Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::GameApp Class Reference

Base class for video game application. More...

Inheritance diagram for Burger::GameApp:
Collaboration diagram for Burger::GameApp:

Public Types

typedef uint_t(*) MainWindowProc(GameApp *pThis, HWND__ *hWnd, uint_t uMessage, uintptr_t wParam, uintptr_t lParam, uintptr_t *pOutput)
 Callback custom window message handler.
 

Public Member Functions

const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
 GameApp (uintptr_t uDefaultMemorySize=Burger::MemoryManagerHandle::kSystemMemoryChuckSize, uint_t uDefaultHandleCount=Burger::MemoryManagerHandle::kDefaultHandleCount, uintptr_t uMinReserveSize=Burger::MemoryManagerHandle::kSystemMemoryReservedSize) noexcept
 Create an instance of a GameApp.
 
virtual ~GameApp ()
 Base destructor for a GameApp.
 
void Poll (void) noexcept
 Perform cooperative multitasking.
 
void AddRoutine (RunQueue::CallbackProc Proc, RunQueue::CallbackProc pShutdown, void *pData, uint_t uPriority=RunQueue::PRIORITY_MEDIUM) noexcept
 Add a RunQueue polling routine.
 
void RemoveRoutine (RunQueue::CallbackProc Proc, void *pData) noexcept
 Remove a RunQueue polling routine.
 
RunQueueGetRunQueue (void) noexcept
 Get the pointer to the RunQueue.
 
KeyboardStartupKeyboard (void) noexcept
 Create an instance of the Keyboard manager.
 
MouseStartupMouse (void) noexcept
 Create an instance of the Mouse manager.
 
JoypadStartupJoypad (void) noexcept
 Create an instance of the Joypad manager.
 
DisplayStartupDisplay (void) noexcept
 Create an instance of the Display manager.
 
SoundManagerStartupSoundManager (void) noexcept
 Create an instance of the SoundManager.
 
uint_t StartupEverything (void) noexcept
 Create instances of all default classes for a game.
 
MemoryManagerGlobalHandleGetMemoryManager (void) noexcept
 Get the pointer to the MemoryManagerGlobalHandle.
 
void SetArgv (const char **ppArgv) noexcept
 Set the current argv parameter.
 
const char ** GetArgv (void) const noexcept
 Get the current argv parameter.
 
void SetArgc (int iArgc) noexcept
 Set the current argc parameter.
 
int GetArgc (void) const noexcept
 Get the current argc parameter.
 
void SetQuitCode (void) noexcept
 Alert the application to shut down.
 
void ClearQuitCode (void) noexcept
 Cancel an application shutdown.
 
uint_t GetQuitCode (void) const noexcept
 Get the current return code.
 
void SetInBackground (uint_t bInBackground) noexcept
 Set the state if app should go into pause mode.
 
uint_t IsInBackground (void) const noexcept
 Detect if the app is should go into pause mode.
 
void SetKeyboard (Keyboard *pKeyboard) noexcept
 Set the pointer to the current Keyboard class instance.
 
KeyboardGetKeyboard (void) const noexcept
 Get the current Keyboard class instance.
 
void SetMouse (Mouse *pMouse) noexcept
 Set the pointer to the current Mouse class instance.
 
MouseGetMouse (void) const noexcept
 Get the current Mouse class instance.
 
void SetJoypad (Joypad *pJoypad) noexcept
 Set the pointer to the current Joypad class instance.
 
JoypadGetJoypad (void) const noexcept
 Get the current Joypad class instance.
 
void SetSoundManager (SoundManager *pSoundManager) noexcept
 Set the pointer to the current SoundManager class instance.
 
SoundManagerGetSoundManager (void) const noexcept
 Get the current SoundManager class instance.
 
void SetDisplay (Display *pDisplay) noexcept
 Set the pointer to the current Display class instance.
 
DisplayGetDisplay (void) const noexcept
 Get the current Display class instance.
 
void SetWindowSwitching (uint_t bAllowWindowSwitching) noexcept
 Enable the Alt-Enter key.
 
uint_t IsWindowSwitchingAllowed (void) const noexcept
 Get the flag for video mode switching.
 
uint_t SwitchVideo (void) noexcept
 Switch from full screen to windowed mode and back again.
 
uint_t IsMinimized (void) const noexcept
 Return TRUE if the application is in the background or minimized.
 
void SetMinimized (uint_t bMinimized) noexcept
 Sets the application flag for being in the background or minimized.
 
uint_t IsAppFullScreen (void) const noexcept
 Return TRUE if the application is in full screen mode.
 
uint_t IsResizingAllowed (void) const noexcept
 Return TRUE if the application can be resized at runtime.
 
void SetMouseOnScreen (uint_t bMouseOnScreen) noexcept
 Sets the application flag if a mouse cursor is on the game screen.
 
uint_t IsMouseOnScreen (void) const noexcept
 Return TRUE if the mouse cursor is on the game screen.
 
void SetWindowSwitchRequested (uint_t bWindowSwitchRequested) noexcept
 Sets the application flag to toggle between full screen and window mode.
 
uint_t IsWindowSwitchRequested (void) const noexcept
 Return TRUE if there is a pending video mode switch.
 
HINSTANCE__ * GetInstance (void) const noexcept
 Get the HINSTANCE of the running application.
 
HWND__ * GetWindow (void) const noexcept
 Return the main application window.
 
HMENU__ * GetMenu (void) const noexcept
 Get the HMENU of the running application.
 
void SetMenu (HMENU__ *hMenu) noexcept
 Set the HMENU of the running application.
 
MainWindowProc GetCallBack (void) const noexcept
 Get the pointer to the window callback.
 
uint_t GetInSizeMove (void) const noexcept
 Return TRUE if the window is resizing.
 
void SetInSizeMove (uint_t bInSizeMode) noexcept
 Set or clear the resizing window flag.
 
int InitWindow (const char *pGameName, MainWindowProc pCallBack, uint_t uIconResID=0) noexcept
 Create an application's default window.
 
int SetWindowSize (uint_t uWidth, uint_t uHeight) noexcept
 Change the size of the application window.
 
int SetWindowFullScreen (uint_t uWidth, uint_t uHeight) noexcept
 Prepare an application window for full screen mode.
 
void ResetWindowLocation (void) noexcept
 Purge the cached window location.
 
void RecordWindowLocation (void) noexcept
 Save the current window location.
 
uint_t HandleCursor (uint_t uParam) noexcept
 Handle cursor updates.
 
void GetInputFocus (void) noexcept
 Obtain DirectInput focus (Windows only)
 
void KillInputFocus (void) noexcept
 Release DirectInput focus (Windows only)
 
int Run (void) noexcept
 Set up iOS and call CodeEntry()
 
UIWindow * CreateWindow (void) noexcept
 Create the main application window.
 
void ReleaseWindow (void) noexcept
 Dispose of the window.
 
void SetViewController (UIViewController *pViewController, UIView *pView) noexcept
 Set the main window's UIView and UIViewController.
 
UIWindow * GetWindow (void) const noexcept
 
UIViewController * GetViewController (void) const noexcept
 Return the main application window controller.
 
UIView * GetView (void) const noexcept
 Return the main application window view.
 
void FocusWindow (void) noexcept
 Handle NSApplicationDidBecomeActiveNotification.
 
uint_t SetWindowSize (uint_t uWidth, uint_t uHeight) noexcept
 
NSApplication * GetApplication (void) const noexcept
 
NSApplicationDelegate * GetDelegate (void) const noexcept
 
NSWindow * GetWindow (void) const noexcept
 
- Public Member Functions inherited from Burger::Base
const char * get_class_name (void) const noexcept
 Get the name of the class.
 
virtual ~Base () noexcept=default
 Destructor.
 

Static Public Member Functions

static RunQueue::eReturnCode Poll (void *pSelf) noexcept
 Process Windows events.
 
static GameAppGetApp (void) noexcept
 Return the pointer to the global application instance.
 
static RunQueue::eReturnCode Poll (void *pSelf) noexcept
 

Static Public Attributes

static const Burger::StaticRTTI g_StaticRTTI
 
- Static Public Attributes inherited from Burger::Base
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 

Protected Member Functions

void InitDefaults (void) noexcept
 Initialize shared variables.
 
void ShutdownDefaults (void) noexcept
 Release shared variables.
 

Static Protected Member Functions

static RunQueue::eReturnCode EventPoll (void *pData) noexcept
 MacOSX event handler.
 

Protected Attributes

Keyboardm_pKeyboard
 Pointer to the active keyboard instance.
 
Mousem_pMouse
 Pointer to the active mouse instance.
 
Joypadm_pJoypad
 Pointer to the active joypad instance.
 
SoundManagerm_pSoundManager
 Pointer to the active sound manager instance.
 
Displaym_pDisplay
 Pointer to the active display instance.
 
const char ** m_ppArgv
 Arguments passed to the console.
 
MemoryManagerGlobalHandle m_MemoryManagerHandle
 Handle based memory manager for the app.
 
RunQueue m_RunQueue
 Internal run queue.
 
HINSTANCE__ * m_hInstance
 (Windows only) Current instance of the application
 
HWND__ * m_hWindow
 (Windows only) Main window for the application
 
HMENU__ * m_hMenu
 (Windows only) Menu bar for the application
 
HICON__ * m_pDefaultCursor
 (Windows only) Default cursor when not in the game area
 
const char ** m_ppOldArgv
 (Windows only) Saved pointer to the global __argv for restoring on exit
 
MainWindowProc m_pCallBack
 (Windows only) Custom application window proc
 
Rect_t m_WindowRect
 (Windows only) Bounds rect of the window
 
uint_t m_uErrorMode
 (Windows only) Initial GetErrorMode() value
 
uint8_t m_bCoCreateInstanceInit
 (Windows only) TRUE if CoInitializeEx() was initialized
 
uint8_t m_bInSizeMove
 (Windows only) TRUE if the window is being resized
 
UIWindow * m_pWindow
 (iOS only) Pointer to the UIWindow for the iOS application
 
UIViewController * m_pViewController
 (iOS only) Pointer to the UIViewController to the window
 
UIView * m_pView
 (iOS only) Pointer to the UIView being used
 
NSApplication * m_pApplication
 Pointer to the current application context (Copy of NSApp)
 
NSApplicationDelegate * m_pApplicationDelegate
 Pointer to the current application delegate.
 
NSWindow * m_pWindow
 Game window.
 
NSResponder * m_pListener
 Main listener for window events.
 
uint_t m_bCenterWindow
 TRUE if the window needs to be centered
 
int m_iArgc
 Number of valid arguments.
 
uint8_t m_bQuit
 Set to TRUE when the application has to shut down.
 
uint8_t m_bInBackground
 Set to TRUE if the game should be paused due to another window being in front.
 
uint8_t m_bMinimized
 Set to TRUE if the game is minimized (PC/Mac only, always false on consoles)
 
uint8_t m_bAllowWindowSwitching
 
uint8_t m_bMouseOnScreen
 TRUE if the mouse cursor is on the screen in windows systems
 
uint8_t m_bWindowSwitchRequested
 TRUE if the window resolution switch key was pressed
 
uint8_t m_bKeyboardStarted
 TRUE if a Keyboard class was started with a call to StartupKeyboard(void)
 
uint8_t m_bMouseStarted
 TRUE if a Mouse class was started with a call to StartupMouse(void)
 
uint8_t m_bJoypadStarted
 TRUE if a Joypad class was started with a call to StartupJoypad(void)
 
uint8_t m_bDisplayStarted
 TRUE if a Display class was started with a call to StartupDisplay(void)
 
uint8_t m_bSoundManagerStarted
 TRUE if a SoundManager class was started with a call to StartupSoundManager(void)
 

Static Protected Attributes

