nCine  2025.04.r498-9d36345
A cross-platform 2D game engine
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ncine::Application Class Reference

Main entry point and handler for nCine applications. More...

#include <Application.h>

Inheritance diagram for ncine::Application:
Inheritance graph
[legend]
Collaboration diagram for ncine::Application:
Collaboration graph
[legend]

Classes

struct  GuiSettings
 GUI settings (for ImGui and Nuklear) that can be changed at run-time. More...
 
struct  RenderingSettings
 Rendering settings that can be changed at run-time. More...
 
struct  Timings
 

Public Member Functions

const AppConfigurationappConfiguration () const
 Returns the configuration used to initialize the application.
 
RenderingSettingsrenderingSettings ()
 Returns the run-time rendering settings.
 
GuiSettingsguiSettings ()
 Returns the run-time GUI settings.
 
IDebugOverlay::DisplaySettingsdebugOverlaySettings ()
 Returns the run-time debug overlay settings, if debug overlay is available.
 
const float * timings () const
 Returns all timings.
 
IGfxDevicegfxDevice ()
 Returns the graphics device instance.
 
SceneNoderootNode ()
 Returns the root node of the transformation graph.
 
ViewportscreenViewport ()
 Returns the screen viewport.
 
IInputManagerinputManager ()
 Returns the input manager instance.
 
unsigned long int numFrames () const
 Returns the total number of frames already rendered.
 
float frameTime () const
 Returns the time in seconds that last frame took to complete. More...
 
IFrameTimerframeTimer ()
 Returns the frame timer interface.
 
float width () const
 Returns the drawable screen width as a float number.
 
float height () const
 Returns the drawable screen height as a float number.
 
Vector2f resolution () const
 Returns the drawable screen resolution as a Vector2f object.
 
int widthInt () const
 Returns the drawable screen width as an integer number.
 
int heightInt () const
 Returns the drawable screen height as an integer number.
 
Vector2i resolutionInt () const
 Returns the drawable screen resolution as a Vector2i object.
 
bool isSuspended () const
 Returns the value of the suspension flag. More...
 
void setSuspended (bool suspended)
 Sets the suspension flag value.
 
bool autoSuspension () const
 Returns the value of the auto-suspension flag. More...
 
void setAutoSuspension (bool autoSuspension)
 Sets the auto-suspension flag value.
 
void quit ()
 Asks the application to quit as soon as possible (by raising the quit flag)
 
bool shouldQuit () const
 Returns the value of the quit flag.
 
bool hasFocus () const
 Returns the focus flag value.
 

Protected Member Functions

void initCommon ()
 Must be called before giving control to the application.
 
void step ()
 A single step of the game loop made to render 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.
 
virtual void setFocus (bool hasFocus)
 Sets the focus flag.
 
bool resizeScreenViewport (int width, int height)
 Resizes the screen viewport, if it exists. More...
 
bool updateScalingFactor ()
 Checks if the window scaling factor has changed this frame. More...
 

Protected Attributes

bool isSuspended_
 
bool autoSuspension_
 
bool hasFocus_
 
bool shouldQuit_
 
const AppConfiguration appCfg_
 
RenderingSettings renderingSettings_
 
GuiSettings guiSettings_
 
float timings_ [Timings::COUNT]
 
IDebugOverlay::DisplaySettings debugOverlayNullSettings_
 
TimeStamp profileStartTime_
 
nctl::UniquePtr< FrameTimer > frameTimer_
 
nctl::UniquePtr< IGfxDevicegfxDevice_
 
nctl::UniquePtr< SceneNoderootNode_
 
nctl::UniquePtr< ScreenViewport > screenViewport_
 
nctl::UniquePtr< IDebugOverlaydebugOverlay_
 
nctl::UniquePtr< IInputManagerinputManager_
 
nctl::UniquePtr< IAppEventHandlerappEventHandler_
 

Friends

class PCApplication
 
class AndroidApplication
 
class Viewport
 
class GlfwInputManager
 
class Qt5Widget
 

Detailed Description

Main entry point and handler for nCine applications.

Member Function Documentation

◆ autoSuspension()

bool ncine::Application::autoSuspension ( ) const
inline

Returns the value of the auto-suspension flag.

If true the application will be suspended when it loses focus

◆ frameTime()

float ncine::Application::frameTime ( ) const

Returns the time in seconds that last frame took to complete.

Note
Also called delta time. *‍/

◆ isSuspended()

bool ncine::Application::isSuspended ( ) const
inline

Returns the value of the suspension flag.

If true the application is suspended, it will neither update nor receive events

◆ resizeScreenViewport()

bool ncine::Application::resizeScreenViewport ( int  width,
int  height 
)
protected

Resizes the screen viewport, if it exists.

Note
It will also call the onResizeWindow() callback if the size has really changed

◆ updateScalingFactor()

bool ncine::Application::updateScalingFactor ( )
protected

Checks if the window scaling factor has changed this frame.

Note
It will also call the onChangeScalingFactor() callback if the factor has really changed

The documentation for this class was generated from the following files: