computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit c584a34ca3d9568d469fdb2c48ea769b5891bcfd
parent f5957fb212ee95e6a02f6664c9aebc8d98737b4a
Author: Adam M <aemalone@gmail.com>
Date:   Thu,  7 Nov 2019 17:10:48 -0600

Reset blank offset when scaling mode changes

Diffstat:
Msrc/ComputerscareBlank.cpp | 13++++++++++---
Msrc/ComputerscareRolyPouter.cpp | 4+---
2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp @@ -144,7 +144,7 @@ struct PNGDisplay : TransparentWidget { int imgWidth, imgHeight; float imgRatio; - + int lastEnum = -1; std::string path = ""; bool first = true; int img = 0; @@ -162,6 +162,13 @@ struct PNGDisplay : TransparentWidget { } + if(module->imageFitEnum != lastEnum) { + lastEnum = module->imageFitEnum; + module->xOffset=0; + module->yOffset=0; + module->zoom=1; + } + nvgBeginPath(args.vg); NVGpaint imgPaint; //if (module->width>0 && module->height>0) @@ -211,7 +218,7 @@ void PNGDisplay::onHoverKey(const event::HoverKey& e) { case GLFW_KEY_S: { //offset.x -= arrowSpeed; DEBUG("S pressed"); - module->yOffset -= module->invertY ? dPosition : -dPosition; + module->yOffset += module->invertY ? dPosition : -dPosition; e.consume(this); } break; case GLFW_KEY_D: { @@ -223,7 +230,7 @@ void PNGDisplay::onHoverKey(const event::HoverKey& e) { case GLFW_KEY_W: { //offset.x -= arrowSpeed; DEBUG("W pressed"); - module->yOffset += module->invertY ? dPosition : -dPosition; + module->yOffset -= module->invertY ? dPosition : -dPosition; e.consume(this); } break; case GLFW_KEY_Z: { diff --git a/src/ComputerscareRolyPouter.cpp b/src/ComputerscareRolyPouter.cpp @@ -47,7 +47,7 @@ struct ComputerscareRolyPouter : Module { counter++; int inputChannels = inputs[POLY_INPUT].getChannels(); int knobSetting; - if (counter > 5012) { + if (counter > 1000) { //printf("%f \n",random::uniform()); counter = 0; for (int i = 0; i < numKnobs; i++) { @@ -59,8 +59,6 @@ struct ComputerscareRolyPouter : Module { //if() if (inputs[ROUTING_CV].isConnected()) { - float v1 = inputs[ROUTING_CV].getVoltage(0); - float v2 = inputs[ROUTING_CV].getVoltage(1); for (int i = 0; i < numOutputChannels; i++) { knobSetting = mapVoltageToChannelCount(inputs[ROUTING_CV].getVoltage(i));