static GameAppg_piOSApp
 (iOS only) Global singular application instance
 

Private Member Functions

 GameApp (const GameApp &)=delete
 
GameAppoperator= (const GameApp &)=delete
 
 GameApp (GameApp &&)=delete
 
GameAppoperator= (GameApp &&)=delete
 

Detailed Description

Base class for video game application.


This class contains the startup code for creating an environment for creating all of the needed subclasses for the operation of a video game. It auto links to instances of the Keyboard, Joypad, Mouse, Sound, Renderer and Display classes so other classes only need to have a GameApp pointer to be able to detect their presence.

A RunQueue is part of this class so background tasks can be executed from the main thread from time to time for background servicing

Member Typedef Documentation

◆ MainWindowProc

uint_t( *) Burger::GameApp::MainWindowProc(GameApp *pThis, HWND__ *hWnd, uint_t uMessage, uintptr_t wParam, uintptr_t lParam, uintptr_t *pOutput)

Callback custom window message handler.

Constructor & Destructor Documentation

◆ GameApp() [1/3]

Burger::GameApp::GameApp ( const GameApp & )
privatedelete

◆ GameApp() [2/3]

Burger::GameApp::GameApp ( GameApp && )
privatedelete

◆ GameApp() [3/3]

Burger::GameApp::GameApp ( uintptr_t uDefaultMemorySize = Burger::MemoryManagerHandle::kSystemMemoryChuckSize,
uint_t uDefaultHandleCount = Burger::MemoryManagerHandle::kDefaultHandleCount,
uintptr_t uMinReserveSize = Burger::MemoryManagerHandle::kSystemMemoryReservedSize )
noexcept

Create an instance of a GameApp.

Base constructor.


Upon startup, a handle based memory manager is instantiated and used for all future memory allocations. Variables are passed for setting the amount of memory the application could manage.

This class is a base class. A system specific class will derive from this one which will contain system specific operating system calls and variables.

Parameters
uDefaultMemorySizeDefault memory block to manager for the handle based memory manager
uDefaultHandleCountDefault number of handles to create on startup.
uMinReserveSizeDefault amount of memory to NOT allocate and leave in the hands of the operating system

When a Windows app is spawned using WinMain(), it is given the application instance. This parm are cached inside of this base class so the member functions can handle automatic parameter passing and decoding. The return code is initialized to zero.

◆ ~GameApp()

Burger::GameApp::~GameApp ( )
virtual

Base destructor for a GameApp.

Dispose of any allocated resources.


Releases the RunQueue and memory manager


When a windows app is shut down, dispose of everything here.

Member Function Documentation

◆ AddRoutine()

void Burger::GameApp::AddRoutine ( RunQueue::CallbackProc Proc,
RunQueue::CallbackProc pShutdown,
void * pData,
uint_t uPriority = RunQueue::PRIORITY_MEDIUM )
inlinenoexcept

Add a RunQueue polling routine.


Given a proc pointer and a pointer to data to pass to the proc pointer, add this to the list of procedures that are called with each call to Poll(). The pointer pData is not used by the polling manager itself. Only the polling proc uses the pointer for it's internal use.

Parameters
ProcPointer to a function of type RunQueue::CallbackProc
pShutdownPointer to a function to call when this is deleted, can be NULL
pDataPointer that is passed to the Proc upon calling. Otherwise, it's not used by Burger::GameApp.
uPriorityPriority value to use to determine the location of this new entry in the linked list.
See also
Poll(), RemoveRoutine()

◆ ClearQuitCode()

void Burger::GameApp::ClearQuitCode ( void )
inlinenoexcept

Cancel an application shutdown.


If an application decides to cancel a shutdown (User chooses to return to the application instead of quitting), call this function to clear the flag. The application will return to executing the main loop.

See also
GetQuitCode() and SetQuitCode()

◆ CreateWindow()

UIWindow *BURGER_API Burger::GameApp::CreateWindow ( void )
noexcept

Create the main application window.


iOS applications have a single master window that covers the entire screen. This function will create the window

Returns
Pointer to the newly created UIWindow.
See also
GetWindow(void) const or ReleaseWindow(void)

◆ EventPoll()

Burger::RunQueue::eReturnCode BURGER_API Burger::GameApp::EventPoll ( void * pData)
staticprotectednoexcept

MacOSX event handler.


MacOSX uses cooperative multi-threading for operating system events. This function, which is called every time Poll() is called, will process all pending MacOSX system events.

Parameters
pDataA pointer to the current GameApp is expected
Returns
RunQueue::OKAY

◆ FocusWindow()

void BURGER_API Burger::GameApp::FocusWindow ( void )
noexcept

Handle NSApplicationDidBecomeActiveNotification.


When a NSApplicationDidBecomeActiveNotification is passed to this application, this function is called to hide or show the game window

◆ get_StaticRTTI()

const Burger::StaticRTTI * Burger::GameApp::get_StaticRTTI ( void ) const
overridevirtualnoexcept

Get the description to the class.


This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.

Returns
Pointer to a global, read only instance of StaticRTTI for the true class

Reimplemented from Burger::Base.

◆ GetApp()

static GameApp * Burger::GameApp::GetApp ( void )
inlinestaticnoexcept

Return the pointer to the global application instance.


iOS applications only exist in a single instance, to simplify internal code, the instance is reflected in a singleton and the pointer to it is stored in a global which is accessed through this function.

Returns
Pointer to the singleton GameApp instance

◆ GetApplication()

NSApplication * Burger::GameApp::GetApplication ( void ) const
inlinenoexcept

◆ GetArgc()

int Burger::GameApp::GetArgc ( void ) const
inlinenoexcept

Get the current argc parameter.


Accessor to get the current argc input value passed to main().

Returns
Integer with the number of valid argv commands. Can be zero.
See also
GetArgv() const

◆ GetArgv()

const char ** Burger::GameApp::GetArgv ( void ) const
inlinenoexcept

Get the current argv parameter.


Accessor to get the current argv input value passed to main().

