|
@@ -58,6 +58,7 @@ class OS {
|
|
|
int _exit_code;
|
|
|
int _orientation;
|
|
|
bool _allow_hidpi;
|
|
|
+ bool _use_vsync;
|
|
|
|
|
|
char *last_error;
|
|
|
|
|
@@ -435,8 +436,16 @@ public:
|
|
|
|
|
|
virtual void set_context(int p_context);
|
|
|
|
|
|
- virtual void set_use_vsync(bool p_enable);
|
|
|
- virtual bool is_vsync_enabled() const;
|
|
|
+ //amazing hack because OpenGL needs this to be set on a separate thread..
|
|
|
+ //also core can't access servers, so a callback must be used
|
|
|
+ typedef void (*SwitchVSyncCallbackInThread)(bool);
|
|
|
+
|
|
|
+ static SwitchVSyncCallbackInThread switch_vsync_function;
|
|
|
+ void set_use_vsync(bool p_enable);
|
|
|
+ bool is_vsync_enabled() const;
|
|
|
+
|
|
|
+ //real, actual overridable function to switch vsync, which needs to be called from graphics thread if needed
|
|
|
+ virtual void _set_use_vsync(bool p_enable) {}
|
|
|
|
|
|
virtual OS::PowerState get_power_state();
|
|
|
virtual int get_power_seconds_left();
|