Fixing small bugs and add console window

This commit is contained in:
Krzosa Karol
2024-08-02 12:03:51 +02:00
parent cff301499f
commit 55223b763a
6 changed files with 74 additions and 25 deletions

View File

@@ -63,7 +63,7 @@ void EndFrameRender(Color color) {
glViewport(0, 0, (GLsizei)WindowSize.x, (GLsizei)WindowSize.y);
glScissor(0, 0, (GLsizei)WindowSize.x, (GLsizei)WindowSize.y);
glClearColor(color.r, color.g, color.b, color.a);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
// Default draw using the font texture
glBindProgramPipeline(Shader2D.pipeline);
@@ -299,6 +299,18 @@ void DrawRect(Rect2I rect, Color color) {
PushQuad2D(RenderArena, &Vertices, ToRect2(rect), MainFont.white_texture_bounding_box, color);
}
void DrawRectOutline(Rect2I rect, Color color, Int thickness = 2) {
Rect2I a = CutLeft(&rect, thickness);
Rect2I b = CutRight(&rect, thickness);
Rect2I c = CutTop(&rect, thickness);
Rect2I d = CutBottom(&rect, thickness);
PushQuad2D(RenderArena, &Vertices, ToRect2(a), MainFont.white_texture_bounding_box, color);
PushQuad2D(RenderArena, &Vertices, ToRect2(b), MainFont.white_texture_bounding_box, color);
PushQuad2D(RenderArena, &Vertices, ToRect2(c), MainFont.white_texture_bounding_box, color);
PushQuad2D(RenderArena, &Vertices, ToRect2(d), MainFont.white_texture_bounding_box, color);
}
Int GetCharSpacing(Font *font, int codepoint = '_') {
Glyph *g = GetGlyph(font, codepoint);
if (g->xadvance) return (Int)g->xadvance;