/
SplashScreenState.cs
83 lines (66 loc) · 2.21 KB
/
SplashScreenState.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
75
76
77
78
79
80
81
82
83
using System;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
using Engine;
using OpenTK.Input;
using System.Drawing;
using Tao.DevIl;
// P/Invoke
using System.Runtime.InteropServices;
namespace U5Designs
{
/** Main Menu State of the game that will be active while the Main Menu is up **/
class SplashScreenState : GameState
{
internal GameEngine eng;
double timeTilMain = 0.0f;
Texture logo;
// // WILL NEED TO BE MOVED SOMEWHERE ELSE
public SplashScreenState(GameEngine engine)
{
eng = engine;
logo = eng.StateTextureManager.GetTexture("logo");
// Graphics
GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL.Enable(EnableCap.Texture2D);
GL.BindTexture(TextureTarget.Texture2D, logo.Id);
//GL.MatrixMode(MatrixMode.Projection);
Matrix4 projection = Matrix4.CreateOrthographic(1280, 720, 0.0f, 1.0f);
GL.LoadMatrix(ref projection);
}
public override void Update(FrameEventArgs e)
{
timeTilMain += e.Time;
//Minus - Toggle fullscreen
if(eng.Keyboard[Key.Minus]) {
eng.toggleFullScreen();
}
#if DEBUG
if(eng.Keyboard[Key.Enter]) {
MainMenuState mms = new MainMenuState(eng);
mms.loadPlayState(0);
// mms.musicFile.Stop();
// eng.ChangeState(new PlayState(eng, mms));
// eng.GameInProgress = true;
}
#endif
if (timeTilMain > 2)
{
MainMenuState ms = new MainMenuState(eng);
//eng.StateTextureManager.Dispose();
eng.ChangeState(ms);
//eng.GameInProgress = true;
}
}
public override void Draw(FrameEventArgs e)
{
GL.Clear(ClearBufferMask.AccumBufferBit | ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);
GL.ClearColor(1.0f, 1.0f, 1.0f, 1.0f);
logo.Draw2DTexture(0, 0, 0.5f, 0.5f);
}
}
}