-
Notifications
You must be signed in to change notification settings - Fork 31
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
implement tinting #38
base: main
Are you sure you want to change the base?
Conversation
- adds a secondary canvas for drawing temporary stuff
related to #32 |
Oh, I haven't noticed that someone has already created another PR for that -.- I think our two approaches are different enough though to leave them both open :)
|
|
||
ClearBackground(RAYWHITE); | ||
|
||
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, RED); |
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.
The only change in the _tint
example versus the other example is the Tint color. This means there's a bunch of duplicated code for a 1-line change. Instead of having the textures_logo_raylib_tint.c
example, I'd actually recommend porting over an official texture example that implements tint, like textures_bunnymark.c.
@@ -301,13 +304,28 @@ class RaylibJs { | |||
} | |||
|
|||
// RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); | |||
DrawTexture(texture_ptr, posX, posY, color_ptr) { | |||
DrawTexture(texture_ptr, posX, posY, tint_ptr) { | |||
/** @type {ArrayBuffer} */ |
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.
I don't think there's type hinting in any of the other JavaScript code here...
/** @type {ArrayBuffer} */ |
I have adapted my previous implementation for texture drawing to the merged one and tinting works now.
Changes