Returns
NULL or pointer to an array of char pointers of command line parameters.
See also
GetArgc() const

◆ GetCallBack()

MainWindowProc Burger::GameApp::GetCallBack ( void ) const
inlinenoexcept

Get the pointer to the window callback.


The main application window has a callback function to handle most functions automatically. A user supplied callback is used or augment or override default behavior. This function returns the pointer to the user supplied callback function.

Note
This is only available on Windows
Returns
The user supplied callback function pointer

◆ GetDelegate()

NSApplicationDelegate * Burger::GameApp::GetDelegate ( void ) const
inlinenoexcept

◆ GetDisplay()

Display * Burger::GameApp::GetDisplay ( void ) const
inlinenoexcept

Get the current Display class instance.


Returns
A pointer to the active Display class or NULL if no class is active
See also
SetDisplay()

◆ GetInputFocus()

void BURGER_API Burger::GameApp::GetInputFocus ( void )
noexcept

Obtain DirectInput focus (Windows only)


When the window is brought forward and focus is desired, this function will first test if the window is part of a desktop or full screen. If full screen, it will call the attached Keyboard, Mouse and Joypad objects to have them Acquire focus with DirectInput.

◆ GetInSizeMove()

uint_t Burger::GameApp::GetInSizeMove ( void ) const
inlinenoexcept

Return TRUE if the window is resizing.


Note
This is only available on Windows
Returns
TRUE if in resizing, FALSE if not.
See also
SetInSizeMove(uint_t)

◆ GetInstance()

HINSTANCE__ * Burger::GameApp::GetInstance ( void ) const
inlinenoexcept

Get the HINSTANCE of the running application.


When started, an HINSTANCE is assigned to an application and this value is used for some Windows specific function.

Note
This is only available on Windows
Returns
The application's HINSTANCE

◆ GetJoypad()

Joypad * Burger::GameApp::GetJoypad ( void ) const
inlinenoexcept

Get the current Joypad class instance.


Returns
A pointer to the active Joypad class or NULL if no class is active
See also
SetJoypad()

◆ GetKeyboard()

Keyboard * Burger::GameApp::GetKeyboard ( void ) const
inlinenoexcept

Get the current Keyboard class instance.


Returns
A pointer to the active Keyboard class or NULL if no class is active
See also
SetKeyboard()

◆ GetMemoryManager()

MemoryManagerGlobalHandle * Burger::GameApp::GetMemoryManager ( void )
inlinenoexcept

Get the pointer to the MemoryManagerGlobalHandle.


Accessor to get the MemoryManagerGlobalHandle associated with the application.

Returns
Pointer to the MemoryManagerGlobalHandle.

◆ GetMenu()

HMENU__ * Burger::GameApp::GetMenu ( void ) const
inlinenoexcept

Get the HMENU of the running application.


Return the HMENU that's attached to the window

Note
This is only available on Windows
Returns
The application's HMENU
See also
Display or SetMenu(HMENU__ *)

◆ GetMouse()

Mouse * Burger::GameApp::GetMouse ( void ) const
inlinenoexcept

Get the current Mouse class instance.


Returns
A pointer to the active Mouse class or NULL if no class is active
See also
SetMouse()

◆ GetQuitCode()

uint_t Burger::GameApp::GetQuitCode ( void ) const
inlinenoexcept

Get the current return code.


Accessor to get the current return code that main() would give back to the operating system if the application exited immediately.

Returns
Integer with main() return code.

◆ GetRunQueue()

RunQueue * Burger::GameApp::GetRunQueue ( void )
inlinenoexcept

Get the pointer to the RunQueue.


Accessor to get the RunQueue associated with the application.

Returns
Pointer to the RunQueue.
See also
Poll(), AddRoutine(), and RemoveRoutine()

◆ GetSoundManager()

SoundManager * Burger::GameApp::GetSoundManager ( void ) const
inlinenoexcept

Get the current SoundManager class instance.


Returns
A pointer to the active SoundManager class or NULL if no class is active
See also
SetSoundManager()

◆ GetView()

UIView * Burger::GameApp::GetView ( void ) const
inlinenoexcept

Return the main application window view.


iOS application windows can have an attached window view, this is the currently active view pointer

Returns
Pointer to the current UIView.
See also
GetViewController(void) const or SetViewController( UIViewController , UIView)

◆ GetViewController()

UIViewController * Burger::GameApp::GetViewController ( void ) const
inlinenoexcept

Return the main application window controller.


iOS application windows can have an attached window controller, this is the currently active controller pointer

Returns
Pointer to the current UIViewController.
See also
GetView(void) const or SetViewController(UIViewController ,UIView)

◆ GetWindow() [1/3]

HWND__ * Burger::GameApp::GetWindow ( void ) const
inlinenoexcept

Return the main application window.

Get the HWND of the running application.


iOS applications have a single master window that covers the entire screen. This function will return the pointer to that window

Returns
Pointer to the current UIWindow.
See also
CreateWindow(void) or ReleaseWindow(void)

When started, a window is created and attached to an application and this is the reference to the global window instance. It is used extensively by the rendering sub-systems.

Note
This is only available on Windows
Returns
The application's window reference
See also
Display

◆ GetWindow() [2/3]

UIWindow * Burger::GameApp::GetWindow ( void ) const
inlinenoexcept

◆ GetWindow() [3/3]

NSWindow * Burger::GameApp::GetWindow ( void ) const
inlinenoexcept

◆ HandleCursor()

uint_t BURGER_API Burger::GameApp::HandleCursor ( uint_t uParam)
noexcept

Handle cursor updates.


When the mouse moves in windowed mode, a WM_CURSOR event is triggered an the window needs to respond by changing the mouse cursor if needed.

If the game has enabled a hardware cursor, it will be enabled if the cursor is hovering over the client area, otherwise, it will be hidden or enabled to whatever cursor is needed for the borders of the window.

The application doesn't call this function. The WindowsApp class will handle it in the default window processing function.

