remove a deprecated function
This commit is contained in:
1 parent
46b3fbb3b5
commit
82dddec0ca
3 files changed
+1
-32
No files matched your search
@@ -39,7 +39,6 @@ window_t* window_create(int width, int height, const char* title);
|
||||
void window_destroy(window_t* s);
|
||||
bool window_pollevent(window_t* s);
|
||||
void window_blit(window_t* s, const uint32_t* framebuffer);
|
||||
void window_limit_framerate(window_t* s, int target_fps);
|
||||
bool window_is_key_down(window_t* s, int key_scancode);
|
||||
bool window_is_mouse_button_down(window_t* s, int button_index);
|
||||
void window_get_mouse_position(window_t* s, int* x, int* y);
|
||||
|
||||
+1
-1
@@ -591,7 +591,7 @@ int main() {
|
||||
compositor_mark_content_dirty(compositor, name_id);
|
||||
compositor_mark_content_dirty(compositor, dialogue_id);
|
||||
|
||||
// NEW: Update animation tracker
|
||||
// Update animation tracker
|
||||
anim_tracker.update(delta_time_sec);
|
||||
|
||||
static bool mouse_was_down = false;
|
||||
|
||||
@@ -131,34 +131,4 @@ void window_blit(window_t* s, const uint32_t* framebuffer) {
|
||||
SDL_RenderCopy(s->renderer, s->texture, nullptr, nullptr);
|
||||
SDL_RenderPresent(s->renderer);
|
||||
}
|
||||
|
||||
void window_limit_framerate(window_t* s, int target_fps) {
|
||||
if (target_fps <= 0) {
|
||||
// No capping or division by zero prevention
|
||||
s->last_tick_time = SDL_GetTicks();
|
||||
return;
|
||||
}
|
||||
|
||||
// Desired time (in ms) for one frame
|
||||
const uint32_t frame_delay_ms = 1000 / target_fps;
|
||||
|
||||
// Current time
|
||||
const uint32_t current_tick_time = SDL_GetTicks();
|
||||
|
||||
// Time elapsed since the last call to this function
|
||||
const uint32_t elapsed_time = current_tick_time - s->last_tick_time;
|
||||
|
||||
// If the elapsed time is less than the desired frame time, delay execution.
|
||||
if (elapsed_time < frame_delay_ms) {
|
||||
// Calculate the time to wait
|
||||
uint32_t time_to_wait = frame_delay_ms - elapsed_time;
|
||||
SDL_Delay(time_to_wait);
|
||||
|
||||
// Update the last_tick_time *after* the delay
|
||||
s->last_tick_time = current_tick_time + time_to_wait;
|
||||
} else {
|
||||
// No delay needed (running slow or exactly on time), just update the start time
|
||||
s->last_tick_time = current_tick_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user