Code Monkey home page Code Monkey logo

Comments (4)

canadaduane avatar canadaduane commented on May 29, 2024 1

Oh! I found the answer right at the top of the source JS file:

// load wasm module and link with gl functions
// 
// this file was made by tons of hacks from emscripten's parseTools and library_webgl 
// https://github.com/emscripten-core/emscripten/blob/incoming/src/parseTools.js
// https://github.com/emscripten-core/emscripten/blob/incoming/src/library_webgl.js

Nice work!!

from good-web-game.

not-fl3 avatar not-fl3 commented on May 29, 2024

Oh, readme looks outdated! The more relevant one is here: https://github.com/not-fl3/miniquad/#wasm

js folder is optional, the idea is to use .html file like this:

<head>
    <meta charset="utf-8">
    <title>TITLE</title>
    <style>
        html,
        body,
        canvas {
            margin: 0px;
            padding: 0px;
            width: 100%;
            height: 100%;
            overflow: hidden;
            position: absolute;
            background: black;
            z-index: 0;
        }
    </style>
</head>

<body>
    <canvas id="glcanvas" tabindex='1'></canvas>
    <!-- Minified and statically hosted version of https://github.com/not-fl3/miniquad/blob/master/native/sapp-wasm/js/gl.js -->
    <script src="https://not-fl3.github.io/miniquad-samples/gl.js"></script>
    <script>load("quad.wasm");</script> <!-- Your compiled wasm file -->
</body>

</html>

And then host that .html alongside with .wasm with any web browser supporting wasm MIME.
I am personally using simple-http-server:

cargo install --git https://github.com/TheWaWaR/simple-http-server.git
simple-http-server . --nocache

from good-web-game.

canadaduane avatar canadaduane commented on May 29, 2024

This works! Thank you. BTW, how was gl.js created? Is that hand-made, or the output of another process?

from good-web-game.

not-fl3 avatar not-fl3 commented on May 29, 2024

Glad it worked!

from good-web-game.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.