Change main.c to timetracker, and executable.

This commit is contained in:
2026-03-03 00:11:40 -08:00
parent cb80ef0931
commit 60902a347d
3 changed files with 12 additions and 11 deletions

5
.gitignore vendored
View File

@@ -1,5 +1,4 @@
main
main.dSYM
timetracker
timetracker.dSYM
third_party
sourcecodepro.ttf
.DS_Store

View File

@@ -36,7 +36,7 @@ else
FRAMEWORKS =
endif
EXE=main
EXE=timetracker
$(EXE): $(EXE).c
$(CC) $(FLAGS) $(UFLAGS) $(INCLUDE) $^ $(LIBS) $(FRAMEWORKS) -o $@

View File

@@ -20,7 +20,7 @@
#include <time.h>
#include <math.h>
#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;
@@ -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();