Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
KatanaEngine::MenuScreen Class Reference

Base class for all game menu screens. More...

#include <MenuScreen.h>

Inheritance diagram for KatanaEngine::MenuScreen:

Public Member Functions

 MenuScreen ()
 
virtual ~MenuScreen ()
 
virtual void HandleInput (const InputState &input)
 Called when the game has determined that player input needs to be processed.
 
virtual void Update (const GameTime &gameTime)
 Called when the game has determined that screen logic needs to be processed.
 
virtual void Draw (SpriteBatch &spriteBatch)
 Called when the game determines it is time to draw a frame.
 
virtual void SetItemListWrapping (const bool wraps)
 Sets whether scrolling past the end of the menu returns the selection back to the first item.
 
- Public Member Functions inherited from KatanaEngine::Screen
 Screen ()
 
virtual ~Screen ()
 
virtual void LoadContent (ResourceManager &resourceManager)
 Called when resources need to be loaded.
 
virtual void UnloadContent ()
 Called when resources need to be unloaded. Override this method to unload any screen-specific resources.
 
virtual bool IsExiting () const
 Determines if the screen is currently exiting.
 
float GetAlpha () const
 Gets the overall screen transition alpha value (or opacity). This is handy for fading screens in and out.
 
virtual ScreenManagerGetScreenManager ()
 Gets a pointer to the ScreenManager, for managing game screens.
 
virtual GameGetGame () const
 Gets a pointer to the Game.
 
virtual void SetScreenManager (ScreenManager &screenManager)
 Gets a pointer to the ScreenManager, for managing game screens.
 
virtual void Show ()
 Tells the screen to transition in.
 
virtual void Exit ()
 Tells the screen to transition out. When the screen has completed its transition, UnloadContent() will be called, and the ScreenManager will remove it.
 
virtual void SetExitCallback (OnExit callback)
 Sets the callback function for when the Exit() is called.
 
virtual void SetRemoveCallback (OnRemove callback)
 Sets the callback function for when the screen is about to be removed by the screen manager.
 
virtual double GetTransitionOutTime () const
 Get the time in seconds that the screen will transition out.
 

Protected Member Functions

virtual void AddMenuItem (MenuItem *pItem)
 Adds a menu item to the screen.
 
virtual MenuItemGetSelectedItem () const
 Get the currently selected menu item.
 
virtual MenuItemGetMenuItem (const int itemIndex) const
 Get a menu item by providing it's index.
 
virtual void SetSelectedItem (const int itemIndex)
 Set the selected menu item by providing it's index.
 
virtual void SetDisplayCount (const unsigned int count)
 Set how many menu items to display.
 
virtual int GetDisplayCount () const
 Get the number of menu items that are set to display.
 
virtual size_t GetCount () const
 Get the total number of menu items.
 
virtual int GetDisplayStartIndex () const
 Get the index corresponding to the first displayed menu item.
 
- Protected Member Functions inherited from KatanaEngine::Screen
virtual bool ShouldHandleInputBelow ()
 Checks if the screen manager should call HandleInput on the screen below this one.
 
virtual bool ShouldUpdateBelow ()
 Checks if the screen manager should call Update on the screen below this one.
 
virtual bool ShouldDrawBelow ()
 Checks if the screen manager should call Draw on the screen below this one.
 
virtual void SetTransitionInTime (double seconds)
 Set the time in seconds that the screen should transition in.
 
virtual void SetTransitionOutTime (double seconds)
 Set the time in seconds that the screen should transition out.
 
virtual double GetTransitionInTime () const
 Get the time in seconds that the screen will transition in.
 
virtual ScreenTransition GetTransition () const
 Get the current transition state of the screen.
 
virtual float GetTransitionValue () const
 Get the interpolated value (between zero and one) of the screen transition.
 
virtual bool NeedsToBeRemoved () const
 Determines if the screen has completely faded out and needs to be removed by the ScreenManager.
 
virtual void UseRenderTarget ()
 Forces all screen rendering to a render target.
 
virtual RenderTargetGetRenderTarget () const
 Get screen's render target.
 
virtual Color GetRenderTargetColor () const
 Get the color that will be used to tint the render target.
 

Additional Inherited Members

