diff --git a/README.md b/README.md index 0f6456c1..b9af12ba 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,6 @@ Build plugin. ## License -Rack source code by [Andrew Belt](https://andrewbelt.name/) licensed under the [BSD-3-Clause](LICENSE.txt) +Rack source code by [Andrew Belt](https://andrewbelt.name/) licensed under [BSD-3-Clause](LICENSE.txt) -Component Library graphics by [Grayscale](http://grayscale.info/) licensed under the [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) +Component Library graphics by [Grayscale](http://grayscale.info/) licensed under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) diff --git a/arch.mk b/arch.mk index 25d7f4c3..cf26b179 100644 --- a/arch.mk +++ b/arch.mk @@ -1,5 +1,7 @@ # Detect architecture if ARCH is not defined +ifndef ARCH + MACHINE = $(shell gcc -dumpmachine) ifneq (,$(findstring linux,$(MACHINE))) # Linux @@ -11,5 +13,7 @@ else ifneq (,$(findstring mingw,$(MACHINE))) # Windows ARCH = win else - $(error Could not determine machine type. Try hacking around in Makefile-arch.inc) + $(error Could not determine machine type. Try hacking around in arch.mk) endif + +endif \ No newline at end of file diff --git a/compile.mk b/compile.mk index edfcee9a..acaf8a0e 100644 --- a/compile.mk +++ b/compile.mk @@ -5,7 +5,8 @@ FLAGS += -DVERSION=$(VERSION) -DVERSION_$(subst .,_,$(VERSION)) FLAGS += -MMD # Optimization FLAGS += -O3 -march=nocona -ffast-math -FLAGS += -g -Wall +FLAGS += -Wall +FLAGS += -g CXXFLAGS += -std=c++11 diff --git a/include/util.hpp b/include/util.hpp index 65abf21f..755b4351 100644 --- a/include/util.hpp +++ b/include/util.hpp @@ -28,6 +28,8 @@ will expand to */ #define TOSTRING(x) STRINGIFY(x) +#define LENGTHOF(arr) (sizeof(arr) / sizeof((arr)[0])) + namespace rack { diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index 47c754a3..0dbf8af9 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -268,6 +268,9 @@ void RackWidget::cloneModule(ModuleWidget *m) { } bool RackWidget::requestModuleBox(ModuleWidget *m, Rect box) { + if (box.pos.x < 0 || box.pos.y < 0) + return false; + for (Widget *child2 : moduleContainer->children) { if (m == child2) continue; if (box.intersects(child2->box)) { diff --git a/src/app/Toolbar.cpp b/src/app/Toolbar.cpp index 4a421522..1c8b5cfe 100644 --- a/src/app/Toolbar.cpp +++ b/src/app/Toolbar.cpp @@ -160,7 +160,6 @@ Toolbar::Toolbar() { plugLightButton->box.pos = Vec(xPos, margin); plugLightButton->box.size.x = 100; plugLightButton->label = "Plug lights"; - plugLightButton->setValue(1.0); addChild(plugLightButton); xPos += plugLightButton->box.size.x; } diff --git a/src/app/WireWidget.cpp b/src/app/WireWidget.cpp index bfcddc8a..9267e79f 100644 --- a/src/app/WireWidget.cpp +++ b/src/app/WireWidget.cpp @@ -69,7 +69,7 @@ static void drawWire(NVGcontext *vg, Vec pos1, Vec pos2, NVGcolor color, float t } -static const NVGcolor wireColors[6] = { +static const NVGcolor wireColors[] = { nvgRGB(0xc9, 0xb7, 0x0e), // yellow nvgRGB(0xc9, 0x18, 0x47), // red nvgRGB(0x0c, 0x8e, 0x15), // green @@ -77,13 +77,13 @@ static const NVGcolor wireColors[6] = { nvgRGB(0x44, 0x44, 0x44), // black // nvgRGB(0x66, 0x66, 0x66), // gray // nvgRGB(0x88, 0x88, 0x88), // light gray - nvgRGB(0xaa, 0xaa, 0xaa), // white + // nvgRGB(0xaa, 0xaa, 0xaa), // white }; static int lastWireColorId = -1; WireWidget::WireWidget() { - lastWireColorId = (lastWireColorId + 1) % 6; + lastWireColorId = (lastWireColorId + 1) % LENGTHOF(wireColors); color = wireColors[lastWireColorId]; inputLight = construct(&PolarityLight::posColor, COLOR_GREEN, &PolarityLight::negColor, COLOR_RED); diff --git a/src/gui.cpp b/src/gui.cpp index 8487002c..dcf71f18 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -244,7 +244,10 @@ void guiInit() { // Set up GLFW glfwSetErrorCallback(errorCallback); err = glfwInit(); - assert(err); + if (err) { + osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Could not initialize GLFW."); + exit(1); + } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); @@ -256,7 +259,7 @@ void guiInit() { glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); gWindow = glfwCreateWindow(640, 480, "", NULL, NULL); if (!gWindow) { - osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Cannot open window with OpenGL 2.0 renderer. Does your graphics card support OpenGL 2.0? If so, are the latest drivers installed?"); + osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Cannot open window with OpenGL 2.0 renderer. Does your graphics card support OpenGL 2.0 or greater? If so, are the latest drivers installed?"); exit(1); } @@ -275,7 +278,10 @@ void guiInit() { // Set up GLEW glewExperimental = GL_TRUE; err = glewInit(); - assert(err == GLEW_OK); + if (err != GLEW_OK) { + osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Could not initialize GLEW. Does your graphics card support OpenGL 2.0 or greater? If so, are the latest drivers installed?"); + exit(1); + } // GLEW generates GL error because it calls glGetString(GL_EXTENSIONS), we'll consume it here. glGetError();