-
Notifications
You must be signed in to change notification settings - Fork 0
/
state_win.cpp
58 lines (43 loc) · 885 Bytes
/
state_win.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
#include "state_win.h"
bool winHasInit = false;
unsigned short winframeCounter = 0;
void Win()
{
if(!winHasInit)
{
Win_Init(); // One-time initialization of state
winHasInit = true;
}
Win_Input();
Win_Update();
Win_Draw();
winframeCounter++; // Update frame counter for this state, resetting whenever it hits 32.
if(winframeCounter > 32)
{
winframeCounter = 0;
}
}
void Win_Init()
{
// Set graphics mode to Mode 4 - Palette-Based Bitmap Mode
REG_DISPCNT = DCNT_MODE4 | DCNT_BG2;
// Load palette from file
memcpy(pal_bg_mem, businessPal, businessPalLen);
// Load graphics from file
memcpy(vid_mem, businessBitmap, businessBitmapLen);
}
void Win_Input()
{
}
void Win_Update()
{
}
void Win_Draw()
{
//Nothing to be done.
}
void Win_Offload()
{
memset(vid_mem, 0, 76800); // Wipe Video Memory
memset(pal_bg_mem, 0, 64); // Clear Palette
}