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.

context.hpp 936B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. struct Window;
  11. struct PatchManager;
  12. namespace event {
  13. struct State;
  14. } // namespace event
  15. namespace app {
  16. struct Scene;
  17. } // namespace app
  18. /** Contains the application state */
  19. struct Context {
  20. event::State* event = NULL;
  21. app::Scene* scene = NULL;
  22. engine::Engine* engine = NULL;
  23. Window* window = NULL;
  24. history::State* history = NULL;
  25. PatchManager* patch = NULL;
  26. ~Context();
  27. };
  28. /** Returns the global Context pointer */
  29. Context* contextGet();
  30. /** Sets the context for this thread.
  31. You must set the context when preparing each thread if the code uses the APP macro in that thread.
  32. */
  33. void contextSet(Context* context);
  34. /** Accesses the global Context pointer. Just an alias for contextGet(). */
  35. #define APP rack::contextGet()
  36. } // namespace rack