GithubHelp home page GithubHelp logo

go-wasm-2d-pinball's Introduction

Go WASM 2D Pinball

Overview

Browser-based pinball game using 2D Canvas and WebAsssembly (WASM), compiled from Go.

Many learnings we drawn from the following projects:

Dev Environment Setup

Basic CLI Setup

Run the static file server:

cd static-server
go run main.go

You can now see game in the browser at http://localhost:3000.

Running make in the project root directory will recompile the Go files into to a WASM target file, and copy this into the static-server/assets directory. From here you just have to reload the page to see your changes.

Further Setup with VSCode

Recompile Go to WASM On-Save

It's helpful to run make automatically on-save when editing Go files. This can be done in VSCode by installing the Run On Save, with a snippet like the following in your settings.json:

    "emeraldwalk.runonsave": {
        "commands": [
            {
                "match": "\\.go$",
                "isAsync": true,
                "cmd": "make"
            }
        ]
    }

Get Intellisense to Work with sycall/js

The syscall/js package has build constraints which prevent Intellisense from working and cause VSCode to report an error with the import. One fix for this is to run VSCode from the terminal like this:

export GOOS=js
export GOARCH=wasm
# run the VSCode executable, which on Darwin is as follows:
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code

go-wasm-2d-pinball's People

Contributors

lmeadows avatar

Watchers

 avatar

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.