diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-11-25 11:43:13 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-11-25 11:43:13 -0500 |
commit | b58e9a3faa4e35ff6e872e28c7051fa19e2b11ad (patch) | |
tree | ba0ab494e36a98cbaa92b99ad1949256e4a98279 | |
parent | c2f91a659c126d1fd5ee951bdf58540d9d39fd47 (diff) |
icon
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | assets/icon.bmp | bin | 0 -> 8994 bytes | |||
-rw-r--r-- | assets/icon.ico | bin | 0 -> 4542 bytes | |||
-rw-r--r-- | buffer.c | 4 | ||||
-rw-r--r-- | main.c | 7 | ||||
-rw-r--r-- | make.bat | 3 | ||||
-rw-r--r-- | ted.rc | 1 | ||||
-rw-r--r-- | text.h | 4 |
8 files changed, 14 insertions, 6 deletions
@@ -9,4 +9,5 @@ TAGS *.dll *.pdb *.ilk +*.res SDL2 diff --git a/assets/icon.bmp b/assets/icon.bmp Binary files differnew file mode 100644 index 0000000..6809d69 --- /dev/null +++ b/assets/icon.bmp diff --git a/assets/icon.ico b/assets/icon.ico Binary files differnew file mode 100644 index 0000000..453dadf --- /dev/null +++ b/assets/icon.ico @@ -125,8 +125,8 @@ void text_buffer_render(TextBuffer *buffer, Font *font, float box_x, float box_y text_chars_begin(font); TextRenderState text_state = { .x = box_x, .y = box_y, - .edge_right = box_x+box_w, - .edge_bottom = box_y+box_h + .min_x = box_x, .min_y = box_y, + .max_x = box_x+box_w, .max_y = box_y+box_h }; for (uint block_idx = 0; block_idx < nblocks; ++block_idx) { @@ -43,6 +43,12 @@ int main(void) { if (!window) die("%s", SDL_GetError()); + { // set icon + SDL_Surface *icon = SDL_LoadBMP("assets/icon.bmp"); + SDL_SetWindowIcon(window, icon); + SDL_FreeSurface(icon); + } + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); SDL_GLContext *glctx = SDL_GL_CreateContext(window); @@ -95,7 +101,6 @@ int main(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1,1,1); - //text_render(font, "hellσ! öθ☺", 50, 50); text_buffer_render(&text_buffer, font, 50, window_heightf-50, window_widthf-100, window_heightf-100); if (text_has_err()) { printf("Text error: %s\n", text_get_err()); @@ -5,7 +5,8 @@ if _%VCVARS% == _ ( ) SET CFLAGS=/nologo /W3 /D_CRT_SECURE_NO_WARNINGS /I SDL2/include SDL2/lib/x64/SDL2main.lib SDL2/lib/x64/SDL2.lib opengl32.lib -SET SOURCES=main.c text.c +rc /nologo ted.rc +SET SOURCES=main.c text.c ted.res if _%1 == _ ( cl %SOURCES% /DDEBUG /DEBUG /Zi %CFLAGS% /Fe:ted ) @@ -0,0 +1 @@ +icon ICON assets\icon.ico @@ -12,8 +12,8 @@ typedef struct Font Font; typedef struct { float x, y; - // points at which the text should be cut off in the x and y directions - float edge_right, edge_bottom; + // points at which the text should be cut off + float min_x, max_x, min_y, max_y; } TextRenderState; extern bool text_has_err(void); |