Add screens

This commit is contained in:
Julian
2021-05-14 10:40:55 +02:00
parent ff05d9a81b
commit f54b093615
3 changed files with 38 additions and 4 deletions

View File

@@ -1,11 +1,12 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
namespace Barbs namespace Barbs
{ {
class Program : Game class Program : Game, IDisposable
{ {
Texture2D ballTexture; Texture2D ballTexture;
private GraphicsDeviceManager graphics; private GraphicsDeviceManager graphics;
@@ -51,6 +52,12 @@ namespace Barbs
this.testLine.InitOnGraphicalDevice(GraphicsDevice); this.testLine.InitOnGraphicalDevice(GraphicsDevice);
} }
protected void Dispose()
{
//Cleanup
// OR Final call before shutdown
}
protected override void Update(GameTime gameTime) protected override void Update(GameTime gameTime)
{ {
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
@@ -82,8 +89,11 @@ namespace Barbs
static void Main(string[] args) static void Main(string[] args)
{ {
var pro = new Program();
pro.Run(); using (Program game = new Program())
{
game.Run();
}
} }
} }
} }

9
Screens/IScreen.cs Normal file
View File

@@ -0,0 +1,9 @@
namespace MyGame.Screens
{
public interface IScreen
{
void Update();
void Draw();
}
}

15
Screens/MenuScreen.cs Normal file
View File

@@ -0,0 +1,15 @@
namespace MyGame.Screens
{
public class MenuScreen : IScreen
{
public void Update()
{
}
public void Draw()
{
}
}
}