Lugdunum  0.1.0
Classes | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
lug::Core::Application Class Referenceabstract

Class for application. More...

#include <Application.hpp>

Collaboration diagram for lug::Core::Application:
[legend]

Classes

struct  Info
 

Public Member Functions

 Application (const Info &info)
 
 Application (const Application &)=delete
 
 Application (Application &&)=delete
 
Applicationoperator= (const Application &)=delete
 
Applicationoperator= (Application &&)=delete
 
virtual ~Application ()=default
 
const Application::InfogetInfo () const
 Gets the application's information. More...
 
lug::Graphics::GraphicsgetGraphics ()
 Gets the lug::Graphics::Graphics component of the Application. More...
 
const lug::Graphics::GraphicsgetGraphics () const
 
lug::Graphics::Render::WindowgetWindow ()
 Gets the Window attached to the Application. More...
 
const lug::Graphics::Render::WindowgetWindow () const
 
void setRenderWindowInfo (lug::Graphics::Render::Window::InitInfo &initInfo)
 Sets the render window information. More...
 
const lug::Graphics::Render::Window::InitInfogetRenderWindowInfo () const
 Gets the render window information. More...
 
lug::Graphics::Render::Window::InitInfogetRenderWindowInfo ()
 
void setGraphicsInfo (const lug::Graphics::Graphics::InitInfo &initInfo)
 Sets the graphics information. More...
 
const lug::Graphics::Graphics::InitInfogetGraphicsInfo () const
 Gets the graphics information. More...
 
lug::Graphics::Graphics::InitInfogetGraphicsInfo ()
 
bool init (int argc, char *argv[])
 Init the application with the informations filled in the lug::Graphics::Graphics::InitInfo and lug::Graphics::RenderWindow::InitInfo structures. More...
 
bool beginInit (int argc, char *argv[])
 Begin the initialization of the application with the informations filled in the lug::Graphics::Graphics::InitInfo structure. More...
 
bool finishInit ()
 Finish the initialization of the application with the informations filled in the lug::Graphics::RenderWindow::InitInfo structure. More...
 
bool run ()
 Run the application. More...
 
void close ()
 Close the application. More...
 
virtual void onEvent (const lug::Window::Event &event)=0
 Override this function to handle an event. More...
 
virtual void onFrame (const System::Time &elapsedTime)=0
 Override this function to handle a frame. More...
 

Protected Attributes

lug::Graphics::Graphics _graphics
 

Private Member Functions

bool beginFrame (const lug::System::Time &elapsedTime)
 
bool endFrame ()
 

Private Attributes

Info _info
 
bool _closed {false}
 
lug::Graphics::Graphics::InitInfo _graphicsInitInfo
 
lug::Graphics::Render::Window::InitInfo _renderWindowInitInfo
 
lug::Graphics::Render::Window_window {nullptr}
 

Detailed Description

Class for application.

Root class of the Engine. The user has to inherit from this class and implement onFrame and onEvent.

Definition at line 20 of file Application.hpp.

Constructor & Destructor Documentation

◆ Application() [1/3]

lug::Core::Application::Application ( const Info info)
explicit

Definition at line 9 of file Application.cpp.

◆ Application() [2/3]

lug::Core::Application::Application ( const Application )
delete

◆ Application() [3/3]

lug::Core::Application::Application ( Application &&  )
delete

◆ ~Application()

virtual lug::Core::Application::~Application ( )
virtualdefault

Member Function Documentation

◆ operator=() [1/2]

Application& lug::Core::Application::operator= ( const Application )
delete

◆ operator=() [2/2]

Application& lug::Core::Application::operator= ( Application &&  )
delete

◆ getInfo()

const Application::Info & Application::getInfo ( ) const
inline

Gets the application's information.

Returns
The application's information.

Definition at line 1 of file Application.inl.

◆ getGraphics() [1/2]

lug::Graphics::Graphics & Application::getGraphics ( )
inline

Gets the lug::Graphics::Graphics component of the Application.

Returns
The lug::Graphics::Graphics component.

Definition at line 5 of file Application.inl.

◆ getGraphics() [2/2]

const lug::Graphics::Graphics & Application::getGraphics ( ) const
inline

Definition at line 9 of file Application.inl.

◆ getWindow() [1/2]

lug::Graphics::Render::Window * Application::getWindow ( )
inline

Gets the Window attached to the Application.

Returns
The lug::Graphics::Render::Window.

Definition at line 14 of file Application.inl.

◆ getWindow() [2/2]

const lug::Graphics::Render::Window * Application::getWindow ( ) const
inline

Definition at line 18 of file Application.inl.

◆ setRenderWindowInfo()

void Application::setRenderWindowInfo ( lug::Graphics::Render::Window::InitInfo initInfo)
inline

Sets the render window information.

Parameters
initInfoThe initialize information.

Definition at line 22 of file Application.inl.

