@@ -4,9 +4,6 @@ | |||||
#include <GLFW/glfw3.h> | #include <GLFW/glfw3.h> | ||||
namespace rack { | |||||
#ifdef ARCH_MAC | #ifdef ARCH_MAC | ||||
#define GUI_MOD_KEY_NAME "Cmd" | #define GUI_MOD_KEY_NAME "Cmd" | ||||
#else | #else | ||||
@@ -14,6 +11,8 @@ namespace rack { | |||||
#endif | #endif | ||||
namespace rack { | |||||
extern GLFWwindow *gWindow; | extern GLFWwindow *gWindow; | ||||
extern NVGcontext *gVg; | extern NVGcontext *gVg; | ||||
@@ -34,4 +33,5 @@ void guiCursorUnlock(); | |||||
bool guiIsModPressed(); | bool guiIsModPressed(); | ||||
bool guiIsShiftPressed(); | bool guiIsShiftPressed(); | ||||
} // namespace rack | } // namespace rack |
@@ -17,6 +17,16 @@ namespace rack { | |||||
// helpers | // helpers | ||||
//////////////////// | //////////////////// | ||||
inline Vec in2px(Vec inches) { | |||||
return inches.mult(SVG_DPI); | |||||
} | |||||
inline Vec mm2px(Vec millimeters) { | |||||
return millimeters.mult(SVG_DPI / 25.4); | |||||
} | |||||
template <class TModuleWidget> | template <class TModuleWidget> | ||||
Model *createModel(std::string manufacturerSlug, std::string manufacturerName, std::string slug, std::string name) { | Model *createModel(std::string manufacturerSlug, std::string manufacturerName, std::string slug, std::string name) { | ||||
struct TModel : Model { | struct TModel : Model { | ||||
@@ -10,6 +10,9 @@ | |||||
#include "util.hpp" | #include "util.hpp" | ||||
#define SVG_DPI 75.0 | |||||
namespace rack { | namespace rack { | ||||
@@ -457,7 +457,7 @@ std::shared_ptr<Image> Image::load(const std::string &filename) { | |||||
//////////////////// | //////////////////// | ||||
SVG::SVG(const std::string &filename) { | SVG::SVG(const std::string &filename) { | ||||
handle = nsvgParseFromFile(filename.c_str(), "px", 96.0); | |||||
handle = nsvgParseFromFile(filename.c_str(), "px", SVG_DPI); | |||||
if (handle) { | if (handle) { | ||||
fprintf(stderr, "Loaded SVG %s\n", filename.c_str()); | fprintf(stderr, "Loaded SVG %s\n", filename.c_str()); | ||||
} | } | ||||