- Protected Types inherited from KatanaEngine::Screen
enum class  ScreenTransition { None , In , Out }
 Defines the state of the transition between screens. More...
 

Detailed Description

Base class for all game menu screens.

Definition at line 22 of file MenuScreen.h.

Constructor & Destructor Documentation

◆ MenuScreen()

KatanaEngine::MenuScreen::MenuScreen ( )

Definition at line 19 of file MenuScreen.cpp.

◆ ~MenuScreen()

KatanaEngine::MenuScreen::~MenuScreen ( )
virtual

Definition at line 28 of file MenuScreen.cpp.

Member Function Documentation

◆ AddMenuItem()

void KatanaEngine::MenuScreen::AddMenuItem ( MenuItem * pItem)
protectedvirtual

Adds a menu item to the screen.

Parameters
pItemA pointer to the item that will be added.

Definition at line 127 of file MenuScreen.cpp.

◆ Draw()

void KatanaEngine::MenuScreen::Draw ( SpriteBatch & spriteBatch)
virtual

Called when the game determines it is time to draw a frame.

Parameters
spriteBatchA reference to the game's sprite batch, used for rendering.

Implements KatanaEngine::Screen.

Reimplemented in MainMenuScreen.

Definition at line 111 of file MenuScreen.cpp.

◆ GetCount()

virtual size_t KatanaEngine::MenuScreen::GetCount ( ) const
inlineprotectedvirtual

Get the total number of menu items.

Returns
Returns the total number of menu items.

Definition at line 76 of file MenuScreen.h.

◆ GetDisplayCount()

virtual int KatanaEngine::MenuScreen::GetDisplayCount ( ) const
inlineprotectedvirtual

Get the number of menu items that are set to display.

Returns
Returns the number of displayed menu items.

Definition at line 72 of file MenuScreen.h.

◆ GetDisplayStartIndex()

virtual int KatanaEngine::MenuScreen::GetDisplayStartIndex ( ) const
inlineprotectedvirtual

Get the index corresponding to the first displayed menu item.

Returns
Returns index of the first displayed menu item.

Definition at line 80 of file MenuScreen.h.

◆ GetMenuItem()

virtual MenuItem * KatanaEngine::MenuScreen::GetMenuItem ( const int itemIndex) const
inlineprotectedvirtual

Get a menu item by providing it's index.

Returns
Returns a pointer to a menu item.

Definition at line 60 of file MenuScreen.h.

◆ GetSelectedItem()

virtual MenuItem * KatanaEngine::MenuScreen::GetSelectedItem ( ) const
inlineprotectedvirtual

Get the currently selected menu item.

Returns
Returns a pointer to the currently selected menu item.

Definition at line 56 of file MenuScreen.h.

◆ HandleInput()

void KatanaEngine::MenuScreen::HandleInput ( const InputState & input)
virtual

Called when the game has determined that player input needs to be processed.

Parameters
inputThe current state of all player input devices.

Reimplemented from KatanaEngine::Screen.

Definition at line 38 of file MenuScreen.cpp.

◆ SetDisplayCount()

virtual void KatanaEngine::MenuScreen::SetDisplayCount ( const unsigned int count)
inlineprotectedvirtual

Set how many menu items to display.

Parameters
countThe number of menu items to display.

Definition at line 68 of file MenuScreen.h.

◆ SetItemListWrapping()

virtual void KatanaEngine::MenuScreen::SetItemListWrapping ( const bool wraps)
inlinevirtual

Sets whether scrolling past the end of the menu returns the selection back to the first item.

Parameters
wrapsPass true if you want the menu items to wrap.

Definition at line 45 of file MenuScreen.h.

◆ SetSelectedItem()

virtual void KatanaEngine::MenuScreen::SetSelectedItem ( const int itemIndex)
inlineprotectedvirtual

Set the selected menu item by providing it's index.

Parameters
itemIndexThe index of the menu item.

Definition at line 64 of file MenuScreen.h.

◆ Update()

void KatanaEngine::MenuScreen::Update ( const GameTime & gameTime)
virtual

Called when the game has determined that screen logic needs to be processed.

Parameters
gameTimeA reference to the game time object.

Implements KatanaEngine::Screen.

Reimplemented in MainMenuScreen.

Definition at line 90 of file MenuScreen.cpp.


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