Parameters
uParamThe passed "lparam" for a WM_CURSOR event.
Returns
TRUE if handled, FALSE if not

◆ InitDefaults()

void BURGER_API Burger::GameApp::InitDefaults ( void )
protectednoexcept

Initialize shared variables.


For variables that are present on all platforms, this function will clear them.

See also
ShutdownDefaults(void)

◆ InitWindow()

int BURGER_API Burger::GameApp::InitWindow ( const char * pGameName,
MainWindowProc pCallBack,
uint_t uIconResID = 0 )
noexcept

Create an application's default window.


Windows requires a window object to be created by the application to send and receive system events including sound and visual focus. Create this window and set internal variables so the Windows version of Burgerlib can function

Parameters
pGameNamePointer to a UTF-8 "C" string of the string to attach to the top of the game window
pCallBackPointer to a user supplied callback function for Windows (NULL if no user supplied pointer is present)
uIconResIDNumeric ID of the Windows Icon to attach to the window that's in the EXE files resource data (0 to use the default application icon from Windows)
Returns
Zero (FALSE) if the window was successfully created

◆ IsAppFullScreen()

uint_t BURGER_API Burger::GameApp::IsAppFullScreen ( void ) const
noexcept

Return TRUE if the application is in full screen mode.


Note
TRUE does not mean that the screen is currently enabled, it only means the application expects to be full screen when in the foreground. If the app is in the background, it is minimized and therefore drawing is not necessary.
Returns
TRUE if the screen mode is full screen. FALSE if not
See also
IsMinimized()

◆ IsInBackground()

uint_t Burger::GameApp::IsInBackground ( void ) const
inlinenoexcept

Detect if the app is should go into pause mode.


On many platforms, applications can be put in the background either through OS or user events from an external source. This flag is set and cleared by Burgerlib when the app is in the background or foreground.

If the game is in progress and this flag is set, force the game to pause and wait for direct user input before resuming.

Returns
TRUE if the application is in the background

◆ IsMinimized()

uint_t Burger::GameApp::IsMinimized ( void ) const
inlinenoexcept

Return TRUE if the application is in the background or minimized.


Determine if the state of the application is for it to be minimized and not drawing anything.

Returns
TRUE if the app is minimized, FALSE if not
See also
SetMinimized()

◆ IsMouseOnScreen()

uint_t Burger::GameApp::IsMouseOnScreen ( void ) const
inlinenoexcept

Return TRUE if the mouse cursor is on the game screen.


Return if a game drawn mouse cursor should be drawn. Do not draw if this flag is FALSE because it means that the mouse cursor is somewhere else on the desktop.

Returns
TRUE if the mouse cursor is on the game screen, FALSE if not
See also
SetMouseOnScreen(uint_t)

◆ IsResizingAllowed()

uint_t BURGER_API Burger::GameApp::IsResizingAllowed ( void ) const
noexcept

Return TRUE if the application can be resized at runtime.


Note
TRUE does not mean that the screen is currently enabled, it only means the application can accept desktop events that will change the screen size.
Returns
TRUE if the screen can change sizes. FALSE if not
See also
IsMinimized() or IsAppFullScreen()

◆ IsWindowSwitchingAllowed()

uint_t Burger::GameApp::IsWindowSwitchingAllowed ( void ) const
inlinenoexcept

Get the flag for video mode switching.


Returns
TRUE if switching video modes is allowed, FALSE if not
See also
SetWindowSwitching()

◆ IsWindowSwitchRequested()

uint_t Burger::GameApp::IsWindowSwitchRequested ( void ) const
inlinenoexcept

Return TRUE if there is a pending video mode switch.


The key command ALT-Enter can be issued by another thread, so to ensure the mode switch is done properly, this flag is set to alert the main thread that a full screen to window or vice versa mode switch is desired.

Returns
TRUE if a mode switch is desired, FALSE if not
See also
SetWindowSwitchRequested(uint_t)

◆ KillInputFocus()

void BURGER_API Burger::GameApp::KillInputFocus ( void )
noexcept

Release DirectInput focus (Windows only)


When the window is moved to the background and focus is no longer desired it will call the attached Keyboard, Mouse and Joypad objects to have them Unacquire focus with DirectInput.

◆ operator=() [1/2]

GameApp & Burger::GameApp::operator= ( const GameApp & )
privatedelete

◆ operator=() [2/2]

GameApp & Burger::GameApp::operator= ( GameApp && )
privatedelete

◆ Poll() [1/3]

Burger::RunQueue::eReturnCode BURGER_API Burger::GameApp::Poll ( void * pSelf)
staticnoexcept

Process Windows events.


Internal function that will call PeekMessage(), TranslateMessage() and DispatchMessage() to handle messages sent to the app

Parameters
pSelf"this" pointer to the WindowsApp class
Returns
RunQueue::OKAY since this function never shuts down on its own

◆ Poll() [2/3]

static RunQueue::eReturnCode Burger::GameApp::Poll ( void * pSelf)
staticnoexcept

◆ Poll() [3/3]

void Burger::GameApp::Poll ( void )
inlinenoexcept

Perform cooperative multitasking.


Some systems only have one CPU, others require background tasks running in the primary thread. To handle these cases, all callbacks are logged in the GameApp via calls to AddRoutine() and RemoveRoutine().

Since this background task can be called as often as possible, write any and all callbacks to do as little work as possible to prevent any sort of performance degradation.

See also
AddRoutine() or RemoveRoutine()

◆ RecordWindowLocation()

void BURGER_API Burger::GameApp::RecordWindowLocation ( void )
noexcept

Save the current window location.


When changing video display modes, it's prudent to save off the location of the application window so if the application switches to full screen mode, it can later revert to a windowed mode with the window in its previous location. This function records the current location of the window for later restoration.

◆ ReleaseWindow()

void BURGER_API Burger::GameApp::ReleaseWindow ( void )
noexcept

Dispose of the window.


Release the UIWindow used by the iOS application

