Cavestory Mod API
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
MessageBoxMode Class Reference

Message box mode. More...

#include <CSMAPI_MessageBoxMode.h>

Inheritance diagram for MessageBoxMode:
BaseModeInstance

Classes

struct  MessageBoxConfigStruct
 Configuration for MessageBoxMode. More...
 

Public Types

enum  MessageBoxReturnCodes { QUIT_GAME = -1 }
 Special return codes. More...
 
- Public Types inherited from BaseModeInstance
typedef void(* ModeCallback_OnEnd) (BaseModeInstance *pMode, const int &iResult, bool &bDelete)
 Callback function for when a mode ends.
 

Public Member Functions

 MessageBoxMode ()
 Default constructor.
 
- Public Member Functions inherited from BaseModeInstance
 BaseModeInstance ()
 Initialize certain values.
 
ModeThreadId StartAsyncOperation (ModeThreadInstance::ModeCallback_OnThreadLoop pOnLoopFunc, ModeThreadInstance::ModeCallback_OnThreadComplete pOnCompleteFunc=NULL, void *pUserData=NULL)
 Begin a thread-safe asynchronous operation. More...
 
bool StopThread (ModeThreadId iThreadId, bool bWaitForFinish=false)
 Stop a thread. More...
 
void StartAllNewThreads ()
 Start all new threads.
 
void FreeAllThreads ()
 Stop & wait for all threads to finish.
 
void EnforceBasicWindowSize (GUI_RECT *pRect)
 Ensure a rect conforms to the size of a basic window. More...
 
int DrawBasicWindow (GUI_RECT *pRect=NULL)
 Draw a basic window. More...
 
VideoTextureGetLocalVideoTexture (int LocalIndex)
 Get a locally allocated video texture object by its index. More...
 
int AllocTexture (int InsertIndex=-1, int Width=WINDOW_WIDTH, int Height=WINDOW_HEIGHT, int BitsPerPixel=32, int Magnification=-1, int WindowIndex=0)
 Allocate private resources. More...
 
void FreeTexture (int Index)
 Free a previously allocated texture. More...
 
void FreeAllTextures ()
 Free all allocated textures.
 
bool IsLocalTextureAllocated (int Index)
 Check to see if a texture at a given local index is allocated. More...
 
void SelectTexture (int Index)
 Select a previously allocated surface. More...
 
int GetSelectedTexture ()
 Get the currently selected texture. More...
 
void FinishTexture (int Index)
 Finish drawing a texture. More...
 
void DrawTexture (int Index, int X=0, int Y=0, unsigned char Alpha=255, bool bSubPixels=false, bool bWrapCoordinates=false)
 Draw an allocated texture onto the screen. More...
 
int GetTextureCenteredX (int Index)
 Get the screen-centered X position of a texture. More...
 
int GetTextureCenteredY (int Index)
 Get the screen-centered Y position of a texture. More...
 
GUI_POINT GetTextureCentered (int Index)
 Get the screen-centered position of a texture. More...
 
int GetTextureWidth (int Index, bool Magnified=true)
 Get the width of an allocated texture. More...
 
int GetTextureHeight (int Index, bool Magnified=true)
 Get the height of an allocated texture. More...
 
GUI_POINT GetTextureRelativeMousePoint (int Index)
 Get the current mouse position relative to a texture. More...
 
virtual bool StartMode ()
 Initialize the mode in free-call mode. More...
 
virtual void EndMode (int value=0x6FFFFFFF, bool bSchedule=false)
 End this mode. More...
 
void SetModePaused (bool bValue)
 Set the 'paused' value for this mode. More...
 
virtual bool ModeTick ()
 Run this mode for one frame. More...
 
int GetRetValue ()
 Get the return value for this mode. More...
 
bool IsModeFreeRunning ()
 Check to see if this mode is running in freerun mode. More...
 
ModeConfigurationGetModeConfig ()
 Get a pointer to this mode's config. More...
 
virtual void SetDirty ()
 Set this mode as dirty.
 
void ReloadMode ()
 Reload this mode.
 
void ResetMode ()
 Reset the mode.
 
void SetRetValue (int value)
 Set the return value. More...
 
virtual int DoMode ()
 Run this mode until it stops. More...
 

Static Public Member Functions

static int ShowMessageBox (const char *pTitle, const char *pMessage, MessageBoxButton *pButtons, int iButtonCount, MessageBoxBusyFunc pBusyFunc=NULL, void *pUserData=NULL, MessageBoxConfigStruct *pConfig=NULL)
 Show a message box. More...
 
