12 #include "al/app/al_AudioDomain.hpp"
13 #include "al/app/al_ComputationDomain.hpp"
14 #include "al/app/al_OSCDomain.hpp"
15 #include "al/app/al_OpenGLGraphicsDomain.hpp"
16 #include "al/app/al_SimulationDomain.hpp"
17 #include "al/graphics/al_Graphics.hpp"
35 template <
class DomainType> std::shared_ptr<DomainType> newDomain() {
36 auto newDomain = std::make_shared<DomainType>();
37 mDomainList.push_back(newDomain);
44 virtual void onInit() {}
45 virtual void onCreate() {}
46 virtual void onAnimate(
double dt) { (void)dt; }
47 virtual void onDraw(
Graphics &g) { (void)g; }
50 virtual void onExit() {}
52 virtual bool onKeyDown(
Keyboard const & ) {
return true; }
53 virtual bool onKeyUp(
Keyboard const & ) {
return true; }
54 virtual bool onMouseDown(
Mouse const & ) {
return true; }
55 virtual bool onMouseUp(
Mouse const & ) {
return true; }
56 virtual bool onMouseDrag(
Mouse const & ) {
return true; }
57 virtual bool onMouseMove(
Mouse const & ) {
return true; }
58 virtual bool onMouseScroll(
Mouse const & ) {
return true; }
59 virtual void onResize(
int ,
int ) {}
66 virtual Window &defaultWindow();
108 float highresFactor();
126 void decorated(
bool b);
129 [[deprecated(
"Call through defaultWindow()")]]
void
131 [[deprecated(
"Call through defaultWindow()")]]
void
133 [[deprecated(
"Call through defaultWindow()")]]
void
139 void configureAudio(
double audioRate = 44100,
int audioBlockSize = 512,
140 int audioOutputs = -1,
int audioInputs = -1);
142 void configureAudio(
AudioDevice &dev,
double audioRate = -1,
143 int audioBlockSize = 512,
int audioOutputs = -1,
144 int audioInputs = -1);
149 virtual void start();
152 std::shared_ptr<OSCDomain> oscDomain() {
return mOSCDomain; }
153 std::shared_ptr<AudioDomain> audioDomain() {
return mAudioDomain; }
154 std::shared_ptr<OpenGLGraphicsDomain> graphicsDomain() {
155 return mOpenGLGraphicsDomain;
157 std::shared_ptr<SimulationDomain> simulationDomain() {
158 return mSimulationDomain;
161 std::shared_ptr<GLFWOpenGLWindowDomain> defaultWindowDomain() {
162 return mDefaultWindowDomain;
171 std::shared_ptr<GLFWOpenGLWindowDomain> mDefaultWindowDomain;
173 std::shared_ptr<OSCDomain> mOSCDomain;
174 std::shared_ptr<AudioDomain> mAudioDomain;
175 std::shared_ptr<OpenGLGraphicsDomain> mOpenGLGraphicsDomain;
176 std::shared_ptr<SimulationDomain> mSimulationDomain;
179 void initializeDomains();
181 std::vector<std::shared_ptr<AsynchronousDomain>> mDomainList;
182 std::stack<std::shared_ptr<AsynchronousDomain>> mRunningDomains;
void fullScreenToggle()
Toggle fullscreen.
void cursorHide(bool v)
Set cursor hiding.
void iconify()
Iconify window.
void cursor(Window::Cursor v)
Set cursor type.
Window::Cursor cursor()
Get current cursor type.
Window::DisplayMode displayMode()
Get current display mode.
void dimensions(int x, int y, int w, int h)
Set dimensions.
void quit()
Requests domain to quit.
int width()
Get window width, in pixels.
double aspect()
Get aspect ratio (width divided by height)
Window::Dim dimensions()
Get current dimensions of window.
bool enabled(Window::DisplayMode v)
Get whether display mode flag is set.
bool fullScreen()
Get whether window is in fullscreen.
void title(const std::string &v)
Set title.
bool cursorHide()
Whether the cursor is hidden.
bool vsync()
Get whether v-sync is enabled.
Keyboard & keyboard()
Get current keyboard state.
void hide()
Hide window (if showing)
void displayMode(Window::DisplayMode v)
Mouse & mouse()
Get current mouse state.
bool visible()
Get whether window is visible.
void dimensions(const Window::Dim &v)
Set dimensions.
const std::string & title()
Get title of window.
void cursorHideToggle()
Toggle cursor hiding.
void dimensions(int w, int h)
Set dimensions.
int height()
Get window height, in pixels.
Interface for loading fonts and rendering text.
The ParameterServer class creates an OSC server to receive parameter values.
A local coordinate frame.
Viewpoint within a scene.
Controller for handling input and window events.
Window with OpenGL context.
DisplayMode
Window display mode bit flags.
bool keyDown(const Keyboard &k)
Called when a keyboard key is pressed.