-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathShatteredPixelDungeonDash.cs
More file actions
124 lines (104 loc) · 3.38 KB
/
ShatteredPixelDungeonDash.cs
File metadata and controls
124 lines (104 loc) · 3.38 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
117
118
119
120
121
122
123
124
using System;
using OpenTK.Windowing.Desktop;
using watabou.noosa;
using watabou.noosa.audio;
using watabou.utils;
using spdd.scenes;
namespace spdd
{
public class ShatteredPixelDungeonDash : Game
{
////variable constants for specific older versions of shattered, used for data conversion
////versions older than v0.7.3b are no longer supported, and data from them is ignored
//public const int v0_7_3b = 349;
//public const int v0_7_4c = 362;
//public const int v0_7_5e = 382;
//
//public const int v0_8_0 = 412;
//public const int v0_8_1a = 422;
public const int v0_8_2 = 447;
private GameWindow gameWindow;
public ShatteredPixelDungeonDash(PlatformSupport platform, GameWindow gameWindow)
: base(sceneClass == null ? typeof(WelcomeScene) : sceneClass, platform)
{
this.gameWindow = gameWindow;
}
public override void Create(float density, int dispWidth, int dispHeight)
{
base.Create(density, dispWidth, dispHeight);
UpdateSystemUI();
SPDAction.LoadBindings();
Music.Instance.Enable(SPDSettings.Music());
Music.Instance.Volume(SPDSettings.MusicVol() * SPDSettings.MusicVol() / 100f);
Sample.Instance.Enable(SPDSettings.SoundFx());
Sample.Instance.Volume(SPDSettings.SFXVol() * SPDSettings.SFXVol() / 100f);
Sample.Instance.Load(Assets.Sounds.all);
}
// Class<? extends PixelScene>
public static void SwitchNoFade(Type c)
{
SwitchNoFade(c, null);
}
// Class<? extends PixelScene>
public static void SwitchNoFade(Type c, ISceneChangeCallback callback)
{
PixelScene.noFade = true;
SwitchScene(c, callback);
}
public static void SeamlessResetScene(ISceneChangeCallback callback)
{
if (Scene() is PixelScene)
{
((PixelScene)Scene()).SaveWindows();
SwitchNoFade(sceneClass, callback);
}
else
{
ResetScene();
}
}
public static void SeamlessResetScene()
{
SeamlessResetScene(null);
}
protected override void SwitchScene()
{
base.SwitchScene();
if (scene is PixelScene)
{
((PixelScene)scene).RestoreWindows();
}
}
public override void Resize(int width, int height)
{
if (width == 0 || height == 0)
return;
if (scene is PixelScene &&
(height != Game.height || width != Game.width))
{
PixelScene.noFade = true;
((PixelScene)scene).SaveWindows();
}
base.Resize(width, height);
UpdateDisplaySize();
}
public override void Destroy()
{
base.Destroy();
GameScene.EndActorThread();
}
public void UpdateDisplaySize()
{
platform.UpdateDisplaySize();
}
public static void UpdateSystemUI()
{
platform.UpdateSystemUI();
}
public override void Finish()
{
//gameWindow.Exit();
gameWindow.Close();
}
}
}