]> git.r.bdr.sh - rbdr/super-polarity/blame_incremental - SuperPolarityMac/ScreenManager.cs
Works in win, compiles in mac
[rbdr/super-polarity] / SuperPolarityMac / ScreenManager.cs
... / ...
CommitLineData
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Microsoft.Xna.Framework;
6using Microsoft.Xna.Framework.Graphics;
7
8namespace SuperPolarity
9{
10 static class ScreenManager
11 {
12 static Stack<Screen> Screens;
13 static SuperPolarity Game;
14
15 static ScreenManager()
16 {
17 Screens = new Stack<Screen>();
18 }
19
20 static public void Push(Screen screen)
21 {
22 if (Screens.Count > 0)
23 {
24 Screens.Peek().Active = false;
25 }
26
27 screen.LoadContent();
28 screen.Active = true;
29 Screens.Push(screen);
30 }
31
32 static public void Pop()
33 {
34 var screen = Screens.Pop();
35 screen.Active = false;
36 screen.CleanUp();
37 Screens.Peek().Active = true;
38 }
39
40 static public void Update(GameTime gameTime)
41 {
42 Screens.Peek().Update(gameTime);
43 }
44
45 static public void Draw(SpriteBatch spriteBatch)
46 {
47 Screens.Peek().Draw(spriteBatch);
48 }
49
50 internal static void SetGame(SuperPolarity game)
51 {
52 Game = game;
53 }
54 }
55}