Skip to content

Commit

Permalink
deploy: 50ef4ea
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Jan 1, 2025
1 parent 2f332b6 commit f6ca2f5
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 3 deletions.
18 changes: 15 additions & 3 deletions RSGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ RSGLDEF void RSGL_init(
void* loader /* opengl prozc address ex. wglProcAddress */
);
RSGLDEF void RSGL_updateSize(RSGL_area r);
RSGLDEF void RSGL_draw(void); /* draw current batch */
RSGLDEF void RSGL_clear(RSGL_color c);
RSGLDEF void RSGL_free(void);

Expand Down Expand Up @@ -403,6 +404,10 @@ RSGLDEF RSGL_texture RSGL_renderCreateTexture(u8* bitmap, RSGL_area memsize, u8
RSGLDEF void RSGL_renderUpdateTexture(RSGL_texture texture, u8* bitmap, RSGL_area memsize, u8 channels);
/* delete a texture */
RSGLDEF void RSGL_renderDeleteTexture(RSGL_texture tex);
/* starts scissoring */
RSGLDEF void RSGL_renderScissorStart(RSGL_rectF scissor);
/* stops scissoring */
RSGLDEF void RSGL_renderScissorEnd(void);

/* custom shader program */
typedef struct RSGL_programInfo {
Expand Down Expand Up @@ -498,6 +503,7 @@ struct RFont_font;
RSGLDEF void RSGL_setRFont(struct RFont_font* font);

RSGLDEF void RSGL_drawText_len(const char* text, size_t len, RSGL_circle c, RSGL_color color);
RSGLDEF void RSGL_drawText_pro(const char* text, size_t len, float spacing, RSGL_circle c, RSGL_color color);
RSGLDEF void RSGL_drawText(const char* text, RSGL_circle c, RSGL_color color);
#define RSGL_drawTextF(text, font, c, color) \
RSGL_setFont(font);\
Expand Down Expand Up @@ -854,10 +860,12 @@ void RSGL_init(RSGL_area r, void* loader) {
}
}

void RSGL_draw(void) {
RSGL_renderBatch(&RSGL_renderInfo);
}

void RSGL_clear(RSGL_color color) {
RSGL_renderClear(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f);

RSGL_renderBatch(&RSGL_renderInfo);
}

void RSGL_updateSize(RSGL_area r) {
Expand Down Expand Up @@ -1389,11 +1397,15 @@ void RSGL_setRFont(RFont_font* font) {
}

void RSGL_drawText_len(const char* text, size_t len, RSGL_circle c, RSGL_color color) {
RSGL_drawText_pro(text, len, 0.0f, c, color);
}

void RSGL_drawText_pro(const char* text, size_t len, float spacing, RSGL_circle c, RSGL_color color) {
if (text == NULL || RSGL_font.f == NULL)
return;

RFont_set_color(color.r / 255.0f, color.b / 255.0f, color.g / 255.0f, color.a / 255.0f);
RFont_draw_text_len(RSGL_font.f, text, len, c.x, c.y, c.d, 0.0f);
RFont_draw_text_len(RSGL_font.f, text, len, c.x, c.y, c.d, spacing);
}

void RSGL_drawText(const char* text, RSGL_circle c, RSGL_color color) {
Expand Down
Binary file modified RSGL.o
Binary file not shown.
13 changes: 13 additions & 0 deletions RSGL_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,19 @@ void RSGL_renderBatch(RSGL_RENDER_INFO* info) {
info->vert_len = 0;
}

void RSGL_renderScissorStart(RSGL_rectF scissor) {
RSGL_draw();
glEnable(GL_SCISSOR_TEST);

glScissor(scissor.x, RSGL_args.currentRect.h - (scissor.y + scissor.h), scissor.w, scissor.h);
glScissor(scissor.x, scissor.y, scissor.w, scissor.h);
}

void RSGL_renderScissorEnd(void) {
RSGL_draw();
glDisable(GL_SCISSOR_TEST);
}

#ifndef GL_RG
#define GL_RG 0x8227
#endif
Expand Down
Binary file modified examples/advanced/rsoft.wasm
Binary file not shown.
Binary file modified examples/advanced/shader.wasm
Binary file not shown.
Binary file modified examples/basics/basic.wasm
Binary file not shown.
Binary file modified examples/basics/shapes.wasm
Binary file not shown.
Binary file modified examples/basics/text.wasm
Binary file not shown.
Binary file modified examples/basics/textures.wasm
Binary file not shown.
Binary file modified libRSGL.a
Binary file not shown.
Binary file modified libRSGL.so
Binary file not shown.

0 comments on commit f6ca2f5

Please sign in to comment.