static bool ShowMessageBoxForOneFrame (const char *pTitle, const char *pMessage, MessageBoxButton *pButtons, int iButtonCount, MessageBoxConfigStruct *pConfig=NULL)
 Display a message box for this frame only. More...
 
- Static Public Member Functions inherited from BaseModeInstance
static void SetGlobalConfig (MODE_GLOBAL_CONFIG_TYPE eType, const char *pValue)
 Set the value of a global config variable. More...
 
static void ProcessScheduleList ()
 Process all schedules.
 
static EventScheduleId Schedule (unsigned int iDelay, EventSchedulePayloadFunc pPayloadFunc, void *pUserData=NULL, BaseModeInstance *pOwner=NULL)
 Schedule an event for later. More...
 
static bool CancelSchedule (EventScheduleId iEventId)
 
static bool IsSchedulePending (EventScheduleId iEventId)
 
static void ShowCursor ()
 Show the cursor. More...
 
static void HideCursor ()
 Hide the cursor. More...
 
static void SetCursor (CSMP_CURSOR_TYPE iType, int iEventId=-1, GUI_RECT *pRect=NULL)
 Set the current cursor. More...
 
static CSMP_CURSOR_TYPE GetCursor (GUI_RECT **pRect=NULL, int *pEventId=NULL)
 Get the current cursor type. More...
 
static void ReloadOpenModes ()
 Reload all currently opened modes.
 
static void ScheduleReloadOpenModes ()
 Reload all currently opened modes.
 
static FontObject * GetDefaultFont (unsigned int iMagnification=0)
 Get the default font that all GUIs should use. More...
 
static void ReloadFont (const char *pFontName, const char *pFontPath, int iFontW=-1, int iFontH=-1, unsigned int iMagnification=0)
 Reload the default font. More...
 
static GameProcessMode ShowTutorialPages (BaseModeInstance *pCaller, int iPageCount,...)
 Show a messagebox that allows the user to scroll through a list of tutorial pages. More...
 
static void RunGameLogic (bool AllowACT=true)
 Run game logic. More...
 
static void DrawGame (bool AllowACT=true, int OffsetX=0, int OffsetY=0, bool DoPutFade=true, bool bRunGameLogic=true)
 Draw game elements. More...
 
static void DrawHUD (int OffsetX=0, int OffsetY=0)
 Draw HUD.
 
static GUI_POINT GetControlKeySize (const KeyControlStruct *Buttons, int ButtonCount, bool StackControls=false, unsigned int CustomMagnification=0)
 Get the size of what DrawControls() would output to the screen. More...
 
static void DrawControls (MENU_CONTROLS_DRAW_POSITION DrawPosition, Surface_Ids destSID, const KeyControlStruct *Buttons, int ButtonCount, bool Flash=false, bool StackControls=false, int Alpha=255, unsigned int CustomMagnification=0)
 Draw standard controls. More...
 

Public Attributes

struct CAVESTORY_MOD_API MessageBoxMode::MessageBoxConfigStruct m_Config
 
