|
Cavestory Mod API
|
A helpful 2D vector class to manage mode input. More...
#include <ModeInputVector.h>
Public Member Functions | |
| ModeInputVector () | |
| Constructor. | |
| ~ModeInputVector () | |
| Deconstructor. | |
| void | SetMinArraySize (ModeInputOptionCoord iWidth, ModeInputOptionCoord iHeight) |
| Set the minimum size for this vector. More... | |
| bool | AddOption (ModeInputSelectionId iSelectionId, ModeInputOptionCoord iX, ModeInputOptionCoord iY, ModeInputOptionCoord iW, ModeInputOptionCoord iH, GUI_RECT *pRect, ScrollAreaInfo *pScroll=NULL, GUI_RECT *pClipRect=NULL, const char *pTooltipText=NULL, ModeInputOptionConfig *pConfig=NULL, unsigned int iFlags=0) |
| Add an option to the vector. More... | |
| bool | AddOption (ModeInputSelectionId iSelectionId, ModeInputOptionCoord iX, ModeInputOptionCoord iY, ModeInputOptionCoord iW, ModeInputOptionCoord iH, GuiBase *pGui, ScrollAreaInfo *pScroll=NULL, GUI_RECT *pClipRect=NULL, const char *pTooltipText=NULL, ModeInputOptionConfig *pConfig=NULL, unsigned int iFlags=0) |
| Add an option to the vector. More... | |
| bool | AddOption (ModeInputSelectionId iSelectionId, ModeInputOptionCoord iX, ModeInputOptionCoord iY, ModeInputOptionCoord iW, ModeInputOptionCoord iH, GUI_RECT pRect, ScrollAreaInfo *pScroll=NULL, GUI_RECT *pClipRect=NULL, const char *pTooltipText=NULL, ModeInputOptionConfig *pConfig=NULL, unsigned int iFlags=0) |
| Add an option to the vector. More... | |
| bool | AddOption (ModeInputSelectionId iSelectionId, GUI_RECT *pRect, ScrollAreaInfo *pScroll=NULL, GUI_RECT *pClipRect=NULL, const char *pTooltipText=NULL, ModeInputOptionConfig *pConfig=NULL, unsigned int iFlags=0) |
| Add an unselectable option to the vector. More... | |
| bool | AddOption (ModeInputSelectionId iSelectionId, GuiBase *pGui, ScrollAreaInfo *pScroll=NULL, GUI_RECT *pClipRect=NULL, const char *pTooltipText=NULL, ModeInputOptionConfig *pConfig=NULL, unsigned int iFlags=0) |
| Add an unselectable option to the vector. More... | |
| bool | AddOption (ModeInputSelectionId iSelectionId, GUI_RECT pRect, ScrollAreaInfo *pScroll=NULL, GUI_RECT *pClipRect=NULL, const char *pTooltipText=NULL, ModeInputOptionConfig *pConfig=NULL, unsigned int iFlags=0) |
| Add an unselectable option to the vector. More... | |
| bool | RemoveOption (ModeInputSelectionId iSelectionId) |
| Remove an option by ID. More... | |
| bool | AddScroll (ScrollAreaInfo *pScroll) |
| Add a controllable scroll area. More... | |
| void | Reset () |
| Reset everything – Unallocates all buffers and resets all variables. | |
| ModeInputButtonState | GetOptionState (ModeInputSelectionId iSelectionId) |
| Get the selected button's determined state. More... | |
| GUI_RECT | GetOptionRect (ModeInputSelectionId iSelectionId) |
| Get the rect for an option. More... | |
| void | SetSelectionByPos (int iX, int iY, bool bUsedKeyboard, bool bOpenTooltip=true) |
| Set the selected option. More... | |
| void | SetSelectionById (ModeInputSelectionId iSelectionId, bool bUsedKeyboard) |
| Set the selected selection ID. More... | |
| GUI_POINT | GetSelectedPos () |
| Get the selected position. More... | |
| int | GetSelectedId () |
| Get the selected ID. More... | |
| int | GetSelectedIndex () |
| Get the selected index. More... | |
| bool | WasKeyboardUsed () |
| Self explanatory. More... | |
| void | SetModeOwner (BaseModeInstance *pMode) |
| Set the mode to use for processing. More... | |
| GUI_POINT | GetArraySize () |
| Get the array's dimensions. More... | |
| int | MoveSelection (int iXM, int iYM) |
| Move the current selection. More... | |
| int | ProcessKeys (int *iSelectedOutTrg) |
| Process key input for the vector. More... | |
| int | ProcessMouse (int *iSelectedOutTrg, GUI_POINT pMousePoint) |
| Process mouse input. More... | |
| void | Lock () |
| Lock the input vector from rebuilding its array. | |
| void | Unlock () |
| Allow the vector to rebuild its array if necessary. | |
| void | DumpMap () |
| Dump the input map. | |
Public Attributes | |
| bool | m_Clicking |
| Are we clicking on the selected option whilst hovering over it? Don't change this. | |
| bool | m_Hovering |
| Are we hovering over the selected option? Don't change this. | |
Protected Member Functions | |
| bool | RebuildArray () |
| Rebuild the m_Array array. More... | |
| bool | IndexOptions () |
| Index all options. More... | |
| ModeInputOption * | AllocateOption () |
| Allocate an option. More... | |
| ModeInputOption * | FindOptionById (ModeInputSelectionId iSelectionId, int *pIndexPtr=NULL) |
| Find an option by ID. More... | |
| GUI_RECT | Internal_GetOptionRect (ModeInputOption *pOption) |
| Get the screen rect for an option. More... | |
| ModeInputOption * | Internal_AddOption (ModeInputSelectionId iSelectionId, ModeInputOptionCoord iX, ModeInputOptionCoord iY, ModeInputOptionCoord iW, ModeInputOptionCoord iH, ScrollAreaInfo *pScroll, GUI_RECT *pClipRect, char *pTooltipText, ModeInputOptionConfig *pConfig, unsigned int iFlags) |
| The general internal method to add an option. More... | |
| void | SetTooltip (ModeInputOption *pOption) |
| Open an option's tooltip. More... | |
| bool | IsTooltipSetTo (ModeInputOption *pOption) |
| Test to see if the current tooltip is set to an option. More... | |
A helpful 2D vector class to manage mode input.
A 2D vector of ModeInputOption objects that allow mode instances to manage their key & mouse input in a neat & uniform fashion.
| bool ModeInputVector::AddOption | ( | ModeInputSelectionId | iSelectionId, |
| GUI_RECT * | pRect, | ||
| ScrollAreaInfo * | pScroll = NULL, |
||
| GUI_RECT * | pClipRect = NULL, |
||
| const char * | pTooltipText = NULL, |
||
| ModeInputOptionConfig * | pConfig = NULL, |
||
| unsigned int | iFlags = 0 |
||
| ) |
Add an unselectable option to the vector.
| iSelectionId | The ID that should be returned by ProcessMouse or ProcessKeys if this option is selected. |
| pRect | A pointer to the on-screen rect. |
| pScroll | The scroll object that this rect is controlled by. Can be NULL. |
| pClipRect | The clip rect for this option. Can be NULL. |
| pTooltipText | The tooltip text for this option. Can be NULL to disable tooltips for this option. |
| pConfig | The advanced configuration to use for this option. Can be NULL to use default configuration settings. |
| bool ModeInputVector::AddOption | ( | ModeInputSelectionId | iSelectionId, |
| GUI_RECT | pRect, | ||
| ScrollAreaInfo * | pScroll = NULL, |
||
| GUI_RECT * | pClipRect = NULL, |
||
| const char * | pTooltipText = NULL, |
||
| ModeInputOptionConfig * | pConfig = NULL, |
||
| unsigned int | iFlags = 0 |
||
| ) |
Add an unselectable option to the vector.
| iSelectionId | The ID that should be returned by ProcessMouse or ProcessKeys if this option is selected. |
| iX | The X position of the input option in the vector. |
| iY | The Y position of the input option in the vector. |
| iW | The width of the input option in the vector. |
| iH | The height of the input option in the vector. |
| pRect | The plain on-screen rect for this option. |
| pScroll | The scroll object that this rect is controlled by. Can be NULL. |
| pClipRect | The clip rect for this option. Can be NULL. |
| pTooltipText | The tooltip text for this option. Can be NULL to disable tooltips for this option. |
| pConfig | The advanced configuration to use for this option. Can be NULL to use default configuration settings. |
| bool ModeInputVector::AddOption | ( | ModeInputSelectionId | iSelectionId, |
| GuiBase * | pGui, | ||
| ScrollAreaInfo * | pScroll = NULL, |
||
| GUI_RECT * | pClipRect = NULL, |
||
| const char * | pTooltipText = NULL, |
||
| ModeInputOptionConfig * | pConfig = NULL, |
||
| unsigned int | iFlags = 0 |
||
| ) |
Add an unselectable option to the vector.
| iSelectionId | The ID that should be returned by ProcessMouse or ProcessKeys if this option is selected. |
| iX | The X position of the input option in the vector. |
| iY | The Y position of the input option in the vector. |
| iW | The width of the input option in the vector. |
| iH | The height of the input option in the vector. |
| pGui | A pointer to the guibase that controls this option. |
| pScroll | The scroll object that this rect is controlled by. Can be NULL. |
| pClipRect | The clip rect for this option. Can be NULL. |
| pTooltipText | The tooltip text for this option. Can be NULL to disable tooltips for this option. |
| pConfig | The advanced configuration to use for this option. Can be NULL to use default configuration settings. |
| bool ModeInputVector::AddOption | ( | ModeInputSelectionId | iSelectionId, |
| ModeInputOptionCoord | iX, | ||
| ModeInputOptionCoord | iY, | ||
| ModeInputOptionCoord | iW, | ||
| ModeInputOptionCoord | iH, | ||
| GUI_RECT * | pRect, | ||
| ScrollAreaInfo * | pScroll = NULL, |
||
| GUI_RECT * | pClipRect = NULL, |
||
| const char * | pTooltipText = NULL, |
||
| ModeInputOptionConfig * | pConfig = NULL, |
||
| unsigned int | iFlags = 0 |
||
| ) |
Add an option to the vector.
| iSelectionId | The ID that should be returned by ProcessMouse or ProcessKeys if this option is selected. |
| iX | The X position of the input option in the vector. |
| iY | The Y position of the input option in the vector. |
| iW | The width of the input option in the vector. |
| iH | The height of the input option in the vector. |
| pRect | A pointer to the on-screen rect. |
| pScroll | The scroll object that this rect is controlled by. Can be NULL. |
| pClipRect | The clip rect for this option. Can be NULL. |
| pTooltipText | The tooltip text for this option. Can be NULL to disable tooltips for this option. |
| pConfig | The advanced configuration to use for this option. Can be NULL to use default configuration settings. |
| bool ModeInputVector::AddOption | ( | ModeInputSelectionId | iSelectionId, |
| ModeInputOptionCoord | iX, | ||
| ModeInputOptionCoord | iY, | ||
| ModeInputOptionCoord | iW, | ||
| ModeInputOptionCoord | iH, | ||
| GUI_RECT | pRect, | ||
| ScrollAreaInfo * | pScroll = NULL, |
||
| GUI_RECT * | pClipRect = NULL, |
||
| const char * | pTooltipText = NULL, |
||
| ModeInputOptionConfig * | pConfig = NULL, |
||
| unsigned int | iFlags = 0 |
||
| ) |
Add an option to the vector.
| iSelectionId | The ID that should be returned by ProcessMouse or ProcessKeys if this option is selected. |
| iX | The X position of the input option in the vector. |
| iY | The Y position of the input option in the vector. |
| iW | The width of the input option in the vector. |
| iH | The height of the input option in the vector. |
| pRect | The plain on-screen rect for this option. |
| pScroll | The scroll object that this rect is controlled by. Can be NULL. |
| pClipRect | The clip rect for this option. Can be NULL. |
| pTooltipText | The tooltip text for this option. Can be NULL to disable tooltips for this option. |
| pConfig | The advanced configuration to use for this option. Can be NULL to use default configuration settings. |
| bool ModeInputVector::AddOption | ( | ModeInputSelectionId | iSelectionId, |
| ModeInputOptionCoord | iX, | ||
| ModeInputOptionCoord | iY, | ||
| ModeInputOptionCoord | iW, | ||
| ModeInputOptionCoord | iH, | ||
| GuiBase * | pGui, | ||
| ScrollAreaInfo * | pScroll = NULL, |
||
| GUI_RECT * | pClipRect = NULL, |
||
| const char * | pTooltipText = NULL, |
||
| ModeInputOptionConfig * | pConfig = NULL, |
||
| unsigned int | iFlags = 0 |
||
| ) |
Add an option to the vector.
| iSelectionId | The ID that should be returned by ProcessMouse or ProcessKeys if this option is selected. |
| iX | The X position of the input option in the vector. |
| iY | The Y position of the input option in the vector. |
| iW | The width of the input option in the vector. |
| iH | The height of the input option in the vector. |
| pGui | A pointer to the guibase that controls this option. |
| pScroll | The scroll object that this rect is controlled by. Can be NULL. |
| pClipRect | The clip rect for this option. Can be NULL. |
| pTooltipText | The tooltip text for this option. Can be NULL to disable tooltips for this option. |
| pConfig | The advanced configuration to use for this option. Can be NULL to use default configuration settings. |
| bool ModeInputVector::AddScroll | ( | ScrollAreaInfo * | pScroll | ) |
Add a controllable scroll area.
| pScroll | A pointer to the ScrollAreaInfo element. |
|
protected |
Allocate an option.
|
protected |
Find an option by ID.
| iSelectionId | The ID of the option. |
| pIndexPtr | A pointer to an int that will store the index that the option was found at. Can be NULL. |
| GUI_POINT ModeInputVector::GetArraySize | ( | ) |
Get the array's dimensions.
| GUI_RECT ModeInputVector::GetOptionRect | ( | ModeInputSelectionId | iSelectionId | ) |
Get the rect for an option.
| iSelectionId | The ID of the option. |
| ModeInputButtonState ModeInputVector::GetOptionState | ( | ModeInputSelectionId | iSelectionId | ) |
Get the selected button's determined state.
| iSelectionId | The ID of the option to get the state of. |
| int ModeInputVector::GetSelectedId | ( | ) |
Get the selected ID.
| int ModeInputVector::GetSelectedIndex | ( | ) |
Get the selected index.
| GUI_POINT ModeInputVector::GetSelectedPos | ( | ) |
Get the selected position.
|
protected |
Index all options.
|
protected |
The general internal method to add an option.
All AddOption methods call this method.
| iSelectionId | The ID that should be returned by ProcessMouse or ProcessKeys if this option is selected. |
| iX | The X position of the input option in the vector. |
| iY | The Y position of the input option in the vector. |
| iW | The width of the input option in the vector. |
| iH | The height of the input option in the vector. |
| pRect | A pointer to the on-screen rect. |
| pScroll | The scroll object that this rect is controlled by. Can be NULL. |
| pClipRect | The clip rect for this option. Can be NULL. |
| pTooltipText | The tooltip text for this option. Can be NULL to disable tooltips for this option. |
| iFlags | The flags for this option. |
| pConfig | The advanced configuration to use for this option. Can be NULL to use default configuration settings. |
|
inlineprotected |
Get the screen rect for an option.
| pOption | The option to get the rect of. |
|
protected |
Test to see if the current tooltip is set to an option.
| pOption | The option to compare against. |
| int ModeInputVector::MoveSelection | ( | int | iXM, |
| int | iYM | ||
| ) |
Move the current selection.
| iXM | The amount to move X by. |
| iYM | The amount to move Y by. |
| int ModeInputVector::ProcessKeys | ( | int * | iSelectedOutTrg | ) |
Process key input for the vector.
| iSelectedOutTrg | A pointer to an int that will store the selected option's ID for one frame if it is selected. |
| int ModeInputVector::ProcessMouse | ( | int * | iSelectedOutTrg, |
| GUI_POINT | pMousePoint | ||
| ) |
Process mouse input.
| iSelectedOutTrg | A pointer to an int that will store the selected option's ID for one frame if it is selected. |
| pMousePoint | The mouse position. |
|
protected |
Rebuild the m_Array array.
| bool ModeInputVector::RemoveOption | ( | ModeInputSelectionId | iSelectionId | ) |
Remove an option by ID.
| iSelectionId | The ID that should be removed. |
| void ModeInputVector::SetMinArraySize | ( | ModeInputOptionCoord | iWidth, |
| ModeInputOptionCoord | iHeight | ||
| ) |
Set the minimum size for this vector.
| iWidth | The minimum width. |
| iHeight | The minimum height. |
|
inline |
Set the mode to use for processing.
| pMode | The mode to use. |
| void ModeInputVector::SetSelectionById | ( | ModeInputSelectionId | iSelectionId, |
| bool | bUsedKeyboard | ||
| ) |
Set the selected selection ID.
| iSelectionId | The ID that should be selected. |
| bUsedKeyboard | Whether this should be considered as "We used the keyboard to get to this position" or "we used the mouse to get to this position". |
| void ModeInputVector::SetSelectionByPos | ( | int | iX, |
| int | iY, | ||
| bool | bUsedKeyboard, | ||
| bool | bOpenTooltip = true |
||
| ) |
Set the selected option.
| iX | The desired X position. |
| iY | The desired Y position. |
| bUsedKeyboard | Whether this should be considered as "We used the keyboard to get to this position" or "we used the mouse to get to this position". |
| bOpenTooltip | Whether to open the tooltip for this option as well. |
|
protected |
Open an option's tooltip.
| pOption | The option to use. |
|
inline |
Self explanatory.