This commit is contained in:
igor
2026-04-18 00:42:29 -07:00
parent de057d852c
commit 4b70fe0b73
2 changed files with 8 additions and 8 deletions

View File

@@ -41,6 +41,9 @@ EXE=timetracker
$(EXE): $(EXE).c $(EXE): $(EXE).c
$(CC) $(FLAGS) $(UFLAGS) $(INCLUDE) $^ $(LIBS) $(FRAMEWORKS) -o $@ $(CC) $(FLAGS) $(UFLAGS) $(INCLUDE) $^ $(LIBS) $(FRAMEWORKS) -o $@
run:
./$(EXE)
tags: $(OBJS) tags: $(OBJS)
ctags -R *.h *.c ctags -R *.h *.c

View File

@@ -154,13 +154,15 @@ typedef struct Hours {
Hours break_time(U64 seconds) Hours break_time(U64 seconds)
{ {
Hours hours; Hours hours;
hours.hours = seconds / 60 / 60; hours.hours = seconds / 60 / 60;
hours.minutes = seconds / 60 - (60 * hours.hours); hours.minutes = seconds / 60 - (60 * hours.hours);
hours.seconds = seconds - ((hours.hours * 60 * 60) + (hours.minutes * 60)); hours.seconds = seconds - ((hours.hours * 60 * 60) + (hours.minutes * 60));
return hours; return hours;
} }
void switch_activity(activity *activities, U32 *current_activity, activity_type type, U64 time) static void switch_activity(activity *activities, U32 *current_activity, activity_type type, U64 time)
{ {
if((activities[*current_activity].type != type) && (0 <= type && type < activity_type_COUNT)) { if((activities[*current_activity].type != type) && (0 <= type && type < activity_type_COUNT)) {
(*current_activity)++; (*current_activity)++;
@@ -311,7 +313,7 @@ internal void poll_input()
mark_dirty(); mark_dirty();
} }
S32 main(int argc, char *argv[]) S32 main(S32 argc, char *argv[])
{ {
// TODO: Move into global state. // TODO: Move into global state.
activity activities[256]; // TODO: This should be a dynamic array. activity activities[256]; // TODO: This should be a dynamic array.
@@ -358,7 +360,6 @@ S32 main(int argc, char *argv[])
state.font_size = 30; state.font_size = 30;
double last_input_s = now(); double last_input_s = now();
SetTargetFPS(30); SetTargetFPS(30);
@@ -490,8 +491,6 @@ S32 main(int argc, char *argv[])
} }
DrawRectangle(state.mouse_pos.x, state.mouse_pos.y, 10, 10, WHITE); DrawRectangle(state.mouse_pos.x, state.mouse_pos.y, 10, 10, WHITE);
DrawFPS(20, 20);
EndDrawing(); EndDrawing();
// Reset statistics as we will accumulate seconds again. // Reset statistics as we will accumulate seconds again.
@@ -505,17 +504,15 @@ S32 main(int argc, char *argv[])
last_save = now_s; last_save = now_s;
} }
#if 0
if(is_dirty()) { if(is_dirty()) {
clear_dirty(); clear_dirty();
SetTargetFPS(120); // FPS cap SetTargetFPS(120); // FPS cap
} else { } else {
if(now_s - last_input_s > 1) { if(now_s - last_input_s > 1) {
SetTargetFPS(20); SetTargetFPS(30);
last_input_s = now_s; last_input_s = now_s;
} }
} }
#endif
} }
save_activities(f, file_path, current_activity, activities); save_activities(f, file_path, current_activity, activities);