aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/sprite.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-19 07:04:21 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-19 07:04:21 +0200
commit3bdf82eec2c915e91ae487e29d72639f9efcad67 (patch)
treec61476e241f75e71959394d82aa3ff9c343febbb /src/graphics/sprite.c
parent4a96d4a354fbde7fd614075c060aea78a3411b42 (diff)
Use uint8_t for color instead of float
Diffstat (limited to 'src/graphics/sprite.c')
-rw-r--r--src/graphics/sprite.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/graphics/sprite.c b/src/graphics/sprite.c
index 2b290bb..7bc9db1 100644
--- a/src/graphics/sprite.c
+++ b/src/graphics/sprite.c
@@ -4,7 +4,7 @@
void mgl_sprite_init(mgl_sprite *self, mgl_texture *texture, float x, float y) {
self->texture = texture;
- self->color = (mgl_color){ 1.0f, 1.0f, 1.0f, 1.0f };
+ self->color = (mgl_color){ 255, 255, 255, 255 };
self->position = (mgl_vec2f){ x, y };
self->scale = (mgl_vec2f){ 1.0f, 1.0f };
}
@@ -19,7 +19,7 @@ void mgl_sprite_set_color(mgl_sprite *self, mgl_color color) {
/* TODO: Cache texture bind to not bind texture if its already bound and do not bind texture 0 */
void mgl_sprite_draw(mgl_context *context, mgl_sprite *sprite) {
- context->gl.glColor4f(sprite->color.r, sprite->color.g, sprite->color.b, sprite->color.a);
+ context->gl.glColor4ub(sprite->color.r, sprite->color.g, sprite->color.b, sprite->color.a);
context->gl.glBindTexture(GL_TEXTURE_2D, sprite->texture->id);
context->gl.glBegin(GL_QUADS);
context->gl.glTexCoord2f(0.0f, 0.0f);