Skip to content

Mojo app appinstance

mojo:mojo.app.AppInstance

Class AppInstance#

The AppInstance class.

The AppInstance class is mainly reponsible for running the app 'event loop', but also provides several utility functions for managing the application.

A global instance of the AppInstance class is stored in the App global variable, so you can use any member of the AppInstance simply by prefixing it with 'App.', eg: App.MilliSecs

There are a number of config settings that can be used to control app behaviour. See SetConfig for more information about config settings.

Config setting Possible values Default value
"MOJO_OPENGL_PROFILE" "es", "compatibility" or "core" "compatibility" on macos and linux, "es" on all other targets. Uses 'Angle' for es support on windows.
"MOJO_OPENGL_VERSION_MAJOR" Open gl major version 2
"MOJO_OPENGL_VERSION_MINOR" Open gl minor version 0
"MOJO_COLOR_BUFFER_BITS" Minimum color bit depth 8
"MOJO_DEPTH_BUFFER_BITS" Minimum depth buffer bit depth 0
"MOJO_STENCIL_BUFFER_BITS" Minimum stencil buffer bit depth 0
Fields
Activated Invoked when app is activated.
Deactivated Invoked when app is deactivated.
FileDropped Invoked when a file is dropped on an app window.
Idle Invoked when the app becomes idle.
KeyEventFilter Key event filter.
MouseEventFilter MouseEvent filter.
SdlEventFilter Raw SDL_Event filter.
ThemeChanged
Constructors
New Creates a new app instance.
Properties
Active True if app is active. (read only)
ActiveWindow The currently active window. (read only)
ClipboardText Clipboard text.
ClipboardTextEmpty True if clipboard text is empty. (read only)
DefaultFont Fallback font. (read only)
DefaultFontName (read only)
DefaultMonoFont (read only)
DefaultMonoFontName (read only)
DesktopMode The desktop display mode. (read only)
DesktopSize The desktop size. (read only)
FPS Approximate frames per second rendering rate. (read only)
HoverView The current hover view. (read only)
KeyView The current key view.
Millisecs Number of milliseconds app has been running. (read only)
ModalView (read only)
MouseLocation Mouse location relative to the active window. (read only)
MouseView The current mouse view. (read only)
Renderable (read only)
Theme The current theme. (read only)
Methods
ActiveViewAtMouseLocation
BeginModal Puts app into modal mode.
DispatchEvents
EndModal Exits app from modal mode.
EnumDisplayModes Enumerate the available display modes
IsActive
MainLoop
RequestRender Request that the app render itself.
ResetPolledInput Resets polled mouse and keyboard devices.
ResumeRendering
Run Run the app.
Sleep Puts the app to sleep.
SuspendRendering
Terminate Terminate the app.
UpdateWindows
WaitIdle
Functions
EmscriptenMainLoop