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.

64 lines
1.0KB

  1. #pragma once
  2. #include <common.hpp>
  3. namespace rack {
  4. namespace history {
  5. struct State;
  6. } // namespace history
  7. namespace engine {
  8. struct Engine;
  9. } // namespace engine
  10. namespace window {
  11. struct Window;
  12. } // namespace window
  13. namespace patch {
  14. struct Manager;
  15. } // namespace patch
  16. namespace widget {
  17. struct EventState;
  18. } // namespace widget
  19. namespace app {
  20. struct Scene;
  21. } // namespace app
  22. /** Rack instance state
  23. */
  24. struct Context {
  25. widget::EventState* event = NULL;
  26. app::Scene* scene = NULL;
  27. engine::Engine* engine = NULL;
  28. window::Window* window = NULL;
  29. history::State* history = NULL;
  30. patch::Manager* patch = NULL;
  31. ~Context();
  32. };
  33. /** Returns the global Context pointer */
  34. Context* contextGet();
  35. /** Sets the context for this thread.
  36. You must set the context when preparing each thread if the code uses the APP macro in that thread.
  37. */
  38. void contextSet(Context* context);
  39. /** Accesses the global Context pointer. Just an alias for contextGet(). */
  40. #define APP rack::contextGet()
  41. } // namespace rack