From 60902a347de8c9aaf1e817b6a08c77adf1583f0d Mon Sep 17 00:00:00 2001 From: igor Date: Tue, 3 Mar 2026 00:11:40 -0800 Subject: [PATCH] Change main.c to timetracker, and executable. --- .gitignore | 5 ++--- Makefile | 2 +- main.c => timetracker.c | 16 +++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) rename main.c => timetracker.c (96%) diff --git a/.gitignore b/.gitignore index d83816d..d751dc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -main -main.dSYM +timetracker +timetracker.dSYM third_party -sourcecodepro.ttf .DS_Store diff --git a/Makefile b/Makefile index ad5ae1d..d802ad3 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ else FRAMEWORKS = endif -EXE=main +EXE=timetracker $(EXE): $(EXE).c $(CC) $(FLAGS) $(UFLAGS) $(INCLUDE) $^ $(LIBS) $(FRAMEWORKS) -o $@ diff --git a/main.c b/timetracker.c similarity index 96% rename from main.c rename to timetracker.c index 84adc72..6bba7a8 100644 --- a/main.c +++ b/timetracker.c @@ -20,7 +20,7 @@ #include #include -#include "sourcecodepro.h" +#include "opensans.h" #include "raylib.h" #ifndef true @@ -321,9 +321,10 @@ int main(int argc, char *argv[]) InitWindow(state.window_w, state.window_h, "Time Tracker"); SetWindowState(FLAG_MSAA_4X_HINT|FLAG_WINDOW_RESIZABLE); - SetTargetFPS(30); + //SetTargetFPS(30); + //SetTargetFPS(1); - state.font = LoadFontFromMemory(".ttf", sourcecodepro_ttf, sourcecodepro_ttf_len, 96, NULL, 0); + state.font = LoadFontFromMemory(".ttf", opensans_ttf, opensans_ttf_len, 96, NULL, 0); if(!IsFontValid(state.font)) { fprintf(stderr, "Unable to load font\n"); return 1; @@ -338,8 +339,8 @@ int main(int argc, char *argv[]) state.font_size = 30; - // DisableEventWaiting(); - // EnableEventWaiting(); + //DisableEventWaiting(); + //EnableEventWaiting(); while(!WindowShouldClose()) { U64 now_s = now(); @@ -445,7 +446,7 @@ int main(int argc, char *argv[]) if(CheckCollisionPointRec(state.mouse_pos, rect)) { // TOOD: A general popup should be its own component. - char *str_activity_type = activity_type_string_representation[i]; + char *str_activity_type = activity_type_string_representation[activities[i].type]; Vector2 activity_type_d = MeasureTextEx(state.font, str_activity_type, state.font_size - 5.0f, 2); Vector2 activity_time_d = MeasureTextEx(state.font, activities_stats[i].seconds_str, state.font_size - 10.0f, 2); @@ -455,8 +456,9 @@ int main(int argc, char *argv[]) DrawRectangleRoundedLinesEx((Rectangle){ start_x, 40, rect_w, (F32)(activity_time_d.y + activity_type_d.y) }, 0.3f, 100, 2.0f, DARKGRAY); // FIXME: We are pulling the aggregate seconds here from the activity statisctics. This is wrong. + // FIXME: The moreover DrawTextEx(state.font, str_activity_type, (Vector2){ start_x, 40.0f }, state.font_size - 5.0f, 2, WHITE); - DrawTextEx(state.font, activities_stats[i].seconds_str, (Vector2){ start_x, 40.0f + (F32)(activity_type_d.y) }, state.font_size - 10.0f, 2, WHITE); + DrawTextEx(state.font, activities_stats[activities[i].type].seconds_str, (Vector2){ start_x, 40.0f + (F32)(activity_type_d.y) }, state.font_size - 10.0f, 2, WHITE); } } EndDrawing();