Difference between revisions of "Game Programming Class1"
(→Discuss Syllabus) |
|||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | GitHuib URL https://github.com/dsp56001/GameProgramming | |
− | |||
− | + | test | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Mono Game== | ==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 | **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 | + | *Also a path from XNA to iOS, Android, Sony PS4, XboxOne, Linux, raspberry pi etc.. |
− | |||
− | |||
==What is DirectX?== | ==What is DirectX?== | ||
Line 39: | Line 25: | ||
[[Hello World in Monogame using spritefont]]. We'll revisit the spriteFont when we build the console/debug class | [[Hello World in Monogame using spritefont]]. We'll revisit the spriteFont when we build the console/debug class | ||
− | ==Hello | + | ==Hello Monogame with texture== |
− | Simple | + | Simple monogame project that draws a pacman sprite |
− | *Start a new | + | *Start a new Monogame Project (For all the example in this class I will use Monogame Windows) |
+ | [[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"> | ||
− | Texture2D PacMan; | + | Texture2D PacMan; //Texture2D to hold pacman texture |
− | Vector2 PacManLoc; | + | Vector2 PacManLoc; //Vector location to draw pacman texture |
</syntaxhighlight> | </syntaxhighlight> | ||
In the <code>LoadContent</code> Function add the following code to initialize the two variables declared above | In the <code>LoadContent</code> Function add the following code to initialize the two variables declared above | ||
Line 81: | Line 69: | ||
the full game1.cs file should look like | the full game1.cs file should look like | ||
− | + | TODO ADD URL | |
− | |||
the build of the game will look like | the build of the game will look like | ||
Line 91: | Line 78: | ||
==Demos== | ==Demos== | ||
+ | |||
+ | [[Monogame Overview]] | ||
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!!! | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 14:30, 9 April 2018
GitHuib URL https://github.com/dsp56001/GameProgramming
test
Mono Game
- http://www.monogame.net/
- MonoGame is a current path to managed games in windows 10 and XboxOne
- Also a path from XNA to iOS, Android, Sony PS4, XboxOne, 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 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)
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:
the full game1.cs file should look like
TODO ADD URL
the build of the game will look like
Simple 2D texture example with update
Demos
MonoGameDemos\IntroFonts https://iam.colum.edu:8443/!/#GPMonogame3/view/head/trunk/jeff/IntroFonts zip file!!!