Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textures asyncify #26

Closed
wants to merge 5 commits into from
Closed

Conversation

AntonPieper
Copy link

This is based on top of my asyncify branch (see #25), because it loads the textures directly when LoadTexture is called asynchronously.

Another approach could be to preload all textures (to later look them up by ID synchronously), but that would require the programmer to specify all image paths upfront in the RaylibJs constructor/start-method.

- uses `asyncify-wasm` by GoogleChromeLabs
- makes raylib.js an ES6 Module
- allows 1:1 mapping from native to web
- move `onchange` from index.html select box due to ES6 modules
- explicitly list imported async functions
- apparently, this is not the complete core_input_mouse example (as the
  name suggests)
- Asyncify requires `memcpy` / `memset` to copy arrays
  - somehow does not work
- Make arrays static for now
@AntonPieper AntonPieper force-pushed the textures-asyncify branch 2 times, most recently from d5694e5 to a40e71b Compare February 12, 2024 20:48
- Uses `LoadTexture` asynchronously
- maps file paths to IDs
- maps IDs to images
- adds `publicDir` as a parameter for specifying the root of all
  resource loading
- adds a second 2D context to draw tinted images on
@@ -1,3 +1,5 @@
import * as Asyncify from "https://unpkg.com/asyncify-wasm?module";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

@rexim rexim closed this Feb 17, 2024
@AntonPieper AntonPieper mentioned this pull request Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants