Conversation
|
This is a nice improvement! This does indeed draw the correct image after some time, however in raylib, you have access to |
|
@AntonPieper Regarding not drawing first few frames -- This is in line with how browser/canvas works. My mental sift around this problem is to remember we're implementing a raylib interface in the browser (not trying to trick a browser to work differently) Behaving like a browser feels okay. You're correct about C potentially needing texture data -- that is still an open problem. Luckily the existing example doesn't need it. Stepping stones... Small gain of not being hardcoded unblocks a few other texture based examples (which might also not need C-side texture data yet (other than id). |
|
I agree and think it is okay to not show an image in this case, however JS "game engines" like phaser do show images on the first game frame by having a preload function (and potentially showing a customizable loading scene). This is a step in the right direction and I think this is mergeable by itself because of the width/height handling👍 P.S.: smart idea with the usage of dataset btw for storing the IDs in the images |
Previously in #30, image dimensions were hardcoded.
The async problem disappears if we only worry about ID.
LoadTextureassigns an ID and returns it.DrawTexturereceives an ID, looks up loaded images, and uses data known about it locally to JS.