- Public Attributes inherited from BaseModeInstance
struct {
   ModeCallback_OnEnd   OnEnd
 This is called when the mode is ending, just before 'Free()'. More...
 
m_Callbacks
 
void * m_PrivData
 Pointer to private data structure, defined by each mode.
 

Protected Member Functions

virtual int Init ()
 Initialize this mode. More...
 
virtual int Free ()
 De-initialize this mode. More...
 
virtual void ProcessLogic ()
 Process the logic of this menu.
 
virtual void ProcessMouse (GUI_POINT mouse_point)
 Process this menu's mouse. More...
 
virtual void ProcessKeys ()
 Process key input.
 
void HandleSelection ()
 
int GetShiftedButtonIndex (GUI_POINT start, GUI_POINT shift)
 
GUI_POINT GetSpecialTextSize ()
 
void DrawSpecialText ()
 
virtual void PreRender ()
 Render everything to surfaces.
 
virtual void Draw ()
 Draw rendered surfaces.
 
- Protected Member Functions inherited from BaseModeInstance
virtual int GetMagnification ()
 Fetch the magnification level for this UI. More...
 
virtual int ModePixelToScreenPixel (int iInput)
 Convert a mode coordinate to screen coordinates.
 
virtual void QueryMenuControls (KeyControlStruct pControlBuffer[32], int &pControlCount, bool &bStackControls)
 Ask the mode to populate pControlBuffer with its control scheme. More...
 
virtual void PostDraw ()
 Draw rendered surfaces over top of everything else.
 
bool IsTooltipOpen ()
 Check to see if a tooltip is open. More...
 
bool CreateTooltip (GUI_POINT point, FontObject *font, const char *text, int life_time=5000)
 Create a tooltip. More...
 
bool CreateTextureTooltip (GUI_POINT point, FontObject *font, const char *text, int life_time=5000, int Magnification=-1)
 Create a texture tooltip. More...
 
bool CloseTooltip (bool fade_out=true)
 Close the currently opened tooltip. More...
 
GUI_RECTGetTooltipRect ()
 Get a pointer to the tooltip's rect. More...
 
void SetTooltipPosition (GUI_POINT new_position)
 Set the tooltip's position. More...
 
void ProcessTooltips ()
 Process the current & old tooltips.
 
void DrawTooltips ()
 Draw the current & old tooltips.
 
uint32_t GetRectHoverTime (GUI_POINT mouse_point, GUI_RECT rect)
 A helper method. More...
 
void ResetRectHover ()
 Reset rect hover system.
 
bool CreateMenuControls (const KeyControlStruct *Buttons, int ButtonCount, bool StackControls=false)
 Create control surfaces. More...
 
void DrawMenuControls (MENU_CONTROLS_DRAW_POSITION DrawPosition, MENU_CONTROLS_DRAW_FRAME DrawFrame)
 Draw the menu control surfaces generated by CreateMenuControls. More...
 
MENU_CONTROLS_ACTS GetMenuControlsAct ()
 Get the act number of the menu controls menu. More...
 
void SetMenuControlsAct (MENU_CONTROLS_ACTS NewAct)
 Set the act number of the menu controls menu. More...
 
bool GrabScreen ()
 Backup the screen to a surface.
 
void DrawScreenGrab ()
 Draw the backed up screen.
 
void UpdateScreenGrab ()
 Update the screen grab surface.
 
void ReleaseScreenGrab ()
 Release this mode's screengrab.
 
void DoEscapeMenu ()
 Open the escape menu. More...
 
int AllocSurface (int InsertIndex=-1, int Width=WINDOW_WIDTH, int Height=WINDOW_HEIGHT, unsigned int iMagnification=0)
 Allocate private resources. More...
 
int LoadImageToSurface (const char *FileName, int InsertIndex=-1)
 Allocate private resources. More...
 
int LoadImageToTexture (const char *FileName, int InsertIndex=-1)
 Allocate private resources. More...
 
int LoadSurfaceIDToSurface (Surface_Ids SurfaceID, int InsertIndex=-1)
 Allocate private resources. More...
 
int LoadSurfaceIDToTexture (Surface_Ids SurfaceID, int InsertIndex=-1)
 Allocate private resources. More...
 
void FreeSurface (int Index)
 Free a previously allocated surface. More...
 
void FreeAllSurfaces ()
 Free all allocated surfaces.
 
bool IsLocalSurfaceAllocated (int Index)
 Check to see if a surface at a given local index is allocated. More...
 
void SelectSurface (int Index)
 Select a previously allocated surface. More...
 
int GetSelectedSurface ()
 Get the currently selected surface. More...
 
Surface_Ids LocalSurfaceIndexToGlobal (int Index)
 Convert the local index of a surface we own to a global index. More...
 
int GlobalSurfaceIndexToLocal (Surface_Ids sId)
 Convert the global index of a surface to a local index. More...
 
void DrawSurface (int Index, int X=0, int Y=0, unsigned char Alpha=255, bool AbsolutePos=false)
 Draw an allocated surface on the screen. More...
 
int GetSurfaceWidth (int Index)
 Get the width of an allocated surface. More...
 
int GetSurfaceHeight (int Index)
 Get the height of an allocated surface. More...
 
int GetCenteredX (int Index)
 Get the screen-centered X position of a surface. More...
 
int GetCenteredY (int Index)
 Get the screen-centered Y position of a surface. More...
 
virtual GUI_POINT TranslateMousePosition (GUI_POINT *pMouseInput, const GUI_POINT &pWindowOffset)
 Translate the mouse position to relative coordinates. More...
 
virtual GUI_POINT TranslateMousePosition (GUI_POINT *pMouseInput)
 Translate the mouse position to relative coordinates. More...
 
virtual int GetRelativeScreenWidth ()
 Get the game window's width relative to this mode. More...
 
virtual int GetRelativeScreenHeight ()
 Get the game window's height relative to this mode. More...
 
bool IsFocusedMode ()
 Check to see if this mode is the currently focused mode. More...
 
void InitControlMenu ()
 Initialize the control menu.
 
bool IsControlMenuOpen ()
 Check to see if the control menu is open. More...
 
void RemoveKey (int iInputFlags, KeyInputType iType=KeyInputType::KIT_Key)
 Remove key inputs after processing them. More...
 
GUI_POINT GetRelativeMousePosition (int iIndex)
 Get the mouse position relative to a surface. More...
 

Protected Attributes

MessageBoxBusyFunc m_BusyFunc
 
void * m_UserData
 
MessageBoxButtonm_Buttons
 
int m_ButtonCount
 
- Protected Attributes inherited from BaseModeInstance
ToolTipStruct m_OldTooltip
 The tooltip that is fading out.
 
ToolTipStruct m_CurTooltip
 The tooltip that is currently being shown.
 
ModeConfiguration m_ModeConfig
 The configuration for this mode.
 
struct BaseModeInstance::ModeInput m_ModeInput
 
Surface_Ids m_ScreenGrabSurf
 The screen grab surface ID.
 
bool m_Dirty
 Controls whether this mode should re-render.
 
bool m_End
 Controls whether this mode should end.
 
bool m_FreeCall
 Controls whether this mode is in free-call mode. More...
 
bool m_FreeCall_Paused
 Controls whether this mode is paused or not.
 
int m_RetValue
 Controls the return value of DoMode() internally. More...
 

Friends

class MessageBoxButton
 

Additional Inherited Members

- Static Protected Member Functions inherited from BaseModeInstance
static void CancelAllModeSchedules (BaseModeInstance *pMode)
 
- Static Protected Attributes inherited from BaseModeInstance
static GLOBAL_CONFIG_STRUCT g_GlobalConfig
 The global configuration.
 

Detailed Description

Message box mode.

Member Enumeration Documentation

◆ MessageBoxReturnCodes

Special return codes.

Enumerator
QUIT_GAME 

Quit the game.

Member Function Documentation

◆ Free()

virtual int MessageBoxMode::Free ( )
protectedvirtual

De-initialize this mode.

Returns
Returns a non-zero value if an error occured. An exception will be thrown if a non-zero value is encountered.

Implements BaseModeInstance.

◆ Init()

virtual int MessageBoxMode::Init ( )
protectedvirtual

Initialize this mode.

Returns
Returns a non-zero value if an error occured. On this occasion, DoMode() will not continue execution.

Implements BaseModeInstance.

◆ ProcessMouse()

virtual void MessageBoxMode::ProcessMouse ( GUI_POINT  mouse_point)
protectedvirtual

Process this menu's mouse.

Parameters
mouse_pointThe mouse point.

Implements BaseModeInstance.

◆ ShowMessageBox()

static int MessageBoxMode::ShowMessageBox ( const char *  pTitle,
const char *  pMessage,
MessageBoxButton pButtons,
int  iButtonCount,
MessageBoxBusyFunc  pBusyFunc = NULL,
void *  pUserData = NULL,
MessageBoxConfigStruct pConfig = NULL 
)
static

Show a message box.

Parameters
pTitleThe title of the message box.
pMessageThe message to display.
pButtonsA pointer to an array holding messagebox buttons.
iButtonCountThe number of buttons in pButtons.
pBusyFuncThe function to run every frame. Can be NULL.
pUserDataThe user data to be passed into pBusyFunc. Can be NULL.
pConfigThe configuration for the messagebox.
Returns
Returns the selected button index, or one of MessageBoxReturnCodes .

◆ ShowMessageBoxForOneFrame()

static bool MessageBoxMode::ShowMessageBoxForOneFrame ( const char *  pTitle,
const char *  pMessage,
MessageBoxButton pButtons,
int  iButtonCount,
MessageBoxConfigStruct pConfig = NULL 
)
static

Display a message box for this frame only.

Parameters
pTitleThe title of the message box.
pMessageThe message to display.
pButtonsA pointer to an array holding messagebox buttons.
iButtonCountThe number of buttons in pButtons.
pConfigThe configuration for the messagebox.
Returns
Returns the selected button index, or one of MessageBoxReturnCodes .

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