Browse Source

Make settings a namespace instead of a global class.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
2446756c54
17 changed files with 146 additions and 127 deletions
  1. +35
    -38
      include/settings.hpp
  2. +1
    -1
      src/app.cpp
  3. +2
    -2
      src/app/CableWidget.cpp
  4. +9
    -9
      src/app/ModuleBrowser.cpp
  5. +2
    -2
      src/app/ModuleWidget.cpp
  6. +1
    -1
      src/app/ParamWidget.cpp
  7. +4
    -4
      src/app/RackScrollWidget.cpp
  8. +2
    -2
      src/app/Scene.cpp
  9. +14
    -14
      src/app/Toolbar.cpp
  10. +2
    -2
      src/asset.cpp
  11. +4
    -4
      src/engine/Engine.cpp
  12. +1
    -1
      src/logger.cpp
  13. +11
    -11
      src/main.cpp
  14. +6
    -6
      src/patch.cpp
  15. +7
    -7
      src/plugin.cpp
  16. +31
    -9
      src/settings.cpp
  17. +14
    -14
      src/window.cpp

+ 35
- 38
include/settings.hpp View File

@@ -6,42 +6,39 @@


namespace rack {


struct Settings {
/** Runtime state, not serialized. */
bool devMode = false;
bool headless = false;

/** Persistent state, serialized to settings.json. */
std::string token;
math::Vec windowSize;
math::Vec windowPos;
float zoom = 1.0;
bool invertZoom = false;
float cableOpacity = 0.5;
float cableTension = 0.5;
bool allowCursorLock = true;
float sampleRate = 44100.0;
int threadCount = 1;
bool paramTooltip = false;
bool cpuMeter = false;
bool lockModules = false;
bool checkVersion = true;
float frameRateLimit = 70.0;
bool frameRateSync = true;
bool skipLoadOnLaunch = false;
std::string patchPath;
std::set<plugin::Model*> favoriteModels;

json_t *toJson();
void fromJson(json_t *rootJ);
void save(const std::string &path);
void load(const std::string &path);
};


extern Settings settings;


namespace settings {


/** Runtime state, not serialized. */
extern bool devMode;
extern bool headless;

/** Persistent state, serialized to settings.json. */
extern std::string token;
extern math::Vec windowSize;
extern math::Vec windowPos;
extern float zoom;
extern bool invertZoom;
extern float cableOpacity;
extern float cableTension;
extern bool allowCursorLock;
extern float sampleRate;
extern int threadCount;
extern bool paramTooltip;
extern bool cpuMeter;
extern bool lockModules;
extern bool checkVersion;
extern float frameRateLimit;
extern bool frameRateSync;
extern bool skipLoadOnLaunch;
extern std::string patchPath;
extern std::set<plugin::Model*> favoriteModels;

json_t *toJson();
void fromJson(json_t *rootJ);
void save(const std::string &path);
void load(const std::string &path);


} // namespace settings
} // namespace rack

+ 1
- 1
src/app.cpp View File

