-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
116 lines (98 loc) · 3.89 KB
/
Program.cs
File metadata and controls
116 lines (98 loc) · 3.89 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
using Raylib_cs;
namespace RaylibCsExamples.Community.Core.BasicScreenManager;
internal enum GameScreen
{
Logo, Title, Gameplay, Ending
}
public class Program
{
public static int Main()
{
const int screenWidth = 800;
const int screenHeight = 450;
Raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic screen manaager");
var currentScreen = GameScreen.Logo;
var frameCounter = 0;
Raylib.SetTargetFPS(60);
while (!Raylib.WindowShouldClose())
{
switch (currentScreen)
{
case GameScreen.Logo:
{
frameCounter++;
if (frameCounter >= 120)
{
currentScreen = GameScreen.Title;
}
}
break;
case GameScreen.Title:
{
if (Raylib.IsKeyPressed(KeyboardKey.Enter) || Raylib.IsGestureDetected(Gesture.Tap))
{
currentScreen = GameScreen.Gameplay;
}
}
break;
case GameScreen.Gameplay:
{
if (Raylib.IsKeyPressed(KeyboardKey.Enter) || Raylib.IsGestureDetected(Gesture.Tap))
{
currentScreen = GameScreen.Ending;
}
}
break;
case GameScreen.Ending:
{
if (Raylib.IsKeyPressed(KeyboardKey.Enter) || Raylib.IsGestureDetected(Gesture.Tap))
{
currentScreen = GameScreen.Title;
}
}
break;
default:
break;
}
Raylib.BeginDrawing();
Raylib.ClearBackground(Color.RayWhite);
switch (currentScreen)
{
case GameScreen.Logo:
{
// TODO: Draw LOGO screen here!
Raylib.DrawText("LOGO SCREEN", 20, 20, 40, Color.LightGray);
Raylib.DrawText("WAIT for 2 SECONDS...", 290, 220, 20, Color.Gray);
}
break;
case GameScreen.Title:
{
// TODO: Draw TITLE screen here!
Raylib.DrawRectangle(0, 0, screenWidth, screenHeight, Color.Green);
Raylib.DrawText("TITLE SCREEN", 20, 20, 40, Color.DarkGreen);
Raylib.DrawText("PRESS ENTER or TAP to JUMP to GAMEPLAY SCREEN", 120, 220, 20, Color.DarkGreen);
}
break;
case GameScreen.Gameplay:
{
// TODO: Draw GAMEPLAY screen here!
Raylib.DrawRectangle(0, 0, screenWidth, screenHeight, Color.Purple);
Raylib.DrawText("GAMEPLAY SCREEN", 20, 20, 40, Color.Maroon);
Raylib.DrawText("PRESS ENTER or TAP to JUMP to ENDING SCREEN", 130, 220, 20, Color.Maroon);
}
break;
case GameScreen.Ending:
{
// TODO: Draw ENDING screen here!
Raylib.DrawRectangle(0, 0, screenWidth, screenHeight, Color.Blue);
Raylib.DrawText("ENDING SCREEN", 20, 20, 40, Color.DarkBlue);
Raylib.DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, Color.DarkBlue);
}
break;
}
Raylib.EndDrawing();
}
Raylib.CloseWindow();
return 0;
}
}