nCine::MainApplication class

Main entry point and event loop driver for standard (desktop) applications.

Concrete Application subclass that initializes the engine, runs the game loop and processes platform events on desktop backends (GLFW/SDL/Qt5).

Base classes

class Application
Base class for the main entry point of an nCine application.

Public static functions

static auto Run(CreateAppEventHandlerDelegate createAppEventHandler, int argc, NativeArgument* argv) -> int
Entry point to be called from the main()/wWinMain() function; returns the process exit code.

Public functions

void Quit() override
Raises the quit flag.
auto EnablePlayStationExtendedSupport(bool enable) -> bool override
Switches PS4 and PS5 controllers to use extended protocol which enables rumble and other features.
auto GetUserName() -> String override
Returns the username of the logged-in user.
auto OpenUrl(StringView url) -> bool override
Opens the specified URL in a default web browser.
void UpdateScreenKeyboard()
Advances the on-screen keyboard, turning a finished IME dialog into text input events.
auto CanShowScreenKeyboard() -> bool override
Returns true if screen (software) keyboard is supported and ShowScreenKeyboard() should succeed.
auto IsScreenKeyboardVisible() -> bool override
Returns true if the screen (software) keyboard is currently shown, always false if it cannot be queried.
auto ToggleScreenKeyboard() -> bool override
Toggles the screen (software) keyboard.
auto ShowScreenKeyboard(Containers::StringView initialText = {}, Containers::Function<void(Containers::StringView)>&& onCompleted = {}) -> bool override
Shows the screen (software) keyboard.
auto HideScreenKeyboard() -> bool override
Hides the screen (software) keyboard.

Friends

auto theApplication() -> Application&
Returns the application instance.

Function documentation

void nCine::MainApplication::UpdateScreenKeyboard()

Advances the on-screen keyboard, turning a finished IME dialog into text input events.

The PS Vita has no keyboard overlay that feeds keystrokes - it has the IME, a modal dialog that collects a whole string - so the result has to be polled and handed to the input event handler as the text input the caller expected. Called once per frame from Run(). The PSP's sceUtility on-screen keyboard is the same kind of dialog and is driven the same way (its drawing is the one part that lives elsewhere: the GU backend refreshes it at present time, see GuDevice::PresentFrame()). The 3DS's software keyboard is a library applet that blocks the thread it is called on until the dialog closes, so there this is where a keyboard asked for during the frame is actually run.

bool nCine::MainApplication::ShowScreenKeyboard(Containers::StringView initialText = {}, Containers::Function<void(Containers::StringView)>&& onCompleted = {}) override

Shows the screen (software) keyboard.

Two kinds of platform answer this, and a caller that wants to work on both has to serve both. Where the keyboard is an overlay that feeds keystrokes (Windows, Android) it types into whatever has focus and the text arrives as IInputEventHandler::OnTextInput() events, exactly as a real keyboard would; initialText and onCompleted are unused there. Where it is a modal editor that collects a whole string (the PS Vita's IME) there are no keystrokes to deliver: initialText seeds the editor with what the field already holds, and onCompleted is invoked once with the finished string, which REPLACES that field rather than appending to it. It is not invoked at all if the user cancels.

So pass both, keep handling OnTextInput, and the field ends up right either way.

Application& theApplication()

Returns the application instance.

Returns the singleton application instance.