@@ -13,7 +13,7 @@ namespace rack {

void App::init() {
engine = new engine::Engine;
if (!settings.headless) {
if (!settings::headless) {
event = new widget::EventState;
history = new history::State;
window = new Window;


+ 2
- 2
src/app/CableWidget.cpp View File

@@ -214,8 +214,8 @@ void CableWidget::fromJson(json_t *rootJ) {
}

void CableWidget::draw(const DrawArgs &args) {
float opacity = settings.cableOpacity;
float tension = settings.cableTension;
float opacity = settings::cableOpacity;
float tension = settings::cableTension;
float thickness = 5;

if (isComplete()) {


+ 9
- 9
src/app/ModuleBrowser.cpp View File

@@ -126,17 +126,17 @@ struct ModelFavoriteQuantity : ui::Quantity {
std::string getLabel() override {return "★";}
void setValue(float value) override {
if (value) {
settings.favoriteModels.insert(model);
settings::favoriteModels.insert(model);
}
else {
auto it = settings.favoriteModels.find(model);
if (it != settings.favoriteModels.end())
settings.favoriteModels.erase(it);
auto it = settings::favoriteModels.find(model);
if (it != settings::favoriteModels.end())
settings::favoriteModels.erase(it);
}
}
float getValue() override {
auto it = settings.favoriteModels.find(model);
return (it != settings.favoriteModels.end());
auto it = settings::favoriteModels.find(model);
return (it != settings::favoriteModels.end());
}
};

@@ -304,7 +304,7 @@ struct BrowserSearchField : ui::TextField {
struct ShowFavoritesQuantity : ui::Quantity {
widget::Widget *widget;
std::string getLabel() override {
int favoritesLen = settings.favoriteModels.size();
int favoritesLen = settings::favoriteModels.size();
return string::f("Only show favorites (%d)", favoritesLen);
}
void setValue(float value) override;
@@ -477,8 +477,8 @@ struct ModuleBrowser : widget::OpaqueWidget {
for (Widget *w : modelContainer->children) {
if (favorites) {
ModelBox *m = dynamic_cast<ModelBox*>(w);
auto it = settings.favoriteModels.find(m->model);
w->visible = (it != settings.favoriteModels.end());
auto it = settings::favoriteModels.find(m->model);
w->visible = (it != settings::favoriteModels.end());
}
else {
w->visible = true;


+ 2
- 2
src/app/ModuleWidget.cpp View File

@@ -228,7 +228,7 @@ void ModuleWidget::draw(const DrawArgs &args) {
Widget::draw(args);

// Power meter
if (module && settings.cpuMeter) {
if (module && settings::cpuMeter) {
nvgBeginPath(args.vg);
nvgRect(args.vg,
0, box.size.y - 20,
@@ -368,7 +368,7 @@ void ModuleWidget::onDragEnd(const widget::DragEndEvent &e) {
}

void ModuleWidget::onDragMove(const widget::DragMoveEvent &e) {
if (!settings.lockModules) {
if (!settings::lockModules) {
math::Rect newBox = box;
newBox.pos = APP->scene->rack->mousePos.minus(dragPos);
APP->scene->rack->requestModuleBoxNearest(this, newBox);


+ 1
- 1
src/app/ParamWidget.cpp View File

@@ -168,7 +168,7 @@ void ParamWidget::onDoubleClick(const widget::DoubleClickEvent &e) {
}

void ParamWidget::onEnter(const widget::EnterEvent &e) {
if (settings.paramTooltip && !tooltip && paramQuantity) {
if (settings::paramTooltip && !tooltip && paramQuantity) {
ParamTooltip *paramTooltip = new ParamTooltip;
paramTooltip->paramWidget = this;
APP->scene->addChild(paramTooltip);


+ 4
- 4
src/app/RackScrollWidget.cpp View File

@@ -21,7 +21,7 @@ RackScrollWidget::RackScrollWidget() {
}

void RackScrollWidget::step() {
float zoom = std::round(settings.zoom / 0.01) * 0.01;
float zoom = std::round(settings::zoom / 0.01) * 0.01;
if (zoom != zoomWidget->zoom) {
// Set offset based on zoomPos
offset = offset.plus(zoomPos).div(zoomWidget->zoom).mult(zoom).minus(zoomPos);
@@ -99,10 +99,10 @@ void RackScrollWidget::onHoverScroll(const widget::HoverScrollEvent &e) {
if ((APP->window->getMods() & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) {
// Increase zoom
float zoomDelta = e.scrollDelta.y / 50 / 4;
if (settings.invertZoom)
if (settings::invertZoom)
zoomDelta *= -1;
settings.zoom *= std::pow(2, zoomDelta);
settings.zoom = math::clamp(settings.zoom, 0.25f, 2.f);
settings::zoom *= std::pow(2, zoomDelta);
settings::zoom = math::clamp(settings::zoom, 0.25f, 2.f);
zoomPos = e.pos;
e.consume(this);
return;


+ 2
- 2
src/app/Scene.cpp View File

@@ -43,11 +43,11 @@ void Scene::step() {
if (time - lastAutoSaveTime >= 15.0) {
lastAutoSaveTime = time;
APP->patch->save(asset::user("autosave.vcv"));
settings.save(asset::user("settings.json"));
settings::save(asset::user("settings.json"));
}

// Request latest version from server
if (!settings.devMode && checkVersion && !checkedVersion) {
if (!settings::devMode && checkVersion && !checkedVersion) {
std::thread t(&Scene::runCheckVersion, this);
t.detach();
checkedVersion = true;


+ 14
- 14
src/app/Toolbar.cpp View File

@@ -172,10 +172,10 @@ struct EditButton : MenuButton {

struct ZoomQuantity : ui::Quantity {
void setValue(float value) override {
settings.zoom = math::clamp(value, getMinValue(), getMaxValue());
settings::zoom = math::clamp(value, getMinValue(), getMaxValue());
}
float getValue() override {
return settings.zoom;
return settings::zoom;
}
float getMinValue() override {return 0.25;}
float getMaxValue() override {return 2.0;}
@@ -189,10 +189,10 @@ struct ZoomQuantity : ui::Quantity {

struct CableOpacityQuantity : ui::Quantity {
void setValue(float value) override {
settings.cableOpacity = math::clamp(value, getMinValue(), getMaxValue());
settings::cableOpacity = math::clamp(value, getMinValue(), getMaxValue());
}
float getValue() override {
return settings.cableOpacity;
return settings::cableOpacity;
}
float getDefaultValue() override {return 0.5;}
float getDisplayValue() override {return getValue() * 100;}
@@ -205,10 +205,10 @@ struct CableOpacityQuantity : ui::Quantity {

struct CableTensionQuantity : ui::Quantity {
void setValue(float value) override {
settings.cableTension = math::clamp(value, getMinValue(), getMaxValue());
settings::cableTension = math::clamp(value, getMinValue(), getMaxValue());
}
float getValue() override {
return settings.cableTension;
return settings::cableTension;
}
float getDefaultValue() override {return 0.5;}
std::string getLabel() override {return "Cable tension";}
@@ -218,21 +218,21 @@ struct CableTensionQuantity : ui::Quantity {

struct CpuMeterItem : ui::MenuItem {
void onAction(const widget::ActionEvent &e) override {
settings.cpuMeter ^= true;
settings::cpuMeter ^= true;
}
};


struct ParamTooltipItem : ui::MenuItem {
void onAction(const widget::ActionEvent &e) override {
settings.paramTooltip ^= true;
settings::paramTooltip ^= true;
}
};


struct LockModulesItem : ui::MenuItem {
void onAction(const widget::ActionEvent &e) override {
settings.lockModules ^= true;
settings::lockModules ^= true;
}
};

@@ -329,17 +329,17 @@ struct SettingsButton : MenuButton {

ParamTooltipItem *paramTooltipItem = new ParamTooltipItem;
paramTooltipItem->text = "Parameter tooltips";
paramTooltipItem->rightText = CHECKMARK(settings.paramTooltip);
paramTooltipItem->rightText = CHECKMARK(settings::paramTooltip);
menu->addChild(paramTooltipItem);

CpuMeterItem *cpuMeterItem = new CpuMeterItem;
cpuMeterItem->text = "CPU meter";
cpuMeterItem->rightText = CHECKMARK(settings.cpuMeter);
cpuMeterItem->rightText = CHECKMARK(settings::cpuMeter);
menu->addChild(cpuMeterItem);

LockModulesItem *lockModulesItem = new LockModulesItem;
lockModulesItem->text = "Lock modules";
lockModulesItem->rightText = CHECKMARK(settings.lockModules);
lockModulesItem->rightText = CHECKMARK(settings::lockModules);
menu->addChild(lockModulesItem);

SampleRateItem *sampleRateItem = new SampleRateItem;
@@ -593,7 +593,7 @@ struct WebsiteItem : ui::MenuItem {

struct CheckVersionItem : ui::MenuItem {
void onAction(const widget::ActionEvent &e) override {
settings.checkVersion ^= true;
settings::checkVersion ^= true;
}
};

@@ -623,7 +623,7 @@ struct HelpButton : MenuButton {

CheckVersionItem *checkVersionItem = new CheckVersionItem;
checkVersionItem->text = "Check version on launch";
checkVersionItem->rightText = CHECKMARK(settings.checkVersion);
checkVersionItem->rightText = CHECKMARK(settings::checkVersion);
menu->addChild(checkVersionItem);

UserFolderItem *folderItem = new UserFolderItem;


+ 2
- 2
src/asset.cpp View File

@@ -28,7 +28,7 @@ namespace asset {
void init() {
// Get system dir
if (systemDir.empty()) {
if (settings.devMode) {
if (settings::devMode) {
systemDir = ".";
}
else {
@@ -58,7 +58,7 @@ void init() {

// Get user dir
if (userDir.empty()) {
if (settings.devMode) {
if (settings::devMode) {
userDir = ".";
}
else {


+ 4
- 4
src/engine/Engine.cpp View File

@@ -166,12 +166,12 @@ Engine::Engine() {
internal->workerBarrier.total = 1;

setSampleRate(44100.f);
setThreadCount(settings.threadCount);
setThreadCount(settings::threadCount);
}

Engine::~Engine() {
settings.sampleRate = internal->sampleRate;
settings.threadCount = internal->threadCount;
settings::sampleRate = internal->sampleRate;
settings::threadCount = internal->threadCount;

// Stop worker threads
setThreadCount(1);
@@ -207,7 +207,7 @@ static void Engine_stepModules(Engine *that, int threadId) {
Module *module = internal->modules[i];
if (!module->bypass) {
// Step module
if (settings.cpuMeter) {
if (settings::cpuMeter) {
auto startTime = std::chrono::high_resolution_clock::now();

module->process(processCtx);


+ 1
- 1
src/logger.cpp View File

@@ -16,7 +16,7 @@ static std::mutex logMutex;

void init() {
startTime = std::chrono::high_resolution_clock::now();
if (settings.devMode) {
if (settings::devMode) {
outputFile = stderr;
}
else {


+ 11
- 11
src/main.cpp View File

@@ -64,10 +64,10 @@ int main(int argc, char *argv[]) {
while ((c = getopt(argc, argv, "ds:u:")) != -1) {
switch (c) {
case 'd': {
settings.devMode = true;
settings::devMode = true;
} break;
case 'h': {
settings.headless = true;
settings::headless = true;
} break;
case 's': {
asset::systemDir = optarg;
@@ -89,7 +89,7 @@ int main(int argc, char *argv[]) {
// We can now install a signal handler and log the output
// Mac has its own decent crash handler
#if 0
if (!settings.devMode) {
if (!settings::devMode) {
signal(SIGABRT, fatalSignalHandler);
signal(SIGFPE, fatalSignalHandler);
signal(SIGILL, fatalSignalHandler);
@@ -100,7 +100,7 @@ int main(int argc, char *argv[]) {

// Log environment
INFO("%s v%s", app::APP_NAME, app::APP_VERSION);
if (settings.devMode)
if (settings::devMode)
INFO("Development mode");
INFO("System directory: %s", asset::systemDir.c_str());
INFO("User directory: %s", asset::userDir.c_str());
@@ -113,14 +113,14 @@ int main(int argc, char *argv[]) {
keyboard::init();
gamepad::init();
plugin::init();
if (!settings.headless) {
if (!settings::headless) {
ui::init();
windowInit();
}

// Initialize app
INFO("Initializing app");
settings.load(asset::user("settings.json"));
settings::load(asset::user("settings.json"));
appInit();

const char *openedFilename = glfwGetOpenedFilename();
@@ -128,14 +128,14 @@ int main(int argc, char *argv[]) {
patchPath = openedFilename;
}

if (!settings.headless) {
if (!settings::headless) {
APP->patch->init(patchPath);
}

INFO("Starting engine");
APP->engine->start();

if (!settings.headless) {
if (!settings::headless) {
INFO("Running window");
APP->window->run();
INFO("Stopped window");
@@ -148,16 +148,16 @@ int main(int argc, char *argv[]) {
APP->engine->stop();

// Destroy app
if (!settings.headless) {
if (!settings::headless) {
APP->patch->save(asset::user("autosave.vcv"));
}
INFO("Destroying app");
appDestroy();
settings.save(asset::user("settings.json"));
settings::save(asset::user("settings.json"));

// Destroy environment
INFO("Destroying environment");
if (!settings.headless) {
if (!settings::headless) {
windowDestroy();
ui::destroy();
}


+ 6
- 6
src/patch.cpp View File

@@ -17,11 +17,11 @@ static const char PATCH_FILTERS[] = "VCV Rack patch (.vcv):vcv";


PatchManager::PatchManager() {
path = settings.patchPath;
path = settings::patchPath;
}

PatchManager::~PatchManager() {
settings.patchPath = path;
settings::patchPath = path;
}

void PatchManager::init(std::string path) {
@@ -33,10 +33,10 @@ void PatchManager::init(std::string path) {
}

// To prevent launch crashes, if Rack crashes between now and 15 seconds from now, the "skipAutosaveOnLaunch" property will remain in settings.json, so that in the next launch, the broken autosave will not be loaded.
bool oldSkipLoadOnLaunch = settings.skipLoadOnLaunch;
settings.skipLoadOnLaunch = true;
settings.save(asset::user("settings.json"));
settings.skipLoadOnLaunch = false;
bool oldSkipLoadOnLaunch = settings::skipLoadOnLaunch;
settings::skipLoadOnLaunch = true;
settings::save(asset::user("settings.json"));
settings::skipLoadOnLaunch = false;
if (oldSkipLoadOnLaunch && osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, "Rack has recovered from a crash, possibly caused by a faulty module in your patch. Clear your patch and start over?")) {
this->path = "";
return;


+ 7
- 7
src/plugin.cpp View File

@@ -206,7 +206,7 @@ static bool syncPlugin(std::string slug, json_t *manifestJ, bool dryRun) {
if (dryRun) {
downloadUrl += "/available";
}
downloadUrl += "?token=" + network::encodeUrl(settings.token);
downloadUrl += "?token=" + network::encodeUrl(settings::token);
downloadUrl += "&slug=" + network::encodeUrl(slug);
downloadUrl += "&version=" + network::encodeUrl(latestVersion);
downloadUrl += "&arch=" + network::encodeUrl(arch);
@@ -366,7 +366,7 @@ void init() {
// Copy Fundamental package to plugins directory if Fundamental is not loaded
std::string fundamentalSrc = asset::system("Fundamental.zip");
std::string fundamentalDir = asset::user("plugins/Fundamental");
if (!settings.devMode && !getPlugin("Fundamental") && system::isFile(fundamentalSrc)) {
if (!settings::devMode && !getPlugin("Fundamental") && system::isFile(fundamentalSrc)) {
extractZip(fundamentalSrc.c_str(), pluginsDir.c_str());
loadPlugin(fundamentalDir);
}
@@ -409,7 +409,7 @@ void logIn(const std::string &email, const std::string &password) {
json_t *tokenJ = json_object_get(resJ, "token");
if (tokenJ) {
const char *tokenStr = json_string_value(tokenJ);
settings.token = tokenStr;
settings::token = tokenStr;
loginStatus = "";
}
}
@@ -418,11 +418,11 @@ void logIn(const std::string &email, const std::string &password) {
}

void logOut() {
settings.token = "";
settings::token = "";
}

bool sync(bool dryRun) {
if (settings.token.empty())
if (settings::token.empty())
return false;

bool available = false;
@@ -438,7 +438,7 @@ bool sync(bool dryRun) {

// Get user's plugins list
json_t *pluginsReqJ = json_object();
json_object_set(pluginsReqJ, "token", json_string(settings.token.c_str()));
json_object_set(pluginsReqJ, "token", json_string(settings::token.c_str()));
std::string pluginsUrl = app::API_URL;
pluginsUrl += "/plugins";
json_t *pluginsResJ = network::requestJson(network::METHOD_GET, pluginsUrl, pluginsReqJ);
@@ -509,7 +509,7 @@ void cancelDownload() {
}

bool isLoggedIn() {
return settings.token != "";
return settings::token != "";
}

Plugin *getPlugin(const std::string &pluginSlug) {


+ 31
- 9
src/settings.cpp View File

@@ -10,9 +10,33 @@


namespace rack {


json_t *Settings::toJson() {
namespace settings {


bool devMode = false;
bool headless = false;
std::string token;
math::Vec windowSize;
math::Vec windowPos;
float zoom = 1.0;
bool invertZoom = false;
float cableOpacity = 0.5;
float cableTension = 0.5;
bool allowCursorLock = true;
float sampleRate = 44100.0;
int threadCount = 1;
bool paramTooltip = false;
bool cpuMeter = false;
bool lockModules = false;
bool checkVersion = true;
float frameRateLimit = 70.0;
bool frameRateSync = true;
bool skipLoadOnLaunch = false;
std::string patchPath;
std::set<plugin::Model*> favoriteModels;


json_t *toJson() {
json_t *rootJ = json_object();

json_object_set_new(rootJ, "token", json_string(token.c_str()));
@@ -67,7 +91,7 @@ json_t *Settings::toJson() {
return rootJ;
}

void Settings::fromJson(json_t *rootJ) {
void fromJson(json_t *rootJ) {
json_t *tokenJ = json_object_get(rootJ, "token");
if (tokenJ)
token = json_string_value(tokenJ);
@@ -172,7 +196,7 @@ void Settings::fromJson(json_t *rootJ) {
}
}

void Settings::save(const std::string &path) {
void save(const std::string &path) {
INFO("Saving settings %s", path.c_str());
json_t *rootJ = toJson();
if (rootJ) {
@@ -186,7 +210,7 @@ void Settings::save(const std::string &path) {
}
}

void Settings::load(const std::string &path) {
void load(const std::string &path) {
INFO("Loading settings %s", path.c_str());
FILE *file = std::fopen(path.c_str(), "r");
if (!file)
@@ -206,7 +230,5 @@ void Settings::load(const std::string &path) {
}


Settings settings;


} // namespace settings
} // namespace rack

+ 14
- 14
src/window.cpp View File

@@ -215,12 +215,12 @@ Window::Window() {
INFO("Window content scale: %f", contentScale);

glfwSetWindowSizeLimits(win, 800, 600, GLFW_DONT_CARE, GLFW_DONT_CARE);
if (settings.windowSize.isZero()) {
if (settings::windowSize.isZero()) {
glfwMaximizeWindow(win);
}
else {
glfwSetWindowPos(win, settings.windowPos.x, settings.windowPos.y);
glfwSetWindowSize(win, settings.windowSize.x, settings.windowSize.y);
glfwSetWindowPos(win, settings::windowPos.x, settings::windowPos.y);
glfwSetWindowSize(win, settings::windowSize.x, settings::windowSize.y);
}
glfwShowWindow(win);

@@ -229,7 +229,7 @@ Window::Window() {

glfwMakeContextCurrent(win);
// Enable v-sync
glfwSwapInterval(settings.frameRateSync ? 1 : 0);
glfwSwapInterval(settings::frameRateSync ? 1 : 0);

// Set window callbacks
glfwSetWindowSizeCallback(win, windowSizeCallback);
@@ -275,16 +275,16 @@ Window::Window() {

Window::~Window() {
if (glfwGetWindowAttrib(win, GLFW_MAXIMIZED)) {
settings.windowSize = math::Vec();
settings.windowPos = math::Vec();
settings::windowSize = math::Vec();
settings::windowPos = math::Vec();
}
else {
int winWidth, winHeight;
glfwGetWindowSize(win, &winWidth, &winHeight);
int winX, winY;
glfwGetWindowPos(win, &winX, &winY);
settings.windowSize = math::Vec(winWidth, winHeight);
settings.windowPos = math::Vec(winX, winY);
settings::windowSize = math::Vec(winWidth, winHeight);
settings::windowPos = math::Vec(winX, winY);
}

#if defined NANOVG_GL2
@@ -380,9 +380,9 @@ void Window::run() {

// Limit frame rate
double frameTimeEnd = glfwGetTime();
if (settings.frameRateLimit > 0.0) {
if (settings::frameRateLimit > 0.0) {
double frameDuration = frameTimeEnd - frameTimeStart;
double waitDuration = 1.0 / settings.frameRateLimit - frameDuration;
double waitDuration = 1.0 / settings::frameRateLimit - frameDuration;
if (waitDuration > 0.0) {
std::this_thread::sleep_for(std::chrono::duration<double>(waitDuration));
}
@@ -400,7 +400,7 @@ void Window::close() {
}

void Window::cursorLock() {
if (settings.allowCursorLock) {
if (settings::allowCursorLock) {
#if defined ARCH_MAC
glfwSetInputMode(win, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
#else
@@ -410,7 +410,7 @@ void Window::cursorLock() {
}

void Window::cursorUnlock() {
if (settings.allowCursorLock) {
if (settings::allowCursorLock) {
glfwSetInputMode(win, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}
}
@@ -447,10 +447,10 @@ bool Window::isFullScreen() {
}

bool Window::isFrameOverdue() {
if (settings.frameRateLimit == 0.0)
if (settings::frameRateLimit == 0.0)
return false;
double frameDuration = glfwGetTime() - frameTimeStart;
return frameDuration > 1.0 / settings.frameRateLimit;
return frameDuration > 1.0 / settings::frameRateLimit;
}

std::shared_ptr<Font> Window::loadFont(const std::string &filename) {


Loading…
Cancel
Save