aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEmil Williams2026-02-01 12:07:18 +0000
committerEmil Williams2026-02-01 12:07:18 +0000
commita5209153cf8df1cd58c2f70f9eabb0bf5dd071f8 (patch)
tree1926b2f597868e371b6c2369c9445df1fdc49cfc /source
parentf7973d58b2eb298bffe0ad3f88897e02e0497de8 (diff)
downloadEUROPAXI-master.tar.xz
EUROPAXI-master.tar.zst
Diffstat (limited to 'source')
-rw-r--r--source/all.h2
-rw-r--r--source/main.c8
-rw-r--r--source/render.c4
3 files changed, 10 insertions, 4 deletions
diff --git a/source/all.h b/source/all.h
index b8f13bd..9d97653 100644
--- a/source/all.h
+++ b/source/all.h
@@ -9,6 +9,8 @@
#define TEXT_BUFFER_LIMIT (1<<12)
#define FRAME_LIMIT (1<<4)
+#define MIN(a,b) (a)<(b)?(a):(b)
+
typedef struct {
Font font;
float frame_x[FRAME_LIMIT];
diff --git a/source/main.c b/source/main.c
index 1cf3c55..c775851 100644
--- a/source/main.c
+++ b/source/main.c
@@ -29,7 +29,8 @@ int main (int count, char ** arguments)
InitAudioDevice();
SetWindowPosition(0, 0);
}
- game->font = GetFontDefault();
+ game->font = LoadFont("fonts/Atkinson/mono/AtkinsonHyperlegibleMono-Bold.otf");
+ if (!IsFontValid(game->font)) { game->font = GetFontDefault(); }
/* :todo ping me I'll update this to a u/f seperated game loop */
{ /* loop to end all loops */
@@ -41,6 +42,8 @@ int main (int count, char ** arguments)
clock_gettime(CLOCK_MONOTONIC, &start);
ClearWindowState(FLAG_WINDOW_HIDDEN);
+ int test[200*200] = {0};
+ for (int i = 0; i < 200*200; i++) { test[i] = i;}
while (1) {
if (delta > wait) {
clock_gettime(CLOCK_MONOTONIC, &start);
@@ -62,7 +65,7 @@ int main (int count, char ** arguments)
{ /* draw */
BeginDrawing();
ClearBackground(BLACK);
- draw_square_grid(game, 0, 50, NULL, (int[]) {1,2,3, 4,5,6, 7,8,9}, 9);
+ draw_square_grid(game, 0, MIN(game->vertical/20, game->horizontal/25), NULL, test, 200);
draw_centered_text(game, 1, 20, WHITE, "Snails are now preparing!");
draw_centered_text(game, 2, 20, WHITE, "Gambling here");
rlDrawRenderBatchActive();
@@ -79,6 +82,7 @@ int main (int count, char ** arguments)
}
stop:
SetWindowState(FLAG_WINDOW_HIDDEN);
+ UnloadFont(game->font);
CloseAudioDevice();
CloseWindow();
return 0;
diff --git a/source/render.c b/source/render.c
index 3271b99..ef7280e 100644
--- a/source/render.c
+++ b/source/render.c
@@ -2,10 +2,10 @@
void draw_square_grid(game_t * game, size_t frame, int size, Texture * texture, int * array, size_t length) {
(void)texture;
+ float x = game->frame_x[frame], y = game->frame_y[frame];
float square_length = size;
size_t square = floor(sqrt(length));
size_t j, i;
- float x = game->frame_x[frame], y = game->frame_y[frame];
for (i = 0; i < square; ++i) {
for (j = 0; j < square; ++j) {
DrawRectangleV((Vector2){x+i*square_length, y+j*square_length},
@@ -20,11 +20,11 @@ void draw_square_grid(game_t * game, size_t frame, int size, Texture * texture,
void draw_centered_text(game_t * game, size_t frame, int font_size, Color color, char * format, ...) {
char buffer[TEXT_BUFFER_LIMIT];
+ float x = game->frame_x[frame], y = game->frame_y[frame];
va_list ap;
va_start(ap, format);
vsnprintf(buffer, TEXT_BUFFER_LIMIT, format, ap);
va_end(ap);
Vector2 v = MeasureTextEx(game->font, buffer, font_size, 1);
- float x = game->frame_x[frame], y = game->frame_y[frame];
DrawTextEx(game->font, buffer, (Vector2){x-v.x/2, y-v.y/2}, font_size, 1, color);
}