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