[nostalgia/core/sdl] Put vsync options in config.hpp
This commit is contained in:
parent
c45f4ccccb
commit
b278b3881e
@ -14,9 +14,16 @@ namespace nostalgia::core {
|
|||||||
|
|
||||||
namespace config {
|
namespace config {
|
||||||
|
|
||||||
|
enum class SdlVsync {
|
||||||
|
Adaptive = -1,
|
||||||
|
Off = 0,
|
||||||
|
On = 1,
|
||||||
|
};
|
||||||
|
|
||||||
constexpr auto GbaSpriteBufferLen = 128;
|
constexpr auto GbaSpriteBufferLen = 128;
|
||||||
constexpr auto GbaEventLoopTimerBased = false;
|
constexpr auto GbaEventLoopTimerBased = false;
|
||||||
constexpr auto UserlandFpsPrint = false;
|
constexpr auto UserlandFpsPrint = false;
|
||||||
|
constexpr auto SdlVsyncOption = static_cast<int>(SdlVsync::Adaptive);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,9 +8,10 @@
|
|||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include <nostalgia/core/config.hpp>
|
||||||
|
#include <nostalgia/core/core.hpp>
|
||||||
#include <nostalgia/core/gfx.hpp>
|
#include <nostalgia/core/gfx.hpp>
|
||||||
#include <nostalgia/core/input.hpp>
|
#include <nostalgia/core/input.hpp>
|
||||||
#include <nostalgia/core/core.hpp>
|
|
||||||
|
|
||||||
#include "core.hpp"
|
#include "core.hpp"
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ ox::Error init(Context *ctx) {
|
|||||||
ox::Error run(Context *ctx) {
|
ox::Error run(Context *ctx) {
|
||||||
const auto id = ctx->windowerData<SdlImplData>();
|
const auto id = ctx->windowerData<SdlImplData>();
|
||||||
// try adaptive vsync
|
// try adaptive vsync
|
||||||
if (SDL_GL_SetSwapInterval(-1) < 0) {
|
if (SDL_GL_SetSwapInterval(config::SdlVsyncOption) < 0) {
|
||||||
oxTrace("nostalgia::core::sdl", "Could not enable adaptive vsync, falling back on vsync");
|
oxTrace("nostalgia::core::sdl", "Could not enable adaptive vsync, falling back on vsync");
|
||||||
SDL_GL_SetSwapInterval(1); // fallback on normal vsync
|
SDL_GL_SetSwapInterval(1); // fallback on normal vsync
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user