Difference between revisions of "Game Programming Class1"

esse quam videri
Jump to: navigation, search
(Hello XNA with texture)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Discuss Syllabus==
+
GitHuib URL https://github.com/dsp56001/GameProgramming
<b>Software</b>
 
  
*Visual Studio 2015 available from MSDN
+
test
**Monogame version 3.6.x 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.4. 64 bit http://download.unity3d.com/download_unity/a6d8d714de6f/Windows64EditorInstaller/UnitySetup64-5.4.0f3.exe
 
**Even if a newwer version of unity comes out during the semester we will stick to using version 5.4.x
 
* TortoiseSVN http://tortoisesvn.net/
 
*AnkhSVN https://ankhsvn.open.collab.net/
 
 
 
 
 
 
 
GitHuib URL https://github.com/orgs/IAMColumbia/
 
  
 
==Mono Game==
 
==Mono Game==
*http://monogame.codeplex.com/ new site http://www.monogame.net/
+
*http://www.monogame.net/
*Mono game is the current path to managed games in windows 8
+
*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
 
**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 Vita, Linux, raspberry pi etc..
+
*Also a path from XNA to iOS, Android, Sony PS4, XboxOne, Linux, raspberry pi etc..
 
 
[[Installing Monogame]]
 
  
 
==What is DirectX?==
 
==What is DirectX?==
Line 41: Line 27:
 
==Hello Monogame with texture==
 
==Hello Monogame with texture==
 
Simple monogame project that draws a pacman sprite
 
Simple monogame project that draws a pacman sprite
*Start a new Monogame Project (For all the example in this class I will use windowsGL)
+
*Start a new Monogame Project (For all the example in this class I will use Monogame Windows)
[Image:NewMonogameProjectWindowGL.PNG]
+
[[File:NewMonogameProjectWindowGL.PNG]]
 +
 
 
Add two variable declarations at the top of the class
 
Add two variable declarations at the top of the class
 
<syntaxhighlight lang="csharp">
 
<syntaxhighlight lang="csharp">
Line 82: Line 69:
 
the full game1.cs file should look like
 
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
+
TODO ADD URL
IntroSimpleSpriteWindows/Game1.cs]
 
  
 
the build of the game will look like
 
the build of the game will look like
Line 96: Line 82:
  
 
MonoGameDemos\IntroFonts https://iam.colum.edu:8443/!/#GPMonogame3/view/head/trunk/jeff/IntroFonts zip file!!!
 
MonoGameDemos\IntroFonts https://iam.colum.edu:8443/!/#GPMonogame3/view/head/trunk/jeff/IntroFonts zip file!!!
 
==HomeWork==
 
 
Watch Accelerating Windows Store Game Development with Middleware http://channel9.msdn.com/Events/Build/2013/3-187
 
 
<!-- COLUMBIA
 
Create an XNA Picture. The picture needs to have at least
 
*1 SpriteFont
 
*3 Textures
 
 
Make a folder in your pub called XNA. Create an index for this folder and link the zipped VS2008 project here. Also please post a screen shot of your project running.
 
 
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.
 
 
*Read Chapter 1 of XNA 3.0
 
-->
 
 
<!-- IIT -->
 
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.
 

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!!!