See also
GetWindow(void) const or CreateWindow(void)

◆ RemoveRoutine()

void Burger::GameApp::RemoveRoutine ( RunQueue::CallbackProc Proc,
void * pData )
inlinenoexcept

Remove a RunQueue polling routine.


Given a proc pointer and a pointer to data to pass to the proc pointer, search the proc list and if a match is found, remove the proc from the list.

Parameters
ProcPointer to a function of type RunQueue::CallbackProc
pDataPointer that is passed to the Proc upon calling. Not used by the input manager.
See also
Poll(), AddRoutine()

◆ ResetWindowLocation()

void BURGER_API Burger::GameApp::ResetWindowLocation ( void )
noexcept

Purge the cached window location.


When calling SetWindowSize(), it will center the window in the middle of the screen on the first call and then use the last known origin location on all subsequent calls so if the user moves the window, the location of the window won't be lost on toggling from full screen to window mode. If the window needs to be re-centered, call this function to purge the cache.

Note
This is only available on Windows

◆ Run()

int BURGER_API Burger::GameApp::Run ( void )
noexcept

Set up iOS and call CodeEntry()


Sets up an iOS application shell and calls CodeEntry()

Returns
Result obtained from the call to CodeEntry()

◆ SetArgc()

void Burger::GameApp::SetArgc ( int iArgc)
inlinenoexcept

Set the current argc parameter.


Override the argc input value passed to main().

Parameters
iArgcNew number of parameters present (Can be zero)
See also
SetArgv(const char **)

◆ SetArgv()

void Burger::GameApp::SetArgv ( const char ** ppArgv)
inlinenoexcept

Set the current argv parameter.


Override the argv input value passed to main().

Parameters
ppArgvNULL or pointer to an array of char pointers of command line parameters.
See also
SetArgc(int)

◆ SetDisplay()

void BURGER_API Burger::GameApp::SetDisplay ( Display * pDisplay)
noexcept

Set the pointer to the current Display class instance.


Sets the pointer to the active Display instance

Parameters
pDisplayPointer to an active Display instance or NULL to disable the connection or delete the instance allocated by StartupDisplay(void)
See also
GetDisplay(void) const or StartupDisplay(void)

◆ SetInBackground()

void Burger::GameApp::SetInBackground ( uint_t bInBackground)
inlinenoexcept

Set the state if app should go into pause mode.


On many platforms, applications can be put in the background either through OS or user events from an external source. This flag is set and cleared by Burgerlib when the app is in the background or foreground.

If the game is in progress and this flag is set, force the game to pause and wait for direct user input before resuming.

Parameters
bInBackgroundTRUE if the application is in the background

◆ SetInSizeMove()

void Burger::GameApp::SetInSizeMove ( uint_t bInSizeMode)
inlinenoexcept

Set or clear the resizing window flag.


Note
This is only available on Windows
Parameters
bInSizeModeTRUE if in resizing, FALSE if not.
See also
GetInSizeMove(void) const

◆ SetJoypad()

void BURGER_API Burger::GameApp::SetJoypad ( Joypad * pJoypad)
noexcept

Set the pointer to the current Joypad class instance.


Sets the pointer to the active Joypad instance

Parameters
pJoypadPointer to an active Joypad instance or NULL to disable the connection or delete the instance allocated by StartupJoypad(void)
See also
GetJoypad(void) const or StartupJoypad(void)

◆ SetKeyboard()

void BURGER_API Burger::GameApp::SetKeyboard ( Keyboard * pKeyboard)
noexcept

Set the pointer to the current Keyboard class instance.


Sets the pointer to the active Keyboard instance

Parameters
pKeyboardPointer to an active Keyboard instance or NULL to disable the connection or delete the instance allocated by StartupKeyboard(void)
See also
GetKeyboard(void) const or StartupKeyboard(void)

◆ SetMenu()

void Burger::GameApp::SetMenu ( HMENU__ * hMenu)
inlinenoexcept

Set the HMENU of the running application.


Note
This is only available on Windows
Parameters
hMenuThe application's new HMENU
See also
Display or GetMenu(void) const

◆ SetMinimized()

void Burger::GameApp::SetMinimized ( uint_t bMinimized)
inlinenoexcept

Sets the application flag for being in the background or minimized.


Parameters
bMinimizedTRUE if the app is minimized, FALSE if not
See also
SetMinimized()

◆ SetMouse()

void BURGER_API Burger::GameApp::SetMouse ( Mouse * pMouse)
noexcept

Set the pointer to the current Mouse class instance.


Sets the pointer to the active Mouse instance

Parameters
pMousePointer to an active Mouse instance or NULL to disable the connection or delete the instance allocated by StartupMouse(void)
See also
GetMouse(void) const or StartupMouse(void)

◆ SetMouseOnScreen()

void Burger::GameApp::SetMouseOnScreen ( uint_t bMouseOnScreen)
inlinenoexcept

Sets the application flag if a mouse cursor is on the game screen.


Parameters
bMouseOnScreenTRUE if the mouse cursor is on the game screen, FALSE if not
See also
IsMouseOnScreen()

◆ SetQuitCode()

void Burger::GameApp::SetQuitCode ( void )
inlinenoexcept

Alert the application to shut down.


Set a flag so that at the end of the update/draw loop, the application can exit cleanly.

See also
GetQuitCode() and ClearQuitCode()

◆ SetSoundManager()

void BURGER_API Burger::GameApp::SetSoundManager ( SoundManager * pSetSoundManager)
noexcept

Set the pointer to the current SoundManager class instance.


Sets the pointer to the active SoundManager instance

Parameters
pSetSoundManagerPointer to an active SoundManager instance or NULL to disable the connection or delete the instance allocated by StartupSoundManager(void)
See also
GetSoundManager(void) const or StartupSoundManager(void)

◆ SetViewController()

void BURGER_API Burger::GameApp::SetViewController ( UIViewController * pViewController,
UIView * pView )
noexcept

Set the main window's UIView and UIViewController.