◆ getRenderWindowInfo() [1/2]

const lug::Graphics::Render::Window::InitInfo & Application::getRenderWindowInfo ( ) const
inline

Gets the render window information.

Returns
The render window information.

Definition at line 26 of file Application.inl.

◆ getRenderWindowInfo() [2/2]

lug::Graphics::Render::Window::InitInfo & Application::getRenderWindowInfo ( )
inline

Definition at line 30 of file Application.inl.

◆ setGraphicsInfo()

void Application::setGraphicsInfo ( const lug::Graphics::Graphics::InitInfo initInfo)
inline

Sets the graphics information.

Parameters
[in]initInfoA reference to the RenderWindow initialize information.

Definition at line 34 of file Application.inl.

◆ getGraphicsInfo() [1/2]

const lug::Graphics::Graphics::InitInfo & Application::getGraphicsInfo ( ) const
inline

Gets the graphics information.

Returns
A reference the Graphics initialize information.

Definition at line 38 of file Application.inl.

◆ getGraphicsInfo() [2/2]

lug::Graphics::Graphics::InitInfo & Application::getGraphicsInfo ( )
inline

Definition at line 42 of file Application.inl.

◆ init()

bool lug::Core::Application::init ( int  argc,
char *  argv[] 
)

Init the application with the informations filled in the lug::Graphics::Graphics::InitInfo and lug::Graphics::RenderWindow::InitInfo structures.

The lug::Graphics::Graphics::InitInfo structure can be modified by calling getGraphicsInfo or setGraphicsInfo.
The lug::Graphics::RenderWindow::InitInfo structure can be modified by calling getRenderWindowInfo or setRenderWindowInfo.

Parameters
[in]argcThe argc argument as received from the main function.
[in]argvThe argv argument as received from the main function.
Returns
Whether the application was successfully initialized.

Definition at line 11 of file Application.cpp.

◆ beginInit()

bool lug::Core::Application::beginInit ( int  argc,
char *  argv[] 
)

Begin the initialization of the application with the informations filled in the lug::Graphics::Graphics::InitInfo structure.

The lug::Graphics::Graphics::InitInfo structure can be modified by calling getGraphicsInfo or setGraphicsInfo.

Parameters
[in]argcThe argc argument as received from the main function.
[in]argvThe argv argument as received from the main function.
Returns
Whether the application was successfully initialized.

Definition at line 15 of file Application.cpp.

◆ finishInit()

bool lug::Core::Application::finishInit ( )

Finish the initialization of the application with the informations filled in the lug::Graphics::RenderWindow::InitInfo structure.

The lug::Graphics::RenderWindow::InitInfo structure can be modified by calling getRenderWindowInfo or setRenderWindowInfo.

Returns
Whether the application was successfully initialized.

Definition at line 27 of file Application.cpp.

◆ run()

bool lug::Core::Application::run ( )

Run the application.

Launches an infinite loop (i.e. it does not exit immediately) and runs the application in the foreground.

Returns
Whether the application exited successfully.

Definition at line 41 of file Application.cpp.

◆ close()

void lug::Core::Application::close ( )

Close the application.

This can be called in onEvent or onFrame.

Definition at line 84 of file Application.cpp.

◆ onEvent()

virtual void lug::Core::Application::onEvent ( const lug::Window::Event event)
pure virtual

Override this function to handle an event.

This function will be called by the engine for each polled event.

Parameters
[in]eventThe event that was polled.

◆ onFrame()

virtual void lug::Core::Application::onFrame ( const System::Time elapsedTime)
pure virtual

Override this function to handle a frame.

This function will be called by the engine at each frame.

◆ beginFrame()

bool lug::Core::Application::beginFrame ( const lug::System::Time elapsedTime)
private

Definition at line 88 of file Application.cpp.

◆ endFrame()

bool lug::Core::Application::endFrame ( )
private

Definition at line 92 of file Application.cpp.

Member Data Documentation

◆ _info

Info lug::Core::Application::_info
private

Definition at line 165 of file Application.hpp.

◆ _closed

bool lug::Core::Application::_closed {false}
private

Definition at line 166 of file Application.hpp.

◆ _graphicsInitInfo

lug::Graphics::Graphics::InitInfo lug::Core::Application::_graphicsInitInfo
private
Initial value:

Definition at line 169 of file Application.hpp.

◆ _renderWindowInitInfo

lug::Graphics::Render::Window::InitInfo lug::Core::Application::_renderWindowInitInfo
private
Initial value:
{
{
800,
600,
"Lugdunum - Default title",
},
{}
}

Definition at line 182 of file Application.hpp.

◆ _window

lug::Graphics::Render::Window* lug::Core::Application::_window {nullptr}
private

Definition at line 193 of file Application.hpp.

◆ _graphics

lug::Graphics::Graphics lug::Core::Application::_graphics
protected

Definition at line 196 of file Application.hpp.


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