Path: blob/master/SonicMania/Objects/Menu/UIControl.h
338 views
#ifndef OBJ_UICONTROL_H1#define OBJ_UICONTROL_H23#include "Game.h"45#define UICONTROL_BUTTON_COUNT (64)6#if MANIA_USE_PLUS7#define UICONTROL_PROMPT_COUNT (4)8#endif910// Object Class11struct ObjectUIControl {12RSDK_OBJECT13bool32 isProcessingInput;14bool32 inputLocked;15bool32 lockInput;16bool32 upPress[PLAYER_COUNT];17bool32 downPress[PLAYER_COUNT];18bool32 leftPress[PLAYER_COUNT];19bool32 rightPress[PLAYER_COUNT];20bool32 backPress[PLAYER_COUNT];21bool32 confirmPress[PLAYER_COUNT];22bool32 yPress[PLAYER_COUNT];23bool32 xPress[PLAYER_COUNT];24#if MANIA_USE_PLUS25bool32 startPress[PLAYER_COUNT];26#endif27bool32 anyUpPress;28bool32 anyDownPress;29bool32 anyLeftPress;30bool32 anyRightPress;31bool32 anyConfirmPress;32bool32 anyBackPress;33bool32 anyYPress;34bool32 anyXPress;35#if MANIA_USE_PLUS36bool32 anyStartPress;37#endif38bool32 forceBackPress;39bool32 hasTouchInput;40int32 timer;41int32 unused1;42uint16 aniFrames;43};4445// Entity Class46struct EntityUIControl {47RSDK_ENTITY48StateMachine(state);49int32 unused1;50int32 buttonID;51String tag;52String parentTag;53bool32 activeOnLoad;54bool32 noWidgets;55bool32 resetSelection;56uint8 buttonCount;57#if MANIA_USE_PLUS58uint8 promptCount;59#endif60uint8 rowCount;61uint8 columnCount;62uint8 startingID;63Vector2 size;64Vector2 cameraOffset;65Vector2 scrollSpeed;66#if MANIA_USE_PLUS67bool32 noClamp;68bool32 noWrap;69#endif70Vector2 startPos;71Vector2 targetPos;72bool32 childHasFocus;73bool32 dialogHasFocus;74#if MANIA_USE_PLUS75bool32 popoverHasFocus;76#endif77bool32 hasStoredButton;78bool32 selectionDisabled;79#if MANIA_USE_PLUS80bool32 menuWasSetup;81#endif82int32 backoutTimer;83int32 storedButtonID;84int32 lastButtonID;85EntityUIHeading *heading;86EntityUIShifter *shifter;87#if MANIA_USE_PLUS88EntityUICarousel *carousel;89EntityUIButtonPrompt *prompts[UICONTROL_PROMPT_COUNT];90#endif91EntityUIButton *buttons[UICONTROL_BUTTON_COUNT];92bool32 (*backPressCB)(void);93void (*processButtonInputCB)(void);94void (*menuSetupCB)(void);95void (*menuUpdateCB)(void);96void (*yPressCB)(void);97void (*xPressCB)(void);98int32 unused2;99int32 unused3;100int32 unused4;101int32 unused5;102int32 unused6;103int32 unused7;104};105106// Object Struct107extern ObjectUIControl *UIControl;108109// Standard Entity Events110void UIControl_Update(void);111void UIControl_LateUpdate(void);112void UIControl_StaticUpdate(void);113void UIControl_Draw(void);114void UIControl_Create(void *data);115void UIControl_StageLoad(void);116#if GAME_INCLUDE_EDITOR117void UIControl_EditorDraw(void);118void UIControl_EditorLoad(void);119#endif120void UIControl_Serialize(void);121122// Extra Entity Functions123int32 UIControl_GetButtonID(EntityUIControl *control, EntityUIButton *entity);124void UIControl_MenuChangeButtonInit(EntityUIControl *control);125126#if MANIA_USE_PLUS127void UIControl_SetActiveMenuButtonPrompts(EntityUIControl *entity);128#endif129void UIControl_SetActiveMenu(EntityUIControl *entity);130void UIControl_SetMenuLostFocus(EntityUIControl *entity);131void UIControl_SetInactiveMenu(EntityUIControl *entity);132void UIControl_SetupButtons(void);133134EntityUIControl *UIControl_GetUIControl(void);135bool32 UIControl_isMoving(EntityUIControl *entity);136void UIControl_MatchMenuTag(const char *text);137void UIControl_HandleMenuChange(String *newMenuTag);138void UIControl_HandleMenuLoseFocus(EntityUIControl *parent);139void UIControl_ReturnToParentMenu(void);140141void UIControl_ClearInputs(uint8 buttonID);142#if MANIA_USE_PLUS143void UIControl_SetTargetPos(EntityUIControl *entity, int32 x, int32 y);144#endif145void UIControl_HandlePosition(void);146void UIControl_ProcessInputs(void);147void UIControl_ProcessButtonInput(void);148bool32 UIControl_ContainsPos(EntityUIControl *control, Vector2 *pos);149150#endif //! OBJ_UICONTROL_H151152153