summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--assets/icon.bmpbin0 -> 8994 bytes
-rw-r--r--assets/icon.icobin0 -> 4542 bytes
-rw-r--r--buffer.c4
-rw-r--r--main.c7
-rw-r--r--make.bat3
-rw-r--r--ted.rc1
-rw-r--r--text.h4
8 files changed, 14 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 163534b..c3220c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,4 +9,5 @@ TAGS
*.dll
*.pdb
*.ilk
+*.res
SDL2
diff --git a/assets/icon.bmp b/assets/icon.bmp
new file mode 100644
index 0000000..6809d69
--- /dev/null
+++ b/assets/icon.bmp
Binary files differ
diff --git a/assets/icon.ico b/assets/icon.ico
new file mode 100644
index 0000000..453dadf
--- /dev/null
+++ b/assets/icon.ico
Binary files differ
diff --git a/buffer.c b/buffer.c
index 8641eb1..a1c0516 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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) {
diff --git a/main.c b/main.c
index f2812f5..d4c61d9 100644
--- a/main.c
+++ b/main.c
@@ -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());
diff --git a/make.bat b/make.bat
index ca72723..42eef65 100644
--- a/make.bat
+++ b/make.bat
@@ -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
)
diff --git a/ted.rc b/ted.rc
new file mode 100644
index 0000000..cd4466b
--- /dev/null
+++ b/ted.rc
@@ -0,0 +1 @@
+icon ICON assets\icon.ico
diff --git a/text.h b/text.h
index 45cc6bb..9f0d351 100644
--- a/text.h
+++ b/text.h
@@ -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);