Class · aurore

aurore::Platform

On this page
aurore/core/platform.hpp
#include <aurore/core/platform.hpp>

class aurore::Platform

Constructors 1

virtual ~Platform() =default

Functions 39

virtual void createWindow(std::string title,uint32_t width,uint32_t height,float windowXPos = NAN,float windowYPos = NAN) =0

Called on startup, right after instanciation, to create and open a window with the given title and size.

platform.hpp:48
virtual void restoreWindow()

This function also restores windows from maximization.

platform.hpp:55
virtual void setWindowSize(uint32_t windowWidth, uint32_t windowHeight)

Set window size

platform.hpp:62
virtual void setWindowSizeLimits(uint32_t windowMinWidth,uint32_t windowMinHeight,uint32_t windowMaxWidth,uint32_t windowMaxHeight)

Set window size limits

platform.hpp:69
virtual void setWindowPosition(int windowXPos, int windowYPos)

Set window position

platform.hpp:76
virtual void setWindowState(uint32_t windowWidth,uint32_t windowHeight,int windowXPos,int windowYPos)

1.restoreWindow 2.Set window size 3.Set window position

platform.hpp:85
virtual std::string getName() =0

Returns the human-readable name of the platform.

platform.hpp:90
virtual const LayoutPreset * getLayoutPreset()

The layout this platform's screen asks for (a small console screen: PRESET_SMALL_SCREEN), nullptr for the usual one. Read by Application::init() unless the app chose its own (Application::usePreset).

platform.hpp:97
virtual bool hasWirelessConnection()

Returns true if device has wireless connection.

platform.hpp:102
virtual int getWirelessLevel() =0

Returns wireless quality level from 0 to 3.

platform.hpp:107
virtual bool hasEthernetConnection()

Returns true if device has ethernet connection.

platform.hpp:112
virtual std::string getIpAddress() =0

Returns ip address.

platform.hpp:117
virtual std::string getDnsServer() =0

Returns dns server address.

platform.hpp:122
virtual bool canShowBatteryLevel()

Returns if battery level supports.

platform.hpp:127
virtual bool canShowWirelessLevel()

Returns if Wireless level supports.

platform.hpp:132
virtual int getBatteryLevel() =0

Returns the battery level from 0 to 100.

platform.hpp:137
virtual bool isBatteryCharging() =0

Returns the battery level from 0 to 100.

platform.hpp:142
virtual void disableScreenDimming(bool disable,const std::string &reason = "disable dimming",const std::string &app = "aurore") =0

Disable screen dimming/saver...

Parameters

disable

Inhibit or not

reason

If disable is true, pass Inhibited reason to the system.

app

If disable is true, pass app name to the system.

platform.hpp:151
virtual bool isScreenDimmingDisabled() =0

Returns true if screen dimming is disabled

platform.hpp:156
virtual void setBacklightBrightness(float brightness) =0

Set the backlight brightness

Parameters

brightness

0.0 to 1.0

platform.hpp:163
virtual float getBacklightBrightness() =0

Get the backlight brightness

Returns

0.0 to 1.0

platform.hpp:169
virtual bool canSetBacklightBrightness() =0

Returns true if the platform can set/get the backlight brightness

platform.hpp:174
virtual void setWindowAlwaysOnTop(bool enable)

Set the windows always on top

platform.hpp:179
virtual bool mainLoopIteration() =0

Called at every iteration of the main loop. Must return false if the app should continue running (for example, return false if the X button was pressed on the window).

platform.hpp:186
virtual bool runLoop(const std::function< bool()> &runLoopImpl)
virtual ThemeVariant getThemeVariant() =0

Can be called at anytime to get the current system theme variant.

For now, the variant is assumed to stay the same during the whole time the app is running (no variant hot swap).

As such, the result should be cached by the platform code.

platform.hpp:198
virtual void setThemeVariant(ThemeVariant theme) =0

Overwrite current theme settings

platform.hpp:203
virtual std::string getLocale() =0

Can be called at anytime to get the current locale

For now, the locale is assumed to stay the same during the whole time the app is running (no locale hot swap)

As such, the result should be cached by the platform code. The method should return one of the locale constants defined in the i18n header file.

platform.hpp:215
virtual AudioPlayer * getAudioPlayer() =0

Returns the AudioPlayer for the platform. Cannot return nullptr.

platform.hpp:221
virtual VideoContext * getVideoContext() =0

Returns the VideoContext for the platform. Cannot return nullptr.

platform.hpp:227
virtual InputManager * getInputManager() =0

Returns the InputManager for the platform. Cannot return nullptr.

platform.hpp:233
virtual ImeManager * getImeManager() =0

Returns the ImeManager for the platform. Cannot return nullptr.

platform.hpp:239
virtual FontLoader * getFontLoader() =0

Returns the FontLoader for the platform. Cannot return nullptr.

platform.hpp:245
virtual bool isApplicationMode() =0

Returns if non applet.

platform.hpp:250
virtual void exitToHomeMode(bool value) =0

When the program exits, exit directly to the home menu

platform.hpp:255
virtual void forceEnableGamePlayRecording() =0

When the program exits, exit directly to the home menu

platform.hpp:260
virtual void openBrowser(std::string url) =0

Open a link in browser

Parameters

url

the link which will be opened; one that isBrowserUrl() refuses is not opened

platform.hpp:267
virtual void pasteToClipboard(const std::string &text)

Paste text to clipboard

platform.hpp:283
virtual std::string pasteFromClipboard()

Copy text from clipboard

platform.hpp:288

Static functions 3

static bool isBrowserUrl(const std::string &url)

true if openBrowser() may open this url: it starts with one of BROWSER_URL_SCHEMES followed by "://" and has no control character

platform.hpp:273
static Platform * createPlatform()

Selects and returns the best platform.

platform.hpp:293
static void setFactory(std::function< Platform *()> factory)

Has createPlatform() return what factory makes instead of the build's own platform (the test harness' headless one). To call before Application::init(); an empty function goes back to the default.

platform.hpp:300

Static attributes 2

static std::vector< std::string > BROWSER_URL_SCHEMES = { "http", "https" }

The schemes openBrowser() accepts, in lower case

platform.hpp:278
static std::string APP_LOCALE_DEFAULT = "auto"

App locale, empty for default

platform.hpp:307

Read from Aurore's headers by Doxygen at each build · library/include