-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoadState.cs
66 lines (56 loc) · 1.58 KB
/
LoadState.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MetalLib;
using MetalLib.GameStructure;
using MetalLib.GameWorld;
using MetalLib.Pencil.Gaming;
using Pencil.Gaming;
using Pencil.Gaming.Graphics;
using Pencil.Gaming.MathUtils;
using Pencil.Gaming.Audio;
namespace MiniLD50
{
class LoadState : GameState
{
private Sprite ratingScreen;
private float alpha = 1f;
private bool begin = false;
public LoadState()
{
ContentManager.LoadTexture(GameUtils.GetAppPath() + "/content/states/rating.png", "rating");
ratingScreen = new Sprite("rating", new Vector2(640 / 2, 480 / 2));
}
public override void Update(GameLoop gameLoop)
{
if (begin)
{
alpha += 0.0005f;
if (alpha >= 1)
{
gameLoop.ActiveGameState = new MenuState();
}
}
else
{
alpha -= 0.0005f;
begin = (alpha <= 0);
}
}
public override void Draw()
{
ratingScreen.Draw();
GL.Enable(EnableCap.Blend);
GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);
GL.Begin(BeginMode.Quads);
GL.Color4(0, 0, 0, alpha);
GL.Vertex2(0, 0);
GL.Vertex2(640, 0);
GL.Vertex2(640, 480);
GL.Vertex2(0, 480);
GL.End();
GL.Disable(EnableCap.Blend);
}
}
}