TouchCPLib  1.0.0
A touch-enabled GUI interface based on SDL and libTS. It provides a simple desktop-free UI for your embedded Raspberry projects.
Application Class Reference

The main application class. You can only initialize one instance. Typically, you instanciate it in main() and then call run() More...

#include <Application.h>

Public Member Functions

 Application (int width, int height, SDL_Color bgColor, std::string touchInputDevice, std::string ttyDevice, int FPS_LIMIT)
 Create an application. More...
 
 ~Application ()
 
 Application (const Application &copy)=delete
 
Application operator= (const Application &copy)=delete
 
void run ()
 Start the application. More...
 
bool isRunning ()
 
SDL_Window * getWindow ()
 Get the SDL window object. More...
 
SDL_Renderer * getRenderer ()
 Get the SDL renderer object. More...
 
SceneManagergetSceneManager ()
 Get the scene manager, needed to change the currently displayed scene. More...
 
void runOnWorkerThread (Task *task)
 Runs the given task on the worker thread. It will be deleted when done. More...
 
void runOnMainThread (Task *task)
 Runs the given task on the main thread. It will be deleted when done. More...
 
void exit ()
 Exit the application. More...
 

Static Public Member Functions

static SDL_Window * getCurrentWindow ()
 Get the SDL window object (static shortcut) More...
 
static SDL_Renderer * getCurrentRenderer ()
 Get the SDL renderer object (static shortcut) More...
 
static SceneManagergetCurrentSceneManager ()
 Get the scene manager, needed to change the currently displayed scene (static shortcut) More...
 
static void runOnCurrentWorkerThread (Task *task)
 Runs the given task on the worker thread. It will be deleted when done (static shortcut) More...
 
static void runOnCurrentMainThread (Task *task)
 Runs the given task on the main thread. It will be deleted when done (static shortcut) More...
 
static ApplicationgetCurrent ()
 Get the currently running application, or null if none is available. More...
 

Detailed Description

The main application class. You can only initialize one instance. Typically, you instanciate it in main() and then call run()

Constructor & Destructor Documentation

◆ Application() [1/2]

Application::Application ( int  width,
int  height,
SDL_Color  bgColor,
std::string  touchInputDevice,
std::string  ttyDevice,
int  FPS_LIMIT 
)

Create an application.

Parameters
widthThe window width
heightThe window height
bgColorThe background color
touchInputDeviceThe path to the touch device (e.g. /dev/input/event0)
ttyDeviceThe path to the console UART device bound to the screen (e.g. /dev/tty0) to disable the blinking cursor
FPS_LIMITThe framerate limit, to avoid stressing the CPU for low Hz displays

◆ ~Application()

Application::~Application ( )

◆ Application() [2/2]

Application::Application ( const Application copy)
delete

Member Function Documentation

◆ exit()

void Application::exit ( )

Exit the application.

◆ getCurrent()

Application * Application::getCurrent ( )
static

Get the currently running application, or null if none is available.

Returns
The application

◆ getCurrentRenderer()

SDL_Renderer * Application::getCurrentRenderer ( )
static

Get the SDL renderer object (static shortcut)

Returns
The SDL renderer object

◆ getCurrentSceneManager()

SceneManager * Application::getCurrentSceneManager ( )
static

Get the scene manager, needed to change the currently displayed scene (static shortcut)

Returns
The scene manager

◆ getCurrentWindow()

SDL_Window * Application::getCurrentWindow ( )
static

Get the SDL window object (static shortcut)

Returns
The SDL window object

◆ getRenderer()

SDL_Renderer * Application::getRenderer ( )

Get the SDL renderer object.

Returns
The SDL renderer object

◆ getSceneManager()

SceneManager * Application::getSceneManager ( )

Get the scene manager, needed to change the currently displayed scene.

Returns
The scene manager

◆ getWindow()

SDL_Window * Application::getWindow ( )

Get the SDL window object.

Returns
The SDL window object

◆ isRunning()

bool Application::isRunning ( )

◆ operator=()

Application Application::operator= ( const Application copy)
delete

◆ run()

void Application::run ( )

Start the application.

◆ runOnCurrentMainThread()

void Application::runOnCurrentMainThread ( Task task)
static

Runs the given task on the main thread. It will be deleted when done (static shortcut)

Parameters
taskThe task to run

◆ runOnCurrentWorkerThread()

void Application::runOnCurrentWorkerThread ( Task task)
static

Runs the given task on the worker thread. It will be deleted when done (static shortcut)

Parameters
taskThe task to run

◆ runOnMainThread()

void Application::runOnMainThread ( Task task)

Runs the given task on the main thread. It will be deleted when done.

Parameters
taskThe task to run

◆ runOnWorkerThread()

void Application::runOnWorkerThread ( Task task)

Runs the given task on the worker thread. It will be deleted when done.

Parameters
taskThe task to run

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