Difference between revisions of "Game Programming Class1"
m (Text replacement - "</csharp>" to "</syntaxhighlight>") |
(→Hello World) |
||
Line 37: | Line 37: | ||
==Hello World== | ==Hello World== | ||
− | [[Hello World in | + | [[Hello World in Monogame using spritefont]]. We'll revisit the spriteFont when we build the console/debug class |
==Hello XNA with texture== | ==Hello XNA with texture== |
Revision as of 04:10, 26 January 2016
Contents
Discuss Syllabus
Software
- Visual Studio 2013 available from MSDN
- Monogame version http://www.monogame.net/
- Monogame source https://github.com/mono/MonoGame/tree/develop
- XNA unofficial update https://msxna.codeplex.com/releases/view/117230
- Unity 5.1. https://unity3d.com/get-unity/download/archive
- Even if a newwer version of unity comes out during the semester we will stick to using version 5.1.x
- TortoiseSVN http://tortoisesvn.net/
- AnkhSVN https://ankhsvn.open.collab.net/
GitHuib URL https://github.com/orgs/IAMColumbia/
Mono Game
- http://monogame.codeplex.com/ new site http://www.monogame.net/
- Mono game is the current path to managed games in windows 8
- Also a path from XNA to iOS, Android, Sony Vita, Linux, raspberry pi etc..
What is DirectX?
show c++ examples
watch Accelerating Windows Store Game Development with Middleware http://channel9.msdn.com/Events/Build/2013/3-187
Hello World
Hello World in Monogame using spritefont. We'll revisit the spriteFont when we build the console/debug class
Hello XNA with texture
Simple xna project that draws a pacman sprite
- Start a new XNA Project
Add two variable declarations at the top of the class
1
2 Texture2D PacMan;
3 Vector2 PacManLoc;
In the LoadContent
Function add the following code to initialize the two variables declared above
1 protected override void LoadContent()
2 {
3 // Create a new SpriteBatch, which can be used to draw textures.
4 spriteBatch = new SpriteBatch(GraphicsDevice);
5
6 // TODO: use this.Content to load your game content here
7 //load PacMan image
8 PacMan = Content.Load<texture2d>("pacmanSingle");
9 //Center PacMan image
10 PacManLoc = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);
11 }
- Add the following code to the Draw Method to Draw the texture
1 protected override void Draw(GameTime gameTime)
2 {
3 graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
4
5 // TODO: Add your drawing code here
6 spriteBatch.Begin();
7 spriteBatch.Draw(PacMan, PacManLoc, Color.White);
8 spriteBatch.End();
9
10 base.Draw(gameTime);
11 }
pacman image is availble here:
the full game1.cs file should look like
[http://brookfield.rice.iit.edu/jmeyers/gbrowser.php?file=/ITM496-595/ClassSource/Projects/IntroSimpleSpriteWindows/IntroSimpleSpriteWindows/Game1.cs IntroSimpleSpriteWindows/Game1.cs]
the build of the game will look like
Simple 2D texture example with update
HomeWork
Watch Accelerating Windows Store Game Development with Middleware http://channel9.msdn.com/Events/Build/2013/3-187
Install VS2010 get XNA 4 http://www.microsoft.com/download/en/details.aspx?id=23714
or
Install VS 2012 with Monogame 3.0.1
Create an XNA Picture. The picture needs to have at least
- 1 SpriteFont
- 3 Textures
Also please post a screen shot of your project running in the assignments. Zip and upload source to moodle.
You can take a screen shot using the snip tool. Start run snip in vista or 7. Or you can just press the Print Screen key on the keyboard.