Make raylib games in JS for the web
npm install raylib-wasmThis is the start of some ideas about making raylib games in JS for the web. It includes raylib 5.5 & raygui 4.0. You can see some examples here.
You can use it in a codepen, for no setup.
Otherwsie you need to import the library from somewhere, like via CDN:
``html`
or you can put raylib/ in your project and do this:
`html`
Then use it like this:
`html
const InitGame = async () => {
InitWindow(800, 450)
}
const UpdateGame = (ts) => {
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
DrawFPS(10, 10)
EndDrawing()
}
`
Have a look at basic.html for an example.
#### python
You can also use python on the web (pyiodide) if you prefer:
`html
def init():
InitWindow(800, 450)
def update():
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("Congrats! You created your first python window!", 150, 200, 20, LIGHTGRAY)
DrawFPS(10, 10)
EndDrawing()
`
Have a look at python.html for an example.
You probably do not need to do this. Here is how I created the wasm/wrapper. Only do this, if you are actually working on the library:
```build & run local development web-server
npm start