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

implement tinting #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

AntonPieper
Copy link

I have adapted my previous implementation for texture drawing to the merged one and tinting works now.

Changes

  • adds a secondary canvas for drawing temporary stuff
  • adds another example where the raylib logo is tinted red

- adds a secondary canvas for drawing temporary stuff
@luxluth
Copy link

luxluth commented Feb 18, 2024

related to #32

@AntonPieper
Copy link
Author

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 :)

  • generating and caching images in base64 may be useful even if this gets merged
  • having a background context may be useful when yours gets merged


ClearBackground(RAYWHITE);

DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, RED);

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} */

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...

Suggested change
/** @type {ArrayBuffer} */

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.

3 participants