-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIdolVillageEngine.cs
74 lines (58 loc) · 2.13 KB
/
IdolVillageEngine.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
62
63
64
65
66
67
68
69
70
71
72
73
74
using IdolVillage.Scenes;
using IdolVillage.Scenes.MainMenu;
using Raylib_cs;
namespace IdolVillage
{
internal class IdolVillageEngine
{
public static IdolVillageEngine Instance = new IdolVillageEngine();
public Camera2D Camera;
internal BaseScene ActiveScene;
internal Font Font;
public void StartGame()
{
//Raylib.SetConfigFlags(ConfigFlags.FLAG_WINDOW_TOPMOST);
//Raylib.SetConfigFlags(ConfigFlags.FLAG_WINDOW_MAXIMIZED);
//Raylib.SetConfigFlags(ConfigFlags.FLAG_WINDOW_UNDECORATED);
Raylib.InitWindow(1280, 768, "Idol Village");
var monitor = Raylib.GetCurrentMonitor();
var width = Raylib.GetMonitorWidth(monitor);
var height = Raylib.GetMonitorHeight(monitor);
//Raylib.SetWindowSize(width, height);
Raylib.SetTargetFPS(60);
Raylib.InitAudioDevice();
Raylib.SetExitKey(0);
Font = Raylib.LoadFont("Assets/Kenney/Fonts/Kenney-Mini.ttf");
//if (SettingsManager.Instance.Settings[SettingsManager.SettingKeys.Fullscreen] == 1)
//{
// Raylib.ToggleFullscreen();
//}
Camera = new Camera2D
{
Zoom = 1.0f,
Offset = new System.Numerics.Vector2(Raylib.GetScreenWidth() / 2, Raylib.GetScreenHeight() / 2),
};
ActiveScene = new MainMenuScene();
while (!Raylib.WindowShouldClose())
{
GameLoop();
}
}
public void GameLoop()
{
Raylib.BeginDrawing();
Raylib.BeginMode2D(Camera);
Raylib.ClearBackground(Color.RayWhite);
for (int i = 0; i < ActiveScene.Systems.Count; i++)
{
ActiveScene.Systems[i].Update(ActiveScene.World);
}
Raylib.EndMode2D();
for (int i = 0; i < ActiveScene.Systems.Count; i++)
{
ActiveScene.Systems[i].UpdateNoCamera(ActiveScene.World);
}
Raylib.EndDrawing();
}
}
}