-
Notifications
You must be signed in to change notification settings - Fork 445
/
Copy pathcontext.hpp
68 lines (45 loc) · 1.14 KB
/
context.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include <common.hpp>
namespace rack {
namespace history {
struct State;
} // namespace history
namespace engine {
struct Engine;
} // namespace engine
namespace window {
struct Window;
} // namespace window
namespace patch {
struct Manager;
} // namespace patch
namespace widget {
struct EventState;
} // namespace widget
namespace app {
struct Scene;
} // namespace app
/** Rack instance state
*/
struct Context {
widget::EventState* event = NULL;
app::Scene* scene = NULL;
engine::Engine* engine = NULL;
window::Window* window = NULL;
history::State* history = NULL;
patch::Manager* patch = NULL;
~Context();
};
/** Returns the global Context pointer */
Context* contextGet();
/** Sets the context for this thread.
You must set the context when preparing each thread if the code uses the APP macro in that thread.
*/
void contextSet(Context* context);
/** Deprecated. Use contextGet() or the APP macro to get the current Context. */
DEPRECATED inline Context* appGet() {
return contextGet();
}
/** Accesses the global Context pointer. Just an alias for contextGet(). */
#define APP rack::contextGet()
} // namespace rack