-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSceneMenu.cs
65 lines (53 loc) · 1.81 KB
/
SceneMenu.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
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Media;
namespace BCEngine
{
public class SceneMenu : Scene
{
private Button btnPlay;
Rectangle Screen;
private Song music;
public SceneMenu(MainGame pGame) : base(pGame)
{
}
public void onClickPlay(Button pSender)
{
MediaPlayer.Stop();
mainGame.gameState.changeScene(GameState.SceneType.Gameplay);
}
public override void Load()
{
Screen = mainGame.Window.ClientBounds;
AssetManager.LoadTexture2D(mainGame.Content,"button");
btnPlay = new Button();
btnPlay.Texture = AssetManager.GetTexture2D("button");
btnPlay.Position = new Vector2(Screen.Width/2-btnPlay.Texture.Width/2,Screen.Height/2-btnPlay.Texture.Height/2);
btnPlay.onClick = onClickPlay;
listActor.Add(btnPlay);
// Music
AssetManager.LoadSong(mainGame.Content,"cool");
music = AssetManager.GetSong("cool");
MediaPlayer.Play(music);
MediaPlayer.IsRepeating=true;
base.Load();
}
public override void Unload()
{
base.Unload();
}
public override void Update(GameTime gameTime)
{
// Debug.WriteLine("Updating Scene Menu...");
base.Update(gameTime);
}
public override void Draw(GameTime gameTime)
{
// Debug.WriteLine("Drawing Scene Menu...");
mainGame.spriteBatch.Begin();
mainGame.spriteBatch.DrawString(AssetManager.MainFont, "This is the Menu", new Vector2(1, 1), Color.Blue);
mainGame.spriteBatch.End();
base.Draw(gameTime);
}
}
}