| @@ -16,7 +16,7 @@ namespace rack { | |||
| //////////////////// | |||
| // Constructing these directly will load from the disk each time. Use the load() functions to load from disk and cache them as long as the shared_ptr is held. | |||
| // Implemented in gui.cpp | |||
| // Implemented in window.cpp | |||
| struct Font { | |||
| int handle; | |||
| @@ -5,9 +5,9 @@ | |||
| #ifdef ARCH_MAC | |||
| #define GUI_MOD_KEY_NAME "Cmd" | |||
| #define WINDOW_MOD_KEY_NAME "Cmd" | |||
| #else | |||
| #define GUI_MOD_KEY_NAME "Ctrl" | |||
| #define WINDOW_MOD_KEY_NAME "Ctrl" | |||
| #endif | |||
| @@ -30,19 +30,19 @@ extern int gGuiFrame; | |||
| extern Vec gMousePos; | |||
| void guiInit(); | |||
| void guiDestroy(); | |||
| void guiRun(); | |||
| void guiClose(); | |||
| void guiCursorLock(); | |||
| void guiCursorUnlock(); | |||
| bool guiIsModPressed(); | |||
| bool guiIsShiftPressed(); | |||
| Vec guiGetWindowSize(); | |||
| void guiSetWindowSize(Vec size); | |||
| Vec guiGetWindowPos(); | |||
| void guiSetWindowPos(Vec pos); | |||
| bool guiIsMaximized(); | |||
| void windowInit(); | |||
| void windowDestroy(); | |||
| void windowRun(); | |||
| void windowClose(); | |||
| void windowCursorLock(); | |||
| void windowCursorUnlock(); | |||
| bool windowIsModPressed(); | |||
| bool windowIsShiftPressed(); | |||
| Vec windowGetWindowSize(); | |||
| void windowSetWindowSize(Vec size); | |||
| Vec windowGetWindowPos(); | |||
| void windowSetWindowPos(Vec pos); | |||
| bool windowIsMaximized(); | |||
| } // namespace rack | |||
| @@ -1,5 +1,5 @@ | |||
| #include "app.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "engine.hpp" | |||
| // For GLFW_KEY_LEFT_CONTROL, etc. | |||
| #include <GLFW/glfw3.h> | |||
| @@ -11,7 +11,7 @@ namespace rack { | |||
| void Knob::onDragStart(EventDragStart &e) { | |||
| guiCursorLock(); | |||
| windowCursorLock(); | |||
| dragValue = value; | |||
| randomizable = false; | |||
| } | |||
| @@ -23,7 +23,7 @@ void Knob::onDragMove(EventDragMove &e) { | |||
| delta *= range; | |||
| // Drag slower if Mod is held | |||
| if (guiIsModPressed()) | |||
| if (windowIsModPressed()) | |||
| delta /= 16.0; | |||
| dragValue += delta; | |||
| if (snap) | |||
| @@ -33,7 +33,7 @@ void Knob::onDragMove(EventDragMove &e) { | |||
| } | |||
| void Knob::onDragEnd(EventDragEnd &e) { | |||
| guiCursorUnlock(); | |||
| windowCursorUnlock(); | |||
| randomizable = true; | |||
| } | |||
| @@ -1,7 +1,7 @@ | |||
| #include "app.hpp" | |||
| #include "engine.hpp" | |||
| #include "plugin.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -220,7 +220,7 @@ void ModuleWidget::onMouseMove(EventMouseMove &e) { | |||
| if (!gFocusedWidget) { | |||
| // Instead of checking key-down events, delete the module even if key-repeat hasn't fired yet and the cursor is hovering over the widget. | |||
| if (glfwGetKey(gWindow, GLFW_KEY_DELETE) == GLFW_PRESS || glfwGetKey(gWindow, GLFW_KEY_BACKSPACE) == GLFW_PRESS) { | |||
| if (!guiIsModPressed() && !guiIsShiftPressed()) { | |||
| if (!windowIsModPressed() && !windowIsShiftPressed()) { | |||
| gRackWidget->deleteModule(this); | |||
| this->finalizeEvents(); | |||
| delete this; | |||
| @@ -234,21 +234,21 @@ void ModuleWidget::onMouseMove(EventMouseMove &e) { | |||
| void ModuleWidget::onHoverKey(EventHoverKey &e) { | |||
| switch (e.key) { | |||
| case GLFW_KEY_I: | |||
| if (guiIsModPressed() && !guiIsShiftPressed()) { | |||
| if (windowIsModPressed() && !windowIsShiftPressed()) { | |||
| reset(); | |||
| e.consumed = true; | |||
| return; | |||
| } | |||
| break; | |||
| case GLFW_KEY_R: | |||
| if (guiIsModPressed() && !guiIsShiftPressed()) { | |||
| if (windowIsModPressed() && !windowIsShiftPressed()) { | |||
| randomize(); | |||
| e.consumed = true; | |||
| return; | |||
| } | |||
| break; | |||
| case GLFW_KEY_D: | |||
| if (guiIsModPressed() && !guiIsShiftPressed()) { | |||
| if (windowIsModPressed() && !windowIsShiftPressed()) { | |||
| gRackWidget->cloneModule(this); | |||
| e.consumed = true; | |||
| return; | |||
| @@ -319,13 +319,13 @@ Menu *ModuleWidget::createContextMenu() { | |||
| ResetMenuItem *resetItem = new ResetMenuItem(); | |||
| resetItem->text = "Initialize"; | |||
| resetItem->rightText = GUI_MOD_KEY_NAME "+I"; | |||
| resetItem->rightText = WINDOW_MOD_KEY_NAME "+I"; | |||
| resetItem->moduleWidget = this; | |||
| menu->addChild(resetItem); | |||
| RandomizeMenuItem *randomizeItem = new RandomizeMenuItem(); | |||
| randomizeItem->text = "Randomize"; | |||
| randomizeItem->rightText = GUI_MOD_KEY_NAME "+R"; | |||
| randomizeItem->rightText = WINDOW_MOD_KEY_NAME "+R"; | |||
| randomizeItem->moduleWidget = this; | |||
| menu->addChild(randomizeItem); | |||
| @@ -336,7 +336,7 @@ Menu *ModuleWidget::createContextMenu() { | |||
| CloneMenuItem *cloneItem = new CloneMenuItem(); | |||
| cloneItem->text = "Duplicate"; | |||
| cloneItem->rightText = GUI_MOD_KEY_NAME "+D"; | |||
| cloneItem->rightText = WINDOW_MOD_KEY_NAME "+D"; | |||
| cloneItem->moduleWidget = this; | |||
| menu->addChild(cloneItem); | |||
| @@ -1,7 +1,7 @@ | |||
| #include <thread> | |||
| #include "app.hpp" | |||
| #include "plugin.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "../ext/osdialog/osdialog.h" | |||
| @@ -24,7 +24,7 @@ struct SyncButton : Button { | |||
| } | |||
| if (completed) { | |||
| if (osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "All plugins have been updated. Close Rack and re-launch it to load new updates.")) { | |||
| guiClose(); | |||
| windowClose(); | |||
| } | |||
| completed = false; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| #include "app.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "engine.hpp" | |||
| #include "componentlibrary.hpp" | |||
| @@ -65,7 +65,7 @@ void Port::onMouseDown(EventMouseDown &e) { | |||
| void Port::onDragStart(EventDragStart &e) { | |||
| // Try to grab wire on top of stack | |||
| WireWidget *wire = gRackWidget->wireContainer->getTopWire(this); | |||
| if (type == OUTPUT && guiIsModPressed()) { | |||
| if (type == OUTPUT && windowIsModPressed()) { | |||
| wire = NULL; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| #include "app.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "util/request.hpp" | |||
| #include "../ext/osdialog/osdialog.h" | |||
| #include <string.h> | |||
| @@ -75,7 +75,7 @@ void RackScene::step() { | |||
| if (osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, versionMessage.c_str())) { | |||
| std::thread t(openBrowser, "https://vcvrack.com/"); | |||
| t.detach(); | |||
| guiClose(); | |||
| windowClose(); | |||
| } | |||
| newVersion = ""; | |||
| } | |||
| @@ -91,33 +91,33 @@ void RackScene::onHoverKey(EventHoverKey &e) { | |||
| if (!e.consumed) { | |||
| switch (e.key) { | |||
| case GLFW_KEY_N: { | |||
| if (guiIsModPressed() && !guiIsShiftPressed()) { | |||
| if (windowIsModPressed() && !windowIsShiftPressed()) { | |||
| gRackWidget->reset(); | |||
| e.consumed = true; | |||
| return; | |||
| } | |||
| } break; | |||
| case GLFW_KEY_Q: { | |||
| if (guiIsModPressed() && !guiIsShiftPressed()) { | |||
| guiClose(); | |||
| if (windowIsModPressed() && !windowIsShiftPressed()) { | |||
| windowClose(); | |||
| e.consumed = true; | |||
| return; | |||
| } | |||
| } break; | |||
| case GLFW_KEY_O: { | |||
| if (guiIsModPressed() && !guiIsShiftPressed()) { | |||
| if (windowIsModPressed() && !windowIsShiftPressed()) { | |||
| gRackWidget->openDialog(); | |||
| e.consumed = true; | |||
| return; | |||
| } | |||
| } break; | |||
| case GLFW_KEY_S: { | |||
| if (guiIsModPressed() && !guiIsShiftPressed()) { | |||
| if (windowIsModPressed() && !windowIsShiftPressed()) { | |||
| gRackWidget->saveDialog(); | |||
| e.consumed = true; | |||
| return; | |||
| } | |||
| if (guiIsModPressed() && guiIsShiftPressed()) { | |||
| if (windowIsModPressed() && windowIsShiftPressed()) { | |||
| gRackWidget->saveAsDialog(); | |||
| e.consumed = true; | |||
| return; | |||
| @@ -1,5 +1,5 @@ | |||
| #include "app.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -1,7 +1,7 @@ | |||
| #include "app.hpp" | |||
| #include "engine.hpp" | |||
| #include "plugin.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "settings.hpp" | |||
| #include "asset.hpp" | |||
| #include <map> | |||
| @@ -1,5 +1,5 @@ | |||
| #include "app.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -1,5 +1,5 @@ | |||
| #include "app.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "engine.hpp" | |||
| @@ -32,7 +32,7 @@ struct SaveAsItem : MenuItem { | |||
| struct QuitItem : MenuItem { | |||
| void onAction(EventAction &e) override { | |||
| guiClose(); | |||
| windowClose(); | |||
| } | |||
| }; | |||
| @@ -43,11 +43,11 @@ struct FileChoice : ChoiceButton { | |||
| menu->box.size.x = box.size.x; | |||
| { | |||
| menu->addChild(construct<NewItem>(&MenuItem::text, "New", &MenuItem::rightText, GUI_MOD_KEY_NAME "+N")); | |||
| menu->addChild(construct<OpenItem>(&MenuItem::text, "Open", &MenuItem::rightText, GUI_MOD_KEY_NAME "+O")); | |||
| menu->addChild(construct<SaveItem>(&MenuItem::text, "Save", &MenuItem::rightText, GUI_MOD_KEY_NAME "+S")); | |||
| menu->addChild(construct<SaveAsItem>(&MenuItem::text, "Save as", &MenuItem::rightText, GUI_MOD_KEY_NAME "+Shift+S")); | |||
| menu->addChild(construct<QuitItem>(&MenuItem::text, "Quit", &MenuItem::rightText, GUI_MOD_KEY_NAME "+Q")); | |||
| menu->addChild(construct<NewItem>(&MenuItem::text, "New", &MenuItem::rightText, WINDOW_MOD_KEY_NAME "+N")); | |||
| menu->addChild(construct<OpenItem>(&MenuItem::text, "Open", &MenuItem::rightText, WINDOW_MOD_KEY_NAME "+O")); | |||
| menu->addChild(construct<SaveItem>(&MenuItem::text, "Save", &MenuItem::rightText, WINDOW_MOD_KEY_NAME "+S")); | |||
| menu->addChild(construct<SaveAsItem>(&MenuItem::text, "Save as", &MenuItem::rightText, WINDOW_MOD_KEY_NAME "+Shift+S")); | |||
| menu->addChild(construct<QuitItem>(&MenuItem::text, "Quit", &MenuItem::rightText, WINDOW_MOD_KEY_NAME "+Q")); | |||
| } | |||
| } | |||
| }; | |||
| @@ -1,7 +1,7 @@ | |||
| #include "app.hpp" | |||
| #include "engine.hpp" | |||
| #include "componentlibrary.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -62,7 +62,7 @@ void engineInit() { | |||
| } | |||
| void engineDestroy() { | |||
| // Make sure there are no wires or modules in the rack on destruction. This suggests that a module failed to remove itself before the GUI was destroyed. | |||
| // Make sure there are no wires or modules in the rack on destruction. This suggests that a module failed to remove itself before the WINDOW was destroyed. | |||
| assert(wires.empty()); | |||
| assert(modules.empty()); | |||
| } | |||
| @@ -1,6 +1,6 @@ | |||
| #include "util/common.hpp" | |||
| #include "engine.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "app.hpp" | |||
| #include "plugin.hpp" | |||
| #include "settings.hpp" | |||
| @@ -33,7 +33,7 @@ int main(int argc, char* argv[]) { | |||
| pluginInit(); | |||
| engineInit(); | |||
| guiInit(); | |||
| windowInit(); | |||
| sceneInit(); | |||
| settingsLoad(assetLocal("settings.json")); | |||
| @@ -50,13 +50,13 @@ int main(int argc, char* argv[]) { | |||
| } | |||
| engineStart(); | |||
| guiRun(); | |||
| windowRun(); | |||
| engineStop(); | |||
| gRackWidget->savePatch(assetLocal("autosave.vcv")); | |||
| settingsSave(assetLocal("settings.json")); | |||
| sceneDestroy(); | |||
| guiDestroy(); | |||
| windowDestroy(); | |||
| engineDestroy(); | |||
| pluginDestroy(); | |||
| @@ -1,6 +1,6 @@ | |||
| #include "settings.hpp" | |||
| #include "app.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "engine.hpp" | |||
| #include "plugin.hpp" | |||
| #include <jansson.h> | |||
| @@ -20,14 +20,14 @@ static json_t *settingsToJson() { | |||
| json_t *tokenJ = json_string(gToken.c_str()); | |||
| json_object_set_new(rootJ, "token", tokenJ); | |||
| if (!guiIsMaximized()) { | |||
| if (!windowIsMaximized()) { | |||
| // windowSize | |||
| Vec windowSize = guiGetWindowSize(); | |||
| Vec windowSize = windowGetWindowSize(); | |||
| json_t *windowSizeJ = json_pack("[f, f]", windowSize.x, windowSize.y); | |||
| json_object_set_new(rootJ, "windowSize", windowSizeJ); | |||
| // windowPos | |||
| Vec windowPos = guiGetWindowPos(); | |||
| Vec windowPos = windowGetWindowPos(); | |||
| json_t *windowPosJ = json_pack("[f, f]", windowPos.x, windowPos.y); | |||
| json_object_set_new(rootJ, "windowPos", windowPosJ); | |||
| } | |||
| @@ -78,7 +78,7 @@ static void settingsFromJson(json_t *rootJ) { | |||
| if (windowSizeJ) { | |||
| double width, height; | |||
| json_unpack(windowSizeJ, "[F, F]", &width, &height); | |||
| guiSetWindowSize(Vec(width, height)); | |||
| windowSetWindowSize(Vec(width, height)); | |||
| } | |||
| // windowPos | |||
| @@ -86,7 +86,7 @@ static void settingsFromJson(json_t *rootJ) { | |||
| if (windowPosJ) { | |||
| double x, y; | |||
| json_unpack(windowPosJ, "[F, F]", &x, &y); | |||
| guiSetWindowPos(Vec(x, y)); | |||
| windowSetWindowPos(Vec(x, y)); | |||
| } | |||
| // opacity | |||
| @@ -1,5 +1,5 @@ | |||
| #include "ui.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -26,7 +26,7 @@ void MenuItem::draw(NVGcontext *vg) { | |||
| void MenuItem::step() { | |||
| // Add 10 more pixels because Retina measurements are sometimes too small | |||
| const float rightPadding = 10.0; | |||
| // HACK use gVg from the gui. | |||
| // HACK use gVg from the window. | |||
| // All this does is inspect the font, so it shouldn't modify gVg and should work when called from a FramebufferWidget for example. | |||
| box.size.x = bndLabelWidth(gVg, -1, text.c_str()) + bndLabelWidth(gVg, -1, rightText.c_str()) + rightPadding; | |||
| Widget::step(); | |||
| @@ -1,5 +1,5 @@ | |||
| #include "ui.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -12,7 +12,7 @@ void MenuLabel::draw(NVGcontext *vg) { | |||
| void MenuLabel::step() { | |||
| // Add 10 more pixels because Retina measurements are sometimes too small | |||
| const float rightPadding = 10.0; | |||
| // HACK use gVg from the gui. | |||
| // HACK use gVg from the window. | |||
| box.size.x = bndLabelWidth(gVg, -1, text.c_str()) + rightPadding; | |||
| Widget::step(); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| #include "widgets.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -1,5 +1,5 @@ | |||
| #include "ui.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -11,7 +11,7 @@ void ScrollBar::draw(NVGcontext *vg) { | |||
| void ScrollBar::onDragStart(EventDragStart &e) { | |||
| state = BND_ACTIVE; | |||
| guiCursorLock(); | |||
| windowCursorLock(); | |||
| } | |||
| void ScrollBar::onDragMove(EventDragMove &e) { | |||
| @@ -25,7 +25,7 @@ void ScrollBar::onDragMove(EventDragMove &e) { | |||
| void ScrollBar::onDragEnd(EventDragEnd &e) { | |||
| state = BND_DEFAULT; | |||
| guiCursorUnlock(); | |||
| windowCursorUnlock(); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| #include "ui.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -61,11 +61,11 @@ void ScrollWidget::onMouseMove(EventMouseMove &e) { | |||
| // Scroll with arrow keys | |||
| if (!gFocusedWidget) { | |||
| float arrowSpeed = 30.0; | |||
| if (guiIsShiftPressed() && guiIsModPressed()) | |||
| if (windowIsShiftPressed() && windowIsModPressed()) | |||
| arrowSpeed /= 16.0; | |||
| else if (guiIsShiftPressed()) | |||
| else if (windowIsShiftPressed()) | |||
| arrowSpeed *= 4.0; | |||
| else if (guiIsModPressed()) | |||
| else if (windowIsModPressed()) | |||
| arrowSpeed /= 4.0; | |||
| if (glfwGetKey(gWindow, GLFW_KEY_LEFT) == GLFW_PRESS) { | |||
| @@ -1,5 +1,5 @@ | |||
| #include "ui.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -13,7 +13,7 @@ void Slider::draw(NVGcontext *vg) { | |||
| void Slider::onDragStart(EventDragStart &e) { | |||
| state = BND_ACTIVE; | |||
| guiCursorLock(); | |||
| windowCursorLock(); | |||
| } | |||
| void Slider::onDragMove(EventDragMove &e) { | |||
| @@ -22,7 +22,7 @@ void Slider::onDragMove(EventDragMove &e) { | |||
| void Slider::onDragEnd(EventDragEnd &e) { | |||
| state = BND_DEFAULT; | |||
| guiCursorUnlock(); | |||
| windowCursorUnlock(); | |||
| EventAction eAction; | |||
| onAction(eAction); | |||
| } | |||
| @@ -1,6 +1,6 @@ | |||
| #include "ui.hpp" | |||
| // for gVg | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| // for key codes | |||
| #include <GLFW/glfw3.h> | |||
| @@ -92,14 +92,14 @@ void TextField::onKey(EventKey &e) { | |||
| end = begin = text.size(); | |||
| break; | |||
| case GLFW_KEY_V: | |||
| if (guiIsModPressed()) { | |||
| if (windowIsModPressed()) { | |||
| const char *newText = glfwGetClipboardString(gWindow); | |||
| if (newText) | |||
| insertText(newText); | |||
| } | |||
| break; | |||
| case GLFW_KEY_C: | |||
| if (guiIsModPressed()) { | |||
| if (windowIsModPressed()) { | |||
| if (begin < end) { | |||
| std::string selectedText = text.substr(begin, end - begin); | |||
| glfwSetClipboardString(gWindow, selectedText.c_str()); | |||
| @@ -1,5 +1,5 @@ | |||
| #include "ui.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| namespace rack { | |||
| @@ -1,5 +1,5 @@ | |||
| #include "widgets.hpp" | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include <GL/glew.h> | |||
| #include "../ext/nanovg/src/nanovg_gl.h" | |||
| #include "../ext/nanovg/src/nanovg_gl_utils.h" | |||
| @@ -1,4 +1,4 @@ | |||
| #include "gui.hpp" | |||
| #include "window.hpp" | |||
| #include "app.hpp" | |||
| #include "asset.hpp" | |||
| @@ -30,6 +30,7 @@ | |||
| namespace rack { | |||
| GLFWwindow *gWindow = NULL; | |||
| NVGcontext *gVg = NULL; | |||
| NVGcontext *gFramebufferVg = NULL; | |||
| @@ -236,7 +237,7 @@ void cursorEnterCallback(GLFWwindow* window, int entered) { | |||
| void scrollCallback(GLFWwindow *window, double x, double y) { | |||
| Vec scrollRel = Vec(x, y); | |||
| #if ARCH_LIN || ARCH_WIN | |||
| if (guiIsShiftPressed()) | |||
| if (windowIsShiftPressed()) | |||
| scrollRel = Vec(y, x); | |||
| #endif | |||
| // onScroll | |||
| @@ -305,7 +306,7 @@ void renderGui() { | |||
| glfwSwapBuffers(gWindow); | |||
| } | |||
| void guiInit() { | |||
| void windowInit() { | |||
| int err; | |||
| // Set up GLFW | |||
| @@ -393,7 +394,7 @@ void guiInit() { | |||
| bndSetTheme(theme); | |||
| } | |||
| void guiDestroy() { | |||
| void windowDestroy() { | |||
| gGuiFont.reset(); | |||
| #if defined NANOVG_GL2 | |||
| @@ -416,7 +417,7 @@ void guiDestroy() { | |||
| glfwTerminate(); | |||
| } | |||
| void guiRun() { | |||
| void windowRun() { | |||
| assert(gWindow); | |||
| gGuiFrame = 0; | |||
| while(!glfwWindowShouldClose(gWindow)) { | |||
| @@ -483,11 +484,11 @@ void guiRun() { | |||
| } | |||
| } | |||
| void guiClose() { | |||
| void windowClose() { | |||
| glfwSetWindowShouldClose(gWindow, GLFW_TRUE); | |||
| } | |||
| void guiCursorLock() { | |||
| void windowCursorLock() { | |||
| if (gAllowCursorLock) { | |||
| #ifdef ARCH_MAC | |||
| glfwSetInputMode(gWindow, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); | |||
| @@ -497,13 +498,13 @@ void guiCursorLock() { | |||
| } | |||
| } | |||
| void guiCursorUnlock() { | |||
| void windowCursorUnlock() { | |||
| if (gAllowCursorLock) { | |||
| glfwSetInputMode(gWindow, GLFW_CURSOR, GLFW_CURSOR_NORMAL); | |||
| } | |||
| } | |||
| bool guiIsModPressed() { | |||
| bool windowIsModPressed() { | |||
| #ifdef ARCH_MAC | |||
| return glfwGetKey(gWindow, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS || glfwGetKey(gWindow, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS; | |||
| #else | |||
| @@ -511,35 +512,35 @@ bool guiIsModPressed() { | |||
| #endif | |||
| } | |||
| bool guiIsShiftPressed() { | |||
| bool windowIsShiftPressed() { | |||
| return glfwGetKey(gWindow, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS || glfwGetKey(gWindow, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS; | |||
| } | |||
| Vec guiGetWindowSize() { | |||
| Vec windowGetWindowSize() { | |||
| int width, height; | |||
| glfwGetWindowSize(gWindow, &width, &height); | |||
| return Vec(width, height); | |||
| } | |||
| void guiSetWindowSize(Vec size) { | |||
| void windowSetWindowSize(Vec size) { | |||
| int width = size.x; | |||
| int height = size.y; | |||
| glfwSetWindowSize(gWindow, width, height); | |||
| } | |||
| Vec guiGetWindowPos() { | |||
| Vec windowGetWindowPos() { | |||
| int x, y; | |||
| glfwGetWindowPos(gWindow, &x, &y); | |||
| return Vec(x, y); | |||
| } | |||
| void guiSetWindowPos(Vec pos) { | |||
| void windowSetWindowPos(Vec pos) { | |||
| int x = pos.x; | |||
| int y = pos.y; | |||
| glfwSetWindowPos(gWindow, x, y); | |||
| } | |||
| bool guiIsMaximized() { | |||
| bool windowIsMaximized() { | |||
| return glfwGetWindowAttrib(gWindow, GLFW_MAXIMIZED); | |||
| } | |||