move 2d toggle to texture draw

This commit is contained in:
NishiOwO 2025-04-03 22:26:56 +09:00
parent b734e42c5c
commit 732db3182b
No known key found for this signature in database
GPG Key ID: 27EF69B208EB9343
2 changed files with 2 additions and 2 deletions

View File

@ -133,6 +133,7 @@ void nb_draw_driver_reshape(nb_draw_t* draw) {
} }
void nb_draw_driver_draw_texture(nb_draw_t* draw, float x, float y, float w, float h, nb_draw_driver_texture_t* texture, float r, float g, float b, float a) { void nb_draw_driver_draw_texture(nb_draw_t* draw, float x, float y, float w, float h, nb_draw_driver_texture_t* texture, float r, float g, float b, float a) {
nb_graphic_begin_2d(draw);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
@ -154,6 +155,7 @@ void nb_draw_driver_draw_texture(nb_draw_t* draw, float x, float y, float w, flo
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
nb_graphic_end_2d(draw);
} }
void nb_draw_driver_destroy(nb_draw_t* draw) { void nb_draw_driver_destroy(nb_draw_t* draw) {

View File

@ -37,9 +37,7 @@ void nb_graphic_clear(nb_draw_t* draw) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_
void nb_graphic_text(nb_draw_t* draw, float x, float y, float size, const char* text, float r, float g, float b, float a) { void nb_graphic_text(nb_draw_t* draw, float x, float y, float size, const char* text, float r, float g, float b, float a) {
int i; int i;
nb_graphic_begin_2d(draw);
for(i = 0; text[i] != 0; i++) { for(i = 0; text[i] != 0; i++) {
nb_draw_texture(draw, x + i * (size / 2), y, size / 2, size, draw->font[text[i]], r, g, b, a); nb_draw_texture(draw, x + i * (size / 2), y, size / 2, size, draw->font[text[i]], r, g, b, a);
} }
nb_graphic_end_2d(draw);
} }