Oficina Framework  1.3
Games Framework
OficinaFramework::ScreenSystem Class Reference

Groups screen management controls. Use this class to add/remove screens and set them active or inactive. More...

#include <ScreenSystem.hpp>

Classes

class  Screen
 A class representing a Screen to be rendered on the screen manager. More...
 

Static Public Member Functions

static void init (std::string windowname, vec2dw windowsize, bool fullscreen, std::string iconpath, bool vsync)
 Initializes the Window and the Screen System. More...
 
static void dispose ()
 Disposes the Screen System and deletes the Window. More...
 
static void AddScreen (Screen *scr)
 Enqueues a screen to be added to the list. More...
 
static void AddScreen (Screen *scr, float Depth)
 Enqueues a screen to be added to the list. More...
 
static void RemoveScreen (Screen *scr)
 Sets a screen to be removed and disposed. More...
 
static void UnloadAllScreens ()
 Unloads the content of all screen on the list, then removes them. More...
 
static void UpdateScreens ()
 Updates the logic of all screens on the list. More...
 
static void DrawScreens ()
 Draws all screens that are not marked as invisible. More...
 
static void ClearScreens ()
 Clears all screens from the list. This will remove the screens from list and dispose them. More...
 
static void SortScreens ()
 Sorts screens by depth on the manager. Useful if you manually changed the depth of a certain screen. More...
 
static float GetBiggestDepth ()
 Gets the biggest depth value available on the manager. More...
 
static float GetSmallestDepth ()
 Gets the smallest depth value available on the manager. More...
 
static SDL_Window * GetWindowHandle ()
 Offers direct access to the SDL2 window handle. More...
 
static vec2dw GetWindowSize ()
 Gets the window size (do not confuse with viewport). More...
 
static void SetWindowSize (vec2dw size)
 Sets the window size (do not confuse with viewport). More...
 
static bool IsFullScreen ()
 Gets the window mode. More...
 
static void SetFullScreen (bool state)
 Sets the fullscreen mode. More...
 
static bool IsDebugActive ()
 Gets if the debug mode is active. More...
 
static void SetDebug (bool state)
 Sets the debug state. More...
 
static void Debug_AddLine (std::string text)
 Adds a text line to the debugger. More...
 
static void Debug_SetFont (RenderingSystem::Font *font)
 Sets the main font to be used on the debugger. More...
 
static void Debug_ToggleMinimalist ()
 Toggles debug as minimalistic or not. More...
 
static void SwapWindow ()
 Swaps window for a new draw routine. More...
 
static void ClearWindow ()
 Clears window of artifacts. More...
 
static bool IsLoadingThreadBusy ()
 Gets whether the loading thread is currently loading screens or not. More...
 

Friends

class EngineCore
 

Detailed Description

Groups screen management controls. Use this class to add/remove screens and set them active or inactive.

Member Function Documentation

◆ AddScreen() [1/2]

static void OficinaFramework::ScreenSystem::AddScreen ( Screen scr)
static

Enqueues a screen to be added to the list.

Parameters
scrPointer to the screen to be added.
Exceptions
OficinaExceptionRuntime error exception, if pointer is null.

◆ AddScreen() [2/2]

static void OficinaFramework::ScreenSystem::AddScreen ( Screen scr,
float  Depth 
)
static

Enqueues a screen to be added to the list.

Parameters
scrPointer to the screen to be added.
DepthDepth to be given to the screen on initialization. This will reflect on update and draw order.
Exceptions
OficinaExceptionRuntime error exception, if pointer is null.

◆ ClearScreens()

static void OficinaFramework::ScreenSystem::ClearScreens ( )
static

Clears all screens from the list. This will remove the screens from list and dispose them.

◆ ClearWindow()

static void OficinaFramework::ScreenSystem::ClearWindow ( )
static

Clears window of artifacts.

◆ Debug_AddLine()

static void OficinaFramework::ScreenSystem::Debug_AddLine ( std::string  text)
static

Adds a text line to the debugger.

Parameters
textThe text to be added to the debugger.

◆ Debug_SetFont()

static void OficinaFramework::ScreenSystem::Debug_SetFont ( RenderingSystem::Font font)
static

Sets the main font to be used on the debugger.

Parameters
fontA pointer to the font to be used.
Warning
Please allocate a font that will be only used on the debugger. The system itself will unload the font when necessary.

