Compare commits

...

2 Commits

Author SHA1 Message Date
48091496d5 Overlooked a stupid in refresh_rate calculation.
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m27s
2024-09-30 23:41:39 -04:00
c202ca5c84 Migrate timekeeping-related member variables to protected scope.
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m43s
2024-09-30 23:35:06 -04:00
3 changed files with 22 additions and 24 deletions

View File

@@ -127,7 +127,6 @@ namespace ReWindow
/// General To Do List
/// TODO: Implement accurate timekeeping on refresh. Have mechanism to expose to user (hook into their game engine's timestepping)
/// TODO: Clean up public API to express the cross-platform, multi-graphics-mode ethos of this project.
///
@@ -182,8 +181,6 @@ namespace ReWindow
/// Returns a Vector2 representing mouse coordinates relative to the top-left corner of the window.
Vector2 GetMouseCoordinates() const;
/// Sets which rendering API is to be used with this window.
void setRenderer(RenderingAPI api);
@@ -280,6 +277,26 @@ namespace ReWindow
static void glSwapBuffers();
Vector2 getLastKnownResize() const;
void setLastKnownWindowSize(const Vector2& size);
protected:
float delta_time;
float refresh_rate;
int refresh_count;
bool cursor_visible = true;
Vector2 lastKnownWindowSize {0, 0};
bool flags[5];
std::vector<RWindowEvent> eventLog;
KeyboardState currentKeyboard; // Current Frame's Keyboard State
KeyboardState previousKeyboard; // Previous Frame's Keyboard State
bool fullscreenmode = false;
std::string title;
int width;
int height;
RenderingAPI renderer;
bool open = false;
bool resizable;
Vector2 mouse_coords = {0, 0};
Vector2 last_mouse_coords = {0, 0};
private:
@@ -310,25 +327,8 @@ namespace ReWindow
void processMouseMove(Vector2 last_pos, Vector2 new_pos);
private:
bool cursor_visible = true;
Vector2 lastKnownWindowSize {0, 0};
bool flags[5];
std::vector<RWindowEvent> eventLog;
KeyboardState currentKeyboard; // Current Frame's Keyboard State
KeyboardState previousKeyboard; // Previous Frame's Keyboard State
bool fullscreenmode = false;
std::string title;
int width;
int height;
RenderingAPI renderer;
bool open = false;
bool resizable;
Vector2 mouse_coords = {0, 0};
Vector2 last_mouse_coords = {0, 0};
float delta_time;
float refresh_rate;
int refresh_count;
};
}

View File

@@ -10,8 +10,6 @@
#include <GL/gl.h>
Vector2 mouse_pos;
// TODO: Move to J3ML::LinearAlgebra::Vector2

View File

@@ -85,7 +85,7 @@ void RWindow::refresh() {
float frame_time_s = frame_time_ms / 1000.f;
delta_time = frame_time_ms;
refresh_rate = 1.f / refresh_rate;
refresh_rate = 1.f / delta_time;
refresh_count++;