Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Menu/UIButtonLabel.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: UIButtonLabel Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectUIButtonLabel *UIButtonLabel;
11
12
void UIButtonLabel_Update(void)
13
{
14
RSDK_THIS(UIButtonLabel);
15
16
if (self->textSprite != UIWidgets->textFrames) {
17
RSDK.SetSpriteAnimation(UIWidgets->textFrames, self->listID, &self->textAnimator, true, self->frameID);
18
self->textSprite = UIWidgets->textFrames;
19
}
20
}
21
22
void UIButtonLabel_LateUpdate(void) {}
23
24
void UIButtonLabel_StaticUpdate(void) {}
25
26
void UIButtonLabel_Draw(void)
27
{
28
RSDK_THIS(UIButtonLabel);
29
30
Vector2 drawPos;
31
drawPos.x = self->position.x;
32
drawPos.y = self->position.y;
33
34
RSDK.DrawSprite(&self->frameAnimator, &drawPos, false);
35
RSDK.DrawSprite(&self->textAnimator, &drawPos, false);
36
}
37
38
void UIButtonLabel_Create(void *data)
39
{
40
RSDK_THIS(UIButtonLabel);
41
42
self->active = ACTIVE_BOUNDS;
43
self->drawGroup = 2;
44
self->visible = true;
45
self->drawFX = FX_FLIP;
46
self->updateRange.x = 0x800000;
47
self->updateRange.y = 0x300000;
48
49
RSDK.SetSpriteAnimation(UIButtonLabel->aniFrames, 0, &self->frameAnimator, true, self->type);
50
RSDK.SetSpriteAnimation(UIWidgets->textFrames, self->listID, &self->textAnimator, true, self->frameID);
51
52
self->textSprite = UIWidgets->textFrames;
53
}
54
55
void UIButtonLabel_StageLoad(void) { UIButtonLabel->aniFrames = RSDK.LoadSpriteAnimation("UI/ButtonLabel.bin", SCOPE_STAGE); }
56
57
#if GAME_INCLUDE_EDITOR
58
void UIButtonLabel_EditorDraw(void)
59
{
60
RSDK_THIS(UIButtonLabel);
61
62
self->drawGroup = 2;
63
self->drawFX = FX_FLIP;
64
self->updateRange.x = 0x800000;
65
self->updateRange.y = 0x300000;
66
67
RSDK.SetSpriteAnimation(UIButtonLabel->aniFrames, 0, &self->frameAnimator, true, self->type);
68
RSDK.SetSpriteAnimation(UIWidgets->textFrames, self->listID, &self->textAnimator, true, self->frameID);
69
70
self->textSprite = UIWidgets->textFrames;
71
72
UIButtonLabel_Draw();
73
}
74
75
void UIButtonLabel_EditorLoad(void) { UIButtonLabel->aniFrames = RSDK.LoadSpriteAnimation("UI/ButtonLabel.bin", SCOPE_STAGE); }
76
#endif
77
78
void UIButtonLabel_Serialize(void)
79
{
80
RSDK_EDITABLE_VAR(UIButtonLabel, VAR_UINT8, type);
81
RSDK_EDITABLE_VAR(UIButtonLabel, VAR_ENUM, listID);
82
RSDK_EDITABLE_VAR(UIButtonLabel, VAR_ENUM, frameID);
83
}
84
85