Difference between revisions of "Game Programming Class3"
esse quam videri
(New page: =Class 3 Input Handling= ==Fonts== free game fonts XNA Redistributable Font Pack font project demo Spritefont demo IntroFonts/Game1.cs IntroFonts.zip ==in class== fonts.zip ==Inp...) |
(→Fonts) |
||
Line 3: | Line 3: | ||
==Fonts== | ==Fonts== | ||
− | free game fonts XNA Redistributable Font Pack | + | free game fonts [http://creators.xna.com/en-us/contentpack/fontpack XNA Redistributable Font Pack] |
− | + | [http://geekswithblogs.net/cwilliams/archive/2007/11/03/116573.aspx Fun with Fonts in XNA] | |
− | Spritefont demo | + | ===Spritefont demo=== |
− | |||
− | |||
− | |||
+ | [http://brookfield.rice.iit.edu/jmeyers/gbrowser.php?file=/ITM496-595/ClassSource/Projects/IntroFonts/IntroFonts/Game1.cs IntroFonts/Game1.cs] | ||
+ | [http://brookfield.rice.iit.edu/jmeyers/ITM496-595/ClassSource/Projects/IntroFonts.zip IntroFonts.zip] | ||
==in class== | ==in class== |
Revision as of 19:33, 14 December 2008
Contents
Class 3 Input Handling
Fonts
free game fonts XNA Redistributable Font Pack
Spritefont demo
IntroFonts/Game1.cs IntroFonts.zip
in class
fonts.zip
Input
input from GameController and Keyboard
XNA has builtin support for up to 4 game controllers. The default controller is a x-box controller. X-Box Controller The Controller is accessed through the GamePad Object and the GamePadState Structure reference types <csharp>
//Get and instance of the gamePadState Structure GamePadState gamePad1State = GamePad.GetState(PlayerIndex.One);
Since the Keyboard structure is Windows only we need to use some preprocessor directives
#if !XBOX360 #region KeyBoard KeyboardState keyboardState = Keyboard.GetState(); #endif
</csharp>
Angle Measured in Radians
using atan2 to get the angle from the direction vector
Vibration
<csharp>
GamePad.SetVibration(PlayerIndex.One, 1.0f, 1.0f); //left low freq motor right high freq motor
</csharp>
Classes and Generics
Shooting with pacman
in class
PacMan Project with input
Homework
Create an XNA project that uses the Keyboard for input. Chapter 5 in XNA Game Studio 2.0 Writing Text Chapter 7 in XNA Game Studio Express