@@ -77,6 +77,6 @@ Build plugin. | |||||
## License | ## 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/) |
@@ -1,5 +1,7 @@ | |||||
# Detect architecture if ARCH is not defined | # Detect architecture if ARCH is not defined | ||||
ifndef ARCH | |||||
MACHINE = $(shell gcc -dumpmachine) | MACHINE = $(shell gcc -dumpmachine) | ||||
ifneq (,$(findstring linux,$(MACHINE))) | ifneq (,$(findstring linux,$(MACHINE))) | ||||
# Linux | # Linux | ||||
@@ -11,5 +13,7 @@ else ifneq (,$(findstring mingw,$(MACHINE))) | |||||
# Windows | # Windows | ||||
ARCH = win | ARCH = win | ||||
else | 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 | ||||
endif |
@@ -5,7 +5,8 @@ FLAGS += -DVERSION=$(VERSION) -DVERSION_$(subst .,_,$(VERSION)) | |||||
FLAGS += -MMD | FLAGS += -MMD | ||||
# Optimization | # Optimization | ||||
FLAGS += -O3 -march=nocona -ffast-math | FLAGS += -O3 -march=nocona -ffast-math | ||||
FLAGS += -g -Wall | |||||
FLAGS += -Wall | |||||
FLAGS += -g | |||||
CXXFLAGS += -std=c++11 | CXXFLAGS += -std=c++11 | ||||
@@ -28,6 +28,8 @@ will expand to | |||||
*/ | */ | ||||
#define TOSTRING(x) STRINGIFY(x) | #define TOSTRING(x) STRINGIFY(x) | ||||
#define LENGTHOF(arr) (sizeof(arr) / sizeof((arr)[0])) | |||||
namespace rack { | namespace rack { | ||||
@@ -268,6 +268,9 @@ void RackWidget::cloneModule(ModuleWidget *m) { | |||||
} | } | ||||
bool RackWidget::requestModuleBox(ModuleWidget *m, Rect box) { | bool RackWidget::requestModuleBox(ModuleWidget *m, Rect box) { | ||||
if (box.pos.x < 0 || box.pos.y < 0) | |||||
return false; | |||||
for (Widget *child2 : moduleContainer->children) { | for (Widget *child2 : moduleContainer->children) { | ||||
if (m == child2) continue; | if (m == child2) continue; | ||||
if (box.intersects(child2->box)) { | if (box.intersects(child2->box)) { | ||||
@@ -160,7 +160,6 @@ Toolbar::Toolbar() { | |||||
plugLightButton->box.pos = Vec(xPos, margin); | plugLightButton->box.pos = Vec(xPos, margin); | ||||
plugLightButton->box.size.x = 100; | plugLightButton->box.size.x = 100; | ||||
plugLightButton->label = "Plug lights"; | plugLightButton->label = "Plug lights"; | ||||
plugLightButton->setValue(1.0); | |||||
addChild(plugLightButton); | addChild(plugLightButton); | ||||
xPos += plugLightButton->box.size.x; | xPos += plugLightButton->box.size.x; | ||||
} | } | ||||
@@ -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, 0xb7, 0x0e), // yellow | ||||
nvgRGB(0xc9, 0x18, 0x47), // red | nvgRGB(0xc9, 0x18, 0x47), // red | ||||
nvgRGB(0x0c, 0x8e, 0x15), // green | nvgRGB(0x0c, 0x8e, 0x15), // green | ||||
@@ -77,13 +77,13 @@ static const NVGcolor wireColors[6] = { | |||||
nvgRGB(0x44, 0x44, 0x44), // black | nvgRGB(0x44, 0x44, 0x44), // black | ||||
// nvgRGB(0x66, 0x66, 0x66), // gray | // nvgRGB(0x66, 0x66, 0x66), // gray | ||||
// nvgRGB(0x88, 0x88, 0x88), // light gray | // nvgRGB(0x88, 0x88, 0x88), // light gray | ||||
nvgRGB(0xaa, 0xaa, 0xaa), // white | |||||
// nvgRGB(0xaa, 0xaa, 0xaa), // white | |||||
}; | }; | ||||
static int lastWireColorId = -1; | static int lastWireColorId = -1; | ||||
WireWidget::WireWidget() { | WireWidget::WireWidget() { | ||||
lastWireColorId = (lastWireColorId + 1) % 6; | |||||
lastWireColorId = (lastWireColorId + 1) % LENGTHOF(wireColors); | |||||
color = wireColors[lastWireColorId]; | color = wireColors[lastWireColorId]; | ||||
inputLight = construct<PolarityLight>(&PolarityLight::posColor, COLOR_GREEN, &PolarityLight::negColor, COLOR_RED); | inputLight = construct<PolarityLight>(&PolarityLight::posColor, COLOR_GREEN, &PolarityLight::negColor, COLOR_RED); | ||||
@@ -244,7 +244,10 @@ void guiInit() { | |||||
// Set up GLFW | // Set up GLFW | ||||
glfwSetErrorCallback(errorCallback); | glfwSetErrorCallback(errorCallback); | ||||
err = glfwInit(); | 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_MAJOR, 2); | ||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); | ||||
@@ -256,7 +259,7 @@ void guiInit() { | |||||
glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); | glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); | ||||
gWindow = glfwCreateWindow(640, 480, "", NULL, NULL); | gWindow = glfwCreateWindow(640, 480, "", NULL, NULL); | ||||
if (!gWindow) { | 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); | exit(1); | ||||
} | } | ||||
@@ -275,7 +278,10 @@ void guiInit() { | |||||
// Set up GLEW | // Set up GLEW | ||||
glewExperimental = GL_TRUE; | glewExperimental = GL_TRUE; | ||||
err = glewInit(); | 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. | // GLEW generates GL error because it calls glGetString(GL_EXTENSIONS), we'll consume it here. | ||||
glGetError(); | glGetError(); | ||||