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.

49 lines
672B

  1. #include "app.hpp"
  2. #include "event.hpp"
  3. #include "window.hpp"
  4. #include "engine/Engine.hpp"
  5. #include "app/Scene.hpp"
  6. #include "history.hpp"
  7. namespace rack {
  8. App::App() {
  9. event = new event::State;
  10. history = new history::State;
  11. window = new Window;
  12. engine = new Engine;
  13. scene = new Scene;
  14. event->rootWidget = scene;
  15. }
  16. App::~App() {
  17. delete scene; scene = NULL;
  18. delete event; event = NULL;
  19. delete history; history = NULL;
  20. delete engine; engine = NULL;
  21. delete window; window = NULL;
  22. }
  23. static App *c = NULL;
  24. void appInit() {
  25. assert(!c);
  26. c = new App;
  27. }
  28. void appDestroy() {
  29. assert(c);
  30. delete c;
  31. c = NULL;
  32. }
  33. App *app() {
  34. return c;
  35. }
  36. } // namespace rack