iOS applications have a single master window that covers the entire screen. This function will attach (If different) a UIViewController and / or UIView to it.

Parameters
pViewControllerPointer to a UIViewController or NULL to detach any previous controller
pViewPointer to a UIView or NULL to detach any previous view
See also
GetViewController(void) const or GetView(void) const

◆ SetWindowFullScreen()

int BURGER_API Burger::GameApp::SetWindowFullScreen ( uint_t uWidth,
uint_t uHeight )
noexcept

Prepare an application window for full screen mode.


When initializing a display, the window needs to be adjusted to be size of the display and all borders removed. This function will make the window visible and adjust if for full screen drawing.

Parameters
uWidthWidth of the display rectangle in pixels
uHeightHeight of the display rectangle in pixels
Returns
Zero if no error, non-zero windows error code

◆ SetWindowSize() [1/2]

int BURGER_API Burger::GameApp::SetWindowSize ( uint_t uWidth,
uint_t uHeight )
noexcept

Change the size of the application window.


When initializing a display, the window needs to be adjusted to be able to accommodate the new size. This function will make the window visible and resize it to the requested dimensions.

If this is the first time executing, the window will be placed in the center of the screen, otherwise it will be placed where at the location of the last time the window was opened.

Parameters
uWidthWidth of the display rectangle in pixels
uHeightHeight of the display rectangle in pixels
Returns
Zero if no error, non-zero windows error code

◆ SetWindowSize() [2/2]

uint_t Burger::GameApp::SetWindowSize ( uint_t uWidth,
uint_t uHeight )
noexcept

◆ SetWindowSwitching()

void Burger::GameApp::SetWindowSwitching ( uint_t bAllowWindowSwitching)
inlinenoexcept

Enable the Alt-Enter key.


Enable the desktop application to switch from full screen to window mode by pressing Alt-Enter or equivalent for the native operating system.

Parameters
bAllowWindowSwitchingTRUE to enable switching, FALSE to disable
See also
IsWindowSwitchingAllowed()

◆ SetWindowSwitchRequested()

void Burger::GameApp::SetWindowSwitchRequested ( uint_t bWindowSwitchRequested)
inlinenoexcept

Sets the application flag to toggle between full screen and window mode.


Parameters
bWindowSwitchRequestedTRUE if a mode switch is desired, FALSE if not
See also
IsWindowSwitchRequested(void) const

◆ ShutdownDefaults()

void BURGER_API Burger::GameApp::ShutdownDefaults ( void )
protectednoexcept

Release shared variables.


For variables that are present on all platforms, this function will clear them and release all resources under this classes' control.

See also
InitDefaults(void)

◆ StartupDisplay()

Burger::Display *BURGER_API Burger::GameApp::StartupDisplay ( void )
noexcept

Create an instance of the Display manager.


If a Display manager was already allocated or manually assigned, return the pointer to the preexisting Display manager. Otherwise allocate a new instance of a Display manager and use it as the default.

Note
If a Display manager was allocated by this function, it will automatically be released when this class shuts down.
On Windows, the default display is OpenGL. If a different renderer is desired like DirectX 9 or DirectX 11, create and attach the custom display instance before calling this function or StartupEverything(void)
Returns
Pointer to the Display manager
See also
StartupEverything(void)

◆ StartupEverything()

uint_t BURGER_API Burger::GameApp::StartupEverything ( void )
noexcept

Create instances of all default classes for a game.


Game applications usually need Mouse/Keyboard/Joypad input, video display and audio managers initialized. This function will initialize all five subsystems and return an error code if it failed.

All managers this function creates will be disposed of when this class shuts down

Returns
Zero on success, error code if not.
See also
StartupKeyboard(void), StartupMouse(void), StartupJoypad(void), StartupDisplay(void) or StartupSoundManager(void)S

◆ StartupJoypad()

Burger::Joypad *BURGER_API Burger::GameApp::StartupJoypad ( void )
noexcept

Create an instance of the Joypad manager.


If a Joypad manager was already allocated or manually assigned, return the pointer to the preexisting Joypad manager. Otherwise allocate a new instance of a Joypad manager and use it as the default.

Note
If a Joypad manager was allocated by this function, it will automatically be released when this class shuts down.
Returns
Pointer to the Joypad manager
See also
StartupEverything(void)

◆ StartupKeyboard()

Burger::Keyboard *BURGER_API Burger::GameApp::StartupKeyboard ( void )
noexcept

Create an instance of the Keyboard manager.


If a Keyboard manager was already allocated or manually assigned, return the pointer to the preexisting Keyboard manager. Otherwise allocate a new instance of a Keyboard manager and use it as the default.

Note
If a Keyboard manager was allocated by this function, it will automatically be released when this class shuts down.
Returns
Pointer to the Keyboard manager
See also
StartupEverything(void)

◆ StartupMouse()

Burger::Mouse *BURGER_API Burger::GameApp::StartupMouse ( void )
noexcept

Create an instance of the Mouse manager.


If a Mouse manager was already allocated or manually assigned, return the pointer to the preexisting Mouse manager. Otherwise allocate a new instance of a Mouse manager and use it as the default.

Note
If a Mouse manager was allocated by this function, it will automatically be released when this class shuts down.
Returns
Pointer to the Mouse manager
See also
StartupEverything(void)

◆ StartupSoundManager()

Burger::SoundManager *BURGER_API Burger::GameApp::StartupSoundManager ( void )
noexcept

Create an instance of the SoundManager.


If a SoundManager was already allocated or manually assigned, return the pointer to the preexisting SoundManager . Otherwise allocate a new instance of a SoundManager and use it as the default.

Note
If a SoundManager was allocated by this function, it will automatically be released when this class shuts down.
Returns
Pointer to the SoundManager
See also
StartupEverything(void)

◆ SwitchVideo()

uint_t BURGER_API Burger::GameApp::SwitchVideo ( void )
noexcept

Switch from full screen to windowed mode and back again.


