X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=Project06%2FlobbyTest%2FlobbyTest%2FGame1.cs;h=cac6219b2a6fbb54311f352832002a15ed366e42;hp=fbb8e733c7fe77fe03cf911bf51b052f7421f7db;hb=356c8e65fc38a3c44c9cee73c38f1bdccef2f30f;hpb=53c3423a7dc02531e793531bf7aee257786ee208 diff --git a/Project06/lobbyTest/lobbyTest/Game1.cs b/Project06/lobbyTest/lobbyTest/Game1.cs index fbb8e73..cac6219 100644 --- a/Project06/lobbyTest/lobbyTest/Game1.cs +++ b/Project06/lobbyTest/lobbyTest/Game1.cs @@ -21,22 +21,7 @@ namespace lobbyTest GraphicsDeviceManager graphics; SpriteBatch spriteBatch; - Texture2D background; - Texture2D spotLight; - Texture2D cs; - - Vector2 backgroundPos; - Vector2 spotLightPos; - Vector2 spotLightCenter; - Vector2 csPos; - - Vector2 zero; - Vector2 spotLightVelocity; - - int MaxX; - int MinX; - int MaxY; - int MinY; + lobbyGUI lbGui; public Game1() { @@ -55,6 +40,7 @@ namespace lobbyTest // TODO: Add your initialization logic here graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferWidth = 600; + lbGui = new lobbyGUI(); base.Initialize(); } @@ -66,22 +52,8 @@ namespace lobbyTest { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); - background = Content.Load("background"); - spotLight = Content.Load("spotlight"); - cs = Content.Load("cs"); - backgroundPos = new Vector2(0f, 0f); - spotLightPos = new Vector2(100f, graphics.GraphicsDevice.Viewport.Height - 98); - spotLightCenter = new Vector2(800f, 800f); - spotLightVelocity = new Vector2(-100, 33); - csPos = new Vector2(10f, graphics.GraphicsDevice.Viewport.Height - 98); - - zero = new Vector2(0, 0); - - MaxX = graphics.GraphicsDevice.Viewport.Width; - MinX = 0; - MaxY = graphics.GraphicsDevice.Viewport.Height; - MinY = 100; - // TODO: use this.Content to load your game content here + lbGui.LoadContent(Content, graphics); + } /// @@ -105,7 +77,8 @@ namespace lobbyTest this.Exit(); // TODO: Add your update logic here - UpdateSpotLight(gameTime); + lbGui.Update(gameTime); + base.Update(gameTime); } @@ -117,28 +90,12 @@ namespace lobbyTest { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteBlendMode.AlphaBlend); - // TODO: Add your drawing code here - spriteBatch.Draw(background, backgroundPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0); - spriteBatch.Draw(cs, csPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0); - spriteBatch.Draw(spotLight, spotLightPos, null, Color.White, 0, spotLightCenter, 1f, SpriteEffects.None, 0); + lbGui.Draw(spriteBatch); + spriteBatch.End(); base.Draw(gameTime); } - - private void UpdateSpotLight(GameTime gameTime) - { - spotLightPos = new Vector2(spotLightPos.X + spotLightVelocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds, - spotLightPos.Y + spotLightVelocity.Y * (float)gameTime.ElapsedGameTime.TotalSeconds); - - if (spotLightPos.X > MaxX || spotLightPos.X < MinX) //right or left wall - { - spotLightVelocity = new Vector2(spotLightVelocity.X * -1, spotLightVelocity.Y); - } - else if (spotLightPos.Y > MaxY || spotLightPos.Y < MinY) //top or bottom wall - { - spotLightVelocity = new Vector2(spotLightVelocity.X, spotLightVelocity.Y * -1); - } - } + } }