diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
commit | 6352e8e3196f78388b6c771073f9e03eaa612673 (patch) | |
tree | e23772f79a7fbc41bc9108951e9e136857484bf4 /source/application/StarApplicationController.hpp | |
parent | 6741a057e5639280d85d0f88ba26f000baa58f61 (diff) |
everything everywhere
all at once
Diffstat (limited to 'source/application/StarApplicationController.hpp')
-rw-r--r-- | source/application/StarApplicationController.hpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/source/application/StarApplicationController.hpp b/source/application/StarApplicationController.hpp new file mode 100644 index 0000000..d19ab4c --- /dev/null +++ b/source/application/StarApplicationController.hpp @@ -0,0 +1,67 @@ +#ifndef STAR_APPLICATION_CONTROLLER_HPP +#define STAR_APPLICATION_CONTROLLER_HPP + +#include "StarApplication.hpp" +#include "StarStatisticsService.hpp" +#include "StarP2PNetworkingService.hpp" +#include "StarUserGeneratedContentService.hpp" +#include "StarDesktopService.hpp" + +namespace Star { + +STAR_CLASS(ApplicationController); + +// Audio format is always 16 bit signed integer samples +struct AudioFormat { + unsigned sampleRate; + unsigned channels; +}; + +// Window size defaults to 800x600, target update rate to 60hz, maximized and +// fullscreen are false, vsync is on, the cursor is visible, and audio and text +// input are disabled. +class ApplicationController { +public: + virtual ~ApplicationController() = default; + + // Target hz at which update() will be called + virtual void setTargetUpdateRate(float targetUpdateRate) = 0; + // Window that controls how long the update rate will be increased or + // decreased to make up for rate errors in the past. + virtual void setUpdateTrackWindow(float updateTrackWindow) = 0; + // Maximum number of calls to update() that can occur before we force + // 'render()' to be called, even if we are still behind on our update rate. + virtual void setMaxFrameSkip(unsigned maxFrameSkip) = 0; + + virtual void setApplicationTitle(String title) = 0; + virtual void setFullscreenWindow(Vec2U fullScreenResolution) = 0; + virtual void setNormalWindow(Vec2U windowSize) = 0; + virtual void setMaximizedWindow() = 0; + virtual void setBorderlessWindow() = 0; + virtual void setVSyncEnabled(bool vSync) = 0; + virtual void setCursorVisible(bool cursorVisible) = 0; + virtual void setAcceptingTextInput(bool acceptingTextInput) = 0; + + virtual AudioFormat enableAudio() = 0; + virtual void disableAudio() = 0; + + virtual void setClipboard(String text) = 0; + virtual Maybe<String> getClipboard() = 0; + + // Returns the latest actual measured update and render rate, which may be + // different than the target update rate. + virtual float updateRate() const = 0; + virtual float renderFps() const = 0; + + virtual StatisticsServicePtr statisticsService() const = 0; + virtual P2PNetworkingServicePtr p2pNetworkingService() const = 0; + virtual UserGeneratedContentServicePtr userGeneratedContentService() const = 0; + virtual DesktopServicePtr desktopService() const = 0; + + // Signals the application to quit + virtual void quit() = 0; +}; + +} + +#endif |