If supported, both by platform and by having the m_bAllowWindowSwitching flag being non-zero, this function will switch to full screen if the game is in a window and vice versa.

Returns
Zero if no error occurred and the mode was switched, or non-zero if not supported or there was an error in the mode switch.
See also
SetWindowSwitching(uint_t) or IsWindowSwitchingAllowed(void) const

Member Data Documentation

◆ g_piOSApp

Burger::GameApp * Burger::GameApp::g_piOSApp
staticprotected

(iOS only) Global singular application instance

◆ g_StaticRTTI

const Burger::StaticRTTI Burger::GameApp::g_StaticRTTI
static

◆ m_bAllowWindowSwitching

uint8_t Burger::GameApp::m_bAllowWindowSwitching
protected

◆ m_bCenterWindow

uint_t Burger::GameApp::m_bCenterWindow
protected

TRUE if the window needs to be centered

◆ m_bCoCreateInstanceInit

uint8_t Burger::GameApp::m_bCoCreateInstanceInit
protected

(Windows only) TRUE if CoInitializeEx() was initialized

◆ m_bDisplayStarted

uint8_t Burger::GameApp::m_bDisplayStarted
protected

TRUE if a Display class was started with a call to StartupDisplay(void)

◆ m_bInBackground

uint8_t Burger::GameApp::m_bInBackground
protected

Set to TRUE if the game should be paused due to another window being in front.

◆ m_bInSizeMove

uint8_t Burger::GameApp::m_bInSizeMove
protected

(Windows only) TRUE if the window is being resized

◆ m_bJoypadStarted

uint8_t Burger::GameApp::m_bJoypadStarted
protected

TRUE if a Joypad class was started with a call to StartupJoypad(void)

◆ m_bKeyboardStarted

uint8_t Burger::GameApp::m_bKeyboardStarted
protected

TRUE if a Keyboard class was started with a call to StartupKeyboard(void)

◆ m_bMinimized

uint8_t Burger::GameApp::m_bMinimized
protected

Set to TRUE if the game is minimized (PC/Mac only, always false on consoles)

◆ m_bMouseOnScreen

uint8_t Burger::GameApp::m_bMouseOnScreen
protected

TRUE if the mouse cursor is on the screen in windows systems

◆ m_bMouseStarted

uint8_t Burger::GameApp::m_bMouseStarted
protected

TRUE if a Mouse class was started with a call to StartupMouse(void)

◆ m_bQuit

uint8_t Burger::GameApp::m_bQuit
protected

Set to TRUE when the application has to shut down.

◆ m_bSoundManagerStarted

uint8_t Burger::GameApp::m_bSoundManagerStarted
protected

TRUE if a SoundManager class was started with a call to StartupSoundManager(void)

◆ m_bWindowSwitchRequested

uint8_t Burger::GameApp::m_bWindowSwitchRequested
protected

TRUE if the window resolution switch key was pressed

◆ m_hInstance

HINSTANCE__* Burger::GameApp::m_hInstance
protected

(Windows only) Current instance of the application

◆ m_hMenu

HMENU__* Burger::GameApp::m_hMenu
protected

(Windows only) Menu bar for the application

◆ m_hWindow

HWND__* Burger::GameApp::m_hWindow
protected

(Windows only) Main window for the application

◆ m_iArgc

int Burger::GameApp::m_iArgc
protected

Number of valid arguments.

◆ m_MemoryManagerHandle

MemoryManagerGlobalHandle Burger::GameApp::m_MemoryManagerHandle
protected

Handle based memory manager for the app.

◆ m_pApplication

NSApplication* Burger::GameApp::m_pApplication
protected

Pointer to the current application context (Copy of NSApp)

◆ m_pApplicationDelegate

NSApplicationDelegate* Burger::GameApp::m_pApplicationDelegate
protected

Pointer to the current application delegate.

◆ m_pCallBack

MainWindowProc Burger::GameApp::m_pCallBack
protected

(Windows only) Custom application window proc

◆ m_pDefaultCursor

HICON__* Burger::GameApp::m_pDefaultCursor
protected

(Windows only) Default cursor when not in the game area

◆ m_pDisplay

Display* Burger::GameApp::m_pDisplay
protected

Pointer to the active display instance.

◆ m_pJoypad

Joypad* Burger::GameApp::m_pJoypad
protected

Pointer to the active joypad instance.

◆ m_pKeyboard

Keyboard* Burger::GameApp::m_pKeyboard
protected

Pointer to the active keyboard instance.

◆ m_pListener

NSResponder* Burger::GameApp::m_pListener
protected

Main listener for window events.

◆ m_pMouse

Mouse* Burger::GameApp::m_pMouse
protected

Pointer to the active mouse instance.

◆ m_ppArgv

const char** Burger::GameApp::m_ppArgv
protected

Arguments passed to the console.

◆ m_ppOldArgv

const char** Burger::GameApp::m_ppOldArgv
protected

(Windows only) Saved pointer to the global __argv for restoring on exit

◆ m_pSoundManager

SoundManager* Burger::GameApp::m_pSoundManager
protected

Pointer to the active sound manager instance.

◆ m_pView

UIView* Burger::GameApp::m_pView
protected

(iOS only) Pointer to the UIView being used

◆ m_pViewController

UIViewController* Burger::GameApp::m_pViewController
protected

(iOS only) Pointer to the UIViewController to the window

◆ m_pWindow [1/2]

UIWindow* Burger::GameApp::m_pWindow
protected

(iOS only) Pointer to the UIWindow for the iOS application

◆ m_pWindow [2/2]

NSWindow* Burger::GameApp::m_pWindow
protected

Game window.

◆ m_RunQueue

RunQueue Burger::GameApp::m_RunQueue
protected

Internal run queue.

◆ m_uErrorMode

uint_t Burger::GameApp::m_uErrorMode
protected

(Windows only) Initial GetErrorMode() value

◆ m_WindowRect

Rect_t Burger::GameApp::m_WindowRect
protected

(Windows only) Bounds rect of the window