-
Notifications
You must be signed in to change notification settings - Fork 2
/
LevelSelect.cs
61 lines (52 loc) · 1.53 KB
/
LevelSelect.cs
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
namespace Nitemare3D
{
public class LevelSelect : Scene
{
const uint textX = 110;
const uint textY = 80;
public LevelSelect()
{
songid = MidiConsts.MIDI_FANTASIA;
pcx = new Pcx(Dat.Uif[ImageConsts.MENU_CHOOSEEPISODE]);
}
float enterTime = .1f;
float enterTimer = 0f;
int selection = 0;
const int episodeCount = 3;
public override void Update()
{
enterTimer += Time.dt;
if (enterTimer > enterTime)
{
if (Input.IsKeyDown(KeyboardKey.Down))
{
enterTimer = 0;
selection++;
}
if (Input.IsKeyDown(KeyboardKey.Up))
{
enterTimer = 0;
selection--;
}
if (selection < 0) { selection = 0; }
if (selection >= episodeCount) { selection = episodeCount - 1; }
if (Input.IsKeyDown(KeyboardKey.Enter))
{
FadeOut(Scene.LEVEL_GAME, 1f);
}
}
for (uint i = 1; i <= episodeCount; i++)
{
int color = (selection + 1 == i) ? 175 : 254;
uint y = textY + (i * 20) - 20;
GameWindow.DrawText(textX, y, "Episode " + i, color);
}
}
public override void Load()
{
}
public override void UnLoad()
{
}
}
}