From 7b8a082e632eeaaae72e09acef22222f3f0b5735 Mon Sep 17 00:00:00 2001 From: imon Date: Wed, 19 Sep 2012 13:11:00 +0200 Subject: [PATCH 1/2] Changed the name of the "Game1" class to "Core" --- DepthsBelow/DepthsBelow/{Game1.cs => Core.cs} | 218 +++++++++--------- DepthsBelow/DepthsBelow/Program.cs | 42 ++-- DepthsBelow/DepthsBelow/Soldier.cs | 92 ++++---- 3 files changed, 176 insertions(+), 176 deletions(-) rename DepthsBelow/DepthsBelow/{Game1.cs => Core.cs} (94%) diff --git a/DepthsBelow/DepthsBelow/Game1.cs b/DepthsBelow/DepthsBelow/Core.cs similarity index 94% rename from DepthsBelow/DepthsBelow/Game1.cs rename to DepthsBelow/DepthsBelow/Core.cs index 58e33bb..54c3ad1 100644 --- a/DepthsBelow/DepthsBelow/Game1.cs +++ b/DepthsBelow/DepthsBelow/Core.cs @@ -1,109 +1,109 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.GamerServices; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Media; - -namespace DepthsBelow -{ - /// - /// This is the main type for your game - /// - public class Game1 : Microsoft.Xna.Framework.Game - { - GraphicsDeviceManager graphics; - SpriteBatch spriteBatch; - - Soldier soldier; - - public Game1() - { - graphics = new GraphicsDeviceManager(this); - Content.RootDirectory = "Content"; - - graphics.PreferredBackBufferWidth = 1280; - graphics.PreferredBackBufferHeight = 720; - graphics.IsFullScreen = true; - - - this.IsMouseVisible = true; - } - - /// - /// Allows the game to perform any initialization it needs to before starting to run. - /// This is where it can query for any required services and load any non-graphic - /// related content. Calling base.Initialize will enumerate through any components - /// and initialize them as well. - /// - protected override void Initialize() - { - // TODO: Add your initialization logic here - - base.Initialize(); - } - - /// - /// LoadContent will be called once per game and is the place to load - /// all of your content. - /// - protected override void LoadContent() - { - // Create a new SpriteBatch, which can be used to draw textures. - spriteBatch = new SpriteBatch(GraphicsDevice); - - // TODO: use this.Content to load your game content here - Soldier.LoadContent(this); - soldier = new Soldier(this); - - } - - /// - /// UnloadContent will be called once per game and is the place to unload - /// all content. - /// - protected override void UnloadContent() - { - // TODO: Unload any non ContentManager content here - } - - /// - /// Allows the game to run logic such as updating the world, - /// checking for collisions, gathering input, and playing audio. - /// - /// Provides a snapshot of timing values. - protected override void Update(GameTime gameTime) - { - // Allows the game to exit - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) - this.Exit(); - - // TODO: Add your update logic here - soldier.Update(gameTime); - - base.Update(gameTime); - } - - /// - /// This is called when the game should draw itself. - /// - /// Provides a snapshot of timing values. - protected override void Draw(GameTime gameTime) - { - GraphicsDevice.Clear(Color.CornflowerBlue); - - // TODO: Add your drawing code here - spriteBatch.Begin(); - SpriteRenderComponent rc = soldier.GetComponent(); - if (rc != null) - rc.Draw(spriteBatch); - spriteBatch.End(); - - base.Draw(gameTime); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Media; + +namespace DepthsBelow +{ + /// + /// This is the main type for your game + /// + public class Core : Microsoft.Xna.Framework.Game + { + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + + Soldier soldier; + + public Core() + { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + + graphics.PreferredBackBufferWidth = 1280; + graphics.PreferredBackBufferHeight = 720; + graphics.IsFullScreen = true; + + + this.IsMouseVisible = true; + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + // TODO: Add your initialization logic here + + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + // TODO: use this.Content to load your game content here + Soldier.LoadContent(this); + soldier = new Soldier(this); + + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// all content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + // Allows the game to exit + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) + this.Exit(); + + // TODO: Add your update logic here + soldier.Update(gameTime); + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.CornflowerBlue); + + // TODO: Add your drawing code here + spriteBatch.Begin(); + SpriteRenderComponent rc = soldier.GetComponent(); + if (rc != null) + rc.Draw(spriteBatch); + spriteBatch.End(); + + base.Draw(gameTime); + } + } +} diff --git a/DepthsBelow/DepthsBelow/Program.cs b/DepthsBelow/DepthsBelow/Program.cs index 67936fc..f016b28 100644 --- a/DepthsBelow/DepthsBelow/Program.cs +++ b/DepthsBelow/DepthsBelow/Program.cs @@ -1,21 +1,21 @@ -using System; - -namespace DepthsBelow -{ -#if WINDOWS || XBOX - static class Program - { - /// - /// The main entry point for the application. - /// - static void Main(string[] args) - { - using (Game1 game = new Game1()) - { - game.Run(); - } - } - } -#endif -} - +using System; + +namespace DepthsBelow +{ +#if WINDOWS || XBOX + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main(string[] args) + { + using (Core game = new Core()) + { + game.Run(); + } + } + } +#endif +} + diff --git a/DepthsBelow/DepthsBelow/Soldier.cs b/DepthsBelow/DepthsBelow/Soldier.cs index e30cf02..6ffbc8b 100644 --- a/DepthsBelow/DepthsBelow/Soldier.cs +++ b/DepthsBelow/DepthsBelow/Soldier.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Media; - -namespace DepthsBelow -{ - class Soldier : Entity - { - Game1 game; - static Texture2D Texture; - - // Components - TransformComponent transform; - - static public void LoadContent(Game1 game) - { - Texture = game.Content.Load("images/soldier"); - } - - public Soldier(Game1 game) - { - if (Texture == null) - LoadContent(game); - - SpriteRenderComponent rc = new SpriteRenderComponent(this); - rc.Texture = Texture; - this.AddComponent(rc); - - transform = new TransformComponent(this); - this.AddComponent(transform); - } - - public void Update(GameTime gameTime) - { - KeyboardState ks = Keyboard.GetState(); - if (ks.IsKeyDown(Keys.Left)) - transform.Position.X--; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Media; + +namespace DepthsBelow +{ + class Soldier : Entity + { + Core game; + static Texture2D Texture; + + // Components + TransformComponent transform; + + static public void LoadContent(Core game) + { + Texture = game.Content.Load("images/soldier"); + } + + public Soldier(Core game) + { + if (Texture == null) + LoadContent(game); + + SpriteRenderComponent rc = new SpriteRenderComponent(this); + rc.Texture = Texture; + this.AddComponent(rc); + + transform = new TransformComponent(this); + this.AddComponent(transform); + } + + public void Update(GameTime gameTime) + { + KeyboardState ks = Keyboard.GetState(); + if (ks.IsKeyDown(Keys.Left)) + transform.Position.X--; + } + } +} From 8d31de1fb8e4848c6feab3df9896f2ef87164f51 Mon Sep 17 00:00:00 2001 From: Simon Holmberg Date: Wed, 19 Sep 2012 13:15:27 +0200 Subject: [PATCH 2/2] Visual Studio being asshat --- DepthsBelow.suo | Bin 9728 -> 27648 bytes DepthsBelow/DepthsBelow/Core.cs | 1 - 2 files changed, 1 deletion(-) diff --git a/DepthsBelow.suo b/DepthsBelow.suo index ef829c5afdcd27f738d80377d4eba99bbd5141f7..dd3ad3a74b5d60b10d36f283cdf9ad56ddee491f 100644 GIT binary patch literal 27648 zcmeHPU5p!76`pOA{-mW%X(*+X)NMm)o3-)A-d$(YlzMINChcyr&APi0Sgrgs-gVZo zxAr*6Dru?2OI0bn0Hp#d71SycAf!G30>J}C@Bmb;gpd$ODDc{c0xCZ*P58b$bM2Y2 zJ)T)R!QS1wx}G~TcjlaX&bjCB-r0BGx$WY&-@NOuimg1VT&rBVe4}!m>G}}btfK5x zlxxu7`K8O3FY6Z-1733~?TC-Vl!t-No%8{Bn-5Bms9-nG-Op1`aA{ zk;N4^WjEk+u5muPg-0+j-B(LdZ5+( zXWzSUPd?*z{PYu4cxEGd~o`k=l}V{g}49v-mAxctl_e!^7j}eq>IAIK4j=s&D56WDr!|NX=$xcF3qL0E9oV5*teiosyIJ55)6pHVPC9P)M^#=U`efM zm2`2~H&@FP3)v^swPblkEgj4RL;2DCcz$FgHyTWb($@=M65_VnY$01ISIc=Vuu!Ph z(#3hLmMfG40)-{DQg0;7<>F$Ylq;XE2I6Tgoh+Sm{~1A+?pS!a<W?RjY9ldwo7wBtBtl^V{en>E;o zlroL`nsNwNGoptIJ+3LsxHpMjMLcmD*E<#J++GyE=LOWb7>90Emte=zz}crv0oNk1 zs-pcMENlci@*!Y1i~cI`uPICTqupD?6B@?4EP8jw%m@2J`KA8nvGWtUFG*X$VuwEo z98}=20&13lwN7olZ>!%20iU*tcF8S#`muTAWp?=VKWKZ&%Yxv(vj^}1;Bzdrn{MIL zpO*ID4xgMVDLF`A8COEG%%6p{ezK?XFt%0 z5|#zc$X69K>$Vu8WO+?D*DNpUa5B{4ey7_zlsACtkn-E1_(TwYXZMH4BB9vmq(3;i zFYXVIghT%QWATVTG#VQlPeei^!C>&Yb8&T5Tdq#3#q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gR}0u+zi4KR*cc(EWMtXfad4K6dXmeh|iPwekEf zNoE>I3%)sMA#(z{JT%inzi+37ckg)+3grdeaD3xYO?c^Yv~c oKVknmw6Ra*%4jqv$aamk^);3JrdrOKe)*cp%&D#RW}v|T01Y2LL;wH) delta 612 zcmZvYPe>a<6vk(g*{~+Fnl&}?V55yo4M@d+mx@R*TF?fP#ft|I2~{j&FLg^x5Z!_Y zPlA3_kkW(T#a>#w^qx|WEn4WoOV5H{bI=}K-xMkvaA5v?zxU>SZ^k|4Zt-(Iq+R>I ze|>0w;#(EDEtXm<1OCH_ou53+7^|D8iAjS~ik~8_c9?n=m!c@!2x$M|FJYk`6?mf+ zB_}9?0XHtZOD)dLe_mAMcHgqk;)^W@+3NX+vCS|3^WHyS-^11iy}W)D;xnj@cAzse zj!LY@Ta8U|JsPO1NfL9ok|kX=rUq0Wj!~8o3h9AduVK6nW62!W7OF4ibNFcPqG09V zw3ns2*c!-1gP=hm7J#0UC~#iE=-s4EjogHuYkF@ evTYUA1vr))nV@9B@YkwoPt*~1-&2hDjobjEHsJgK diff --git a/DepthsBelow/DepthsBelow/Core.cs b/DepthsBelow/DepthsBelow/Core.cs index 54c3ad1..6851e96 100644 --- a/DepthsBelow/DepthsBelow/Core.cs +++ b/DepthsBelow/DepthsBelow/Core.cs @@ -30,7 +30,6 @@ namespace DepthsBelow graphics.PreferredBackBufferHeight = 720; graphics.IsFullScreen = true; - this.IsMouseVisible = true; }