]> Dogcows Code - chaz/carfire/blobdiff - Project06/lobbyTest/lobbyTest/Game1.cs
Added states for lobby gui. Welcome, CreateGame, FindGame, and Connected. Welcome...
[chaz/carfire] / Project06 / lobbyTest / lobbyTest / Game1.cs
index fbb8e733c7fe77fe03cf911bf51b052f7421f7db..cac6219b2a6fbb54311f352832002a15ed366e42 100644 (file)
@@ -21,22 +21,7 @@ namespace lobbyTest
         GraphicsDeviceManager graphics;\r
         SpriteBatch spriteBatch;\r
 \r
-        Texture2D background;\r
-        Texture2D spotLight;\r
-        Texture2D cs;\r
-\r
-        Vector2 backgroundPos;\r
-        Vector2 spotLightPos;\r
-        Vector2 spotLightCenter;\r
-        Vector2 csPos;\r
-\r
-        Vector2 zero;\r
-        Vector2 spotLightVelocity;\r
-\r
-        int MaxX;\r
-        int MinX;\r
-        int MaxY;\r
-        int MinY;\r
+        lobbyGUI lbGui;\r
 \r
         public Game1()\r
         {\r
@@ -55,6 +40,7 @@ namespace lobbyTest
             // TODO: Add your initialization logic here\r
             graphics.PreferredBackBufferWidth = 800;\r
             graphics.PreferredBackBufferWidth = 600;\r
+            lbGui = new lobbyGUI();\r
             base.Initialize();\r
         }\r
 \r
@@ -66,22 +52,8 @@ namespace lobbyTest
         {\r
             // Create a new SpriteBatch, which can be used to draw textures.\r
             spriteBatch = new SpriteBatch(GraphicsDevice);\r
-            background = Content.Load<Texture2D>("background");\r
-            spotLight = Content.Load<Texture2D>("spotlight");\r
-            cs = Content.Load<Texture2D>("cs");\r
-            backgroundPos = new Vector2(0f, 0f);\r
-            spotLightPos = new Vector2(100f, graphics.GraphicsDevice.Viewport.Height - 98);\r
-            spotLightCenter = new Vector2(800f, 800f);\r
-            spotLightVelocity = new Vector2(-100, 33);\r
-            csPos = new Vector2(10f, graphics.GraphicsDevice.Viewport.Height - 98);\r
-  \r
-            zero = new Vector2(0, 0);\r
-\r
-            MaxX = graphics.GraphicsDevice.Viewport.Width;\r
-            MinX = 0;\r
-            MaxY = graphics.GraphicsDevice.Viewport.Height;\r
-            MinY = 100;\r
-            // TODO: use this.Content to load your game content here\r
+            lbGui.LoadContent(Content, graphics);\r
+            \r
         }\r
 \r
         /// <summary>\r
@@ -105,7 +77,8 @@ namespace lobbyTest
                 this.Exit();\r
 \r
             // TODO: Add your update logic here\r
-            UpdateSpotLight(gameTime);\r
+            lbGui.Update(gameTime);\r
+            \r
             base.Update(gameTime);\r
         }\r
 \r
@@ -117,28 +90,12 @@ namespace lobbyTest
         {\r
             GraphicsDevice.Clear(Color.CornflowerBlue);\r
             spriteBatch.Begin(SpriteBlendMode.AlphaBlend);\r
-            // TODO: Add your drawing code here\r
-            spriteBatch.Draw(background, backgroundPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0);\r
-            spriteBatch.Draw(cs, csPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0);\r
-            spriteBatch.Draw(spotLight, spotLightPos, null, Color.White, 0, spotLightCenter, 1f, SpriteEffects.None, 0);\r
 \r
+            lbGui.Draw(spriteBatch);\r
+            \r
             spriteBatch.End();\r
             base.Draw(gameTime);\r
         }\r
-\r
-        private void UpdateSpotLight(GameTime gameTime)\r
-        {\r
-            spotLightPos = new Vector2(spotLightPos.X + spotLightVelocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds,\r
-                                        spotLightPos.Y + spotLightVelocity.Y * (float)gameTime.ElapsedGameTime.TotalSeconds);\r
-\r
-            if (spotLightPos.X > MaxX || spotLightPos.X < MinX) //right or left wall\r
-            {\r
-                spotLightVelocity = new Vector2(spotLightVelocity.X * -1, spotLightVelocity.Y);\r
-            }\r
-            else if (spotLightPos.Y > MaxY || spotLightPos.Y < MinY) //top or bottom wall\r
-            {\r
-                spotLightVelocity = new Vector2(spotLightVelocity.X, spotLightVelocity.Y * -1);\r
-            }\r
-        }\r
+        \r
     }\r
 }\r
This page took 0.023957 seconds and 4 git commands to generate.