Difference between revisions of "Game Programming Class1"

esse quam videri
Jump to: navigation, search
 
(64 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Discuss Syllabus==
+
GitHuib URL https://github.com/dsp56001/GameProgramming
<b>Software</b>
 
  
*Visual Studio 2005 available from MSDN (VS2008 work with XNA 3.0 CTP but not with XNA 2.0)</li>
+
test
*XNA 2.0 GSE <a href="http://creators.xna.com/en-US/downloads">http://creators.xna.com/en-US/downloads</a></li>
 
*Direct X SDK <a href="http://msdn.microsoft.com/en-us/directx/aa937788.aspx">http://msdn.microsoft.com/en-us/directx/aa937788.aspx</a>
 
   
 
   
 
   
 
==What is XNA?==
 
  
Discussion<br>
+
==Mono Game==
 +
*http://www.monogame.net/
 +
*MonoGame is a current path to managed games in windows 10 and XboxOne
 +
**http://blogs.msdn.com/b/bobfamiliar/archive/2012/08/01/windows-8-xna-and-monogame-part-1-overview.aspx
 +
*Also a path from XNA to iOS, Android, Sony PS4, XboxOne, Linux, raspberry pi etc..
  
Why do we need it?
 
 
Why not use c++?
 
           
 
 
==What is DirectX?==
 
==What is DirectX?==
 
show c++ examples
 
show c++ examples
  
<a href="http://creators.xna.com/en-US/create_detail">quick start guide - create</a>
+
[http://creators.xna.com/en-US/create_detail quick start guide - create]
<br>
+
 
How much c# do you know?
+
* DirectX 8.1 http://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fsessions%2fbuild%2f2013%2f3-187.pptx
<br>
+
** Game Sections http://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fsessions%2fbuild%2f2013%2f3-187.pptx
 +
 
 +
* Middleware http://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fsessions%2fbuild%2f2013%2f3-187.pptx
 +
 
 +
watch Accelerating Windows Store Game Development with Middleware http://channel9.msdn.com/Events/Build/2013/3-187
  
==in class==
+
==Hello World==
 
<p>Simple 2D texture demo</p>
 
 
Simple xna project that draws a pacman sprite
 
 
 
Demo
 
*Start a new XNA Project
 
  
 +
[[Hello World in Monogame using spritefont]]. We'll revisit the spriteFont when we build the console/debug class
  
Add two varibale declareations at the top of the class
+
==Hello Monogame with texture==
 +
Simple monogame project that draws a pacman sprite
 +
*Start a new Monogame Project (For all the example in this class I will use Monogame Windows)
 +
[[File:NewMonogameProjectWindowGL.PNG]]
  
<pre>
+
Add two variable declarations at the top of the class
             Texture2D PacMan;
+
<syntaxhighlight lang="csharp">
             Vector2 PacManLoc;
+
           
</pre>
+
             Texture2D PacMan;   //Texture2D to hold pacman texture
</li>
+
             Vector2 PacManLoc; //Vector location to draw pacman texture
<li>
+
</syntaxhighlight>
In the Load_Content Funtion add the following code to initialize the two varibales declared above
+
In the <code>LoadContent</code> Function add the following code to initialize the two variables declared above
<pre> protected override void LoadContent()
+
<syntaxhighlight lang="csharp">
 +
        protected override void LoadContent()
 
         {
 
         {
 
             // Create a new SpriteBatch, which can be used to draw textures.
 
             // Create a new SpriteBatch, which can be used to draw textures.
Line 50: Line 44:
  
 
             // TODO: use this.Content to load your game content here
 
             // TODO: use this.Content to load your game content here
 +
            //load PacMan image
 
             PacMan = Content.Load<texture2d>("pacmanSingle");
 
             PacMan = Content.Load<texture2d>("pacmanSingle");
 +
            //Center PacMan image
 
             PacManLoc = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);
 
             PacManLoc = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);
         }</texture2d></pre>
+
         }
</li>
+
</syntaxhighlight>
 
+
*Add the following code to the Draw Method to Draw the texture
<li>Add the following code to the Draw Method to Draw the texture
+
<syntaxhighlight lang="csharp">
<pre> protected override void Draw(GameTime gameTime)
+
protected override void Draw(GameTime gameTime)
 
         {
 
         {
 
             graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
 
             graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
Line 67: Line 63:
 
             base.Draw(gameTime);
 
             base.Draw(gameTime);
 
         }
 
         }
</pre>
+
</syntaxhighlight>
 +
pacman image is availble here: [[Image:PacmanSingle.png]]
  
pacman image is availble @
 
<a href="http://brookfield.rice.iit.edu/jmeyers/ITM496-595/ClassSource/Content/pacman/png/pacmanSingle.png">pacmanSingle.png</a>
 
  
<img src="http://brookfield.rice.iit.edu/jmeyers/ITM496-595/ClassSource/Content/pacma/png/pacmanSingle.png">
 
 
the full game1.cs file should look like
 
the full game1.cs file should look like
<a href="http://brookfield.rice.iit.edu/jmeyers/gbrowser.php?file=/ITM496-595/ClassSource/Projects/IntroSimpleSpriteWindows/IntroSimpleSpriteWindows/Game1.cs">
+
 
IntroSimpleSpriteWindows/Game1.cs
+
TODO ADD URL
</a>
+
 
 
the build of the game will look like
 
the build of the game will look like
<img src="ClassSource/Images/IntroSimpleSpriteWindows.png">
+
[[Image:IntroSimpleSpriteWindows.png]]
 
 
 
 +
 
<p>Simple 2D texture example with update</p>
 
<p>Simple 2D texture example with update</p>
 +
 +
==Demos==
 +
 +
[[Monogame Overview]]
 +
 +
MonoGameDemos\IntroFonts https://iam.colum.edu:8443/!/#GPMonogame3/view/head/trunk/jeff/IntroFonts zip file!!!

Latest revision as of 14:30, 9 April 2018

GitHuib URL https://github.com/dsp56001/GameProgramming

test

Mono Game

What is DirectX?

show c++ examples

quick start guide - create

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 Monogame with texture

Simple monogame project that draws a pacman sprite

  • Start a new Monogame Project (For all the example in this class I will use Monogame Windows)

NewMonogameProjectWindowGL.PNG

Add two variable declarations at the top of the class

            
            Texture2D PacMan;   //Texture2D to hold pacman texture
            Vector2 PacManLoc;  //Vector location to draw pacman texture

In the LoadContent Function add the following code to initialize the two variables declared above

        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
            //load PacMan image
            PacMan = Content.Load<texture2d>("pacmanSingle");
            //Center PacMan image
            PacManLoc = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);
        }
  • Add the following code to the Draw Method to Draw the texture
	protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            spriteBatch.Draw(PacMan, PacManLoc, Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }

pacman image is availble here: PacmanSingle.png


the full game1.cs file should look like

TODO ADD URL

the build of the game will look like IntroSimpleSpriteWindows.png


Simple 2D texture example with update

Demos

Monogame Overview

MonoGameDemos\IntroFonts https://iam.colum.edu:8443/!/#GPMonogame3/view/head/trunk/jeff/IntroFonts zip file!!!