-
Notifications
You must be signed in to change notification settings - Fork 30
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_logo_raylib example #30
Conversation
8e03136
to
bb2e77d
Compare
result[1] = 256; // width | ||
result[2] = 256; // height |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible to add an event listener load
that provides the true width and height. I couldn't quite get it to work. I think due to async. Any tips?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async does not work unless you use asyncify
(see #25 and #26). You sadly can't write to the result_ptr
when the load
callback finishes in the general case, because the result_ptr
lives on the stack and might already have different data on it.
You could add the images to RaylibJs in a preload step (as an argument to start
, or the constructor) from JavaScript (like emscripten --preload-file
).
DrawTexture(texture_ptr, posX, posY, color_ptr) { | ||
const buffer = this.wasm.instance.exports.memory.buffer; | ||
const [id, width, height, mipmaps, format] = new Uint32Array(buffer, texture_ptr, 5); | ||
// const tint = getColorFromMemory(buffer, color_ptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no tinting yet
LGTM! Thank you! |
Implements:
LoadTexture
DrawTexture