1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using Microsoft.Xna.Framework; |
---|
5 | using Microsoft.Xna.Framework.Audio; |
---|
6 | using Microsoft.Xna.Framework.Content; |
---|
7 | using Microsoft.Xna.Framework.GamerServices; |
---|
8 | using Microsoft.Xna.Framework.Graphics; |
---|
9 | using Microsoft.Xna.Framework.Input; |
---|
10 | using Microsoft.Xna.Framework.Media; |
---|
11 | using Microsoft.Xna.Framework.Net; |
---|
12 | using Microsoft.Xna.Framework.Storage; |
---|
13 | |
---|
14 | namespace Effects |
---|
15 | { |
---|
16 | /// <summary> |
---|
17 | /// This is the main type for your game |
---|
18 | /// </summary> |
---|
19 | public class ParticleGame : Microsoft.Xna.Framework.Game |
---|
20 | { |
---|
21 | GraphicsDeviceManager graphics; |
---|
22 | SpriteBatch spriteBatch; |
---|
23 | public SpriteBatch SpriteBatch |
---|
24 | { |
---|
25 | get { return spriteBatch; } |
---|
26 | } |
---|
27 | |
---|
28 | Random random = new Random(); |
---|
29 | |
---|
30 | KeyboardState previousKeyboardState = Keyboard.GetState(); |
---|
31 | |
---|
32 | Explosion explosion; |
---|
33 | |
---|
34 | public ParticleGame() |
---|
35 | { |
---|
36 | graphics = new GraphicsDeviceManager(this); |
---|
37 | |
---|
38 | explosion = new Explosion(this, Vector2.Zero); |
---|
39 | |
---|
40 | Content.RootDirectory = "Content"; |
---|
41 | } |
---|
42 | |
---|
43 | /// <summary> |
---|
44 | /// Allows the game to perform any initialization it needs to before starting to run. |
---|
45 | /// This is where it can query for any required services and load any non-graphic |
---|
46 | /// related content. Calling base.Initialize will enumerate through any components |
---|
47 | /// and initialize them as well. |
---|
48 | /// </summary> |
---|
49 | protected override void Initialize() |
---|
50 | { |
---|
51 | // TODO: Add your initialization logic here |
---|
52 | |
---|
53 | base.Initialize(); |
---|
54 | } |
---|
55 | |
---|
56 | /// <summary> |
---|
57 | /// LoadContent will be called once per game and is the place to load |
---|
58 | /// all of your content. |
---|
59 | /// </summary> |
---|
60 | protected override void LoadContent() |
---|
61 | { |
---|
62 | Texture2D glowTexture = Content.Load<Texture2D>("Glow"); |
---|
63 | Texture2D glowTexture2 = Content.Load<Texture2D>("Glow2"); |
---|
64 | // Create a new SpriteBatch, which can be used to draw textures. |
---|
65 | spriteBatch = new SpriteBatch(GraphicsDevice); |
---|
66 | // TODO: use this.Content to load your game content here |
---|
67 | } |
---|
68 | |
---|
69 | /// <summary> |
---|
70 | /// UnloadContent will be called once per game and is the place to unload |
---|
71 | /// all content. |
---|
72 | /// </summary> |
---|
73 | protected override void UnloadContent() |
---|
74 | { |
---|
75 | // TODO: Unload any non ContentManager content here |
---|
76 | } |
---|
77 | |
---|
78 | /// <summary> |
---|
79 | /// Allows the game to run logic such as updating the world, |
---|
80 | /// checking for collisions, gathering input, and playing audio. |
---|
81 | /// </summary> |
---|
82 | /// <param name="gameTime">Provides a snapshot of timing values.</param> |
---|
83 | protected override void Update(GameTime gameTime) |
---|
84 | { |
---|
85 | float dt = (float)gameTime.ElapsedGameTime.TotalSeconds; |
---|
86 | base.Update(gameTime); |
---|
87 | } |
---|
88 | |
---|
89 | /// <summary> |
---|
90 | /// This is called when the game should draw itself. |
---|
91 | /// </summary> |
---|
92 | /// <param name="gameTime">Provides a snapshot of timing values.</param> |
---|
93 | protected override void Draw(GameTime gameTime) |
---|
94 | { |
---|
95 | GraphicsDevice.Clear(Color.Black); |
---|
96 | // TODO: Add your drawing code here |
---|
97 | base.Draw(gameTime); |
---|
98 | } |
---|
99 | } |
---|
100 | } |
---|