nCine::Application class

Base class for main entry points of nCine applications.

Base classes

class Death::ITraceSink
Interface for sink to be used by logger writing to it.

Derived classes

class AndroidApplication
Main entry point and handler for Android applications.
class MainApplication
Main entry point and handler for standard (desktop) applications.
class UwpApplication
Main entry point and handler for UWP (Universal Windows Platform) applications.

Public types

struct GuiSettings
GUI settings (for ImGui) that can be changed at run-time.
struct RenderingSettings
Rendering settings that can be changed at run-time.
enum class Timings { PreInit, InitCommon, AppInit, BeginFrame, UpdateVisitDraw, Update, PostUpdate, Visit, Draw, ImGui, EndFrame, Count }
Timings for profiling.

Public static variables

static char const * ConsoleTarget constexpr
Can be used in AttachTraceTarget() to attach to a console (if exists)

Constructors, destructors, conversion operators

Application() protected
~Application() protected

Public functions

auto GetAppConfiguration() const -> const AppConfiguration&
Returns the configuration used to initialize the application.
auto GetRenderingSettings() -> RenderingSettings&
Returns the run-time rendering settings.
auto GetGuiSettings() -> GuiSettings&
Returns run-time GUI settings.
auto GetDebugOverlaySettings() -> IDebugOverlay::DisplaySettings&
Returns debug overlay settings.
auto GetTimings() const -> const float*
Returns all timings.
auto GetGfxDevice() -> IGfxDevice&
Returns the graphics device instance.
auto GetRootNode() -> SceneNode&
Returns the root of the transformation graph.
auto GetScreenViewport() -> Viewport&
Returns the screen viewport.
auto GetInputManager() -> IInputManager&
Returns the input manager instance.
auto GetFrameCount() const -> std::uint32_t
Returns the total number of frames already rendered.
auto GetTimeMult() const -> float
Returns a factor that represents how long the last frame took relative to the desired frame time.
auto GetFrameTimer() const -> const FrameTimer&
Returns the frame timer interface.
auto GetWidth() const -> std::int32_t
Returns the drawable screen width as an integer number.
auto GetHeight() const -> std::int32_t
Returns the drawable screen height as an integer number.
auto GetResolution() const -> Vector2i
Returns the drawable screen resolution as a Vector2i object.
void ResizeScreenViewport(std::int32_t width, std::int32_t height)
Resizes the screen viewport, if exists.
auto ShouldSuspend() -> bool
Returns whether the application should currently be suspended.
auto GetAutoSuspension() const -> bool
Returns the value of the auto-suspension flag (the application will be suspended when it loses focus)
void SetAutoSuspension(bool autoSuspension)
Sets the auto-suspension flag value.
void Quit() virtual
Raises the quit flag.
auto ShouldQuit() const -> bool
Returns the quit flag value.
auto HasFocus() const -> bool
Returns the focus flag value.
auto GetDataPath() const -> const String&
Returns the path for the application to load data from.
auto EnablePlayStationExtendedSupport(bool enable) -> bool virtual
Switches PS4 and PS5 controllers to use extended protocol which enables rumble and other features.
auto OpenUrl(StringView url) -> bool virtual
Opens the specified URL in a default web browser.
void AttachTraceTarget(Containers::StringView targetPath)
Adds the specified target as a sink for tracing.

Protected functions

void PreInitCommon(std::unique_ptr<IAppEventHandler> appEventHandler)
Must be called as early as possible during the application startup.
void InitCommon()
Must be called before giving control to the application.
void Step()
Processes a single step of the game loop and renders a frame.
void ShutdownCommon()
Must be called before exiting to shut down the application.
void Suspend()
Called when the application gets suspended.
void Resume()
Called when the application resumes execution.
void SetFocus(bool hasFocus) virtual
Sets the focus flag.
void OnTraceReceived(TraceLevel level, std::uint64_t timestamp, StringView threadId, StringView message) override
Called when new trace item is received and should be written to the sink destination.
void OnTraceFlushed() override
Called when all sink buffers should be flushed immediately.