◆ Debug_ToggleMinimalist()

static void OficinaFramework::ScreenSystem::Debug_ToggleMinimalist ( )
static

Toggles debug as minimalistic or not.

◆ dispose()

static void OficinaFramework::ScreenSystem::dispose ( )
static

Disposes the Screen System and deletes the Window.

◆ DrawScreens()

static void OficinaFramework::ScreenSystem::DrawScreens ( )
static

Draws all screens that are not marked as invisible.

◆ GetBiggestDepth()

static float OficinaFramework::ScreenSystem::GetBiggestDepth ( )
static

Gets the biggest depth value available on the manager.

Warning
This method will assume that the screen list is sorted!
Returns
Biggest depth value of the screen that is most in front.

◆ GetSmallestDepth()

static float OficinaFramework::ScreenSystem::GetSmallestDepth ( )
static

Gets the smallest depth value available on the manager.

Warning
This method will assume that the screen list is sorted!
Returns
Smallest depth value of the screen that is most in back.

◆ GetWindowHandle()

static SDL_Window* OficinaFramework::ScreenSystem::GetWindowHandle ( )
static

Offers direct access to the SDL2 window handle.

Warning
Be careful when dealing directly with this. Oficina manipulates the window directly on initialization and runtime, so there is no need for advanced operations, unless you need the handle for third-party APIs.
Returns
Pointer for the SDL2 Window.

◆ GetWindowSize()

static vec2dw OficinaFramework::ScreenSystem::GetWindowSize ( )
static

Gets the window size (do not confuse with viewport).

Returns
A vec2 with dword precision with the window size.

◆ init()

static void OficinaFramework::ScreenSystem::init ( std::string  windowname,
vec2dw  windowsize,
bool  fullscreen,
std::string  iconpath,
bool  vsync 
)
static

Initializes the Window and the Screen System.

Parameters
windownameCaption of the main window.
windowsizeSize of the window.
fullscreenWhether the main window is in fullscreen mode or not.
iconpathPath to the main window's icon. Can be set to an empty string in case none is intended.
vsyncWhether VSync is active or not.
Exceptions
SystemInitializationErrorExceptionInvalidAssetException

◆ IsDebugActive()

static bool OficinaFramework::ScreenSystem::IsDebugActive ( )
static

Gets if the debug mode is active.

Returns
Whether debug is active or not.

◆ IsFullScreen()

static bool OficinaFramework::ScreenSystem::IsFullScreen ( )
static

Gets the window mode.

Returns
Whether the window is fullscreen or not.

◆ IsLoadingThreadBusy()

static bool OficinaFramework::ScreenSystem::IsLoadingThreadBusy ( )
static

Gets whether the loading thread is currently loading screens or not.

Returns
If the loading thread is in a work.

◆ RemoveScreen()

static void OficinaFramework::ScreenSystem::RemoveScreen ( Screen scr)
static

Sets a screen to be removed and disposed.

Parameters
scrA pointer to the screen to be removed.

◆ SetDebug()

static void OficinaFramework::ScreenSystem::SetDebug ( bool  state)
static

Sets the debug state.

Parameters
stateState of the debug to be set to.

◆ SetFullScreen()

static void OficinaFramework::ScreenSystem::SetFullScreen ( bool  state)
static

Sets the fullscreen mode.

Parameters
stateWhether to set the display to fullscreen or not.

◆ SetWindowSize()

static void OficinaFramework::ScreenSystem::SetWindowSize ( vec2dw  size)
static

Sets the window size (do not confuse with viewport).

Parameters
sizeA vec2 with dword precision indicating new window size.

◆ SortScreens()

static void OficinaFramework::ScreenSystem::SortScreens ( )
static

Sorts screens by depth on the manager. Useful if you manually changed the depth of a certain screen.

Warning
Sorting screens on gameloop may give unexpected behaviour on the current frame.

◆ SwapWindow()

static void OficinaFramework::ScreenSystem::SwapWindow ( )
static

Swaps window for a new draw routine.

◆ UnloadAllScreens()

static void OficinaFramework::ScreenSystem::UnloadAllScreens ( )
static

Unloads the content of all screen on the list, then removes them.

◆ UpdateScreens()

static void OficinaFramework::ScreenSystem::UpdateScreens ( )
static

Updates the logic of all screens on the list.

Friends And Related Function Documentation

◆ EngineCore

friend class EngineCore
friend

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