-
Notifications
You must be signed in to change notification settings - Fork 0
/
state_pause.cpp
81 lines (57 loc) · 1.18 KB
/
state_pause.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "state_pause.h"
bool pauseHasInit = false;
unsigned short pauseframeCounter = 0;
void Pause()
{
if(!pauseHasInit)
{
Pause_Init(); // One-time initialization of menu state.
pauseHasInit = true;
}
Pause_Update();
Pause_Draw();
Pause_Input();
pauseframeCounter++; // Update frame counter for this state, resetting whenever it hits 32.
if(pauseframeCounter > 32)
{
pauseframeCounter = 0;
}
}
void Pause_Init()
{
// Copy PAUSED graphics to CB2
memcpy(&tile_mem[2][192], pausestuffTiles, pausestuffTilesLen);
}
void Pause_Input()
{
//Pushing start will push the Pause state onto the stack, starting the pause.
key_poll();
if(key_hit(KEY_START))
{
// Pop pause state & offload
Pause_Offload();
g_StateStack->states.pop();
}
}
void Pause_Update()
{
//Pause logic goes here
}
void Pause_Draw()
{
//Pause draw routines go here
// Write "PAUSED" on BG0.
SetTile(27, 10, 10, 96);
SetTile(27, 12, 10, 97);
SetTile(27, 14, 10, 98);
SetTile(27, 16, 10, 99);
SetTile(27, 18, 10, 100);
SetTile(27, 20, 10, 101);
// Update Objects
UpdateObjects();
}
void Pause_Offload()
{
// Clear BG0
memcpy(&se_mem[27][0], Blank, sizeof(u16)*32*32);
}