You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1010B

  1. #pragma once
  2. #include "../common.hpp"
  3. #include "math.hpp"
  4. #include <jansson.h>
  5. namespace rack {
  6. static const char APP_NAME[] = "VCV Rack";
  7. static const char APP_VERSION[] = TOSTRING(VERSION);
  8. static const char APP_API_URL[] = "https://api.vcvrack.com";
  9. static const float APP_SVG_DPI = 75.0;
  10. static const float MM_PER_IN = 25.4;
  11. /** Converts inch measurements to pixels */
  12. inline float in2px(float in) {
  13. return in * APP_SVG_DPI;
  14. }
  15. inline math::Vec in2px(math::Vec in) {
  16. return in.mult(APP_SVG_DPI);
  17. }
  18. /** Converts millimeter measurements to pixels */
  19. inline float mm2px(float mm) {
  20. return mm * (APP_SVG_DPI / MM_PER_IN);
  21. }
  22. inline math::Vec mm2px(math::Vec mm) {
  23. return mm.mult(APP_SVG_DPI / MM_PER_IN);
  24. }
  25. // A 1HPx3U module should be 15x380 pixels. Thus the width of a module should be a factor of 15.
  26. static const float RACK_GRID_WIDTH = 15;
  27. static const float RACK_GRID_HEIGHT = 380;
  28. static const math::Vec RACK_GRID_SIZE = math::Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT);
  29. } // namespace rack