main.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. 
  2. // TODO:
  3. // * Make this project into an application that starts automatically to test GUI and sound after building the Builder build system.
  4. // * Let the user browse a file system and select a location for a new or existing project.
  5. // * Explain how everything works when starting for the first time, using a command line argument.
  6. // * A catalogue of SDK examples with images and descriptions loaded automatically from their folder.
  7. // * Offer one-click build and execution of SDK examples on multiple platforms, while explaining how the building works.
  8. #include "../../DFPSR/includeFramework.h"
  9. using namespace dsr;
  10. // Embedding your interface's layout is the simplest way to get started
  11. // It works even if the application is called from another folder
  12. String interfaceContent =
  13. UR"QUOTE(
  14. Begin : Panel
  15. Name = "mainPanel"
  16. Color = 150,160,170
  17. Solid = 1
  18. End
  19. )QUOTE";
  20. // Global
  21. bool running = true;
  22. // GUI handles
  23. Window window;
  24. DSR_MAIN_CALLER(dsrMain)
  25. void dsrMain(List<String> args) {
  26. // Create a window
  27. window = window_create(U"Project wizard", 1000, 700);
  28. // Register your custom components here
  29. //REGISTER_PERSISTENT_CLASS(className);
  30. // Load an interface to the window
  31. window_loadInterfaceFromString(window, interfaceContent);
  32. // Bind methods to events
  33. window_setCloseEvent(window, []() {
  34. running = false;
  35. });
  36. // Get your component handles here
  37. //myComponent = window_findComponentByName(window, U"myComponent");
  38. // Bind your components to events here
  39. //component_setPressedEvent(myButton, []() {});
  40. // Execute
  41. while(running) {
  42. // Wait for actions so that we don't render until an action has been recieved
  43. // This will save battery on laptops for applications that don't require animation
  44. while (!window_executeEvents(window)) {
  45. time_sleepSeconds(0.01);
  46. }
  47. // Draw interface
  48. window_drawComponents(window);
  49. // Show the final image
  50. window_showCanvas(window);
  51. }
  52. }