Path: blob/master/SonicMania/Objects/Menu/UIDialog.h
338 views
#ifndef OBJ_UIDIALOG_H1#define OBJ_UIDIALOG_H23#include "Game.h"45#define UIDIALOG_OPTION_COUNT (3)67typedef enum {8DIALOG_YES,9DIALOG_NO,10DIALOG_OK,11DIALOG_CANCEL,12DIALOG_CONTINUE,13} DialogOptions;1415// Object Class16struct ObjectUIDialog {17RSDK_OBJECT18EntityUIDialog *activeDialog;19EntityUIControl *controlStore;20StateMachine(controlStateStore);21};2223// Entity Class24struct EntityUIDialog {25RSDK_ENTITY26StateMachine(state);27int32 timer;28int32 closeDelay;29String textInfo;30int32 buttonCount;31Vector2 bgRectSize;32Vector2 dialogPos;33EntityUIControl *parent;34Entity *entityPtr;35uint8 buttonFrames[UIDIALOG_OPTION_COUNT];36StateMachine(callbacks[UIDIALOG_OPTION_COUNT]);37bool32 closeOnSelect[UIDIALOG_OPTION_COUNT];38EntityUIButton *buttons[UIDIALOG_OPTION_COUNT];39StateMachine(closeCB);40bool32 playEventSfx;41bool32 useAltColor;42int32 lineLength[3];43int32 lineCount;44Animator animator;45};4647// Object Struct48extern ObjectUIDialog *UIDialog;4950// Standard Entity Events51void UIDialog_Update(void);52void UIDialog_LateUpdate(void);53void UIDialog_StaticUpdate(void);54void UIDialog_Draw(void);55void UIDialog_Create(void *data);56void UIDialog_StageLoad(void);57#if GAME_INCLUDE_EDITOR58void UIDialog_EditorDraw(void);59void UIDialog_EditorLoad(void);60#endif61void UIDialog_Serialize(void);6263// Extra Entity Functions64EntityUIDialog *UIDialog_CreateActiveDialog(String *msg);65void UIDialog_SetupText(EntityUIDialog *dialog, String *text);6667void UIDialog_AddButton(uint8 frame, EntityUIDialog *dialog, void (*callback)(void), bool32 closeOnSelect);68void UIDialog_Setup(EntityUIDialog *dialog);69void UIDialog_CloseOnSel_HandleSelection(EntityUIDialog *dialog, void (*callback)(void));70void UIDialog_DrawBGShapes(void);71void UIDialog_HandleButtonPositions(void);72void UIDialog_Close(void);73bool32 UIDialog_HandleAutoClose(void);74void UIDialog_ButtonActionCB(void);75void UIDialog_State_Appear(void);76void UIDialog_State_Idle(void);77void UIDialog_State_Close(void);7879// Some Helpers80EntityUIDialog *UIDialog_CreateDialogOk(String *text, void (*callback)(void), bool32 closeOnSelect);81EntityUIDialog *UIDialog_CreateDialogYesNo(String *text, void (*callbackYes)(void), void (*callbackNo)(void), bool32 closeOnSelect_Yes,82bool32 closeOnSelect_No);83EntityUIDialog *UIDialog_CreateDialogOkCancel(String *text, void (*callbackOk)(void), void (*callbackCancel)(void), bool32 closeOnSelect_Ok,84bool32 closeOnSelect_Cancel);8586#endif //! OBJ_UIDIALOG_H878889