Galaxy Wars

Transcription

Galaxy Wars
Galaxy Wars
2.0.0.3
Generated by Doxygen 1.5.5
Tue May 13 00:00:38 2008
Contents
1
2
3
4
5
6
Namespace Index
1
1.1
1
Package List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Class Index
3
2.1
3
Class Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Class Index
5
3.1
5
Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
File Index
9
4.1
9
File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Namespace Documentation
11
5.1
Package GalaxyWars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
5.2
Package GalaxyWars.GameLogic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
5.3
Package GalaxyWars.GameScreens . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
5.4
Package GalaxyWars.Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
5.5
Package GalaxyWars.Helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5.6
Package GalaxyWars.Particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.7
Package GalaxyWars.Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
5.8
Package GalaxyWars.Scenes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
5.9
Package GalaxyWars.Shaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
5.10 Package GalaxyWars.Sounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
Class Documentation
23
6.1
GalaxyWars.Scenes.Asteroid Class Reference . . . . . . . . . . . . . . . . . . . . . . . .
23
6.2
GalaxyWars.Scenes.Asteroids Class Reference . . . . . . . . . . . . . . . . . . . . . . .
28
6.3
GalaxyWars.Graphics.BaseGame Class Reference . . . . . . . . . . . . . . . . . . . . . .
32
6.4
GalaxyWars.GameLogic.BasePlayer Class Reference . . . . . . . . . . . . . . . . . . . .
72
6.5
GalaxyWars.GameLogic.ChaseCamera Class Reference . . . . . . . . . . . . . . . . . . .
77
ii
CONTENTS
6.6
GalaxyWars.Helpers.ColorHelper Class Reference . . . . . . . . . . . . . . . . . . . . .
90
6.7
GalaxyWars.Helpers.Directories Class Reference . . . . . . . . . . . . . . . . . . . . . .
95
6.8
GalaxyWars.Helpers.FileHelper Class Reference . . . . . . . . . . . . . . . . . . . . . .
97
6.9
GalaxyWars.Particles.FireParticleSystem Class Reference . . . . . . . . . . . . . . . . . . 104
6.10 GalaxyWars.Graphics.Material Class Reference . . . . . . . . . . . . . . . . . . . . . . . 106
6.11 GalaxyWars.Graphics.Model Class Reference . . . . . . . . . . . . . . . . . . . . . . . . 114
6.12 GalaxyWars.Graphics.Texture Class Reference . . . . . . . . . . . . . . . . . . . . . . . 124
6.13 GalaxyWars.GalaxyWarsManager Class Reference . . . . . . . . . . . . . . . . . . . . . 136
6.14 GalaxyWars.GameScreens.GameScreen Class Reference . . . . . . . . . . . . . . . . . . 145
6.15 GalaxyWars.Properties.GameSettings Class Reference . . . . . . . . . . . . . . . . . . . 149
6.16 GalaxyWars.GameScreens.Help Class Reference . . . . . . . . . . . . . . . . . . . . . . 160
6.17 GalaxyWars.GameScreens.IGameScreen Interface Reference . . . . . . . . . . . . . . . . 162
6.18 GalaxyWars.GameLogic.Input Class Reference . . . . . . . . . . . . . . . . . . . . . . . 163
6.19 GalaxyWars.Graphics.LensFlare Class Reference . . . . . . . . . . . . . . . . . . . . . . 183
6.20 GalaxyWars.Graphics.LensFlare.FlareData Struct Reference . . . . . . . . . . . . . . . . 191
6.21 GalaxyWars.Graphics.LineManager2D Class Reference . . . . . . . . . . . . . . . . . . . 193
6.22 GalaxyWars.Graphics.LineManager2D.Line Struct Reference . . . . . . . . . . . . . . . . 199
6.23 GalaxyWars.Graphics.LineManager3D Class Reference . . . . . . . . . . . . . . . . . . . 202
6.24 GalaxyWars.Graphics.LineManager3D.Line Struct Reference . . . . . . . . . . . . . . . . 208
6.25 GalaxyWars.Helpers.Log Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.26 GalaxyWars.GameScreens.MainMenu Class Reference . . . . . . . . . . . . . . . . . . . 215
6.27 GalaxyWars.Graphics.MeshRenderManager Class Reference . . . . . . . . . . . . . . . . 222
6.28 GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial Class Reference . . . . . 227
6.29 GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
6.30 GalaxyWars.Graphics.MeshRenderManager.RenderableMesh Class Reference . . . . . . . 235
6.31 GalaxyWars.Sounds.Music Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . 240
6.32 GalaxyWars.GameScreens.Options Class Reference . . . . . . . . . . . . . . . . . . . . . 244
6.33 GalaxyWars.Particles.ParticleEmitter Class Reference . . . . . . . . . . . . . . . . . . . . 255
6.34 GalaxyWars.Particles.ParticleSettings Class Reference . . . . . . . . . . . . . . . . . . . 258
6.35 GalaxyWars.Particles.ParticleSystem Class Reference . . . . . . . . . . . . . . . . . . . . 262
6.36 GalaxyWars.Particles.ParticleVertex Struct Reference . . . . . . . . . . . . . . . . . . . . 273
6.37 GalaxyWars.GameLogic.Player Class Reference . . . . . . . . . . . . . . . . . . . . . . . 275
6.38 GalaxyWars.Shaders.PostScreenGlow Class Reference . . . . . . . . . . . . . . . . . . . 278
6.39 GalaxyWars.Shaders.PostScreenMenu Class Reference . . . . . . . . . . . . . . . . . . . 284
6.40 GalaxyWars.Shaders.PreScreenSkyCubeMapping Class Reference . . . . . . . . . . . . . 291
6.41 GalaxyWars.Graphics.PrimitivesRenderer Class Reference . . . . . . . . . . . . . . . . . 295
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
CONTENTS
iii
6.42 GalaxyWars.Program Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
6.43 GalaxyWars.Helpers.RandomHelper Class Reference . . . . . . . . . . . . . . . . . . . . 302
6.44 GalaxyWars.Shaders.RenderToTexture Class Reference . . . . . . . . . . . . . . . . . . . 306
6.45 GalaxyWars.GameLogic.ScreenshotCapturer Class Reference . . . . . . . . . . . . . . . 315
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference . . . . . . . . . . . . . . . . . . . . . 319
6.47 GalaxyWars.Sounds.Sound Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . 340
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference . . . . . . . . . . . . . . . . 348
6.49 GalaxyWars.GameScreens.SplashScreen Class Reference . . . . . . . . . . . . . . . . . . 367
6.50 GalaxyWars.Graphics.TangentVertex Struct Reference . . . . . . . . . . . . . . . . . . . 369
6.51 GalaxyWars.Graphics.TextureFont Class Reference . . . . . . . . . . . . . . . . . . . . . 375
6.52 GalaxyWars.Graphics.TextureFont.FontToRender Class Reference . . . . . . . . . . . . . 383
6.53 GalaxyWars.Graphics.TextureFontBigNumbers Class Reference . . . . . . . . . . . . . . 386
6.54 GalaxyWars.Graphics.UIRenderer Class Reference . . . . . . . . . . . . . . . . . . . . . 392
6.55 GalaxyWars.Graphics.UIRenderer.TimeFadeupText Class Reference . . . . . . . . . . . . 416
6.56 GalaxyWars.Shaders.VBScreenHelper Class Reference . . . . . . . . . . . . . . . . . . . 418
6.57 GalaxyWars.Shaders.VBScreenHelper.GridScreen Class Reference . . . . . . . . . . . . . 420
6.58 GalaxyWars.Shaders.VBScreenHelper.VBScreen Class Reference . . . . . . . . . . . . . 424
6.59 GalaxyWars.Helpers.Vector3Helper Class Reference . . . . . . . . . . . . . . . . . . . . 426
7
File Documentation
429
7.1
AssemblyInfo.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
7.2
Asteroid.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
7.3
Asteroids.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
7.4
BaseGame.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
7.5
BasePlayer.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
7.6
ChaseCamera.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
7.7
ColorHelper.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
7.8
Directories.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
7.9
FileHelper.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
7.10 FireParticleSystem.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
7.11 GalaxyWarsManager.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
7.12 GameScreen.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
7.13 GameSettings.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
7.14 Help.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
7.15 IGameScreen.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
7.16 Input.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
7.17 LensFlare.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
iv
CONTENTS
7.18 LineManager2D.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
7.19 LineManager3D.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
7.20 Log.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
7.21 MainMenu.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
7.22 Material.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
7.23 MeshRenderManager.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
7.24 Model.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
7.25 Music.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
7.26 Options.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
7.27 ParticleEmitter.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
7.28 ParticleSettings.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
7.29 ParticleSystem.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
7.30 ParticleVertex.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
7.31 Player.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
7.32 PostScreenGlow.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
7.33 PostScreenMenu.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
7.34 PreScreenSkyCubeMapping.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . 462
7.35 PrimitivesRenderer.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
7.36 Program.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
7.37 RandomHelper.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
7.38 RenderToTexture.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
7.39 ScreenshotCapturer.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
7.40 ShaderEffect.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
7.41 Sound.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
7.42 SpaceshipPhysics.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
7.43 SplashScreen.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
7.44 TangentVertex.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
7.45 Texture.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
7.46 TextureFont.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
7.47 TextureFontBigNumbers.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . 475
7.48 UIRenderer.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
7.49 VBScreenHelper.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
7.50 Vector3Helper.cs File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Chapter 1
Namespace Index
1.1
Package List
Here are the packages with brief descriptions (if available):
GalaxyWars . . . . . . . .
GalaxyWars.GameLogic .
GalaxyWars.GameScreens
GalaxyWars.Graphics . .
GalaxyWars.Helpers . . .
GalaxyWars.Particles . . .
GalaxyWars.Properties . .
GalaxyWars.Scenes . . . .
GalaxyWars.Shaders . . .
GalaxyWars.Sounds . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11
12
13
14
16
17
18
19
20
21
2
Namespace Index
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Chapter 2
Class Index
2.1
Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically:
GalaxyWars.Scenes.Asteroid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Scenes.Asteroids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.BaseGame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GalaxyWarsManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameLogic.BasePlayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameLogic.SpaceshipPhysics . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameLogic.ChaseCamera . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameLogic.Player . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Helpers.ColorHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Helpers.Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Helpers.FileHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.Texture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Shaders.RenderToTexture . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Properties.GameSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameScreens.IGameScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameScreens.GameScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameScreens.Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameScreens.MainMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameScreens.Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameScreens.SplashScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameLogic.Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.LensFlare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.LensFlare.FlareData . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.LineManager2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.LineManager2D.Line . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.LineManager3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.LineManager3D.Line . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Helpers.Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.MeshRenderManager . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial . . . . . . . . . . . . . . . . .
23
28
32
136
72
348
77
275
90
95
97
106
114
124
306
149
162
145
160
215
244
367
163
183
191
193
199
202
208
212
222
227
4
Class Index
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques
GalaxyWars.Graphics.MeshRenderManager.RenderableMesh . . . . . . . . . .
GalaxyWars.Sounds.Music . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Particles.ParticleEmitter . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Particles.ParticleSettings . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Particles.ParticleSystem . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Particles.FireParticleSystem . . . . . . . . . . . . . . . . . . .
GalaxyWars.Particles.ParticleVertex . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.PrimitivesRenderer . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Helpers.RandomHelper . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.GameLogic.ScreenshotCapturer . . . . . . . . . . . . . . . . . .
GalaxyWars.Shaders.ShaderEffect . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Shaders.PostScreenMenu . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Shaders.PostScreenGlow . . . . . . . . . . . . . . . . . .
GalaxyWars.Shaders.PreScreenSkyCubeMapping . . . . . . . . . . . . . .
GalaxyWars.Sounds.Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.TangentVertex . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.TextureFont . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.TextureFont.FontToRender . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.TextureFontBigNumbers . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.UIRenderer . . . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Graphics.UIRenderer.TimeFadeupText . . . . . . . . . . . . . . .
GalaxyWars.Shaders.VBScreenHelper . . . . . . . . . . . . . . . . . . . . . .
GalaxyWars.Shaders.VBScreenHelper.GridScreen . . . . . . . . . . . . . . . .
GalaxyWars.Shaders.VBScreenHelper.VBScreen . . . . . . . . . . . . . . . .
GalaxyWars.Helpers.Vector3Helper . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
231
235
240
255
258
262
104
273
295
300
302
315
319
284
278
291
340
369
375
383
386
392
416
418
420
424
426
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Chapter 3
Class Index
3.1
Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
GalaxyWars.Scenes.Asteroid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
GalaxyWars.Scenes.Asteroids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
GalaxyWars.Graphics.BaseGame (Base game class for all the basic game support. Connects all
our helper classes together and makes our life easier! Note: This game was designed
for 16:9 (e.g. 1920x1200), but it also works just fine for 4:3 (1024x768, 800x600, etc.).
This is the reason you might see 1024x640 instead of 1024x768 in some width/height
calculations and the UI textures. The game looks best at 1920x1080 (HDTV 1080p
resolution) ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
GalaxyWars.GameLogic.BasePlayer (Base player helper class, holds all the current game values: Game time, game over, level number, victory. More stuff that has impact to the
ShipController or ChaseCamera classes should be included here, else add them directly
to the Player class, which handles all the game logic. For example adding items or
powerups should be done in this class if they affect the speed or physics of our ship ) . 72
GalaxyWars.GameLogic.ChaseCamera (Chase camera for our car. We are always close behind it.
The camera rotation is not the same as the current car rotation, we interpolate the values
a bit, allowing the user to do small changes without rotating the camera frantically. Also
feels more realistic in curves. Derived from the CarController class, which controls the
car by the user input. This camera class is not controlled by the user, its all automatic! ) 77
GalaxyWars.Helpers.ColorHelper (Color helper, just to convert colors to different formats and
providing more helper methods missing in the Color class ) . . . . . . . . . . . . . . . 90
GalaxyWars.Helpers.Directories (Helper class which stores all used directories ) . . . . . . . . . 95
GalaxyWars.Helpers.FileHelper (File helper class to get text lines, number of text lines, etc.
Update: Now also supports the XNA Storage classes :) ) . . . . . . . . . . . . . . . . 97
GalaxyWars.Particles.FireParticleSystem (Custom particle system for creating a flame effect ) . 104
GalaxyWars.Graphics.Material (Material class for DirectX materials used for Models. Consists
of normal DirectX material settings (ambient, diffuse, specular), the diffuse texture and
optionally of normal map, height map and shader parameters ) . . . . . . . . . . . . . 106
GalaxyWars.Graphics.Model (Model class for loading and displaying x files including all materials and textures. Provides load and render functions to render static non animated
models (mostly 1 mesh), for animated models we need a more advanced class, which
is not required for this game yet ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
6
Class Index
GalaxyWars.Graphics.Texture (Texture class helping you with using DirectX Textures and handling possible errors that can happen while loading (stupid DirectX error messages
telling you absolutly nothing, so a lot of pre-checks help you determinate the error
before even calling DirectX methods) ) . . . . . . . . . . . . . . . . . . . . . . . . . . 124
GalaxyWars.GalaxyWarsManager (Manager class of the game. Handles all game screens, which
themself handle all the game logic ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
GalaxyWars.GameScreens.GameScreen (GameScreen, just manages the on screen display for
the game ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
GalaxyWars.Properties.GameSettings (Game settings, stored in a custom XML file. The reason
for this is we want to be able to store our game data on the Xbox360 too. On the PC we
could just use a Settings/config file and have all the code autogenerated for us, but this
way it works both on PC and Xbox. Note: The default instance for the game settings is
in this class, this way we get the same behaviour as for normal Settings files! ) . . . . . 149
GalaxyWars.GameScreens.Help (Help ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
GalaxyWars.GameScreens.IGameScreen (Game screen helper interface for all game screens of
our game. Helps us to put them all into one list and manage them in our RaceGame ) . 162
GalaxyWars.GameLogic.Input (Input helper class, captures all the mouse, keyboard and XBox
360 controller input and provides some nice helper methods and properties. Will also
keep track of the last frame states for comparison if a button was just pressed this frame,
but not already in the last frame ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
GalaxyWars.Graphics.LensFlare (Lens flare class for simple 2d lens flare rendering ) . . . . . . 183
GalaxyWars.Graphics.LensFlare.FlareData (Flare data struct for the quick and easy flare type list
below ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
GalaxyWars.Graphics.LineManager2D (LineManager class, used for drawing lines. We can’t
simply draw lines like in OpenGL (glLine) because we need to do everything with
vertex buffers, which is a bit more work (and using DrawPrimitives directly produces
way worse code) ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
GalaxyWars.Graphics.LineManager2D.Line (Struct for a line, instances of this struct will be
added to lines ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
GalaxyWars.Graphics.LineManager3D (Helper class for game for rendering lines. This class will
collect all line calls, then build a new vertex buffer if any line has changed or the line
number changed and finally will render all lines in the vertex buffer at the end of the
frame (so this class is obviously only for 2D lines directly on screen, no z buffer and no
stuff will be in front of the lines, because everything is rendered at the end of the frame) )202
GalaxyWars.Graphics.LineManager3D.Line (Struct for a line, instances of this class will be
added to lines ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
GalaxyWars.Helpers.Log (Log will create automatically a log file and write log/error/debug info
for simple runtime error checking, very useful for minor errors, such as finding not files.
The application can still continue working, but this log provides an easy support to find
out what files are missing (in this example) ) . . . . . . . . . . . . . . . . . . . . . . . 212
GalaxyWars.GameScreens.MainMenu (Main menu ) . . . . . . . . . . . . . . . . . . . . . . . 215
GalaxyWars.Graphics.MeshRenderManager (Mesh render manager, a little helper class which
allows us to render all our models with much faster performance through sorting by
material and shader techniques ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial (Meshes per material ) . . . . . 227
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques (Meshes per material per techniques ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
GalaxyWars.Graphics.MeshRenderManager.RenderableMesh (Renderable mesh, created in the
Model constructor and is rendered when we render all the models at once at the end of
each frame! ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
GalaxyWars.Sounds.Music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
GalaxyWars.GameScreens.Options (Options ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
3.1 Class List
7
GalaxyWars.Particles.ParticleEmitter (Helper for objects that want to leave particles behind them
as they move around the world. This emitter implementation solves two related problems: ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
GalaxyWars.Particles.ParticleSettings (Settings class describes all the tweakable options used to
control the appearance of a particle system ) . . . . . . . . . . . . . . . . . . . . . . . 258
GalaxyWars.Particles.ParticleSystem (The main component in charge of displaying particles ) . 262
GalaxyWars.Particles.ParticleVertex (Custom vertex structure for drawing point sprite particles ) 273
GalaxyWars.GameLogic.Player (Player helper class, holds all the current game properties: Fuel,
Health, Speed, Lifes and Score. Note: This class is just used in GalaxyWars and we
only have 1 instance of it for the current player for the current game. If we want to have
more than 1 player (e.g. in multiplayer mode) you should add a multiplayer class and
have all player instances there ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
GalaxyWars.Shaders.PostScreenGlow (Post screen glow shader based on PostScreenGlow.fx.
Derive from PostScreenMenu, this way we can save duplicating the effect parameters
and use the same RenderToTextures ) . . . . . . . . . . . . . . . . . . . . . . . . . . 278
GalaxyWars.Shaders.PostScreenMenu (Post screen glow shader based on PostScreenMenu.fx ) . 284
GalaxyWars.Shaders.PreScreenSkyCubeMapping (Pre screen sky cube mapping ) . . . . . . . . 291
GalaxyWars.Graphics.PrimitivesRenderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
GalaxyWars.Program (Main class of the Galaxy Wars game ) . . . . . . . . . . . . . . . . . . . 300
GalaxyWars.Helpers.RandomHelper (Random helper ) . . . . . . . . . . . . . . . . . . . . . . 302
GalaxyWars.Shaders.RenderToTexture (Render to texture helper class based on the Texture class.
This class allows to render stuff onto textures, if thats not supported, it will just not work
and report an engine log message. This class is required for most PostScreenShaders ) . 306
GalaxyWars.GameLogic.ScreenshotCapturer (This is a game component that implements IUpdateable ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
GalaxyWars.Shaders.ShaderEffect (Shader effect class. You can either directly use this class by
providing a fx filename in the constructor or derive from this class for special shader
functionality (see post screen shaders for a more complex example) ) . . . . . . . . . . 319
GalaxyWars.Sounds.Sound (Sound ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
GalaxyWars.GameLogic.SpaceshipPhysics (Spaceship controller class for controlling the ship
we control. This class is derived from the BasePlayer class, which stores all important
game values for us (game time, game over, etc.). The ChaseCamera is then derived
from this class and finally we got the Player class itself at the top, which is deriven
from all these classes. This way we can easily access everything from the Player class ) 348
GalaxyWars.GameScreens.SplashScreen (Splash screen ) . . . . . . . . . . . . . . . . . . . . . 367
GalaxyWars.Graphics.TangentVertex (Tangent vertex format for shader vertex format used all
over the place. It contains: Position, Normal vector, texture coords, tangent vector ) . . 369
GalaxyWars.Graphics.TextureFont (Texture font for our game, uses GameFont.png. If you
want to know more details about creating bitmap fonts in XNA, how to generate
the bitmaps and more details about using it, please check out the following links:
http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx
http://blogs.msdn.com/garykac/articles/732007.aspx
http://www.angelcode.com/products/bmfont/ ) . . . . . . . . . . . . . 375
GalaxyWars.Graphics.TextureFont.FontToRender (TextureFont to render ) . . . . . . . . . . . . 383
GalaxyWars.Graphics.TextureFontBigNumbers (TextureFontBigNumbers ) . . . . . . . . . . . 386
GalaxyWars.Graphics.UIRenderer (Helper class to render all UI 2D stuff. Rendering textures is
very easy with XNA using the Sprite class, but we still have to create SpriteBatches.
This class helps and handles everything for us ) . . . . . . . . . . . . . . . . . . . . . 392
GalaxyWars.Graphics.UIRenderer.TimeFadeupText . . . . . . . . . . . . . . . . . . . . . . . . 416
GalaxyWars.Shaders.VBScreenHelper (The VBScreenHelper class helps you to create and use
vertex buffers for on screen rendering used in PreScreen and PostScreen shaders. You
don’t have to create a VB for every shader anymore, just call VBScreenHelper.Render()
and everything will be created for you and reused if same parameters are requested
again! Supports also Grid screen rendering required for radial motion blur ) . . . . . . 418
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
8
Class Index
GalaxyWars.Shaders.VBScreenHelper.GridScreen (Another vertex and index buffer for a screen
grid, basically used for the same purpose as VBScreen, but allows us to create a grid
(e.g. 10x10), very useful for advanced post screen shaders ) . . . . . . . . . . . . . . . 420
GalaxyWars.Shaders.VBScreenHelper.VBScreen (VBScreen holds all data for the vbScreens list
to reuse existing VBScreens. Handles also the VB, creation and rendering ) . . . . . . 424
GalaxyWars.Helpers.Vector3Helper (Vector 3 helper ) . . . . . . . . . . . . . . . . . . . . . . . 426
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Chapter 4
File Index
4.1
File List
Here is a list of all files with brief descriptions:
AssemblyInfo.cs . . .
Asteroid.cs . . . . . .
Asteroids.cs . . . . . .
BaseGame.cs . . . . .
BasePlayer.cs . . . . .
ChaseCamera.cs . . .
ColorHelper.cs . . . .
Directories.cs . . . . .
FileHelper.cs . . . . .
FireParticleSystem.cs .
GalaxyWarsManager.cs
GameScreen.cs . . . .
GameSettings.cs . . .
Help.cs . . . . . . . .
IGameScreen.cs . . .
Input.cs . . . . . . . .
LensFlare.cs . . . . .
LineManager2D.cs . .
LineManager3D.cs . .
Log.cs . . . . . . . . .
MainMenu.cs . . . . .
Material.cs . . . . . .
MeshRenderManager.cs
Model.cs . . . . . . .
Music.cs . . . . . . .
Options.cs . . . . . .
ParticleEmitter.cs . . .
ParticleSettings.cs . .
ParticleSystem.cs . . .
ParticleVertex.cs . . .
Player.cs . . . . . . .
PostScreenGlow.cs . .
PostScreenMenu.cs . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
10
File Index
PreScreenSkyCubeMapping.cs
PrimitivesRenderer.cs . . . .
Program.cs . . . . . . . . . .
RandomHelper.cs . . . . . . .
RenderToTexture.cs . . . . .
ScreenshotCapturer.cs . . . .
ShaderEffect.cs . . . . . . . .
Sound.cs . . . . . . . . . . .
SpaceshipPhysics.cs . . . . .
SplashScreen.cs . . . . . . . .
TangentVertex.cs . . . . . . .
Texture.cs . . . . . . . . . . .
TextureFont.cs . . . . . . . .
TextureFontBigNumbers.cs .
UIRenderer.cs . . . . . . . . .
VBScreenHelper.cs . . . . . .
Vector3Helper.cs . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Chapter 5
Namespace Documentation
5.1
Package GalaxyWars
Classes
• class GalaxyWarsManager
Manager class of the game. Handles all game screens, which themself handle all the game logic.
• class Program
Main class of the Galaxy Wars game.
Packages
•
•
•
•
•
•
•
•
•
package GameLogic
package GameScreens
package Graphics
package Helpers
package Particles
package Properties
package Scenes
package Shaders
package Sounds
12
Namespace Documentation
5.2
Package GalaxyWars.GameLogic
Classes
• class BasePlayer
Base player helper class, holds all the current game values: Game time, game over, level number, victory.
More stuff that has impact to the ShipController or ChaseCamera classes should be included here, else add
them directly to the Player class, which handles all the game logic. For example adding items or powerups
should be done in this class if they affect the speed or physics of our ship.
• class ChaseCamera
Chase camera for our car. We are always close behind it. The camera rotation is not the same as the
current car rotation, we interpolate the values a bit, allowing the user to do small changes without rotating
the camera frantically. Also feels more realistic in curves. Derived from the CarController class, which
controls the car by the user input. This camera class is not controlled by the user, its all automatic!
• class Input
Input helper class, captures all the mouse, keyboard and XBox 360 controller input and provides some nice
helper methods and properties. Will also keep track of the last frame states for comparison if a button was
just pressed this frame, but not already in the last frame.
• class Player
Player helper class, holds all the current game properties: Fuel, Health, Speed, Lifes and Score. Note: This
class is just used in GalaxyWars and we only have 1 instance of it for the current player for the current
game. If we want to have more than 1 player (e.g. in multiplayer mode) you should add a multiplayer class
and have all player instances there.
• class ScreenshotCapturer
This is a game component that implements IUpdateable.
• class SpaceshipPhysics
Spaceship controller class for controlling the ship we control. This class is derived from the BasePlayer
class, which stores all important game values for us (game time, game over, etc.). The ChaseCamera is then
derived from this class and finally we got the Player class itself at the top, which is deriven from all these
classes. This way we can easily access everything from the Player class.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
5.3 Package GalaxyWars.GameScreens
5.3
13
Package GalaxyWars.GameScreens
Classes
• class GameScreen
GameScreen, just manages the on screen display for the game.
• class Help
Help.
• interface IGameScreen
Game screen helper interface for all game screens of our game. Helps us to put them all into one list and
manage them in our RaceGame.
• class MainMenu
Main menu.
• class Options
Options.
• class SplashScreen
Splash screen.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
14
Namespace Documentation
5.4
Package GalaxyWars.Graphics
Classes
• class BaseGame
Base game class for all the basic game support. Connects all our helper classes together and makes our
life easier! Note: This game was designed for 16:9 (e.g. 1920x1200), but it also works just fine for
4:3 (1024x768, 800x600, etc.). This is the reason you might see 1024x640 instead of 1024x768 in some
width/height calculations and the UI textures. The game looks best at 1920x1080 (HDTV 1080p resolution).
• class LensFlare
Lens flare class for simple 2d lens flare rendering.
• class LineManager2D
LineManager class, used for drawing lines. We can’t simply draw lines like in OpenGL (glLine) because
we need to do everything with vertex buffers, which is a bit more work (and using DrawPrimitives directly
produces way worse code).
• class LineManager3D
Helper class for game for rendering lines. This class will collect all line calls, then build a new vertex buffer
if any line has changed or the line number changed and finally will render all lines in the vertex buffer at
the end of the frame (so this class is obviously only for 2D lines directly on screen, no z buffer and no stuff
will be in front of the lines, because everything is rendered at the end of the frame).
• class Material
Material class for DirectX materials used for Models. Consists of normal DirectX material settings (ambient, diffuse, specular), the diffuse texture and optionally of normal map, height map and shader parameters.
• class MeshRenderManager
Mesh render manager, a little helper class which allows us to render all our models with much faster
performance through sorting by material and shader techniques.
• class Model
Model class for loading and displaying x files including all materials and textures. Provides load and
render functions to render static non animated models (mostly 1 mesh), for animated models we need a
more advanced class, which is not required for this game yet.
• class PrimitivesRenderer
• struct TangentVertex
Tangent vertex format for shader vertex format used all over the place. It contains: Position, Normal vector,
texture coords, tangent vector.
• class Texture
Texture class helping you with using DirectX Textures and handling possible errors that can happen while
loading (stupid DirectX error messages telling you absolutly nothing, so a lot of pre-checks help you determinate the error before even calling DirectX methods).
• class TextureFont
Texture font for our game, uses GameFont.png. If you want to know more details about creating bitmap
fonts in XNA, how to generate the bitmaps and more details about using it, please check out the following links:
http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx
http://blogs.msdn.com/garykac/articles/732007.aspx
http://www.angelcode.com/products/bmfont/.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
5.4 Package GalaxyWars.Graphics
15
• class TextureFontBigNumbers
TextureFontBigNumbers.
• class UIRenderer
Helper class to render all UI 2D stuff. Rendering textures is very easy with XNA using the Sprite class, but
we still have to create SpriteBatches. This class helps and handles everything for us.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
16
Namespace Documentation
5.5
Package GalaxyWars.Helpers
Classes
• class ColorHelper
Color helper, just to convert colors to different formats and providing more helper methods missing in the
Color class.
• class Directories
Helper class which stores all used directories.
• class FileHelper
File helper class to get text lines, number of text lines, etc. Update: Now also supports the XNA Storage
classes :).
• class Log
Log will create automatically a log file and write log/error/debug info for simple runtime error checking,
very useful for minor errors, such as finding not files. The application can still continue working, but this
log provides an easy support to find out what files are missing (in this example).
• class RandomHelper
Random helper.
• class Vector3Helper
Vector 3 helper.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
5.6 Package GalaxyWars.Particles
5.6
17
Package GalaxyWars.Particles
Classes
• class FireParticleSystem
Custom particle system for creating a flame effect.
• class ParticleEmitter
Helper for objects that want to leave particles behind them as they move around the world. This emitter
implementation solves two related problems:.
• class ParticleSettings
Settings class describes all the tweakable options used to control the appearance of a particle system.
• class ParticleSystem
The main component in charge of displaying particles.
• struct ParticleVertex
Custom vertex structure for drawing point sprite particles.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
18
Namespace Documentation
5.7
Package GalaxyWars.Properties
Classes
• class GameSettings
Game settings, stored in a custom XML file. The reason for this is we want to be able to store our game data
on the Xbox360 too. On the PC we could just use a Settings/config file and have all the code autogenerated
for us, but this way it works both on PC and Xbox. Note: The default instance for the game settings is in
this class, this way we get the same behaviour as for normal Settings files!
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
5.8 Package GalaxyWars.Scenes
5.8
Package GalaxyWars.Scenes
Classes
• class Asteroid
• class Asteroids
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
19
20
Namespace Documentation
5.9
Package GalaxyWars.Shaders
Classes
• class PostScreenGlow
Post screen glow shader based on PostScreenGlow.fx. Derive from PostScreenMenu, this way we can save
duplicating the effect parameters and use the same RenderToTextures.
• class PostScreenMenu
Post screen glow shader based on PostScreenMenu.fx.
• class PreScreenSkyCubeMapping
Pre screen sky cube mapping.
• class RenderToTexture
Render to texture helper class based on the Texture class. This class allows to render stuff onto textures, if
thats not supported, it will just not work and report an engine log message. This class is required for most
PostScreenShaders.
• class ShaderEffect
Shader effect class. You can either directly use this class by providing a fx filename in the constructor or
derive from this class for special shader functionality (see post screen shaders for a more complex example).
• class VBScreenHelper
The VBScreenHelper class helps you to create and use vertex buffers for on screen rendering used in PreScreen and PostScreen shaders. You don’t have to create a VB for every shader anymore, just call VBScreenHelper.Render() and everything will be created for you and reused if same parameters are requested
again! Supports also Grid screen rendering required for radial motion blur.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
5.10 Package GalaxyWars.Sounds
5.10
Package GalaxyWars.Sounds
Classes
• class Music
• class Sound
Sound.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
21
22
Namespace Documentation
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Chapter 6
Class Documentation
6.1
GalaxyWars.Scenes.Asteroid Class Reference
Collaboration diagram for GalaxyWars.Scenes.Asteroid:
XnaModel
xnaModel
GalaxyWars.Graphics.Model
mesh
GalaxyWars.Scenes.Asteroid
Public Member Functions
•
•
•
•
•
•
•
Asteroid (Model model, Vector3 position, Vector3 rotation, Vector3 scale)
void Set (Vector3 position, Vector3 rotation, Vector3 scale)
void Render ()
override IEnumerable< TrippVector > Vertices ()
override void GetPosition (out float x, out float y, out float z)
override void GetRotation (out float x, out float y, out float z)
override void GetScale (out float x, out float y, out float z)
Protected Member Functions
• void UpdateMatrix ()
Updated the intern transformation matrix for this asteroid.
Protected Attributes
• Vector3 position
24
Class Documentation
•
•
•
•
Vector3 rotation
Vector3 scale = new Vector3(1, 1, 1)
Matrix transformation
Model mesh
Properties
•
•
•
•
Vector3 Position [get, set]
Vector3 Rotation [get, set]
Vector3 Scale [get, set]
Model Model [get, set]
6.1.1
Detailed Description
Definition at line 10 of file Asteroid.cs.
6.1.2
Constructor & Destructor Documentation
6.1.2.1
GalaxyWars.Scenes.Asteroid.Asteroid (Model model, Vector3 position, Vector3 rotation,
Vector3 scale)
Definition at line 64 of file Asteroid.cs.
65
66
67
68
{
mesh = model;
Set(position, rotation, scale);
}
6.1.3
Member Function Documentation
6.1.3.1
void GalaxyWars.Scenes.Asteroid.Set (Vector3 position, Vector3 rotation, Vector3 scale)
Definition at line 70 of file Asteroid.cs.
71
72
73
74
75
76
6.1.3.2
{
this.position = position;
this.rotation = rotation;
this.scale = scale;
UpdateMatrix();
}
void GalaxyWars.Scenes.Asteroid.Render ()
Definition at line 78 of file Asteroid.cs.
79
80
81
82
{
mesh.Render(transformation);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.1 GalaxyWars.Scenes.Asteroid Class Reference
6.1.3.3
25
override IEnumerable<TrippVector> GalaxyWars.Scenes.Asteroid.Vertices ()
Definition at line 84 of file Asteroid.cs.
85
86
87
88
89
90
91
6.1.3.4
{
foreach (Vector3 v in mesh.Positions)
{
// Vector3 w = Vector3.Transform(v, transformation);
yield return new TrippVector(v.X, v.Y, v.Z);
}
}
override void GalaxyWars.Scenes.Asteroid.GetPosition (out float x, out float y, out float z)
Definition at line 93 of file Asteroid.cs.
94
95
96
97
98
6.1.3.5
{
x = position.X;
y = position.Y;
z = position.Z;
}
override void GalaxyWars.Scenes.Asteroid.GetRotation (out float x, out float y, out float z)
Definition at line 100 of file Asteroid.cs.
101
102
103
104
105
6.1.3.6
{
x = rotation.X;
y = rotation.Y;
z = rotation.Z;
}
override void GalaxyWars.Scenes.Asteroid.GetScale (out float x, out float y, out float z)
Definition at line 107 of file Asteroid.cs.
108
109
110
111
112
6.1.3.7
{
x = scale.X;
y = scale.Y;
z = scale.Z;
}
void GalaxyWars.Scenes.Asteroid.UpdateMatrix () [protected]
Updated the intern transformation matrix for this asteroid.
Definition at line 117 of file Asteroid.cs.
118
119
120
121
122
{
transformation = Matrix.CreateScale(scale);
if (rotation.X != 0)
transformation *= Matrix.CreateRotationX(rotation.X);
if (rotation.Y != 0)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
26
123
124
125
126
127
128
Class Documentation
transformation *= Matrix.CreateRotationX(rotation.Y);
if (rotation.Z != 0)
transformation *= Matrix.CreateRotationX(rotation.Z);
if (position != Vector3.Zero)
transformation *= Matrix.CreateTranslation(position);
}
6.1.4
Member Data Documentation
6.1.4.1
Vector3 GalaxyWars.Scenes.Asteroid.position [protected]
Definition at line 12 of file Asteroid.cs.
6.1.4.2
Vector3 GalaxyWars.Scenes.Asteroid.rotation [protected]
Definition at line 13 of file Asteroid.cs.
6.1.4.3
Vector3 GalaxyWars.Scenes.Asteroid.scale = new Vector3(1, 1, 1) [protected]
Definition at line 14 of file Asteroid.cs.
6.1.4.4
Matrix GalaxyWars.Scenes.Asteroid.transformation [protected]
Definition at line 15 of file Asteroid.cs.
6.1.4.5
Model GalaxyWars.Scenes.Asteroid.mesh [protected]
Definition at line 16 of file Asteroid.cs.
6.1.5
Property Documentation
6.1.5.1
Vector3 GalaxyWars.Scenes.Asteroid.Position [get, set]
Definition at line 19 of file Asteroid.cs.
6.1.5.2
Vector3 GalaxyWars.Scenes.Asteroid.Rotation [get, set]
Definition at line 31 of file Asteroid.cs.
6.1.5.3
Vector3 GalaxyWars.Scenes.Asteroid.Scale [get, set]
Definition at line 43 of file Asteroid.cs.
6.1.5.4
Model GalaxyWars.Scenes.Asteroid.Model [get, set]
Definition at line 55 of file Asteroid.cs.
The documentation for this class was generated from the following file:
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.1 GalaxyWars.Scenes.Asteroid Class Reference
• Asteroid.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
27
28
Class Documentation
6.2
GalaxyWars.Scenes.Asteroids Class Reference
Collaboration diagram for GalaxyWars.Scenes.Asteroids:
XnaModel
xnaModel
GalaxyWars.Graphics.Model
asteroidModels
GalaxyWars.Scenes.Asteroids
Public Member Functions
•
•
•
•
Asteroids (Vector3 origin, Vector3 size)
void Update (GameTime gt)
void Render ()
IEnumerable< Vector3 > Vertices ()
Public Attributes
• const int AsteroidsAmount = 128
• const int MinimalSize = 50
• const int MaximalSize = 250
Properties
• List< Asteroid > ActiveAsteroids [get]
Private Attributes
•
•
•
•
Vector3 areaOrigin
Vector3 areaSize
Model[ ] asteroidModels = null
List< Asteroid > asteroids = new List<Asteroid>()
6.2.1
Detailed Description
Definition at line 10 of file Asteroids.cs.
6.2.2
Constructor & Destructor Documentation
6.2.2.1
GalaxyWars.Scenes.Asteroids.Asteroids (Vector3 origin, Vector3 size)
Definition at line 28 of file Asteroids.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.2 GalaxyWars.Scenes.Asteroids Class Reference
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
Random r = new Random();
float x, y, z;
asteroidModels = new Model[6];
asteroidModels[0] = new Model("AsteroidA");
asteroidModels[1] = new Model("AsteroidB");
asteroidModels[2] = new Model("AsteroidC");
asteroidModels[3] = new Model("AsteroidD");
asteroidModels[4] = new Model("AsteroidE");
asteroidModels[5] = new Model("AsteroidF");
areaOrigin = origin;
areaSize = size;
for (int i = 0; i < AsteroidsAmount; i++)
{
if (i == 0)
{
x = origin.X;
y = origin.Y;
z = origin.Z;
}
else
{
x = origin.X + (float)(r.NextDouble() - 0.5) * size.X;
y = origin.Y + (float)(r.NextDouble() - 0.5) * size.Y;
z = origin.Z + (float)(r.NextDouble() - 0.5) * size.Z;
}
Asteroid a = new Asteroid(asteroidModels[i % 6],
new Vector3(x, y, z),
Vector3.Zero,
new Vector3(r.Next(MinimalSize, MaximalSize)));
asteroids.Add(a);
}
}
6.2.3
Member Function Documentation
6.2.3.1
void GalaxyWars.Scenes.Asteroids.Update (GameTime gt)
Definition at line 67 of file Asteroids.cs.
68
69
70
71
72
73
74
6.2.3.2
{
//Random r = new Random();
//asteroids[0].Position += new Vector3((float)(r.NextDouble() - 0.5),
//
(float)(r.NextDouble() - 0.5),
//
(float)(r.NextDouble() - 0.5));
}
void GalaxyWars.Scenes.Asteroids.Render ()
Definition at line 76 of file Asteroids.cs.
77
78
79
80
29
{
foreach (Asteroid a in asteroids)
a.Render();
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
30
6.2.3.3
Class Documentation
IEnumerable<Vector3> GalaxyWars.Scenes.Asteroids.Vertices ()
Definition at line 106 of file Asteroids.cs.
107
108
109
110
111
{
foreach (Asteroid a in asteroids)
foreach (TrippVector p in a.Vertices())
yield return new Vector3(p.X, p.Y, p.Z);
}
6.2.4
Member Data Documentation
6.2.4.1
const int GalaxyWars.Scenes.Asteroids.AsteroidsAmount = 128
Definition at line 12 of file Asteroids.cs.
6.2.4.2
const int GalaxyWars.Scenes.Asteroids.MinimalSize = 50
Definition at line 13 of file Asteroids.cs.
6.2.4.3
const int GalaxyWars.Scenes.Asteroids.MaximalSize = 250
Definition at line 14 of file Asteroids.cs.
6.2.4.4
Vector3 GalaxyWars.Scenes.Asteroids.areaOrigin [private]
Definition at line 16 of file Asteroids.cs.
6.2.4.5
Vector3 GalaxyWars.Scenes.Asteroids.areaSize [private]
Definition at line 16 of file Asteroids.cs.
6.2.4.6
Model [ ] GalaxyWars.Scenes.Asteroids.asteroidModels = null [private]
Definition at line 17 of file Asteroids.cs.
6.2.4.7
List<Asteroid> GalaxyWars.Scenes.Asteroids.asteroids = new List<Asteroid>()
[private]
Definition at line 18 of file Asteroids.cs.
6.2.5
Property Documentation
6.2.5.1
List<Asteroid> GalaxyWars.Scenes.Asteroids.ActiveAsteroids [get]
Definition at line 21 of file Asteroids.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
The documentation for this class was generated from the following file:
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.2 GalaxyWars.Scenes.Asteroids Class Reference
• Asteroids.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
31
32
Class Documentation
6.3
GalaxyWars.Graphics.BaseGame Class Reference
Base game class for all the basic game support. Connects all our helper classes together and makes our
life easier! Note: This game was designed for 16:9 (e.g. 1920x1200), but it also works just fine for
4:3 (1024x768, 800x600, etc.). This is the reason you might see 1024x640 instead of 1024x768 in some
width/height calculations and the UI textures. The game looks best at 1920x1080 (HDTV 1080p resolution).
Inheritance diagram for GalaxyWars.Graphics.BaseGame:
GalaxyWars.Graphics.BaseGame
GalaxyWars.GalaxyWarsManager
Collaboration diagram for GalaxyWars.Graphics.BaseGame:
GalaxyWars.Graphics.MeshRenderManager
meshRenderManager
GalaxyWars.Graphics.LineManager2D
GalaxyWars.Graphics.LineManager3D
lineManager2D
lineManager3D
GalaxyWars.Graphics.BaseGame
BackgroundColor
randomCarColor
ui
color
Color
flareTypes
GalaxyWars.Graphics.LensFlare.FlareData
DefaultSkyColor
lastUsedAmbientColor
lastUsedSpecularColor
lastUsedDiffuseColor
lastUsedCarHueColorChange
flareTextures
GalaxyWars.Graphics.LensFlare
lensFlare
cube
XnaModel
XnaTexture
lastUsedHeightTexture
lastUsedNormalTexture
lastUsedDiffuseTexture
lastUsedDetailTexture
GalaxyWars.Shaders.PreScreenSkyCubeMapping
skyCube
GalaxyWars.Graphics.UIRenderer
lighting
normalMapping
landscapeNormalMapping
lineRendering
postScreenMenuShader
postScreenGameShader
GalaxyWars.Shaders.ShaderEffect
noiseMapTexture
GalaxyWars.Shaders.PostScreenMenu
blurMap1Texture
blurMap2Texture
sceneMapTexture
downsampleMapTexture
GalaxyWars.Shaders.PostScreenGlow
radialSceneMapTexture
GalaxyWars.Shaders.RenderToTexture
Texture2D
internalXnaTexture
screenBorderFadeoutMapTexture
GalaxyWars.Graphics.Texture
fontTexture
font
GalaxyWars.Graphics.TextureFont
headers
buttons
ingame
background
optionsScreen
helpScreen
trophies
mouseCursor
Public Types
• enum AlphaMode
Alpha modes.
Public Member Functions
• delegate void RenderHandler ()
Render delegate for rendering methods, also used for many other methods.
Static Public Member Functions
• static bool EveryMillisecond (int checkMilliseconds)
Return true every checkMilliseconds.
• static int XToRes (int xIn1024px)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
33
XToRes helper method to convert 1024x640 to the current screen resolution. Used to position UI elements.
• static int YToRes (int yIn640px)
YToRes helper method to convert 1024x640 to the current screen resolution. Used to position UI elements.
• static int YToRes768 (int yIn768px)
YTo res 768.
• static int XToRes1600 (int xIn1600px)
XTo res 1600.
• static int YToRes1200 (int yIn1200px)
YTo res 1200.
• static int XToRes1400 (int xIn1400px)
XTo res 1400.
• static int YToRes1050 (int yIn1050px)
YTo res 1200.
• static Rectangle CalcRectangle (int relX, int relY, int relWidth, int relHeight)
Calc rectangle, helper method to convert from our images (1024) to the current resolution. Everything will
stay in the 16/9 format of the textures.
• static Rectangle CalcRectangleWithBounce (int relX, int relY, int relWidth, int relHeight, float
bounceEffect)
Calc rectangle with bounce effect, same as CalcRectangle, but sizes the resulting rect up and down depending on the bounceEffect value.
• static Rectangle CalcRectangleKeep4To3 (int relX, int relY, int relWidth, int relHeight)
Calc rectangle, same method as CalcRectangle, but keep the 4 to 3 ratio for the image. The Rect will take
same screen space in 16:9 and 4:3 modes. E.g. Buttons should be displayed this way. Should be used for
1024px width graphics.
• static Rectangle CalcRectangleKeep4To3 (Rectangle gfxRect)
Calc rectangle, same method as CalcRectangle, but keep the 4 to 3 ratio for the image. The Rect will take
same screen space in 16:9 and 4:3 modes. E.g. Buttons should be displayed this way. Should be used for
1024px width graphics.
• static Rectangle CalcRectangle1600 (int relX, int relY, int relWidth, int relHeight)
Calc rectangle for 1600px width graphics.
• static Rectangle CalcRectangle2000 (int relX, int relY, int relWidth, int relHeight)
Calc rectangle 2000px, just a helper to scale stuff down.
• static Rectangle CalcRectangleKeep4To3AlignBottom (int relX, int relY, int relWidth, int relHeight)
Calc rectangle keep 4 to 3 align bottom.
• static Rectangle CalcRectangleKeep4To3AlignBottomRight (int relX, int relY, int relWidth, int relHeight)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
34
Class Documentation
Calc rectangle keep 4 to 3 align bottom right.
• static Rectangle CalcRectangleCenteredWithGivenHeight (int relX, int relY, int relHeight, Rectangle
gfxRect)
Calc rectangle centered with given height. This one uses relX and relY points as the center for our rect. The
relHeight is then calculated and we align everything with help of gfxRect (determinating the width). Very
useful for buttons, logos and other centered UI textures.
• static void SetAlphaBlendingEnabled (bool value)
Alpha blending.
• static void SetCurrentAlphaMode (AlphaMode value)
Current alpha mode.
• static Point Convert3DPointTo2D (Vector3 point)
Convert 3D vector to 2D vector, this is kinda the oposite of GetScreenPlaneVector (not shown here). This
can be useful for user input/output, because we will often need the actual position on screen of an object in
3D space from the users view to handle it the right way. Used for lens flare and asteroid optimizations.
• static bool PointInFront (Vector3 point)
Is point in front of camera?
• static bool PointVisible (Vector3 point, float checkOffset)
Helper to check if a 3d-point is visible on the screen. Will basically do the same as IsInFrontOfCamera and
Convert3DPointTo2D, but requires less code and is faster. Also returns just an bool. Will return true if point
is visble on screen, false otherwise. Use the offset parameter to include points into the screen that are only
a couple of pixel outside of it.
• static void DrawLine (Point startPoint, Point endPoint, Color color)
Draw line.
• static void DrawLine (Point startPoint, Point endPoint)
Draw line.
• static void DrawLine (Vector3 startPos, Vector3 endPos, Color color)
Draw line.
• static void DrawLine (Vector3 startPos, Vector3 endPos, Color startColor, Color endColor)
Draw line.
• static void DrawLine (Vector3 startPos, Vector3 endPos)
Draw line.
• static void RenderLines2D ()
Flush line manager 2D. Renders all lines and allows more lines to be rendered. Used to render lines into
textures and stuff.
• static void RenderLines3D ()
Flush line manager 3D. Renders all lines and allows more lines to be rendered.
• static void ClearBackground ()
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
35
Clear background.
• static void AddRemRenderToTexture (RenderToTexture renderToTexture)
Add render to texture instance to allow recreating them all when DeviceReset is called with help of the
remRenderToTextures list.
Public Attributes
• const float ViewableFieldOfView = FieldOfView / 1.125f
Viewable field of view for object visibility testing (see Model class).
• const float Epsilon = 0.000001f
Epsilon (1/1000000) for comparing stuff which is nearly equal.
Static Public Attributes
• static PlatformID CurrentPlatform = Environment.OSVersion.Platform
Protected Member Functions
• BaseGame (string setWindowsTitle)
Create base game.
• BaseGame ()
Empty constructor for the designer support.
• override void Initialize ()
Initialize.
• override void Update (GameTime gameTime)
Update.
• override void OnActivated (object sender, EventArgs args)
On activated.
• override void OnDeactivated (object sender, EventArgs args)
On deactivated.
• override void Draw (GameTime gameTime)
Draw.
• virtual void Render ()
Render.
• virtual void PostUIRender ()
Post user interface rendering, in case we need it. Used for rendering the car selection 3d stuff after the UI.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
36
Class Documentation
Static Protected Attributes
• static GraphicsDeviceManager graphicsManager = null
Graphics device manager, used for the graphics creation and holds the GraphicsDevice.
• static ContentManager contentManager = null
Content manager for all game resources.
• static UIRenderer ui = null
UI Renderer helper class for all 2d rendering.
• static int screenWidth
Our screen resolution: Width and height of visible render area.
• static int screenHeight
Properties
• static string WindowsTitle [get]
Get windows title to check if we are in certain unit tests!
• static LineManager3D LineManager [get]
• static Vector3 LightDirection [get, set]
Light direction.
• static GraphicsDevice Device [get]
• static DepthFormat BackBufferDepthFormat [get]
Back buffer depth format.
• static bool Fullscreen [get]
Fullscreen.
• static bool HighDetail [get]
High detail.
• static bool AllowShadowMapping [get]
Allow shadow mapping.
• static bool UsePostScreenShaders [get]
Use post screen shaders.
• static ContentManager Content [get]
Content.
• static UIRenderer UI [get]
User interface renderer helper ∧∧ .
• static MeshRenderManager MeshRenderManager [get]
Mesh render manager to render meshes of models in a highly optimized manner.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
37
• static int Width [get]
Width.
• static int Height [get]
Height.
• static float AspectRatio [get]
Aspect ratio.
• static Rectangle ResolutionRect [get]
Resolution rectangle.
• static int Fps [get]
Fps.
• static int TotalFrames [get]
Total frames.
• static float ElapsedTimeThisFrameInMilliseconds [get]
Elapsed time this frame in ms.
• static float TotalTime [get]
Total time in seconds.
• static float TotalTimeMilliseconds [get]
Total time ms.
• static float MoveFactorPerSecond [get]
Move factor per second, when we got 1 fps, this will be 1.0f, when we got 100 fps, this will be 0.01f.
• static Matrix WorldMatrix [get, set]
World matrix.
• static Matrix ViewMatrix [get, set]
View matrix.
• static Matrix ProjectionMatrix [get, set]
Projection matrix.
• static Vector3 CameraPos [get]
Get camera position from inverse view matrix. Similar to method used in shader. Works only if ViewMatrix
is correctly set.
• static Vector3 CameraRotation [get]
Camera rotation.
• static Matrix InverseViewMatrix [get]
Inverse view matrix.
• static Matrix ViewProjectionMatrix [get]
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
38
Class Documentation
View projection matrix.
• static Matrix WorldViewProjectionMatrix [get]
World view projection matrix.
• static bool IsAppActive [get]
Is app active.
• static RenderTarget2D CurrentRenderTarget [get]
Current render target we have set, null if it is just the back buffer.
Private Member Functions
• void graphics_PrepareDevice (object sender, PreparingDeviceSettingsEventArgs e)
• void graphics_DeviceReset (object sender, EventArgs e)
Graphics device reset.
Static Private Member Functions
• static internal void CheckOptionsAndShaderVersion ()
Check options and PS version.
• static internal void ApplyResolutionChange ()
• static internal void SetRenderTarget (RenderTarget2D renderTarget, bool isSceneRenderTarget)
Set render target.
• static internal void ResetRenderTarget (bool fullResetToBackBuffer)
Reset render target.
Private Attributes
• const float FieldOfView = (float)(0.4 ∗ Math.PI)
Field of view and near and far plane distances for the ProjectionMatrix creation.
• const float NearPlane = 0.5f
• const float FarPlane = 1750
• int renderLoopErrorCount = 0
Static Private Attributes
• static readonly Color BackgroundColor = Color.White
Background color.
• static float aspectRatio = 1.0f
Aspect ratio of our current resolution.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
39
• static string remWindowsTitle = ""
Remember windows title to check if we are in certain unit tests!
• static LineManager2D lineManager2D = null
Helper class instance to work the 2D lines.
• static LineManager3D lineManager3D
Helper class instance to work the 3D lines.
• static MeshRenderManager meshRenderManager = new MeshRenderManager()
Mesh render manager to render meshes of models in a highly optimized manner. We don’t really have
anything stored in here except for a sorted list on how to render everything based on the techniques and the
materials and links to the renderable meshes.
• static Matrix worldMatrix
Matrices for shaders. Used in a similar way than in Rocket Commander, but since we don’t have a fixed
function pipeline here we just use these values in the shader. Make sure to set all matrices before calling
a shader. Inside a shader you have to update the shader parameter too, just setting the WorldMatrix alone
does not work.
• static Matrix viewMatrix
• static Matrix projectionMatrix
• static Vector3 lightDirection = new Vector3(0, 0, 1)
Light direction, please read matrices info above for more details. The same things apply here.
• static float elapsedTimeThisFrameInMs = 0.001f
Elapsed time this frame in ms. Always have something valid here in case we devide through this values!
• static float totalTimeMs = 0
• static float lastFrameTotalTimeMs = 0
• static float startTimeThisSecond = 0
Helper for calculating frames per second.
• static int frameCountThisSecond = 0
For more accurate frames per second calculations, just count for one second, then fpsLastSecond is updated.
Btw: Start with 1 to help some tests avoid the devide through zero problem.
• static int totalFrameCount = 0
• static int fpsLastSecond = 60
• static DepthFormat backBufferDepthFormat = DepthFormat.Depth32
Back buffer depth format.
•
•
•
•
•
•
static bool alreadyCheckedGraphicsOptions = false
static bool highDetail = true
static bool allowShadowMapping = true
static bool usePostScreenShaders = true
static bool mustApplyDeviceChanges = false
static float fpsInterpolated = 100.0f
Interpolated fps over the last 10 seconds. Obviously goes down if our framerate is low.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
40
Class Documentation
• static Vector3 camPosition
Camera pos, updated each frame in ViewMatrix! Public to allow easy access from everywhere, will be
called a lot each frame, for example Model.Render uses this for distance checks.
• static Vector3 cameraRotation = new Vector3(0, 0, 1)
Camera rotation, used to compare objects for visibility.
• static Matrix invViewMatrix
Remember inverse view matrix.
• static bool isAppActive = true
• static RenderTarget2D remSceneRenderTarget = null
Remember scene render target. This is very important because for our post screen shaders we have to
render our whole scene to this render target. But in the process we will use many other shaders and they
might set their own render targets and then reset it, but we need to have this scene still to be set. Don’t reset
to the back buffer (with SetRenderTarget(0, null), this would stop rendering to our scene render target and
the post screen shader will not be able to process our screen. The whole reason for this is that we can’t use
StrechRectangle like in Rocket Commander because XNA does not provide that function (the reason for that
is cross platform compatibility with the XBox360). Instead we could use ResolveBackBuffer, but that method
is VERY SLOW. Our framerate would drop from 600 fps down to 20, not good. However, multisampling will
not work, so we will disable it anyway!
• static RenderTarget2D lastSetRenderTarget = null
Remember the last render target we set, this way we can check if the rendertarget was set before calling
resolve!
• static List< RenderToTexture > remRenderToTextures = new List<RenderToTexture>()
Remember render to texture instances to allow recreating them all when DeviceReset is called.
6.3.1
Detailed Description
Base game class for all the basic game support. Connects all our helper classes together and makes our
life easier! Note: This game was designed for 16:9 (e.g. 1920x1200), but it also works just fine for
4:3 (1024x768, 800x600, etc.). This is the reason you might see 1024x640 instead of 1024x768 in some
width/height calculations and the UI textures. The game looks best at 1920x1080 (HDTV 1080p resolution).
Definition at line 31 of file BaseGame.cs.
6.3.2
Member Enumeration Documentation
6.3.2.1
enum GalaxyWars::Graphics::BaseGame::AlphaMode
Alpha modes.
Enumerator:
DisableAlpha Disable alpha blending for this (even if the texture has alpha).
Default Default alpha mode: SourceAlpha and InvSourceAlpha, which does nothing if the texture
does not have alpha, else it just displays it as it is (with transparent pixels).
SourceAlphaOne Use source alpha one mode, this is the default mode for lighting effects.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
41
OneOne One one alpha mode.
Definition at line 945 of file BaseGame.cs.
946
950
956
961
965
966
{
DisableAlpha,
Default,
SourceAlphaOne,
OneOne,
}
6.3.3
Constructor & Destructor Documentation
6.3.3.1
GalaxyWars.Graphics.BaseGame.BaseGame (string setWindowsTitle) [protected]
Create base game.
Parameters:
setWindowsTitle Set windows title
Definition at line 1003 of file BaseGame.cs.
1004
{
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016 #if DEBUG
1017
1018
1019 #endif
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
}
6.3.3.2
graphicsManager = new GraphicsDeviceManager(this); // Set graphics
// Set minimum requirements
graphicsManager.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;
graphicsManager.MinimumVertexShaderProfile = ShaderProfile.VS_2_0;
graphicsManager.PreparingDeviceSettings +=
new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PrepareDevice);
GameSettings.Initialize();
ApplyResolutionChange();
// Disable vertical retrace to get highest framerates possible for testing performance.
graphicsManager.SynchronizeWithVerticalRetrace = false;
// Update as fast as possible, do not use fixed time steps.
// The whole game is designed this way, if you remove this line
// the car will not behave normal anymore!
this.IsFixedTimeStep = false;
// Init content manager
contentManager = new ContentManager(this.Services);
// Update windows title (used for unit testing)
this.Window.Title = setWindowsTitle;
remWindowsTitle = setWindowsTitle;
// Replaces static Constructors with simple inits.
Sound.Initialize();
Music.Initialize();
Log.Initialize();
GalaxyWars.Graphics.BaseGame.BaseGame () [protected]
Empty constructor for the designer support.
Definition at line 1040 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
42
Class Documentation
1040
1041
1042
: this("Game")
{
}
6.3.4
Member Function Documentation
6.3.4.1
static bool GalaxyWars.Graphics.BaseGame.EveryMillisecond (int checkMilliseconds)
[static]
Return true every checkMilliseconds.
Parameters:
checkMilliseconds Check ms
Returns:
Bool
Definition at line 178 of file BaseGame.cs.
179
180
181
182
6.3.4.2
{
return (int)(lastFrameTotalTimeMs / checkMilliseconds) !=
(int)(totalTimeMs / checkMilliseconds);
}
static internal void GalaxyWars.Graphics.BaseGame.CheckOptionsAndShaderVersion ()
[static, private]
Check options and PS version.
Definition at line 220 of file BaseGame.cs.
221
222
223
224
225
226
227
228
229
230
231
232
6.3.4.3
{
GraphicsDevice device = Device;
if (device == null)
throw new InvalidOperationException("Device is not created yet!");
alreadyCheckedGraphicsOptions = true;
usePostScreenShaders = GameSettings.Default.PostScreenEffects;
allowShadowMapping = GameSettings.Default.ShadowMapping;
highDetail = GameSettings.Default.HighDetail;
}
static internal void GalaxyWars.Graphics.BaseGame.ApplyResolutionChange ()
[static, private]
Definition at line 299 of file BaseGame.cs.
300
301
302
303
{
int resolutionWidth = GameSettings.Default.ResolutionWidth;
int resolutionHeight = GameSettings.Default.ResolutionHeight;
// Use current desktop resolution if autodetect is selected.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
304
305
306
307
308
309
310
311
312
313 #if XBOX360
314
315
316
317
318
319
320 #else
321
322
323
324
325
326 #endif
327
}
6.3.4.4
43
if (resolutionWidth <= 0 ||
resolutionHeight <= 0)
{
resolutionWidth =
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
resolutionHeight =
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
}
// Xbox 360 graphics settings are fixed
graphicsManager.IsFullScreen = true;
graphicsManager.PreferredBackBufferWidth =
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
graphicsManager.PreferredBackBufferHeight =
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
graphicsManager.PreferredBackBufferWidth = resolutionWidth;
graphicsManager.PreferredBackBufferHeight = resolutionHeight;
graphicsManager.IsFullScreen = GameSettings.Default.Fullscreen;
mustApplyDeviceChanges = true;
static int GalaxyWars.Graphics.BaseGame.XToRes (int xIn1024px) [static]
XToRes helper method to convert 1024x640 to the current screen resolution. Used to position UI elements.
Parameters:
xIn1024px X in 1024px width resolution
Returns:
Int
Definition at line 434 of file BaseGame.cs.
435
436
437
{
return (int)Math.Round(xIn1024px * BaseGame.Width / 1024.0f);
}
6.3.4.5
static int GalaxyWars.Graphics.BaseGame.YToRes (int yIn640px) [static]
YToRes helper method to convert 1024x640 to the current screen resolution. Used to position UI elements.
Parameters:
yIn640px Y in 640px height
Returns:
Int
Definition at line 445 of file BaseGame.cs.
446
447
448
{
return (int)Math.Round(yIn640px * BaseGame.Height / 640.0f);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
44
Class Documentation
6.3.4.6
static int GalaxyWars.Graphics.BaseGame.YToRes768 (int yIn768px) [static]
YTo res 768.
Parameters:
yIn768px Y in 768px
Returns:
Int
Definition at line 455 of file BaseGame.cs.
456
457
458
{
return (int)Math.Round(yIn768px * BaseGame.Height / 768.0f);
}
6.3.4.7
static int GalaxyWars.Graphics.BaseGame.XToRes1600 (int xIn1600px) [static]
XTo res 1600.
Parameters:
xIn1600px X in 1600px
Returns:
Int
Definition at line 465 of file BaseGame.cs.
466
467
468
{
return (int)Math.Round(xIn1600px * BaseGame.Width / 1600.0f);
}
6.3.4.8
static int GalaxyWars.Graphics.BaseGame.YToRes1200 (int yIn1200px) [static]
YTo res 1200.
Parameters:
yIn768px Y in 1200px
Returns:
Int
Definition at line 475 of file BaseGame.cs.
476
477
478
{
return (int)Math.Round(yIn1200px * BaseGame.Height / 1200.0f);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.4.9
45
static int GalaxyWars.Graphics.BaseGame.XToRes1400 (int xIn1400px) [static]
XTo res 1400.
Parameters:
xIn1400px X in 1400px
Returns:
Int
Definition at line 485 of file BaseGame.cs.
486
487
488
{
return (int)Math.Round(xIn1400px * BaseGame.Width / 1400.0f);
}
6.3.4.10
static int GalaxyWars.Graphics.BaseGame.YToRes1050 (int yIn1050px) [static]
YTo res 1200.
Parameters:
yIn1050px Y in 1050px
Returns:
Int
Definition at line 495 of file BaseGame.cs.
496
497
498
{
return (int)Math.Round(yIn1050px * BaseGame.Height / 1050.0f);
}
6.3.4.11
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangle (int relX, int relY, int
relWidth, int relHeight) [static]
Calc rectangle, helper method to convert from our images (1024) to the current resolution. Everything will
stay in the 16/9 format of the textures.
Parameters:
x X
y Y
width Width
height Height
Returns:
Rectangle
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
46
Class Documentation
Definition at line 510 of file BaseGame.cs.
512
513
514
515
516
517
518
519
520
{
float widthFactor = screenWidth / 1024.0f;
float heightFactor = screenHeight / 640.0f;
return new Rectangle(
(int)Math.Round(relX * widthFactor),
(int)Math.Round(relY * heightFactor),
(int)Math.Round(relWidth * widthFactor),
(int)Math.Round(relHeight * heightFactor));
}
6.3.4.12
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangleWithBounce (int relX,
int relY, int relWidth, int relHeight, float bounceEffect) [static]
Calc rectangle with bounce effect, same as CalcRectangle, but sizes the resulting rect up and down depending on the bounceEffect value.
Parameters:
relX Rel x
relY Rel y
relWidth Rel width
relHeight Rel height
bounceEffect Bounce effect
Returns:
Rectangle
Definition at line 532 of file BaseGame.cs.
534
535
536
537
538
539
540
541
542
543
544
545
546
{
float widthFactor = screenWidth / 1024.0f;
float heightFactor = screenHeight / 640.0f;
float middleX = (relX + relWidth / 2) * widthFactor;
float middleY = (relY + relHeight / 2) * heightFactor;
float retWidth = relWidth * widthFactor * bounceEffect;
float retHeight = relHeight * heightFactor * bounceEffect;
return new Rectangle(
(int)Math.Round(middleX - retWidth / 2),
(int)Math.Round(middleY - retHeight / 2),
(int)Math.Round(retWidth),
(int)Math.Round(retHeight));
}
6.3.4.13
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangleKeep4To3 (int relX, int
relY, int relWidth, int relHeight) [static]
Calc rectangle, same method as CalcRectangle, but keep the 4 to 3 ratio for the image. The Rect will take
same screen space in 16:9 and 4:3 modes. E.g. Buttons should be displayed this way. Should be used for
1024px width graphics.
Parameters:
relX Rel x
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
47
relY Rel y
relWidth Rel width
relHeight Rel height
Returns:
Rectangle
Definition at line 559 of file BaseGame.cs.
561
562
563
564
565
566
567
568
569
{
float widthFactor = screenWidth / 1024.0f;
float heightFactor = screenHeight / 768.0f;
return new Rectangle(
(int)Math.Round(relX * widthFactor),
(int)Math.Round(relY * heightFactor),
(int)Math.Round(relWidth * widthFactor),
(int)Math.Round(relHeight * heightFactor));
}
6.3.4.14
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangleKeep4To3 (Rectangle
gfxRect) [static]
Calc rectangle, same method as CalcRectangle, but keep the 4 to 3 ratio for the image. The Rect will take
same screen space in 16:9 and 4:3 modes. E.g. Buttons should be displayed this way. Should be used for
1024px width graphics.
Parameters:
gfxRect Gfx rectangle
Returns:
Rectangle
Definition at line 579 of file BaseGame.cs.
581
582
583
584
585
586
587
588
589
{
float widthFactor = screenWidth / 1024.0f;
float heightFactor = screenHeight / 768.0f;
return new Rectangle(
(int)Math.Round(gfxRect.X * widthFactor),
(int)Math.Round(gfxRect.Y * heightFactor),
(int)Math.Round(gfxRect.Width * widthFactor),
(int)Math.Round(gfxRect.Height * heightFactor));
}
6.3.4.15
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangle1600 (int relX, int relY,
int relWidth, int relHeight) [static]
Calc rectangle for 1600px width graphics.
Parameters:
relX Rel x
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
48
Class Documentation
relY Rel y
relWidth Rel width
relHeight Rel height
Returns:
Rectangle
Definition at line 599 of file BaseGame.cs.
601
602
603
604
605
606
607
608
609
610
{
float widthFactor = screenWidth / 1600.0f;
float heightFactor = (screenHeight / 1200.0f);// / (aspectRatio / (16 / 9));
return new Rectangle(
(int)Math.Round(relX * widthFactor),
(int)Math.Round(relY * heightFactor),
(int)Math.Round(relWidth * widthFactor),
(int)Math.Round(relHeight * heightFactor));
}
6.3.4.16
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangle2000 (int relX, int relY,
int relWidth, int relHeight) [static]
Calc rectangle 2000px, just a helper to scale stuff down.
Parameters:
relX Rel x
relY Rel y
relWidth Rel width
relHeight Rel height
Returns:
Rectangle
Definition at line 620 of file BaseGame.cs.
622
623
624
625
626
627
628
629
630
6.3.4.17
{
float widthFactor = screenWidth / 2000.0f;
float heightFactor = (screenHeight / 1500.0f);
return new Rectangle(
(int)Math.Round(relX * widthFactor),
(int)Math.Round(relY * heightFactor),
(int)Math.Round(relWidth * widthFactor),
(int)Math.Round(relHeight * heightFactor));
}
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangleKeep4To3AlignBottom
(int relX, int relY, int relWidth, int relHeight) [static]
Calc rectangle keep 4 to 3 align bottom.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
Parameters:
relX Rel x
relY Rel y
relWidth Rel width
relHeight Rel height
Returns:
Rectangle
Definition at line 640 of file BaseGame.cs.
642
643
644
645
646
647
648
649
650
651
652
{
float widthFactor = screenWidth / 1024.0f;
float heightFactor16To9 = screenHeight / 640.0f;
float heightFactor4To3 = screenHeight / 768.0f;
return new Rectangle(
(int)(relX * widthFactor),
(int)(relY * heightFactor16To9) (int)Math.Round(relHeight * heightFactor4To3),
(int)Math.Round(relWidth * widthFactor),
(int)Math.Round(relHeight * heightFactor4To3));
}
6.3.4.18
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangleKeep4To3AlignBottomRight
(int relX, int relY, int relWidth, int relHeight) [static]
Calc rectangle keep 4 to 3 align bottom right.
Parameters:
relX Rel x
relY Rel y
relWidth Rel width
relHeight Rel height
Returns:
Rectangle
Definition at line 662 of file BaseGame.cs.
664
665
666
667
668
669
670
671
672
673
674
675
{
float widthFactor = screenWidth / 1024.0f;
float heightFactor16To9 = screenHeight / 640.0f;
float heightFactor4To3 = screenHeight / 768.0f;
return new Rectangle(
(int)(relX * widthFactor) (int)Math.Round(relWidth * widthFactor),
(int)(relY * heightFactor16To9) (int)Math.Round(relHeight * heightFactor4To3),
(int)Math.Round(relWidth * widthFactor),
(int)Math.Round(relHeight * heightFactor4To3));
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
49
50
Class Documentation
6.3.4.19
static Rectangle GalaxyWars.Graphics.BaseGame.CalcRectangleCenteredWithGivenHeight (int
relX, int relY, int relHeight, Rectangle gfxRect) [static]
Calc rectangle centered with given height. This one uses relX and relY points as the center for our rect.
The relHeight is then calculated and we align everything with help of gfxRect (determinating the width).
Very useful for buttons, logos and other centered UI textures.
Parameters:
relX Rel x
relY Rel y
relHeight Rel height
gfxRect Gfx rectangle
Returns:
Rectangle
Definition at line 689 of file BaseGame.cs.
691
692
693
694
695
696
697
698
699
700
701
702
6.3.4.20
{
float widthFactor = screenWidth / 1024.0f;
float heightFactor = screenHeight / 640.0f;
int rectHeight = (int)Math.Round(relHeight * heightFactor);
// Keep aspect ratio
int rectWidth = (int)Math.Round(
gfxRect.Width * rectHeight / (float)gfxRect.Height);
return new Rectangle(
Math.Max(0, (int)Math.Round(relX * widthFactor) - rectWidth / 2),
Math.Max(0, (int)Math.Round(relY * heightFactor) - rectHeight / 2),
rectWidth, rectHeight);
}
static void GalaxyWars.Graphics.BaseGame.SetAlphaBlendingEnabled (bool value)
[static]
Alpha blending.
Definition at line 928 of file BaseGame.cs.
929
930
931
932
933
934
935
936
937
938
939
940
{
if (value)
{
Device.RenderState.AlphaBlendEnable = true;
Device.RenderState.SourceBlend = Blend.SourceAlpha;
Device.RenderState.DestinationBlend = Blend.InverseSourceAlpha;
}
else
{
Device.RenderState.AlphaBlendEnable = false;
}
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.4.21
51
static void GalaxyWars.Graphics.BaseGame.SetCurrentAlphaMode (AlphaMode value)
[static]
Current alpha mode.
Definition at line 971 of file BaseGame.cs.
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
{
switch (value)
{
case AlphaMode.DisableAlpha:
Device.RenderState.SourceBlend = Blend.Zero;
Device.RenderState.DestinationBlend = Blend.One;
break;
case AlphaMode.Default:
Device.RenderState.SourceBlend = Blend.SourceAlpha;
Device.RenderState.DestinationBlend = Blend.InverseSourceAlpha;
break;
case AlphaMode.SourceAlphaOne:
Device.RenderState.SourceBlend = Blend.SourceAlpha;
Device.RenderState.DestinationBlend = Blend.One;
break;
case AlphaMode.OneOne:
Device.RenderState.SourceBlend = Blend.One;
Device.RenderState.DestinationBlend = Blend.One;
break;
}
}
6.3.4.22
void GalaxyWars.Graphics.BaseGame.graphics_PrepareDevice (object sender,
PreparingDeviceSettingsEventArgs e) [private]
Definition at line 1044 of file BaseGame.cs.
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
{
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
PresentationParameters presentParams = e.GraphicsDeviceInformation.PresentationParame
if (graphicsManager.PreferredBackBufferHeight == 720)
{
presentParams.MultiSampleType = MultiSampleType.FourSamples;
#if !DEBUG
presentParams.PresentationInterval = PresentInterval.One;
#endif
}
else
{
presentParams.MultiSampleType = MultiSampleType.TwoSamples;
#if !DEBUG
presentParams.PresentationInterval = PresentInterval.Two;
#endif
6.3.4.23
}
}
}
override void GalaxyWars.Graphics.BaseGame.Initialize () [protected]
Initialize.
Reimplemented in GalaxyWars.GalaxyWarsManager.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
52
Class Documentation
Definition at line 1069 of file BaseGame.cs.
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
6.3.4.24
{
// Add screenshot capturer. Note: Don’t do this in constructor,
// we need the correct window name for screenshots!
this.Components.Add(new ScreenshotCapturer(this));
base.Initialize();
// Set depth format
backBufferDepthFormat = graphicsManager.PreferredDepthStencilFormat;
// Update resolution if it changes
graphicsManager.DeviceReset += new EventHandler(graphics_DeviceReset);
graphics_DeviceReset(null, EventArgs.Empty);
// Create matrices for our shaders, this makes it much easier
// to manage all the required matrices since there is no fixed
// function support and theirfore no Device.Transform class.
WorldMatrix = Matrix.Identity;
// ViewMatrix is updated in camera class
ViewMatrix = Matrix.CreateLookAt(
new Vector3(0, 0, 250), Vector3.Zero, Vector3.Up);
// Projection matrix is set by DeviceReset
// Init global manager classes, which will be used all over the place ^^
lineManager2D = new LineManager2D();
lineManager3D = new LineManager3D();
ui = new UIRenderer();
}
void GalaxyWars.Graphics.BaseGame.graphics_DeviceReset (object sender, EventArgs
e) [private]
Graphics device reset.
Parameters:
sender Sender
e E
Definition at line 1106 of file BaseGame.cs.
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
{
// Update width and height
screenWidth = Device.Viewport.Width;//Window.ClientBounds.Width;
screenHeight = Device.Viewport.Height;//Window.ClientBounds.Height;
aspectRatio = (float)screenWidth / (float)screenHeight;
ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(
FieldOfView, aspectRatio, NearPlane, FarPlane);
// Re-Set device
// Restore z buffer state
BaseGame.Device.RenderState.DepthBufferEnable = true;
BaseGame.Device.RenderState.DepthBufferWriteEnable = true;
// Set u/v addressing back to wrap
BaseGame.Device.SamplerStates[0].AddressU = TextureAddressMode.Wrap;
BaseGame.Device.SamplerStates[0].AddressV = TextureAddressMode.Wrap;
// Restore normal alpha blending
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
6.3.4.25
53
BaseGame.SetCurrentAlphaMode(BaseGame.AlphaMode.Default);
// Set 128 and greate alpha compare for Model.Render
BaseGame.Device.RenderState.ReferenceAlpha = 128;
BaseGame.Device.RenderState.AlphaFunction = CompareFunction.Greater;
// Recreate all render-targets
foreach (RenderToTexture renderToTexture in remRenderToTextures)
renderToTexture.HandleDeviceReset();
}
static Point GalaxyWars.Graphics.BaseGame.Convert3DPointTo2D (Vector3 point)
[static]
Convert 3D vector to 2D vector, this is kinda the oposite of GetScreenPlaneVector (not shown here). This
can be useful for user input/output, because we will often need the actual position on screen of an object in
3D space from the users view to handle it the right way. Used for lens flare and asteroid optimizations.
Parameters:
point 3D world position
<return>Resulting 2D screen position</return>
Definition at line 1152 of file BaseGame.cs.
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
6.3.4.26
{
Vector4 result4 = Vector4.Transform(point, ViewProjectionMatrix);
if (result4.W == 0)
result4.W = BaseGame.Epsilon;
Vector3 result = new Vector3(result4.X / result4.W, result4.Y / result4.W, result4.Z / re
// Output result from 3D to 2D
return new Point(
(int)Math.Round(+result.X * (screenWidth / 2)) + (screenWidth / 2),
(int)Math.Round(-result.Y * (screenHeight / 2)) + (screenHeight / 2));
}
static bool GalaxyWars.Graphics.BaseGame.PointInFront (Vector3 point) [static]
Is point in front of camera?
Parameters:
point Position to check.
Returns:
Bool
Definition at line 1171 of file BaseGame.cs.
1172
1173
1174
1175
{
Vector4 result = Vector4.Transform(new Vector4(point.X, point.Y, point.Z, 1), ViewProject
return result.Z > result.W - NearPlane;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
54
Class Documentation
6.3.4.27
static bool GalaxyWars.Graphics.BaseGame.PointVisible (Vector3 point, float
checkOffset) [static]
Helper to check if a 3d-point is visible on the screen. Will basically do the same as IsInFrontOfCamera
and Convert3DPointTo2D, but requires less code and is faster. Also returns just an bool. Will return true
if point is visble on screen, false otherwise. Use the offset parameter to include points into the screen that
are only a couple of pixel outside of it.
Parameters:
point Point
checkOffset Check offset in percent of total screen
Returns:
Bool
Definition at line 1189 of file BaseGame.cs.
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
6.3.4.28
{
Vector4 result = Vector4.Transform(new Vector4(point.X, point.Y, point.Z, 1), ViewProject
// Point must be in front of camera, else just skip everything.
if (result.Z > result.W - NearPlane)
{
Vector2 screenPoint = new Vector2(result.X / result.W, result.Y / result.W);
// Change checkOffset depending on how depth we are into the scene
// for very near objects (z < 5) pass all tests!
// for very far objects (z >> 5) only pass if near to +- 1.0f
float zDist = Math.Abs(result.Z);
if (zDist < 5.0f)
return true;
checkOffset = 1.0f + (checkOffset / zDist);
return
screenPoint.X >= -checkOffset && screenPoint.X <= +checkOffset &&
screenPoint.Y >= -checkOffset && screenPoint.Y <= +checkOffset;
}
// Point is not in front of camera, return false.
return false;
}
static void GalaxyWars.Graphics.BaseGame.DrawLine (Point startPoint, Point endPoint,
Color color) [static]
Draw line.
Parameters:
startPoint Start point
endPoint End point
color Color
Definition at line 1225 of file BaseGame.cs.
1226
{ lineManager2D.AddLine(startPoint, endPoint, color); }
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.4.29
static void GalaxyWars.Graphics.BaseGame.DrawLine (Point startPoint, Point endPoint)
[static]
Draw line.
Parameters:
startPoint Start point
endPoint End point
Definition at line 1233 of file BaseGame.cs.
1234
6.3.4.30
{ lineManager2D.AddLine(startPoint, endPoint, Color.White); }
static void GalaxyWars.Graphics.BaseGame.DrawLine (Vector3 startPos, Vector3
endPos, Color color) [static]
Draw line.
Parameters:
startPos Start position
endPos End position
color Color
Definition at line 1242 of file BaseGame.cs.
1243
6.3.4.31
{ lineManager3D.AddLine(startPos, endPos, color); }
static void GalaxyWars.Graphics.BaseGame.DrawLine (Vector3 startPos, Vector3
endPos, Color startColor, Color endColor) [static]
Draw line.
Parameters:
startPos Start position
endPos End position
startColor Start color
endColor End color
Definition at line 1252 of file BaseGame.cs.
1253
55
{ lineManager3D.AddLine(startPos, startColor, endPos, endColor); }
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
56
Class Documentation
6.3.4.32
static void GalaxyWars.Graphics.BaseGame.DrawLine (Vector3 startPos, Vector3
endPos) [static]
Draw line.
Parameters:
startPos Start position
endPos End position
Definition at line 1260 of file BaseGame.cs.
1261
6.3.4.33
{ lineManager3D.AddLine(startPos, endPos, Color.White); }
static void GalaxyWars.Graphics.BaseGame.RenderLines2D () [static]
Flush line manager 2D. Renders all lines and allows more lines to be rendered. Used to render lines into
textures and stuff.
Definition at line 1267 of file BaseGame.cs.
1268
6.3.4.34
{ lineManager2D.Render(); }
static void GalaxyWars.Graphics.BaseGame.RenderLines3D () [static]
Flush line manager 3D. Renders all lines and allows more lines to be rendered.
Definition at line 1274 of file BaseGame.cs.
1275
6.3.4.35
{ lineManager3D.Render(); }
override void GalaxyWars.Graphics.BaseGame.Update (GameTime gameTime)
[protected]
Update.
Reimplemented in GalaxyWars.GalaxyWarsManager.
Definition at line 1284 of file BaseGame.cs.
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
{
base.Update(gameTime);
// Update all input states
Input.Update();
lastFrameTotalTimeMs = totalTimeMs;
elapsedTimeThisFrameInMs = (float)gameTime.ElapsedRealTime.TotalMilliseconds;
totalTimeMs += elapsedTimeThisFrameInMs;
// Make sure elapsedTimeThisFrameInMs is never 0
if (elapsedTimeThisFrameInMs <= 0)
elapsedTimeThisFrameInMs = 0.001f;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
6.3.4.36
57
// Increase frame counter for FramesPerSecond
frameCountThisSecond++;
totalFrameCount++;
// One second elapsed?
if (totalTimeMs - startTimeThisSecond > 1000.0f)
{
// Calc fps
fpsLastSecond = (int)(frameCountThisSecond * 1000.0f / (totalTimeMs - startTimeThisSe
// Reset startSecondTick and repaintCountSecond
startTimeThisSecond = totalTimeMs;
frameCountThisSecond = 0;
fpsInterpolated = MathHelper.Lerp(fpsInterpolated, fpsLastSecond, 0.1f);
// Check out if our framerate is running very low. Then we can improve
// rendering by reducing the number of objects we draw.
if (fpsInterpolated < 5)
Model.MaxViewDistance = 50;
else if (fpsInterpolated < 12)
Model.MaxViewDistance = 70;
else if (fpsInterpolated < 16)
Model.MaxViewDistance = 90;
else if (fpsInterpolated < 20)
Model.MaxViewDistance = 120;
else if (fpsInterpolated < 25)
Model.MaxViewDistance = 150;
else if (fpsInterpolated < 30 ||
HighDetail == false)
Model.MaxViewDistance = 175;
}
// Update sound and music
Sound.Update();
}
override void GalaxyWars.Graphics.BaseGame.OnActivated (object sender, EventArgs
args) [protected]
On activated.
Parameters:
sender Sender
args Arguments
Definition at line 1360 of file BaseGame.cs.
1361
1362
1363
1364
6.3.4.37
{
base.OnActivated(sender, args);
isAppActive = true;
}
override void GalaxyWars.Graphics.BaseGame.OnDeactivated (object sender, EventArgs
args) [protected]
On deactivated.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
58
Class Documentation
Parameters:
sender Sender
args Arguments
Definition at line 1371 of file BaseGame.cs.
1372
1373
1374
1375
6.3.4.38
{
base.OnDeactivated(sender, args);
isAppActive = false;
}
override void GalaxyWars.Graphics.BaseGame.Draw (GameTime gameTime)
[protected]
Draw.
Parameters:
gameTime Game time
Definition at line 1387 of file BaseGame.cs.
1388
{
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411 #if !DEBUG
1412
1413
1414
1415
1416
1417
1418 #endif
1419
1420
1421
1422
1423
1424
1425
try
{
// Clear anyway, makes unit tests easier and fixes problems if
// we don’t have the z buffer cleared (some issues with line
// rendering might happen else). Performance drop is not significant!
ClearBackground();
// Get our sprites ready to draw...
Texture.AdditiveSprite.Begin(SpriteBlendMode.Additive);
Texture.AlphaSprite.Begin(SpriteBlendMode.AlphaBlend);
Render(); // Custom user render code
meshRenderManager.Render(); // Render all models we remembered this frame
lineManager3D.Render(); // Render all 3d lines
UIRenderer.Render(lineManager2D); // Render UI, font texts and also all collected scr
PostUIRender();
ui.RenderTextsAndMouseCursor();
}
// Only catch exceptions here in release mode, when debugging
// we want to see the source of the error. In release mode
// we want to play and not be annoyed by some bugs ^^
catch (Exception ex)
{
Log.Write("Render loop error: " + ex.ToString());
if (renderLoopErrorCount++ > 100)
throw;
}
finally
{
// Dummy block to prevent error in debug mode
}
base.Draw(gameTime);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
1426
1427
1428
1429
1430
1431
1432
6.3.4.39
59
// Apply device changes
if (mustApplyDeviceChanges)
{
graphicsManager.ApplyChanges();
mustApplyDeviceChanges = false;
}
}
delegate void GalaxyWars.Graphics.BaseGame.RenderHandler ()
Render delegate for rendering methods, also used for many other methods.
6.3.4.40
virtual void GalaxyWars.Graphics.BaseGame.Render () [protected, virtual]
Render.
Reimplemented in GalaxyWars.GalaxyWarsManager.
Definition at line 1447 of file BaseGame.cs.
1448
1449
1450
6.3.4.41
{
}
virtual void GalaxyWars.Graphics.BaseGame.PostUIRender () [protected,
virtual]
Post user interface rendering, in case we need it. Used for rendering the car selection 3d stuff after the UI.
Reimplemented in GalaxyWars.GalaxyWarsManager.
Definition at line 1456 of file BaseGame.cs.
1457
1458
1459
6.3.4.42
{
// Overwrite this for your custom render code ..
}
static void GalaxyWars.Graphics.BaseGame.ClearBackground () [static]
Clear background.
Definition at line 1464 of file BaseGame.cs.
1465
1466
1467
1468
6.3.4.43
{
// Unsure if it clears depth correctly: Device.Clear(BackgroundColor);
Device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, BackgroundColor, 1.0f, 0);
}
static void GalaxyWars.Graphics.BaseGame.AddRemRenderToTexture
(RenderToTexture renderToTexture) [static]
Add render to texture instance to allow recreating them all when DeviceReset is called with help of the
remRenderToTextures list.
Definition at line 1508 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
60
Class Documentation
1509
6.3.4.44
{ remRenderToTextures.Add(renderToTexture); }
static internal void GalaxyWars.Graphics.BaseGame.SetRenderTarget (RenderTarget2D
renderTarget, bool isSceneRenderTarget) [static, private]
Set render target.
Parameters:
isSceneRenderTarget Is scene render target
Definition at line 1526 of file BaseGame.cs.
1527
1528
1529
1530
1531
1532
6.3.4.45
{
Device.SetRenderTarget(0, renderTarget);
if (isSceneRenderTarget)
remSceneRenderTarget = renderTarget;
lastSetRenderTarget = renderTarget;
}
static internal void GalaxyWars.Graphics.BaseGame.ResetRenderTarget (bool
fullResetToBackBuffer) [static, private]
Reset render target.
Parameters:
fullResetToBackBuffer Full reset to back buffer
Definition at line 1538 of file BaseGame.cs.
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
{
if (remSceneRenderTarget == null || fullResetToBackBuffer)
{
remSceneRenderTarget = null;
lastSetRenderTarget = null;
Device.SetRenderTarget(0, null);
}
else
{
Device.SetRenderTarget(0, remSceneRenderTarget);
lastSetRenderTarget = remSceneRenderTarget;
}
}
6.3.5
Member Data Documentation
6.3.5.1
readonly Color GalaxyWars.Graphics.BaseGame.BackgroundColor = Color.White
[static, private]
Background color.
Definition at line 38 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.5.2
61
const float GalaxyWars.Graphics.BaseGame.FieldOfView = (float)(0.4 ∗ Math.PI)
[private]
Field of view and near and far plane distances for the ProjectionMatrix creation.
Definition at line 44 of file BaseGame.cs.
6.3.5.3
const float GalaxyWars.Graphics.BaseGame.NearPlane = 0.5f [private]
Definition at line 45 of file BaseGame.cs.
6.3.5.4
const float GalaxyWars.Graphics.BaseGame.FarPlane = 1750 [private]
Definition at line 46 of file BaseGame.cs.
6.3.5.5
const float GalaxyWars.Graphics.BaseGame.ViewableFieldOfView = FieldOfView / 1.125f
Viewable field of view for object visibility testing (see Model class).
Definition at line 51 of file BaseGame.cs.
6.3.5.6
PlatformID GalaxyWars.Graphics.BaseGame.CurrentPlatform =
Environment.OSVersion.Platform [static]
Definition at line 57 of file BaseGame.cs.
6.3.5.7
GraphicsDeviceManager GalaxyWars.Graphics.BaseGame.graphicsManager = null
[static, protected]
Graphics device manager, used for the graphics creation and holds the GraphicsDevice.
Definition at line 63 of file BaseGame.cs.
6.3.5.8
ContentManager GalaxyWars.Graphics.BaseGame.contentManager = null [static,
protected]
Content manager for all game resources.
Definition at line 68 of file BaseGame.cs.
6.3.5.9
UIRenderer GalaxyWars.Graphics.BaseGame.ui = null [static, protected]
UI Renderer helper class for all 2d rendering.
Definition at line 73 of file BaseGame.cs.
6.3.5.10
int GalaxyWars.Graphics.BaseGame.screenWidth [static, protected]
Our screen resolution: Width and height of visible render area.
Definition at line 78 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
62
6.3.5.11
Class Documentation
int GalaxyWars.Graphics.BaseGame.screenHeight [static, protected]
Definition at line 78 of file BaseGame.cs.
6.3.5.12
float GalaxyWars.Graphics.BaseGame.aspectRatio = 1.0f [static, private]
Aspect ratio of our current resolution.
Definition at line 83 of file BaseGame.cs.
6.3.5.13
string GalaxyWars.Graphics.BaseGame.remWindowsTitle = "" [static, private]
Remember windows title to check if we are in certain unit tests!
Definition at line 88 of file BaseGame.cs.
6.3.5.14
LineManager2D GalaxyWars.Graphics.BaseGame.lineManager2D = null [static,
private]
Helper class instance to work the 2D lines.
Definition at line 104 of file BaseGame.cs.
6.3.5.15
LineManager3D GalaxyWars.Graphics.BaseGame.lineManager3D [static,
private]
Helper class instance to work the 3D lines.
Definition at line 109 of file BaseGame.cs.
6.3.5.16
MeshRenderManager GalaxyWars.Graphics.BaseGame.meshRenderManager = new
MeshRenderManager() [static, private]
Mesh render manager to render meshes of models in a highly optimized manner. We don’t really have
anything stored in here except for a sorted list on how to render everything based on the techniques and the
materials and links to the renderable meshes.
Definition at line 120 of file BaseGame.cs.
6.3.5.17
Matrix GalaxyWars.Graphics.BaseGame.worldMatrix [static, private]
Matrices for shaders. Used in a similar way than in Rocket Commander, but since we don’t have a fixed
function pipeline here we just use these values in the shader. Make sure to set all matrices before calling
a shader. Inside a shader you have to update the shader parameter too, just setting the WorldMatrix alone
does not work.
Definition at line 129 of file BaseGame.cs.
6.3.5.18
Matrix GalaxyWars.Graphics.BaseGame.viewMatrix [static, private]
Definition at line 129 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.5.19
63
Matrix GalaxyWars.Graphics.BaseGame.projectionMatrix [static, private]
Definition at line 129 of file BaseGame.cs.
6.3.5.20
Vector3 GalaxyWars.Graphics.BaseGame.lightDirection = new Vector3(0, 0, 1)
[static, private]
Light direction, please read matrices info above for more details. The same things apply here.
Definition at line 135 of file BaseGame.cs.
6.3.5.21
float GalaxyWars.Graphics.BaseGame.elapsedTimeThisFrameInMs = 0.001f
[static, private]
Elapsed time this frame in ms. Always have something valid here in case we devide through this values!
Definition at line 158 of file BaseGame.cs.
6.3.5.22
float GalaxyWars.Graphics.BaseGame.totalTimeMs = 0 [static, private]
Definition at line 158 of file BaseGame.cs.
6.3.5.23
float GalaxyWars.Graphics.BaseGame.lastFrameTotalTimeMs = 0 [static,
private]
Definition at line 158 of file BaseGame.cs.
6.3.5.24
float GalaxyWars.Graphics.BaseGame.startTimeThisSecond = 0 [static,
private]
Helper for calculating frames per second.
Definition at line 163 of file BaseGame.cs.
6.3.5.25
int GalaxyWars.Graphics.BaseGame.frameCountThisSecond = 0 [static,
private]
For more accurate frames per second calculations, just count for one second, then fpsLastSecond is updated.
Btw: Start with 1 to help some tests avoid the devide through zero problem.
Definition at line 171 of file BaseGame.cs.
6.3.5.26
int GalaxyWars.Graphics.BaseGame.totalFrameCount = 0 [static, private]
Definition at line 171 of file BaseGame.cs.
6.3.5.27
int GalaxyWars.Graphics.BaseGame.fpsLastSecond = 60 [static, private]
Definition at line 171 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
64
6.3.5.28
Class Documentation
DepthFormat GalaxyWars.Graphics.BaseGame.backBufferDepthFormat =
DepthFormat.Depth32 [static, private]
Back buffer depth format.
Definition at line 201 of file BaseGame.cs.
6.3.5.29
bool GalaxyWars.Graphics.BaseGame.alreadyCheckedGraphicsOptions = false
[static, private]
Definition at line 215 of file BaseGame.cs.
6.3.5.30
bool GalaxyWars.Graphics.BaseGame.highDetail = true [static, private]
Definition at line 246 of file BaseGame.cs.
6.3.5.31
bool GalaxyWars.Graphics.BaseGame.allowShadowMapping = true [static,
private]
Definition at line 263 of file BaseGame.cs.
6.3.5.32
bool GalaxyWars.Graphics.BaseGame.usePostScreenShaders = true [static,
private]
Definition at line 280 of file BaseGame.cs.
6.3.5.33
bool GalaxyWars.Graphics.BaseGame.mustApplyDeviceChanges = false [static,
private]
Definition at line 297 of file BaseGame.cs.
6.3.5.34
float GalaxyWars.Graphics.BaseGame.fpsInterpolated = 100.0f [static, private]
Interpolated fps over the last 10 seconds. Obviously goes down if our framerate is low.
Definition at line 722 of file BaseGame.cs.
6.3.5.35
Vector3 GalaxyWars.Graphics.BaseGame.camPosition [static, private]
Camera pos, updated each frame in ViewMatrix! Public to allow easy access from everywhere, will be
called a lot each frame, for example Model.Render uses this for distance checks.
Definition at line 850 of file BaseGame.cs.
6.3.5.36
Vector3 GalaxyWars.Graphics.BaseGame.cameraRotation = new Vector3(0, 0, 1)
[static, private]
Camera rotation, used to compare objects for visibility.
Definition at line 868 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.5.37
65
Matrix GalaxyWars.Graphics.BaseGame.invViewMatrix [static, private]
Remember inverse view matrix.
Definition at line 885 of file BaseGame.cs.
6.3.5.38
const float GalaxyWars.Graphics.BaseGame.Epsilon = 0.000001f
Epsilon (1/1000000) for comparing stuff which is nearly equal.
Definition at line 1141 of file BaseGame.cs.
6.3.5.39
bool GalaxyWars.Graphics.BaseGame.isAppActive = true [static, private]
Definition at line 1341 of file BaseGame.cs.
6.3.5.40
int GalaxyWars.Graphics.BaseGame.renderLoopErrorCount = 0 [private]
Definition at line 1381 of file BaseGame.cs.
6.3.5.41
RenderTarget2D GalaxyWars.Graphics.BaseGame.remSceneRenderTarget = null
[static, private]
Remember scene render target. This is very important because for our post screen shaders we have to
render our whole scene to this render target. But in the process we will use many other shaders and they
might set their own render targets and then reset it, but we need to have this scene still to be set. Don’t
reset to the back buffer (with SetRenderTarget(0, null), this would stop rendering to our scene render target
and the post screen shader will not be able to process our screen. The whole reason for this is that we can’t
use StrechRectangle like in Rocket Commander because XNA does not provide that function (the reason
for that is cross platform compatibility with the XBox360). Instead we could use ResolveBackBuffer, but
that method is VERY SLOW. Our framerate would drop from 600 fps down to 20, not good. However,
multisampling will not work, so we will disable it anyway!
Definition at line 1490 of file BaseGame.cs.
6.3.5.42
RenderTarget2D GalaxyWars.Graphics.BaseGame.lastSetRenderTarget = null
[static, private]
Remember the last render target we set, this way we can check if the rendertarget was set before calling
resolve!
Definition at line 1496 of file BaseGame.cs.
6.3.5.43
List<RenderToTexture> GalaxyWars.Graphics.BaseGame.remRenderToTextures = new
List<RenderToTexture>() [static, private]
Remember render to texture instances to allow recreating them all when DeviceReset is called.
Definition at line 1502 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
66
Class Documentation
6.3.6
Property Documentation
6.3.6.1
string GalaxyWars.Graphics.BaseGame.WindowsTitle [static, get]
Get windows title to check if we are in certain unit tests!
Definition at line 94 of file BaseGame.cs.
6.3.6.2
LineManager3D GalaxyWars.Graphics.BaseGame.LineManager [static, get]
Definition at line 112 of file BaseGame.cs.
6.3.6.3
Vector3 GalaxyWars.Graphics.BaseGame.LightDirection [static, get, set]
Light direction.
Returns:
Vector 3
Definition at line 142 of file BaseGame.cs.
6.3.6.4
GraphicsDevice GalaxyWars.Graphics.BaseGame.Device [static, get]
Definition at line 191 of file BaseGame.cs.
6.3.6.5
DepthFormat GalaxyWars.Graphics.BaseGame.BackBufferDepthFormat [static,
get]
Back buffer depth format.
Returns:
Surface format
Definition at line 208 of file BaseGame.cs.
6.3.6.6
bool GalaxyWars.Graphics.BaseGame.Fullscreen [static, get]
Fullscreen.
Returns:
Bool
Definition at line 239 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.6.7
bool GalaxyWars.Graphics.BaseGame.HighDetail [static, get]
High detail.
Returns:
Bool
Definition at line 253 of file BaseGame.cs.
6.3.6.8
bool GalaxyWars.Graphics.BaseGame.AllowShadowMapping [static, get]
Allow shadow mapping.
Returns:
Bool
Definition at line 270 of file BaseGame.cs.
6.3.6.9
bool GalaxyWars.Graphics.BaseGame.UsePostScreenShaders [static, get]
Use post screen shaders.
Returns:
Bool
Definition at line 287 of file BaseGame.cs.
6.3.6.10
ContentManager GalaxyWars.Graphics.BaseGame.Content [static, get]
Content.
Returns:
Content manager
Definition at line 338 of file BaseGame.cs.
6.3.6.11
UIRenderer GalaxyWars.Graphics.BaseGame.UI [static, get]
User interface renderer helper ∧∧ .
Returns:
UIRenderer
Definition at line 354 of file BaseGame.cs.
Referenced by GalaxyWars.GalaxyWarsManager.PostUIRender().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
67
68
Class Documentation
6.3.6.12
MeshRenderManager GalaxyWars.Graphics.BaseGame.MeshRenderManager
[static, get]
Mesh render manager to render meshes of models in a highly optimized manner.
Returns:
Mesh render manager
Definition at line 370 of file BaseGame.cs.
6.3.6.13
int GalaxyWars.Graphics.BaseGame.Width [static, get]
Width.
Returns:
Int
Definition at line 384 of file BaseGame.cs.
6.3.6.14
int GalaxyWars.Graphics.BaseGame.Height [static, get]
Height.
Returns:
Int
Definition at line 395 of file BaseGame.cs.
6.3.6.15
float GalaxyWars.Graphics.BaseGame.AspectRatio [static, get]
Aspect ratio.
Returns:
Float
Definition at line 407 of file BaseGame.cs.
6.3.6.16
Rectangle GalaxyWars.Graphics.BaseGame.ResolutionRect [static, get]
Resolution rectangle.
Returns:
Rectangle
Definition at line 419 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.6.17
int GalaxyWars.Graphics.BaseGame.Fps [static, get]
Fps.
Returns:
Int
Definition at line 711 of file BaseGame.cs.
6.3.6.18
int GalaxyWars.Graphics.BaseGame.TotalFrames [static, get]
Total frames.
Returns:
Int
Definition at line 729 of file BaseGame.cs.
6.3.6.19
float GalaxyWars.Graphics.BaseGame.ElapsedTimeThisFrameInMilliseconds
[static, get]
Elapsed time this frame in ms.
Returns:
Int
Definition at line 743 of file BaseGame.cs.
6.3.6.20
float GalaxyWars.Graphics.BaseGame.TotalTime [static, get]
Total time in seconds.
Returns:
Int
Definition at line 755 of file BaseGame.cs.
6.3.6.21
float GalaxyWars.Graphics.BaseGame.TotalTimeMilliseconds [static, get]
Total time ms.
Returns:
Float
Definition at line 767 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
69
70
Class Documentation
6.3.6.22
float GalaxyWars.Graphics.BaseGame.MoveFactorPerSecond [static, get]
Move factor per second, when we got 1 fps, this will be 1.0f, when we got 100 fps, this will be 0.01f.
Definition at line 779 of file BaseGame.cs.
6.3.6.23
Matrix GalaxyWars.Graphics.BaseGame.WorldMatrix [static, get, set]
World matrix.
Returns:
Matrix
Definition at line 793 of file BaseGame.cs.
6.3.6.24
Matrix GalaxyWars.Graphics.BaseGame.ViewMatrix [static, get, set]
View matrix.
Returns:
Matrix
Definition at line 810 of file BaseGame.cs.
6.3.6.25
Matrix GalaxyWars.Graphics.BaseGame.ProjectionMatrix [static, get, set]
Projection matrix.
Returns:
Matrix
Definition at line 833 of file BaseGame.cs.
6.3.6.26
Vector3 GalaxyWars.Graphics.BaseGame.CameraPos [static, get]
Get camera position from inverse view matrix. Similar to method used in shader. Works only if ViewMatrix
is correctly set.
Returns:
Vector 3
Definition at line 858 of file BaseGame.cs.
6.3.6.27
Vector3 GalaxyWars.Graphics.BaseGame.CameraRotation [static, get]
Camera rotation.
Returns:
Vector 3
Definition at line 875 of file BaseGame.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.3 GalaxyWars.Graphics.BaseGame Class Reference
6.3.6.28
Matrix GalaxyWars.Graphics.BaseGame.InverseViewMatrix [static, get]
Inverse view matrix.
Returns:
Matrix
Definition at line 892 of file BaseGame.cs.
6.3.6.29
Matrix GalaxyWars.Graphics.BaseGame.ViewProjectionMatrix [static, get]
View projection matrix.
Returns:
Matrix
Definition at line 904 of file BaseGame.cs.
6.3.6.30
Matrix GalaxyWars.Graphics.BaseGame.WorldViewProjectionMatrix [static,
get]
World view projection matrix.
Returns:
Matrix
Definition at line 916 of file BaseGame.cs.
6.3.6.31
bool GalaxyWars.Graphics.BaseGame.IsAppActive [static, get]
Is app active.
Returns:
Bool
Definition at line 1348 of file BaseGame.cs.
6.3.6.32
RenderTarget2D GalaxyWars.Graphics.BaseGame.CurrentRenderTarget [static,
get]
Current render target we have set, null if it is just the back buffer.
Definition at line 1515 of file BaseGame.cs.
The documentation for this class was generated from the following file:
• BaseGame.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
71
72
Class Documentation
6.4
GalaxyWars.GameLogic.BasePlayer Class Reference
Base player helper class, holds all the current game values: Game time, game over, level number, victory.
More stuff that has impact to the ShipController or ChaseCamera classes should be included here, else add
them directly to the Player class, which handles all the game logic. For example adding items or powerups
should be done in this class if they affect the speed or physics of our ship.
Inheritance diagram for GalaxyWars.GameLogic.BasePlayer:
GalaxyWars.GameLogic.BasePlayer
GalaxyWars.GameLogic.SpaceshipPhysics
GalaxyWars.GameLogic.ChaseCamera
GalaxyWars.GameLogic.Player
Public Member Functions
• virtual void Reset ()
Reset all player entries for restarting a game. In derived classes reset all the variables we need to reset for
a new game there (e.g. speed or cameraWobbel in ChaseCamera).
• virtual void ClearVariablesForGameOver ()
Clear variables for game over.
• virtual void Update ()
Update game logic, called every frame. In Rocket Commander we did all the game logic in one big method
inside the player class, but it was hard to add new game logic and many small things were also in the
GameAsteroidManager. For this game we split everything up into much more classes and every class handles only its own variables. For example this class just handles the game time and zoom in time, for the ship
speed and physics just go into the SpaceshipPhysics class.
Public Attributes
• const int StartGameZoomTimeMilliseconds = 5000
How long do we zoom in.
• const int StartGameZoomedInTime = 3000
The amount of time to remain fully zoomed.
Protected Attributes
• float currentGameTimeMilliseconds = 0
Current game time in ms. Used for time display in game. Also used to update the sun position. Will be
stopped if we die or if we are still zooming in.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.4 GalaxyWars.GameLogic.BasePlayer Class Reference
73
• bool isGameOver
Game over?
Properties
• float GameTimeMilliseconds [get]
Game time (will return negative values if currently zooming in!).
• float ZoomInTime [get, set]
Zoom in time.
• bool GameOver [get]
Is game over?
• bool CanControlShip [get]
Helper to determinate if user can control the ship. If game just started we still zoom into the chase camera.
Private Attributes
• float zoomInTime = StartGameZoomTimeMilliseconds
Zoom in time.
• bool firstFrame = true
6.4.1
Detailed Description
Base player helper class, holds all the current game values: Game time, game over, level number, victory.
More stuff that has impact to the ShipController or ChaseCamera classes should be included here, else add
them directly to the Player class, which handles all the game logic. For example adding items or powerups
should be done in this class if they affect the speed or physics of our ship.
Definition at line 34 of file BasePlayer.cs.
6.4.2
Member Function Documentation
6.4.2.1
virtual void GalaxyWars.GameLogic.BasePlayer.Reset () [virtual]
Reset all player entries for restarting a game. In derived classes reset all the variables we need to reset for
a new game there (e.g. speed or cameraWobbel in ChaseCamera).
Reimplemented in GalaxyWars.GameLogic.ChaseCamera, GalaxyWars.GameLogic.Player, and GalaxyWars.GameLogic.SpaceshipPhysics.
Definition at line 129 of file BasePlayer.cs.
130
131
132
{
isGameOver = false;
currentGameTimeMilliseconds = 0;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
74
133
134
135
6.4.2.2
Class Documentation
zoomInTime = StartGameZoomTimeMilliseconds;
firstFrame = true;
}
virtual void GalaxyWars.GameLogic.BasePlayer.ClearVariablesForGameOver ()
[virtual]
Clear variables for game over.
Reimplemented
in
GalaxyWars.GameLogic.ChaseCamera,
Wars.GameLogic.SpaceshipPhysics.
and
Galaxy-
Definition at line 140 of file BasePlayer.cs.
141
142
6.4.2.3
{
}
virtual void GalaxyWars.GameLogic.BasePlayer.Update () [virtual]
Update game logic, called every frame. In Rocket Commander we did all the game logic in one big method
inside the player class, but it was hard to add new game logic and many small things were also in the
GameAsteroidManager. For this game we split everything up into much more classes and every class
handles only its own variables. For example this class just handles the game time and zoom in time, for the
ship speed and physics just go into the SpaceshipPhysics class.
Reimplemented in GalaxyWars.GameLogic.ChaseCamera, GalaxyWars.GameLogic.Player, and GalaxyWars.GameLogic.SpaceshipPhysics.
Definition at line 157 of file BasePlayer.cs.
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
{
// Since there is no loading screen, we need to skip the first frame because
// the loading will cause ElapsedTimeThisFrameInMilliseconds to be too high
if (firstFrame)
{
firstFrame = false;
return;
}
// Handle zoomInTime at the beginning of a game
if (!GalaxyWarsManager.MenuActive && zoomInTime > 0)
{
float lastZoomInTime = zoomInTime;
zoomInTime -= BaseGame.ElapsedTimeThisFrameInMilliseconds;
}
// Don’t handle any more game logic if game is over or still zooming in.
if (CanControlShip == false)
return;
// Increase game time
currentGameTimeMilliseconds += BaseGame.ElapsedTimeThisFrameInMilliseconds;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.4 GalaxyWars.GameLogic.BasePlayer Class Reference
6.4.3
Member Data Documentation
6.4.3.1
float GalaxyWars.GameLogic.BasePlayer.currentGameTimeMilliseconds = 0
[protected]
75
Current game time in ms. Used for time display in game. Also used to update the sun position. Will be
stopped if we die or if we are still zooming in.
Definition at line 42 of file BasePlayer.cs.
6.4.3.2
const int GalaxyWars.GameLogic.BasePlayer.StartGameZoomTimeMilliseconds = 5000
How long do we zoom in.
Definition at line 59 of file BasePlayer.cs.
6.4.3.3
float GalaxyWars.GameLogic.BasePlayer.zoomInTime = StartGameZoomTimeMilliseconds [private]
Zoom in time.
Definition at line 64 of file BasePlayer.cs.
6.4.3.4
const int GalaxyWars.GameLogic.BasePlayer.StartGameZoomedInTime = 3000
The amount of time to remain fully zoomed.
Definition at line 85 of file BasePlayer.cs.
6.4.3.5
bool GalaxyWars.GameLogic.BasePlayer.isGameOver [protected]
Game over?
Definition at line 90 of file BasePlayer.cs.
6.4.3.6
bool GalaxyWars.GameLogic.BasePlayer.firstFrame = true [private]
Definition at line 118 of file BasePlayer.cs.
6.4.4
Property Documentation
6.4.4.1
float GalaxyWars.GameLogic.BasePlayer.GameTimeMilliseconds [get]
Game time (will return negative values if currently zooming in!).
Returns:
Game time in ms.
Definition at line 49 of file BasePlayer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
76
Class Documentation
6.4.4.2
float GalaxyWars.GameLogic.BasePlayer.ZoomInTime [get, set, protected]
Zoom in time.
Returns:
Float
Definition at line 71 of file BasePlayer.cs.
6.4.4.3
bool GalaxyWars.GameLogic.BasePlayer.GameOver [get]
Is game over?
Returns:
Bool
Definition at line 97 of file BasePlayer.cs.
6.4.4.4
bool GalaxyWars.GameLogic.BasePlayer.CanControlShip [get]
Helper to determinate if user can control the ship. If game just started we still zoom into the chase camera.
Returns:
Bool
Definition at line 110 of file BasePlayer.cs.
The documentation for this class was generated from the following file:
• BasePlayer.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.5 GalaxyWars.GameLogic.ChaseCamera Class Reference
6.5
77
GalaxyWars.GameLogic.ChaseCamera Class Reference
Chase camera for our car. We are always close behind it. The camera rotation is not the same as the
current car rotation, we interpolate the values a bit, allowing the user to do small changes without rotating
the camera frantically. Also feels more realistic in curves. Derived from the CarController class, which
controls the car by the user input. This camera class is not controlled by the user, its all automatic!
Inheritance diagram for GalaxyWars.GameLogic.ChaseCamera:
GalaxyWars.GameLogic.BasePlayer
GalaxyWars.GameLogic.SpaceshipPhysics
GalaxyWars.GameLogic.ChaseCamera
GalaxyWars.GameLogic.Player
Collaboration diagram for GalaxyWars.GameLogic.ChaseCamera:
GalaxyWars.GameLogic.BasePlayer
GalaxyWars.GameLogic.SpaceshipPhysics
GalaxyWars.GameLogic.ChaseCamera
Public Types
• enum CameraMode
Camera modes.
Public Member Functions
• ChaseCamera (Vector3 setCarPosition, Vector3 setDirection, Vector3 setUp, Vector3 setCameraPos)
Create chase camera. Sets the car position and the camera position, which is then used to rotate around the
car.
• ChaseCamera (Vector3 setCarPosition, Vector3 setCameraPos)
Create chase camera. Sets the car position and the camera position, which is then used to rotate around the
ship.
• ChaseCamera (Vector3 setCarPosition)
Create chase camera. Just sets the ship position. The chase camera is set behind it.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
78
Class Documentation
• void SetCameraPosition (Vector3 setCameraPos)
Set camera position.
• void InterpolateCameraPosition (Vector3 setInterpolatedCameraPos)
Interpolate camera position.
• override void Reset ()
Resets just the camera wobbel factor here.
• override void ClearVariablesForGameOver ()
Clear variables for game over.
• override void Update ()
Update camera, should be called every frame to handle all the input.
Static Public Member Functions
• static void WobbelCamera (float wobbelFactor)
Sets the camera to wobble which fades over time.
Protected Attributes
• Vector3 cameraPos
Current camera position.
Properties
• Matrix RotationMatrix [get]
Rotation matrix.
• Vector3 CameraPosition [get]
Camera position.
• static Vector3 XAxis [get]
Get current x axis with help of the current view matrix.
• static Vector3 YAxis [get]
Get current y axis with help of the current view matrix.
• static Vector3 ZAxis [get]
Get current z axis with help of the current view matrix.
• bool FreeCamera [get, set]
Free camera.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.5 GalaxyWars.GameLogic.ChaseCamera Class Reference
79
Private Member Functions
• void HandleFreeCamera ()
Handle free camera, only used for unit tests.
• void UpdateViewMatrix ()
Update view matrix.
Private Attributes
• float cameraDistance
Distance of the camera to our car.
• Vector3 cameraLookVector
Look vector to the car. The car is our look at target. The up vector is the same as the one from the car, but
the look vector is different because we slowly interpolate it.
• CameraMode cameraMode = CameraMode.Default
Current camera mode.
• Matrix rotMatrix = Matrix.Identity
Rotation matrix, used in UpdateViewMatrix.
• const int MaxCameraWobbelTimeoutMs = 700
Max. value for camera wobbel timeout.
• Vector3 wannaCameraLookVector = Vector3.Zero
• float wannaCameraDistance = 0.0f
• Vector3 freeCameraRot = new Vector3(MathHelper.Pi, 0, -MathHelper.Pi / 2)
Helper values to keep the free camera steady.
• Vector3 wannaHaveCameraRotation = Vector3.Zero
Wanna have camera rotation.
• Vector3 lastCameraWobble = Vector3.Zero
Static Private Attributes
• static float cameraWobbelTimeoutMs = 0
Camera wobbel timeout. Used to shake camera after a collision.
• static float cameraWobbelFactor = 1.0f
Camera wobbel factor.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
80
Class Documentation
6.5.1
Detailed Description
Chase camera for our car. We are always close behind it. The camera rotation is not the same as the
current car rotation, we interpolate the values a bit, allowing the user to do small changes without rotating
the camera frantically. Also feels more realistic in curves. Derived from the CarController class, which
controls the car by the user input. This camera class is not controlled by the user, its all automatic!
Definition at line 27 of file ChaseCamera.cs.
6.5.2
Member Enumeration Documentation
6.5.2.1
enum GalaxyWars::GameLogic::ChaseCamera::CameraMode
Camera modes.
Enumerator:
Default Default mode for game and menu, just chasing the car.
FreeCamera Free camera mode, allows to freely rotate and zoom around the car, much cooler than
the Default mode for testing and stuff. Also used when we lose a game (fallen out of the track).
Definition at line 50 of file ChaseCamera.cs.
51
55
61
62
{
Default,
FreeCamera
}
6.5.3
Constructor & Destructor Documentation
6.5.3.1
GalaxyWars.GameLogic.ChaseCamera.ChaseCamera (Vector3 setCarPosition, Vector3
setDirection, Vector3 setUp, Vector3 setCameraPos)
Create chase camera. Sets the car position and the camera position, which is then used to rotate around the
car.
Parameters:
setCarPosition Set car position
setDirection Set direction
setUp Set up
setCameraPos Set camera pos
Definition at line 212 of file ChaseCamera.cs.
213
214
215
216
: base(setCarPosition, setDirection, setUp)
{
SetCameraPosition(setCameraPos); // Set camera position and calculate rotation from look p
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.5 GalaxyWars.GameLogic.ChaseCamera Class Reference
6.5.3.2
81
GalaxyWars.GameLogic.ChaseCamera.ChaseCamera (Vector3 setCarPosition, Vector3
setCameraPos)
Create chase camera. Sets the car position and the camera position, which is then used to rotate around the
ship.
Parameters:
setCarPosition Set car position
setCameraPos Set camera pos
Definition at line 224 of file ChaseCamera.cs.
224
225
226
227
: base(setCarPosition)
{
SetCameraPosition(setCameraPos); // Set camera position and calculate rotation from look p
}
6.5.3.3
GalaxyWars.GameLogic.ChaseCamera.ChaseCamera (Vector3 setCarPosition)
Create chase camera. Just sets the ship position. The chase camera is set behind it.
Parameters:
setCarPosition Set car position
Definition at line 233 of file ChaseCamera.cs.
233
234
235
236
237
238
239
: base(setCarPosition)
{
// Set camera position and calculate rotation from look pos
SetCameraPosition(
//setCarPosition - new Vector3(0, 0.5f, 1.0f) * carDir);
setCarPosition + new Vector3(0, 10.0f, 25.0f));
}
6.5.4
Member Function Documentation
6.5.4.1
static void GalaxyWars.GameLogic.ChaseCamera.WobbelCamera (float wobbelFactor)
[static]
Sets the camera to wobble which fades over time.
Parameters:
factor Factor
Definition at line 109 of file ChaseCamera.cs.
110
111
112
113
114
115
{
cameraWobbelTimeoutMs = (int)
//((0.75f + 0.5f * wobbelFactor) *
(MaxCameraWobbelTimeoutMs);
cameraWobbelFactor = wobbelFactor;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
82
Class Documentation
6.5.4.2
void GalaxyWars.GameLogic.ChaseCamera.SetCameraPosition (Vector3 setCameraPos)
Set camera position.
Parameters:
setCameraPos Set camera position
Definition at line 249 of file ChaseCamera.cs.
250
251
252
253
254
255
256
257
258
259
{
cameraPos = setCameraPos;
cameraDistance = Vector3.Distance(LookAtPos, cameraPos);
cameraLookVector = LookAtPos - cameraPos;
wannaCameraDistance = cameraDistance;
wannaCameraLookVector = cameraLookVector;
// Build look at matrix
rotMatrix = Matrix.CreateLookAt(cameraPos, LookAtPos, SpaceshipUpVector);
}
6.5.4.3
void GalaxyWars.GameLogic.ChaseCamera.InterpolateCameraPosition (Vector3
setInterpolatedCameraPos)
Interpolate camera position.
Parameters:
setInterpolatedCameraPos Set interpolated camera position
Definition at line 269 of file ChaseCamera.cs.
References FreeCamera.
270
271
272
273
274
275
276
277
278
279
280
6.5.4.4
{
// Don’t use for free camera
if (FreeCamera)
return;
if (wannaCameraDistance == 0.0f)
SetCameraPosition(setInterpolatedCameraPos);
wannaCameraDistance = Vector3.Distance(LookAtPos, setInterpolatedCameraPos);
wannaCameraLookVector = LookAtPos - setInterpolatedCameraPos;
}
void GalaxyWars.GameLogic.ChaseCamera.HandleFreeCamera () [private]
Handle free camera, only used for unit tests.
Definition at line 299 of file ChaseCamera.cs.
300
301
302
303
304
{
// Don’t control the camera in the menu or game, only in unit tests!
if (cameraMode != CameraMode.FreeCamera)
return;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.5 GalaxyWars.GameLogic.ChaseCamera Class Reference
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
83
float rotationFactor = 0.0075f;
float gamePadRotFactor = 5.0f * BaseGame.MoveFactorPerSecond;
// We don’t use lookDistance or cameraRotation here, so we have
// to calculate this values here.
cameraDistance = cameraLookVector.Length();
if (wannaHaveCameraRotation.Equals(Vector3.Zero))
wannaHaveCameraRotation = freeCameraRot;
Vector3 rot = wannaHaveCameraRotation;
float addRotX =
// Allow mouse input
-Input.MouseXMovement * rotationFactor +
// And gamepad input
Input.GamePad.ThumbSticks.Left.X * gamePadRotFactor;
// Also allow gamepad and keyboard cursors
if (addRotX == 0)
{
if (Input.GamePadLeftPressed || Input.KeyboardLeftPressed)
addRotX = -gamePadRotFactor;
if (Input.GamePadRightPressed || Input.KeyboardRightPressed)
addRotX = +gamePadRotFactor;
}
float addRotY =
// Allow mouse input
-Input.MouseYMovement * rotationFactor +
// And gamepad input
Input.GamePad.ThumbSticks.Left.Y * gamePadRotFactor;
// Also allow gamepad and keyboard cursors
if (addRotY == 0)
{
if (Input.GamePadUpPressed ||
Input.KeyboardUpPressed)
addRotY = -gamePadRotFactor;
if (Input.GamePadDownPressed ||
Input.KeyboardDownPressed)
addRotY = +gamePadRotFactor;
}
wannaHaveCameraRotation = new Vector3(rot.X, rot.Y + addRotY, rot.Z + addRotX);
// Mix camera rotation slowly to wanna have rotation
freeCameraRot = Vector3.Lerp(freeCameraRot, wannaHaveCameraRotation, 0.5f);
// Substract a very small value to make sure we never reach PI,
// this causes the z rotation to mess everything else up ...
float minRotationRange = BaseGame.Epsilon;
float maxRotationRange = (float)Math.PI - BaseGame.Epsilon;
if (freeCameraRot.X < minRotationRange)
{
freeCameraRot.X = minRotationRange;
}
else if (freeCameraRot.X > maxRotationRange)
{
freeCameraRot.X = maxRotationRange;
}
// Calculate cameraPos like in HandleLookPosCamera()
cameraLookVector = new Vector3(0, 0, cameraDistance);
cameraLookVector = Vector3.TransformNormal(cameraLookVector,
Matrix.CreateRotationX(freeCameraRot.X) *
Matrix.CreateRotationY(freeCameraRot.Y) *
Matrix.CreateRotationZ(freeCameraRot.Z));
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
84
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
6.5.4.5
Class Documentation
float moveFactor =
(Input.Keyboard.IsKeyDown(Keys.LeftShift) ? 20.0f : 40.0f) *
BaseGame.MoveFactorPerSecond;
float smallMoveFactor = moveFactor / 4.0f;
float lookDistanceChange = 0.0f;
// Page up/down or Home/End to zoom in and out.
if (Input.Keyboard.IsKeyDown(Keys.PageUp))
lookDistanceChange += moveFactor * 0.05f;
if (Input.Keyboard.IsKeyDown(Keys.PageDown))
lookDistanceChange -= moveFactor * 0.05f;
if (Input.Keyboard.IsKeyDown(Keys.Home))
lookDistanceChange += smallMoveFactor * 0.05f;
if (Input.Keyboard.IsKeyDown(Keys.End))
lookDistanceChange -= smallMoveFactor * 0.05f;
// Also allow mouse wheel to zoom
if (Input.MouseWheelDelta != 0)
lookDistanceChange = Input.MouseWheelDelta * BaseGame.MoveFactorPerSecond / 16.0f;
// Also allow gamepad to zoom
if (Input.GamePad.ThumbSticks.Right.Y != 0)
lookDistanceChange = Input.GamePad.ThumbSticks.Right.Y * BaseGame.MoveFactorPerSecond;
if (lookDistanceChange != 0)
{
// Half zoom effect if shift is pressed
if (Input.Keyboard.IsKeyDown(Keys.LeftShift))
lookDistanceChange /= 2.0f;
cameraDistance *= 1.0f - lookDistanceChange;
if (cameraDistance < 1.0f)
cameraDistance = 1.0f;
// Calculate cameraPos like in HandleLookPosCamera()
cameraLookVector = Vector3.TransformNormal(
new Vector3(0, 0, cameraDistance),
Matrix.CreateRotationX(freeCameraRot.X) *
Matrix.CreateRotationY(freeCameraRot.Y) *
Matrix.CreateRotationZ(freeCameraRot.Z));
}
// Make sure we use these new values and don’t interpolate them back.
wannaCameraDistance = cameraDistance;
wannaCameraLookVector = cameraLookVector;
}
void GalaxyWars.GameLogic.ChaseCamera.UpdateViewMatrix () [private]
Update view matrix.
Definition at line 429 of file ChaseCamera.cs.
430
431
432
433
434
435
436
437
438
439
{
cameraDistance = cameraDistance * 0.9f + wannaCameraDistance * 0.1f;
// Better interpolation formula, not good for slow framerates,
// but looks much better on high frame rates this way.
cameraLookVector = (cameraLookVector * 0.9f) + (wannaCameraLookVector * 0.1f);
// Update camera pos based on the current lookPos and cameraDistance
cameraPos = LookAtPos + cameraLookVector;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.5 GalaxyWars.GameLogic.ChaseCamera Class Reference
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
6.5.4.6
if (Input.Keyboard.IsKeyDown(Keys.D))
{
Console.Out.WriteLine("Pozice rakety: " + ShipPosition);
Console.Out.WriteLine("Pozice kamery: " + CameraPosition);
Console.Out.WriteLine("CameraLookVector: " + cameraLookVector);
}
// Build look at matrix
rotMatrix = Matrix.CreateLookAt(cameraPos, LookAtPos, SpaceshipUpVector);
// Is camera wobbeling?
if (cameraWobbelTimeoutMs > 0)
{
cameraWobbelTimeoutMs -= BaseGame.ElapsedTimeThisFrameInMilliseconds;
if (cameraWobbelTimeoutMs < 0)
cameraWobbelTimeoutMs = 0;
}
// Add camera shake if camera wobbel effect is on
if (cameraWobbelTimeoutMs > 0 &&
// But only if not zooming in and if in game.
ZoomInTime <= StartGameZoomTimeMilliseconds)
{
float effectStrength = 1.5f * cameraWobbelFactor *
(cameraWobbelTimeoutMs / (float)MaxCameraWobbelTimeoutMs);
// Interpolate, make wobbleing more smoooth than in Rocket Commander
lastCameraWobble =
lastCameraWobble * 0.9f +
RandomHelper.GetRandomVector3(
-effectStrength, +effectStrength) * 0.1f;
rotMatrix *= Matrix.CreateTranslation(lastCameraWobble);
}
// Just set view matrix
BaseGame.ViewMatrix = rotMatrix;
}
override void GalaxyWars.GameLogic.ChaseCamera.Reset () [virtual]
Resets just the camera wobbel factor here.
Reimplemented from GalaxyWars.GameLogic.SpaceshipPhysics.
Reimplemented in GalaxyWars.GameLogic.Player.
Definition at line 483 of file ChaseCamera.cs.
484
485
486
487
6.5.4.7
85
{
base.Reset();
cameraWobbelFactor = 0;
}
override void GalaxyWars.GameLogic.ChaseCamera.ClearVariablesForGameOver ()
[virtual]
Clear variables for game over.
Reimplemented from GalaxyWars.GameLogic.SpaceshipPhysics.
Definition at line 492 of file ChaseCamera.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
86
493
494
495
496
6.5.4.8
Class Documentation
{
base.ClearVariablesForGameOver();
cameraWobbelFactor = 0;
}
override void GalaxyWars.GameLogic.ChaseCamera.Update () [virtual]
Update camera, should be called every frame to handle all the input.
Reimplemented from GalaxyWars.GameLogic.SpaceshipPhysics.
Reimplemented in GalaxyWars.GameLogic.Player.
Definition at line 503 of file ChaseCamera.cs.
504
505
506
507
508
509
510
511
{
base.Update();
// Only allow control when zooming is finished.
HandleFreeCamera();
UpdateViewMatrix();
}
6.5.5
Member Data Documentation
6.5.5.1
Vector3 GalaxyWars.GameLogic.ChaseCamera.cameraPos [protected]
Current camera position.
Definition at line 34 of file ChaseCamera.cs.
6.5.5.2
float GalaxyWars.GameLogic.ChaseCamera.cameraDistance [private]
Distance of the camera to our car.
Definition at line 38 of file ChaseCamera.cs.
6.5.5.3
Vector3 GalaxyWars.GameLogic.ChaseCamera.cameraLookVector [private]
Look vector to the car. The car is our look at target. The up vector is the same as the one from the car, but
the look vector is different because we slowly interpolate it.
Definition at line 45 of file ChaseCamera.cs.
6.5.5.4
CameraMode GalaxyWars.GameLogic.ChaseCamera.cameraMode =
CameraMode.Default [private]
Current camera mode.
Definition at line 67 of file ChaseCamera.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.5 GalaxyWars.GameLogic.ChaseCamera Class Reference
6.5.5.5
87
Matrix GalaxyWars.GameLogic.ChaseCamera.rotMatrix = Matrix.Identity [private]
Rotation matrix, used in UpdateViewMatrix.
Definition at line 72 of file ChaseCamera.cs.
6.5.5.6
const int GalaxyWars.GameLogic.ChaseCamera.MaxCameraWobbelTimeoutMs = 700
[private]
Max. value for camera wobbel timeout.
Definition at line 92 of file ChaseCamera.cs.
6.5.5.7
float GalaxyWars.GameLogic.ChaseCamera.cameraWobbelTimeoutMs = 0 [static,
private]
Camera wobbel timeout. Used to shake camera after a collision.
Definition at line 98 of file ChaseCamera.cs.
6.5.5.8
float GalaxyWars.GameLogic.ChaseCamera.cameraWobbelFactor = 1.0f [static,
private]
Camera wobbel factor.
Definition at line 103 of file ChaseCamera.cs.
6.5.5.9
Vector3 GalaxyWars.GameLogic.ChaseCamera.wannaCameraLookVector = Vector3.Zero
[private]
Definition at line 261 of file ChaseCamera.cs.
6.5.5.10
float GalaxyWars.GameLogic.ChaseCamera.wannaCameraDistance = 0.0f [private]
Definition at line 262 of file ChaseCamera.cs.
6.5.5.11
Vector3 GalaxyWars.GameLogic.ChaseCamera.freeCameraRot = new
Vector3(MathHelper.Pi, 0, -MathHelper.Pi / 2) [private]
Helper values to keep the free camera steady.
Definition at line 289 of file ChaseCamera.cs.
6.5.5.12
Vector3 GalaxyWars.GameLogic.ChaseCamera.wannaHaveCameraRotation =
Vector3.Zero [private]
Wanna have camera rotation.
Definition at line 294 of file ChaseCamera.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
88
Class Documentation
6.5.5.13
Vector3 GalaxyWars.GameLogic.ChaseCamera.lastCameraWobble = Vector3.Zero
[private]
Definition at line 424 of file ChaseCamera.cs.
6.5.6
Property Documentation
6.5.6.1
Matrix GalaxyWars.GameLogic.ChaseCamera.RotationMatrix [get]
Rotation matrix.
Returns:
Matrix
Definition at line 78 of file ChaseCamera.cs.
6.5.6.2
Vector3 GalaxyWars.GameLogic.ChaseCamera.CameraPosition [get]
Camera position.
Returns:
Vector 3
Definition at line 126 of file ChaseCamera.cs.
6.5.6.3
Vector3 GalaxyWars.GameLogic.ChaseCamera.XAxis [static, get]
Get current x axis with help of the current view matrix.
Returns:
Vector 3
Definition at line 138 of file ChaseCamera.cs.
6.5.6.4
Vector3 GalaxyWars.GameLogic.ChaseCamera.YAxis [static, get]
Get current y axis with help of the current view matrix.
Returns:
Vector 3
Definition at line 154 of file ChaseCamera.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.5 GalaxyWars.GameLogic.ChaseCamera Class Reference
6.5.6.5
Vector3 GalaxyWars.GameLogic.ChaseCamera.ZAxis [static, get]
Get current z axis with help of the current view matrix.
Returns:
Vector 3
Definition at line 170 of file ChaseCamera.cs.
6.5.6.6
bool GalaxyWars.GameLogic.ChaseCamera.FreeCamera [get, set]
Free camera.
Returns:
Bool
Definition at line 186 of file ChaseCamera.cs.
The documentation for this class was generated from the following file:
• ChaseCamera.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
89
90
Class Documentation
6.6
GalaxyWars.Helpers.ColorHelper Class Reference
Color helper, just to convert colors to different formats and providing more helper methods missing in the
Color class.
Collaboration diagram for GalaxyWars.Helpers.ColorHelper:
Color
Empty
HalfAlpha
GalaxyWars.Helpers.ColorHelper
Static Public Member Functions
• static Color MultiplyColors (Color color1, Color color2)
Multiply colors.
• static bool SameColor (Color color, Color checkColor)
Same color. Helper method for LoadLevel because for some reason the color compare does not work and
causes a lot of errors.
• static Color InterpolateColor (Color col1, Color col2, float percent)
Interpolate color. Used to fade the hud colors from green to red.
• static Color ApplyAlphaToColor (Color col, float newAlpha)
Apply alpha to color.
• static Color MixAlphaToColor (Color col, float newAlpha)
Mix alpha to color.
Static Public Attributes
• static readonly Color Empty = new Color(0, 0, 0, 0)
Empty color, used to mark unused color values.
• static readonly Color HalfAlpha = new Color(255, 255, 255, 128)
Half alpha color helper. Just white with 50% alpha.
Static Private Member Functions
• static float StayInRange (float val, float min, float max)
Stay in range, val will be set to min if less or to max when bigger.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.6 GalaxyWars.Helpers.ColorHelper Class Reference
6.6.1
91
Detailed Description
Color helper, just to convert colors to different formats and providing more helper methods missing in the
Color class.
Definition at line 15 of file ColorHelper.cs.
6.6.2
Member Function Documentation
6.6.2.1
static float GalaxyWars.Helpers.ColorHelper.StayInRange (float val, float min, float max)
[static, private]
Stay in range, val will be set to min if less or to max when bigger.
Definition at line 34 of file ColorHelper.cs.
35
36
37
38
39
40
41
{
if (val < min)
return min;
if (val > max)
return max;
return val;
}
6.6.2.2
static Color GalaxyWars.Helpers.ColorHelper.MultiplyColors (Color color1, Color color2)
[static]
Multiply colors.
Parameters:
color1 Color 1
color2 Color 2
Returns:
Return color
Definition at line 51 of file ColorHelper.cs.
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
// Quick check if any of the colors is white,
// multiplying won’t do anything then.
if (color1 == Color.White)
return color2;
if (color2 == Color.White)
return color1;
// Get values from color1
float redValue1 = color1.R / 255.0f;
float greenValue1 = color1.G / 255.0f;
float blueValue1 = color1.B / 255.0f;
float alphaValue1 = color1.A / 255.0f;
// Get values from color2
float redValue2 = color2.R / 255.0f;
float greenValue2 = color2.G / 255.0f;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
92
Class Documentation
69
70
71
72
73
74
75
76
77
78
float blueValue2 = color2.B / 255.0f;
float alphaValue2 = color2.A / 255.0f;
// Multiply everything using our floats
return new Color(
(byte)(StayInRange(redValue1 * redValue2, 0, 1) * 255.0f),
(byte)(StayInRange(greenValue1 * greenValue2, 0, 1) * 255.0f),
(byte)(StayInRange(blueValue1 * blueValue2, 0, 1) * 255.0f),
(byte)(StayInRange(alphaValue1 * alphaValue2, 0, 1) * 255.0f));
}
6.6.2.3
static bool GalaxyWars.Helpers.ColorHelper.SameColor (Color color, Color checkColor)
[static]
Same color. Helper method for LoadLevel because for some reason the color compare does not work and
causes a lot of errors.
Parameters:
color Color
checkColor Check color
Returns:
Bool
Definition at line 89 of file ColorHelper.cs.
90
91
92
93
94
6.6.2.4
{
return color.R == checkColor.R &&
color.G == checkColor.G &&
color.B == checkColor.B;
}
static Color GalaxyWars.Helpers.ColorHelper.InterpolateColor (Color col1, Color col2,
float percent) [static]
Interpolate color. Used to fade the hud colors from green to red.
Definition at line 101 of file ColorHelper.cs.
102
103
104
105
106
107
108
6.6.2.5
{
return new Color(
(byte)((float)col1.R
(byte)((float)col1.G
(byte)((float)col1.B
(byte)((float)col1.A
*
*
*
*
(1.0f
(1.0f
(1.0f
(1.0f
-
percent)
percent)
percent)
percent)
+
+
+
+
(float)col2.R
(float)col2.G
(float)col2.B
(float)col2.A
*
*
*
*
percent),
percent),
percent),
percent));
}
static Color GalaxyWars.Helpers.ColorHelper.ApplyAlphaToColor (Color col, float
newAlpha) [static]
Apply alpha to color.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.6 GalaxyWars.Helpers.ColorHelper Class Reference
Parameters:
col Color
newAlpha New alpha
Returns:
Color
Definition at line 118 of file ColorHelper.cs.
119
120
121
122
123
124
125
126
127
128
129
{
if (newAlpha < 0)
newAlpha = 0;
if (newAlpha > 1)
newAlpha = 1;
return new Color(
(byte)(col.R),
(byte)(col.G),
(byte)(col.B),
(byte)(newAlpha * 255.0f));
}
6.6.2.6
static Color GalaxyWars.Helpers.ColorHelper.MixAlphaToColor (Color col, float
newAlpha) [static]
Mix alpha to color.
Parameters:
col Color
newAlpha New alpha
Returns:
Color
Definition at line 137 of file ColorHelper.cs.
138
139
140
141
142
143
144
145
146
147
148
{
if (newAlpha < 0)
newAlpha = 0;
if (newAlpha > 1)
newAlpha = 1;
return new Color(
(byte)(col.R * newAlpha),
(byte)(col.G * newAlpha),
(byte)(col.B * newAlpha),
(byte)(newAlpha * 255.0f));
}
6.6.3
Member Data Documentation
6.6.3.1
readonly Color GalaxyWars.Helpers.ColorHelper.Empty = new Color(0, 0, 0, 0)
[static]
Empty color, used to mark unused color values.
Definition at line 21 of file ColorHelper.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
93
94
Class Documentation
6.6.3.2
readonly Color GalaxyWars.Helpers.ColorHelper.HalfAlpha = new Color(255, 255, 255,
128) [static]
Half alpha color helper. Just white with 50% alpha.
Definition at line 27 of file ColorHelper.cs.
The documentation for this class was generated from the following file:
• ColorHelper.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.7 GalaxyWars.Helpers.Directories Class Reference
6.7
95
GalaxyWars.Helpers.Directories Class Reference
Helper class which stores all used directories.
Static Public Attributes
• static readonly string GameBaseDirectory
We can use this to relocate the whole game directory to another location. Used for testing (everything is
stored on a network drive).
Properties
• static string ContentDirectory [get]
Content directory for all our textures, models and shaders.
• static string SoundsDirectory [get]
Sounds directory, for some reason XAct projects don’t produce any content files (bug?). We just load them
ourself!
• static string ScreenshotsDirectory [get]
Default Screenshots directory.
Private Member Functions
• Directories ()
Private constructor to prevent instantiation.
6.7.1
Detailed Description
Helper class which stores all used directories.
Definition at line 14 of file Directories.cs.
6.7.2
Constructor & Destructor Documentation
6.7.2.1
GalaxyWars.Helpers.Directories.Directories () [private]
Private constructor to prevent instantiation.
Definition at line 73 of file Directories.cs.
74
75
{
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
96
Class Documentation
6.7.3
Member Data Documentation
6.7.3.1
readonly string GalaxyWars.Helpers.Directories.GameBaseDirectory [static]
Initial value:
StorageContainer.TitleLocation
We can use this to relocate the whole game directory to another location. Used for testing (everything is
stored on a network drive).
Definition at line 22 of file Directories.cs.
6.7.4
Property Documentation
6.7.4.1
string GalaxyWars.Helpers.Directories.ContentDirectory [static, get]
Content directory for all our textures, models and shaders.
Returns:
String
Definition at line 34 of file Directories.cs.
6.7.4.2
string GalaxyWars.Helpers.Directories.SoundsDirectory [static, get]
Sounds directory, for some reason XAct projects don’t produce any content files (bug?). We just load them
ourself!
Returns:
String
Definition at line 47 of file Directories.cs.
6.7.4.3
string GalaxyWars.Helpers.Directories.ScreenshotsDirectory [static, get]
Default Screenshots directory.
Returns:
String
Definition at line 59 of file Directories.cs.
The documentation for this class was generated from the following file:
• Directories.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.8 GalaxyWars.Helpers.FileHelper Class Reference
6.8
97
GalaxyWars.Helpers.FileHelper Class Reference
File helper class to get text lines, number of text lines, etc. Update: Now also supports the XNA Storage
classes :).
Static Public Member Functions
• static FileStream CreateGameContentFile (string relativeFilename, bool createNew)
Create game content file, will create file if it does not exist. Else the existing file is just loaded.
• static FileStream LoadGameContentFile (string relativeFilename)
Load game content file, returns null if file was not found.
• static FileStream SaveGameContentFile (string relativeFilename)
• static FileStream OpenFileForCurrentPlayer (string filename, FileMode mode, FileAccess access)
Open or create file for current player. Basically just creates a FileStream using the specified FileMode flag,
but on the Xbox360 we have to ask the user first where he wants to. Basically used for the GameSettings
and the Log class.
• static string[ ] GetLines (string filename)
Returns the number of text lines we got in a file.
• static void WriteVector3 (BinaryWriter writer, Vector3 vec)
Write vector3 to stream.
• static void WriteVector4 (BinaryWriter writer, Vector4 vec)
Write vector4 to stream.
• static void WriteMatrix (BinaryWriter writer, Matrix matrix)
Write matrix to stream.
• static Vector3 ReadVector3 (BinaryReader reader)
Read vector3 from stream.
• static Vector4 ReadVector4 (BinaryReader reader)
Read vector4 from stream.
• static Matrix ReadMatrix (BinaryReader reader)
Read matrix from stream.
Properties
• static StorageDevice XnaUserDevice [get]
Xna user device.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
98
Class Documentation
Static Private Attributes
• static StorageDevice xnaUserDevice = null
XNA user device, asks for the saving location on the Xbox360, theirfore remember this device for the time
we run the game.
6.8.1
Detailed Description
File helper class to get text lines, number of text lines, etc. Update: Now also supports the XNA Storage
classes :).
Definition at line 17 of file FileHelper.cs.
6.8.2
Member Function Documentation
6.8.2.1
static FileStream GalaxyWars.Helpers.FileHelper.CreateGameContentFile (string
relativeFilename, bool createNew) [static]
Create game content file, will create file if it does not exist. Else the existing file is just loaded.
Parameters:
relativeFilename Relative filename
Returns:
File stream
Definition at line 26 of file FileHelper.cs.
28
29
30
31
32
33
34
{
string fullPath = Path.Combine(
StorageContainer.TitleLocation, relativeFilename);
return File.Open(fullPath,
createNew ? FileMode.Create : FileMode.OpenOrCreate,
FileAccess.Write, FileShare.ReadWrite);
}
6.8.2.2
static FileStream GalaxyWars.Helpers.FileHelper.LoadGameContentFile (string
relativeFilename) [static]
Load game content file, returns null if file was not found.
Parameters:
relativeFilename Relative filename
Returns:
File stream
Definition at line 43 of file FileHelper.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.8 GalaxyWars.Helpers.FileHelper Class Reference
44
45
46
47
48
49
50
51
52
99
{
string fullPath = Path.Combine(
StorageContainer.TitleLocation, relativeFilename);
if (File.Exists(fullPath) == false)
return null;
else
return File.Open(fullPath,
FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
6.8.2.3
static FileStream GalaxyWars.Helpers.FileHelper.SaveGameContentFile (string
relativeFilename) [static]
Definition at line 56 of file FileHelper.cs.
57
58
59
60
61
62
{
string fullPath = Path.Combine(
StorageContainer.TitleLocation, relativeFilename);
return File.Open(fullPath,
FileMode.Create, FileAccess.Write);
}
6.8.2.4
static FileStream GalaxyWars.Helpers.FileHelper.OpenFileForCurrentPlayer (string
filename, FileMode mode, FileAccess access) [static]
Open or create file for current player. Basically just creates a FileStream using the specified FileMode flag,
but on the Xbox360 we have to ask the user first where he wants to. Basically used for the GameSettings
and the Log class.
Parameters:
filename Filename
mode Mode
access Access
Returns:
File stream
Definition at line 98 of file FileHelper.cs.
100
101
102
103
104
105
106
107
108
109
110
111
{
// Open a storage container
StorageContainer container =
XnaUserDevice.OpenContainer("GalaxyWars");
// Add the container path to our filename
string fullFilename = Path.Combine(container.Path, filename);
// Opens or creates the requested file
return new FileStream(
fullFilename, mode, access, FileShare.ReadWrite);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
100
Class Documentation
6.8.2.5
static string [ ] GalaxyWars.Helpers.FileHelper.GetLines (string filename) [static]
Returns the number of text lines we got in a file.
Definition at line 118 of file FileHelper.cs.
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
try
{
StreamReader reader = new StreamReader(
new FileStream(filename, FileMode.Open, FileAccess.Read),
System.Text.Encoding.UTF8);
// Generic version
List<string> lines = new List<string>();
do
{
lines.Add(reader.ReadLine());
} while (reader.Peek() > -1);
reader.Close();
return lines.ToArray();
}
catch (FileNotFoundException)
{
// Failed to read, just return null!
return null;
}
catch (DirectoryNotFoundException)
{
return null;
}
catch (IOException)
{
return null;
}
}
6.8.2.6
static void GalaxyWars.Helpers.FileHelper.WriteVector3 (BinaryWriter writer, Vector3
vec) [static]
Write vector3 to stream.
Parameters:
writer Writer
vec Vector3
Definition at line 156 of file FileHelper.cs.
157
158
159
160
161
162
163
164
{
if (writer == null)
throw new ArgumentNullException("writer");
writer.Write(vec.X);
writer.Write(vec.Y);
writer.Write(vec.Z);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.8 GalaxyWars.Helpers.FileHelper Class Reference
6.8.2.7
static void GalaxyWars.Helpers.FileHelper.WriteVector4 (BinaryWriter writer, Vector4
vec) [static]
Write vector4 to stream.
Parameters:
writer Writer
vec Vector4
Definition at line 171 of file FileHelper.cs.
172
173
174
175
176
177
178
179
180
{
if (writer == null)
throw new ArgumentNullException("writer");
writer.Write(vec.X);
writer.Write(vec.Y);
writer.Write(vec.Z);
writer.Write(vec.W);
}
6.8.2.8
static void GalaxyWars.Helpers.FileHelper.WriteMatrix (BinaryWriter writer, Matrix
matrix) [static]
Write matrix to stream.
Parameters:
writer Writer
matrix Matrix
Definition at line 187 of file FileHelper.cs.
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
101
{
if (writer == null)
throw new ArgumentNullException("writer");
writer.Write(matrix.M11);
writer.Write(matrix.M12);
writer.Write(matrix.M13);
writer.Write(matrix.M14);
writer.Write(matrix.M21);
writer.Write(matrix.M22);
writer.Write(matrix.M23);
writer.Write(matrix.M24);
writer.Write(matrix.M31);
writer.Write(matrix.M32);
writer.Write(matrix.M33);
writer.Write(matrix.M34);
writer.Write(matrix.M41);
writer.Write(matrix.M42);
writer.Write(matrix.M43);
writer.Write(matrix.M44);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
102
Class Documentation
6.8.2.9
static Vector3 GalaxyWars.Helpers.FileHelper.ReadVector3 (BinaryReader reader)
[static]
Read vector3 from stream.
Parameters:
reader Reader
Returns:
Vector3
Definition at line 217 of file FileHelper.cs.
218
219
220
221
222
223
224
225
226
{
if (reader == null)
throw new ArgumentNullException("reader");
return new Vector3(
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle());
}
6.8.2.10
static Vector4 GalaxyWars.Helpers.FileHelper.ReadVector4 (BinaryReader reader)
[static]
Read vector4 from stream.
Parameters:
reader Reader
Returns:
Vector4
Definition at line 233 of file FileHelper.cs.
234
235
236
237
238
239
240
241
242
243
6.8.2.11
{
if (reader == null)
throw new ArgumentNullException("reader");
return new Vector4(
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle());
}
static Matrix GalaxyWars.Helpers.FileHelper.ReadMatrix (BinaryReader reader)
[static]
Read matrix from stream.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.8 GalaxyWars.Helpers.FileHelper Class Reference
103
Parameters:
reader Reader
Returns:
Matrix
Definition at line 250 of file FileHelper.cs.
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
{
if (reader == null)
throw new ArgumentNullException("reader");
return new Matrix(
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle(),
reader.ReadSingle());
}
6.8.3
Member Data Documentation
6.8.3.1
StorageDevice GalaxyWars.Helpers.FileHelper.xnaUserDevice = null [static,
private]
XNA user device, asks for the saving location on the Xbox360, theirfore remember this device for the time
we run the game.
Definition at line 70 of file FileHelper.cs.
6.8.4
Property Documentation
6.8.4.1
StorageDevice GalaxyWars.Helpers.FileHelper.XnaUserDevice [static, get]
Xna user device.
Returns:
Storage device
Definition at line 77 of file FileHelper.cs.
The documentation for this class was generated from the following file:
• FileHelper.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
104
Class Documentation
6.9
GalaxyWars.Particles.FireParticleSystem Class Reference
Custom particle system for creating a flame effect.
Inheritance diagram for GalaxyWars.Particles.FireParticleSystem:
GalaxyWars.Particles.ParticleSystem
GalaxyWars.Particles.FireParticleSystem
Collaboration diagram for GalaxyWars.Particles.FireParticleSystem:
Color
MaxColor
MinColor
GalaxyWars.Particles.ParticleSettings
Random
GalaxyWars.Particles.ParticleVertex
settings
particles
GalaxyWars.Particles.ParticleSystem
GalaxyWars.Particles.FireParticleSystem
Public Member Functions
• FireParticleSystem (ContentManager content)
Protected Member Functions
• override void InitializeSettings (ParticleSettings settings)
Derived particle system classes should override this method and use it to initalize their tweakable settings.
6.9.1
Detailed Description
Custom particle system for creating a flame effect.
Definition at line 13 of file FireParticleSystem.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.9 GalaxyWars.Particles.FireParticleSystem Class Reference
105
6.9.2
Constructor & Destructor Documentation
6.9.2.1
GalaxyWars.Particles.FireParticleSystem.FireParticleSystem (ContentManager content)
Definition at line 15 of file FireParticleSystem.cs.
15
16
: base(content)
{ }
6.9.3
Member Function Documentation
6.9.3.1
override void GalaxyWars.Particles.FireParticleSystem.InitializeSettings (ParticleSettings
settings) [protected, virtual]
Derived particle system classes should override this method and use it to initalize their tweakable settings.
Implements GalaxyWars.Particles.ParticleSystem.
Definition at line 18 of file FireParticleSystem.cs.
References
GalaxyWars.Particles.ParticleSettings.DestinationBlend,
GalaxyWars.Particles.ParticleSettings.Duration,
GalaxyWars.Particles.ParticleSettings.DurationRandomness,
GalaxyWars.Particles.ParticleSettings.Gravity, GalaxyWars.Particles.ParticleSettings.MaxColor, GalaxyWars.Particles.ParticleSettings.MaxEndSize, GalaxyWars.Particles.ParticleSettings.MaxHorizontalVelocity,
GalaxyWars.Particles.ParticleSettings.MaxParticles, GalaxyWars.Particles.ParticleSettings.MaxStartSize,
GalaxyWars.Particles.ParticleSettings.MaxVerticalVelocity, GalaxyWars.Particles.ParticleSettings.MinColor,
GalaxyWars.Particles.ParticleSettings.MinEndSize, GalaxyWars.Particles.ParticleSettings.MinHorizontalVelocity,
GalaxyWars.Particles.ParticleSettings.MinStartSize, GalaxyWars.Particles.ParticleSettings.MinVerticalVelocity,
GalaxyWars.Particles.ParticleSettings.SourceBlend, and GalaxyWars.Particles.ParticleSettings.TextureName.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
settings.TextureName = "Content/Textures/fire";
settings.MaxParticles = 512;
settings.Duration = TimeSpan.FromSeconds(0.125);
settings.DurationRandomness = 0.5f;
settings.MinHorizontalVelocity = -2;
settings.MaxHorizontalVelocity = 2;
settings.MinVerticalVelocity = -2;
settings.MaxVerticalVelocity = 2;
// Set gravity upside down, so the flames will ’fall’ upward.
settings.Gravity = new Vector3(0, 0, 0);
settings.MinColor = new Color(255, 255, 255, 64);
settings.MaxColor = new Color(255, 255, 255, 128);
settings.MinStartSize = 0.1f;
settings.MaxStartSize = 0.25f;
settings.MinEndSize = 0.25f;
settings.MaxEndSize = 1.0f;
// Use additive blending.
settings.SourceBlend = Blend.SourceAlpha;
settings.DestinationBlend = Blend.One;
}
The documentation for this class was generated from the following file:
• FireParticleSystem.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
106
Class Documentation
6.10
GalaxyWars.Graphics.Material Class Reference
Material class for DirectX materials used for Models. Consists of normal DirectX material settings (ambient, diffuse, specular), the diffuse texture and optionally of normal map, height map and shader parameters.
Collaboration diagram for GalaxyWars.Graphics.Material:
Texture2D
internalXnaTexture
GalaxyWars.Graphics.Texture
diffuseTexture
detailTexture
heightTexture
normalTexture
Color
diffuseColor
specularColor
DefaultDiffuseColor
ambientColor
DefaultAmbientColor
DefaultSpecularColor
GalaxyWars.Graphics.Material
Public Member Functions
• Material ()
Create material, just using default values.
• Material (string setDiffuseTexture)
Create material, just using default color values.
• Material (Color setAmbientColor, Color setDiffuseColor, string setDiffuseTexture)
Create material.
• Material (Color setAmbientColor, Color setDiffuseColor, Texture setDiffuseTexture)
Create material.
• Material (string setDiffuseTexture, string setNormalTexture)
Create material.
• Material (string setDiffuseTexture, string setNormalTexture, string setHeightTexture)
Create material.
• Material (Color setAmbientColor, Color setDiffuseColor, Color setSpecularColor, string setDiffuseTexture, string setNormalTexture, string setHeightTexture, string setDetailTexture)
Create material.
• Material (Effect effect)
Create material.
• void Dispose ()
Dispose.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.10 GalaxyWars.Graphics.Material Class Reference
Public Attributes
• const float DefaultParallaxAmount = 0.04f
Parallax amount for parallax and offset shaders.
• Color diffuseColor = DefaultDiffuseColor
Colors.
• Color ambientColor = DefaultAmbientColor
• Color specularColor = DefaultSpecularColor
• float specularPower = DefaultSpecularPower
Specular power.
• Texture diffuseTexture = null
Diffuse texture for the material. Can be null for unused.
• Texture normalTexture = null
Normal texture in case we use normal mapping. Can be null for unused.
• Texture heightTexture = null
Height texture in case we use parallax mapping. Can be null for unused.
• Texture detailTexture = null
Detail texture, used for landscape rendering. Can be null for unused.
• float parallaxAmount = DefaultParallaxAmount
Parallax amount for parallax and offset shaders.
Static Public Attributes
• static readonly Color DefaultAmbientColor = new Color(40, 40, 40)
Default color values are: 0.15f for ambient and 1.0f for diffuse and 1.0f specular.
• static readonly Color DefaultDiffuseColor = new Color(210, 210, 210)
• static readonly Color DefaultSpecularColor = new Color(255, 255, 255)
Protected Member Functions
• virtual void Dispose (bool disposing)
Dispose.
Properties
• bool HasAlpha [get]
Checks if the diffuse texture has alpha.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
107
108
Class Documentation
Private Attributes
• const float DefaultSpecularPower = 24.0f
Default specular power (24).
6.10.1
Detailed Description
Material class for DirectX materials used for Models. Consists of normal DirectX material settings (ambient, diffuse, specular), the diffuse texture and optionally of normal map, height map and shader parameters.
Definition at line 18 of file Material.cs.
6.10.2
Constructor & Destructor Documentation
6.10.2.1
GalaxyWars.Graphics.Material.Material ()
Create material, just using default values.
Definition at line 97 of file Material.cs.
98
99
6.10.2.2
{
}
GalaxyWars.Graphics.Material.Material (string setDiffuseTexture)
Create material, just using default color values.
Definition at line 104 of file Material.cs.
105
106
107
6.10.2.3
{
diffuseTexture = new Texture(setDiffuseTexture);
}
GalaxyWars.Graphics.Material.Material (Color setAmbientColor, Color setDiffuseColor,
string setDiffuseTexture)
Create material.
Definition at line 112 of file Material.cs.
114
115
116
117
118
119
{
ambientColor = setAmbientColor;
diffuseColor = setDiffuseColor;
diffuseTexture = new Texture(setDiffuseTexture);
// Leave rest to default
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.10 GalaxyWars.Graphics.Material Class Reference
6.10.2.4
109
GalaxyWars.Graphics.Material.Material (Color setAmbientColor, Color setDiffuseColor,
Texture setDiffuseTexture)
Create material.
Definition at line 124 of file Material.cs.
126
127
128
129
130
131
6.10.2.5
{
ambientColor = setAmbientColor;
diffuseColor = setDiffuseColor;
diffuseTexture = setDiffuseTexture;
// Leave rest to default
}
GalaxyWars.Graphics.Material.Material (string setDiffuseTexture, string
setNormalTexture)
Create material.
Definition at line 136 of file Material.cs.
137
138
139
140
141
6.10.2.6
{
diffuseTexture = new Texture(setDiffuseTexture);
normalTexture = new Texture(setNormalTexture);
// Leave rest to default
}
GalaxyWars.Graphics.Material.Material (string setDiffuseTexture, string
setNormalTexture, string setHeightTexture)
Create material.
Definition at line 146 of file Material.cs.
148
149
150
151
152
153
6.10.2.7
{
diffuseTexture = new Texture(setDiffuseTexture);
normalTexture = new Texture(setNormalTexture);
heightTexture = new Texture(setHeightTexture);
// Leave rest to default
}
GalaxyWars.Graphics.Material.Material (Color setAmbientColor, Color setDiffuseColor,
Color setSpecularColor, string setDiffuseTexture, string setNormalTexture, string
setHeightTexture, string setDetailTexture)
Create material.
Definition at line 158 of file Material.cs.
162
163
164
165
166
167
{
ambientColor = setAmbientColor;
diffuseColor = setDiffuseColor;
specularColor = setSpecularColor;
diffuseTexture = new Texture(setDiffuseTexture);
if (String.IsNullOrEmpty(setNormalTexture) == false)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
110
Class Documentation
168
169
170
171
172
173
174
normalTexture = new Texture(setNormalTexture);
if (String.IsNullOrEmpty(setHeightTexture) == false)
heightTexture = new Texture(setHeightTexture);
if (String.IsNullOrEmpty(setDetailTexture) == false)
detailTexture = new Texture(setDetailTexture);
// Leave rest to default
}
6.10.2.8
GalaxyWars.Graphics.Material.Material (Effect effect)
Create material.
Parameters:
effect Effect
Definition at line 182 of file Material.cs.
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
{
if (effect == null)
throw new ArgumentNullException("effect");
EffectParameter diffuseTextureParameter =
effect.Parameters["diffuseTexture"];
if (diffuseTextureParameter != null)
diffuseTexture = new Texture(
diffuseTextureParameter.GetValueTexture2D());
EffectParameter normalTextureParameter =
effect.Parameters["normalTexture"];
if (normalTextureParameter != null)
normalTexture = new Texture(
normalTextureParameter.GetValueTexture2D());
EffectParameter diffuseColorParameter =
effect.Parameters["diffuseColor"];
if (diffuseColorParameter != null)
diffuseColor = new Color(diffuseColorParameter.GetValueVector4());
EffectParameter ambientColorParameter =
effect.Parameters["ambientColor"];
if (ambientColorParameter != null)
ambientColor = new Color(ambientColorParameter.GetValueVector4());
EffectParameter specularColorParameter =
effect.Parameters["specularColor"];
if (specularColorParameter != null)
specularColor = new Color(specularColorParameter.GetValueVector4());
EffectParameter specularPowerParameter =
effect.Parameters["specularPower"];
if (specularPowerParameter != null)
specularPower = specularPowerParameter.GetValueSingle();
}
6.10.3
Member Function Documentation
6.10.3.1
void GalaxyWars.Graphics.Material.Dispose ()
Dispose.
Definition at line 226 of file Material.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.10 GalaxyWars.Graphics.Material Class Reference
227
228
229
230
111
{
Dispose(true);
GC.SuppressFinalize(this);
}
6.10.3.2
virtual void GalaxyWars.Graphics.Material.Dispose (bool disposing) [protected,
virtual]
Dispose.
Parameters:
disposing Disposing
Definition at line 236 of file Material.cs.
237
238
239
240
241
242
243
244
245
246
247
248
249
{
if (disposing)
{
if (diffuseTexture != null)
diffuseTexture.Dispose();
if (normalTexture != null)
normalTexture.Dispose();
if (heightTexture != null)
heightTexture.Dispose();
if (detailTexture != null)
detailTexture.Dispose();
}
}
6.10.4
Member Data Documentation
6.10.4.1
readonly Color GalaxyWars.Graphics.Material.DefaultAmbientColor = new Color(40,
40, 40) [static]
Default color values are: 0.15f for ambient and 1.0f for diffuse and 1.0f specular.
Definition at line 26 of file Material.cs.
6.10.4.2
readonly Color GalaxyWars.Graphics.Material.DefaultDiffuseColor = new Color(210,
210, 210) [static]
Definition at line 27 of file Material.cs.
6.10.4.3
readonly Color GalaxyWars.Graphics.Material.DefaultSpecularColor = new Color(255,
255, 255) [static]
Definition at line 28 of file Material.cs.
6.10.4.4
const float GalaxyWars.Graphics.Material.DefaultSpecularPower = 24.0f [private]
Default specular power (24).
Definition at line 33 of file Material.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
112
6.10.4.5
Class Documentation
const float GalaxyWars.Graphics.Material.DefaultParallaxAmount = 0.04f
Parallax amount for parallax and offset shaders.
Definition at line 38 of file Material.cs.
6.10.4.6
Color GalaxyWars.Graphics.Material.diffuseColor = DefaultDiffuseColor
Colors.
Definition at line 45 of file Material.cs.
Referenced
by
GalaxyWars.Graphics.MeshRenderManager.Add(),
Wars.Shaders.ShaderEffect.SetParametersOptimized().
6.10.4.7
and
Galaxy-
Color GalaxyWars.Graphics.Material.ambientColor = DefaultAmbientColor
Definition at line 46 of file Material.cs.
Referenced
by
GalaxyWars.Graphics.MeshRenderManager.Add(),
Wars.Shaders.ShaderEffect.SetParametersOptimized().
6.10.4.8
and
Galaxy-
Color GalaxyWars.Graphics.Material.specularColor = DefaultSpecularColor
Definition at line 47 of file Material.cs.
Referenced
by
GalaxyWars.Graphics.MeshRenderManager.Add(),
Wars.Shaders.ShaderEffect.SetParametersOptimized().
6.10.4.9
and
Galaxy-
float GalaxyWars.Graphics.Material.specularPower = DefaultSpecularPower
Specular power.
Definition at line 52 of file Material.cs.
Referenced by GalaxyWars.Graphics.MeshRenderManager.Add().
6.10.4.10
Texture GalaxyWars.Graphics.Material.diffuseTexture = null
Diffuse texture for the material. Can be null for unused.
Definition at line 57 of file Material.cs.
Referenced
by
GalaxyWars.Graphics.MeshRenderManager.Add(),
Wars.Shaders.ShaderEffect.SetParametersOptimized().
6.10.4.11
and
Galaxy-
and
Galaxy-
Texture GalaxyWars.Graphics.Material.normalTexture = null
Normal texture in case we use normal mapping. Can be null for unused.
Definition at line 61 of file Material.cs.
Referenced
by
GalaxyWars.Graphics.MeshRenderManager.Add(),
Wars.Shaders.ShaderEffect.SetParametersOptimized().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.10 GalaxyWars.Graphics.Material Class Reference
6.10.4.12
Texture GalaxyWars.Graphics.Material.heightTexture = null
Height texture in case we use parallax mapping. Can be null for unused.
Definition at line 65 of file Material.cs.
6.10.4.13
Texture GalaxyWars.Graphics.Material.detailTexture = null
Detail texture, used for landscape rendering. Can be null for unused.
Definition at line 69 of file Material.cs.
6.10.4.14
float GalaxyWars.Graphics.Material.parallaxAmount = DefaultParallaxAmount
Parallax amount for parallax and offset shaders.
Definition at line 73 of file Material.cs.
6.10.5
Property Documentation
6.10.5.1
bool GalaxyWars.Graphics.Material.HasAlpha [get]
Checks if the diffuse texture has alpha.
Definition at line 81 of file Material.cs.
The documentation for this class was generated from the following file:
• Material.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
113
114
Class Documentation
6.11
GalaxyWars.Graphics.Model Class Reference
Model class for loading and displaying x files including all materials and textures. Provides load and
render functions to render static non animated models (mostly 1 mesh), for animated models we need a
more advanced class, which is not required for this game yet.
Collaboration diagram for GalaxyWars.Graphics.Model:
XnaModel
xnaModel
GalaxyWars.Graphics.Model
Public Member Functions
• Model (string setModelName)
Create model.
• void Dispose ()
Dispose.
• void Render (Matrix renderMatrix)
Render.
• void Render (Vector3 renderPos)
Render.
• void GetVertexBuffer (out VertexPositionColor[ ] vertices)
• void GetIndexBuffer (out short[ ] indices)
Protected Member Functions
• virtual void Dispose (bool disposing)
Dispose.
Properties
• Matrix ObjectMatrix [get]
• string Name [get]
Name for this model, this is the content name.
• float Size [get]
Size.
• int NumOfMeshParts [get]
Number of mesh parts.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.11 GalaxyWars.Graphics.Model Class Reference
115
• static int MaxViewDistance [get, set]
Maximum view distance.
• IEnumerable< Vector3 > Positions [get]
Provides positions of all vertices in the vertex buffer.
Private Attributes
• string name = ""
Name of this model, also used to load it from the content system.
• XnaModel xnaModel = null
Underlying xna model object. Loaded with the content system.
• Matrix[ ] transforms = null
Transform matrices for this model, used in all Render methods, build once in the constructor, it never
changes and none of our models are animated.
• float realScaling = 1.0f
Scaling for this object, used for distance comparisons.
• float scaling = 1.0f
• bool hasAlpha = false
Does this model has alpha textures? Then render with alpha blending turned on. This is usually false and
rendering is faster without alpha blending. Also used to skip shadow receiving, which looks strange on
palms.
• bool isShip = false
Is this the ship model? Set in constructor and used in the render methods, this way we can compare much
faster when rendering!
• ModelMesh animatedMesh = null
If we want to animated some mesh in the model, just set the modelmesh here. Used for the windmill, which
is rotated in Render!
• List< EffectParameter > cachedEffectParameters = new List<EffectParameter>()
Cached effect parameters to improve performance. For around 100 000 objects we save 1 second per effect
parameters call. We only save the world matrix, worldViewProj matrix, viewInverse matrix and the lightDir
vector effect parameters. Update: We also save diffuseTexture, ambientColor and diffuseColor now.
• List< bool > cachedIsReflectionSpecularTechnique = new List<bool>()
Another helper to check if the effect technique is "ReflectionSpecular". Checking this each frame takes a lot
of time, this helper does the check only once in the constuctor. Used in RenderCar!
• Dictionary< ModelMeshPart, MeshRenderManager.RenderableMesh > renderableMeshes
Renderable meshes dictionary. Used to render every RenderableMesh in our render method.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
116
Class Documentation
Static Private Attributes
• static readonly Matrix objectMatrix
Default object matrix to fix models from 3ds max to our engine!
• static int maxViewDistance = 200
Default view distance optimizer is at 250m, then skip stuff. This will be reduced as our framerate runs low
to improve performance on low end systems.
6.11.1
Detailed Description
Model class for loading and displaying x files including all materials and textures. Provides load and
render functions to render static non animated models (mostly 1 mesh), for animated models we need a
more advanced class, which is not required for this game yet.
Definition at line 20 of file Model.cs.
6.11.2
Constructor & Destructor Documentation
6.11.2.1
GalaxyWars.Graphics.Model.Model (string setModelName)
Create model.
Parameters:
setModelName Set model name
Definition at line 157 of file Model.cs.
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{
name = setModelName;
xnaModel = BaseGame.Content.Load<XnaModel>(@"Content\models\" + name);
// Get matrix transformations of the model
// Has to be done only once because we don’t use animations in our game.
if (xnaModel != null)
{
transforms = new Matrix[xnaModel.Bones.Count];
xnaModel.CopyAbsoluteBoneTransformsTo(transforms);
// Calculate scaling for this object, used for distance comparisons.
if (xnaModel.Meshes.Count > 0)
realScaling = scaling = xnaModel.Meshes[0].BoundingSphere.Radius * transforms[0].R
}
hasAlpha = name.ToLower().StartsWith("alpha");
isShip = (name.ToLower() == "spaceship");
// Go through all meshes in the model
for (int meshNum = 0; meshNum < xnaModel.Meshes.Count; meshNum++)
{
ModelMesh mesh = xnaModel.Meshes[meshNum];
int meshPartNum = 0;
string meshName = mesh.Name;
// And for each effect this mesh uses (usually just 1, multimaterials
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.11 GalaxyWars.Graphics.Model Class Reference
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252 #if DEBUG
117
// are nice in 3ds max, but not efficiently for rendering stuff).
for (int effectNum = 0; effectNum < mesh.Effects.Count; effectNum++)
{
Effect effect = mesh.Effects[effectNum];
// Store our 4 effect parameters
cachedEffectParameters.Add(effect.Parameters["diffuseTexture"]);
cachedEffectParameters.Add(effect.Parameters["ambientColor"]);
cachedEffectParameters.Add(effect.Parameters["diffuseColor"]);
cachedEffectParameters.Add(effect.Parameters["world"]);
cachedEffectParameters.Add(effect.Parameters["viewProj"]);
cachedEffectParameters.Add(effect.Parameters["viewInverse"]);
cachedEffectParameters.Add(effect.Parameters["lightDir"]);
// Store if this is a "ReflectionSpecular" technique
cachedIsReflectionSpecularTechnique.Add(
effect.CurrentTechnique.Name.Contains("ReflectionSpecular"));
// Car only uses alpha on the glass
if (isShip && !mesh.Name.StartsWith("glass") && effect.Parameters["UseAlpha"] != n
effect.Parameters["UseAlpha"].SetValue(false);
// Get technique from meshName
int techniqueIndex = -1;
if (meshName.Length > meshPartNum)
{
string techniqueNumberString = meshName.Substring(
meshName.Length - (1 + meshPartNum), 1);
// Faster and does not throw an exception!
int.TryParse(techniqueNumberString, out techniqueIndex);
}
// No technique found or invalid?
if (techniqueIndex < 0 ||
techniqueIndex >= effect.Techniques.Count)
{
// Try to use last technique
techniqueIndex = effect.Techniques.Count - 1;
// If this is NormalMapping, use DiffuseSpecular20 instead
// of the last technique (which is SpecularWithReflection20)
if (effect.Techniques[techniqueIndex].Name.Contains("SpecularWithReflection"))
techniqueIndex -= 2;
// Update: We have now 2 more techniques (ReflectionSpecular)
if (effect.Techniques[techniqueIndex].Name.Contains("ReflectionSpecular"))
techniqueIndex -= 4;
}
// Set current technique for rendering below
if (techniqueIndex >= 0)
effect.CurrentTechnique = effect.Techniques[techniqueIndex];
// Next mesh part
meshPartNum++;
}
// Add all mesh parts!
for (int partNum = 0; partNum < mesh.MeshParts.Count; partNum++)
{
ModelMeshPart part = mesh.MeshParts[partNum];
// The model mesh part is not really used, we just extract the
// index and vertex buffers and all the render data.
// Material settings are build from the effect settings.
// Also add this to our own dictionary for rendering.
renderableMeshes.Add(part, BaseGame.MeshRenderManager.Add(
mesh.VertexBuffer, mesh.IndexBuffer, part, part.Effect));
}
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
118
Class Documentation
253
254
255
256 #endif
257
// Check if there are no meshes to render
if (xnaModel.Meshes.Count == 0)
throw new ArgumentException("Invalid model " + name + ". It does not contain any meshe
}
6.11.3
Member Function Documentation
6.11.3.1
void GalaxyWars.Graphics.Model.Dispose ()
Dispose.
Definition at line 266 of file Model.cs.
267
268
269
270
{
Dispose(true);
GC.SuppressFinalize(this);
}
6.11.3.2
virtual void GalaxyWars.Graphics.Model.Dispose (bool disposing) [protected,
virtual]
Dispose.
Parameters:
disposing Disposing
Definition at line 276 of file Model.cs.
277
278
279
280
281
282
283
284
285
286
{
if (disposing)
{
// Just set everything to null so we stop using this!
name = "";
xnaModel = null;
transforms = null;
animatedMesh = null;
}
}
6.11.3.3
void GalaxyWars.Graphics.Model.Render (Matrix renderMatrix)
Render.
Parameters:
renderMatrix Render matrix
Definition at line 322 of file Model.cs.
323
324
325
326
{
// Optimization to skip smaller objects, which are very far away!
// Display 1 meter big objects only if in a distance of 250 meters!
// Scaling is guessed by the length of the first vector in our matrix,
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.11 GalaxyWars.Graphics.Model Class Reference
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
119
// because we always use the same scaling for x, y, z this should be
// correct!
float maxDistance = maxViewDistance * scaling;
float distanceSquared = Vector3.DistanceSquared(BaseGame.CameraPos, renderMatrix.Translati
if (distanceSquared > maxDistance * maxDistance)
// Don’t render, too far away!
return;
//
//
//
if
{
Check out if object is behind us or not visible, then we can skip
rendering. This is the GREATEST performance gain in the whole game!
Object must be away at least 20 units!
(distanceSquared > 20 * 20 && distanceSquared > (10 * scaling) * (10 * scaling))
Vector3 objectDirection =
Vector3.Normalize(BaseGame.CameraPos - renderMatrix.Translation);
// Half field of view should be fov / 2, but because of
// the aspect ratio (1.33) and an additional offset we need
// to include to see objects at the borders.
float objAngle = Vector3Helper.GetAngleBetweenVectors(BaseGame.CameraRotation, objectD
if (objAngle > BaseGame.ViewableFieldOfView)
return;
}
// Multiply object matrix by render matrix, result is used multiple
// times here.
renderMatrix = objectMatrix * renderMatrix;
// Go through all meshes in the model
for (int meshNum = 0; meshNum < xnaModel.Meshes.Count; meshNum++)
{
ModelMesh mesh = xnaModel.Meshes[meshNum];
// Assign world matrix
Matrix worldMatrix = transforms[mesh.ParentBone.Index] * renderMatrix;
// Just add this world matrix to our render matrices for each part.
for (int partNum = 0; partNum < mesh.MeshParts.Count; partNum++)
{
// Find mesh part in the renderableMeshes dictionary and add the
// new render matrix to be picked up in the mesh rendering later.
renderableMeshes[mesh.MeshParts[partNum]].renderMatrices.Add(worldMatrix);
}
}
}
6.11.3.4
void GalaxyWars.Graphics.Model.Render (Vector3 renderPos)
Render.
Parameters:
renderPos Render position
Definition at line 376 of file Model.cs.
377
378
379
6.11.3.5
{
Render(Matrix.CreateTranslation(renderPos));
}
void GalaxyWars.Graphics.Model.GetVertexBuffer (out VertexPositionColor[ ] vertices)
Definition at line 408 of file Model.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
120
Class Documentation
409
410
411
412
413
414
415
6.11.3.6
{
VertexBuffer vb = xnaModel.Meshes[0].VertexBuffer;
int count = xnaModel.Meshes[0].MeshParts[0].NumVertices;
vertices = new VertexPositionColor[count];
vb.GetData<VertexPositionColor>(vertices, 0, count);
}
void GalaxyWars.Graphics.Model.GetIndexBuffer (out short[ ] indices)
Definition at line 417 of file Model.cs.
418
419
420
421
422
423
424
{
IndexBuffer ib = xnaModel.Meshes[0].IndexBuffer;
int count = xnaModel.Meshes[0].IndexBuffer.SizeInBytes / sizeof(short);
indices = new short[count];
ib.GetData<short>(indices, 0, count);
}
6.11.4
Member Data Documentation
6.11.4.1
string GalaxyWars.Graphics.Model.name = "" [private]
Name of this model, also used to load it from the content system.
Definition at line 27 of file Model.cs.
6.11.4.2
XnaModel GalaxyWars.Graphics.Model.xnaModel = null [private]
Underlying xna model object. Loaded with the content system.
Definition at line 32 of file Model.cs.
6.11.4.3
readonly Matrix GalaxyWars.Graphics.Model.objectMatrix [static, private]
Initial value:
Matrix.CreateRotationX((float)(-1.5 * Math.PI)) * Matrix.CreateScale(0.0125f)
Default object matrix to fix models from 3ds max to our engine!
Definition at line 37 of file Model.cs.
6.11.4.4
Matrix [ ] GalaxyWars.Graphics.Model.transforms = null [private]
Transform matrices for this model, used in all Render methods, build once in the constructor, it never
changes and none of our models are animated.
Definition at line 45 of file Model.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.11 GalaxyWars.Graphics.Model Class Reference
6.11.4.5
121
float GalaxyWars.Graphics.Model.realScaling = 1.0f [private]
Scaling for this object, used for distance comparisons.
Definition at line 50 of file Model.cs.
6.11.4.6
float GalaxyWars.Graphics.Model.scaling = 1.0f [private]
Definition at line 50 of file Model.cs.
6.11.4.7
bool GalaxyWars.Graphics.Model.hasAlpha = false [private]
Does this model has alpha textures? Then render with alpha blending turned on. This is usually false and
rendering is faster without alpha blending. Also used to skip shadow receiving, which looks strange on
palms.
Definition at line 58 of file Model.cs.
6.11.4.8
bool GalaxyWars.Graphics.Model.isShip = false [private]
Is this the ship model? Set in constructor and used in the render methods, this way we can compare much
faster when rendering!
Definition at line 64 of file Model.cs.
6.11.4.9
ModelMesh GalaxyWars.Graphics.Model.animatedMesh = null [private]
If we want to animated some mesh in the model, just set the modelmesh here. Used for the windmill, which
is rotated in Render!
Definition at line 71 of file Model.cs.
6.11.4.10
List<EffectParameter> GalaxyWars.Graphics.Model.cachedEffectParameters = new
List<EffectParameter>() [private]
Cached effect parameters to improve performance. For around 100 000 objects we save 1 second per effect
parameters call. We only save the world matrix, worldViewProj matrix, viewInverse matrix and the lightDir
vector effect parameters. Update: We also save diffuseTexture, ambientColor and diffuseColor now.
Definition at line 80 of file Model.cs.
6.11.4.11
List<bool> GalaxyWars.Graphics.Model.cachedIsReflectionSpecularTechnique = new
List<bool>() [private]
Another helper to check if the effect technique is "ReflectionSpecular". Checking this each frame takes a
lot of time, this helper does the check only once in the constuctor. Used in RenderCar!
Definition at line 88 of file Model.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
122
Class Documentation
6.11.4.12
Dictionary<ModelMeshPart, MeshRenderManager.RenderableMesh>
GalaxyWars.Graphics.Model.renderableMeshes [private]
Initial value:
new Dictionary<ModelMeshPart, MeshRenderManager.RenderableMesh>()
Renderable meshes dictionary. Used to render every RenderableMesh in our render method.
Definition at line 95 of file Model.cs.
6.11.4.13
int GalaxyWars.Graphics.Model.maxViewDistance = 200 [static, private]
Default view distance optimizer is at 250m, then skip stuff. This will be reduced as our framerate runs low
to improve performance on low end systems.
Definition at line 297 of file Model.cs.
6.11.5
Property Documentation
6.11.5.1
Matrix GalaxyWars.Graphics.Model.ObjectMatrix [get]
Definition at line 103 of file Model.cs.
6.11.5.2
string GalaxyWars.Graphics.Model.Name [get]
Name for this model, this is the content name.
Returns:
String
Definition at line 115 of file Model.cs.
6.11.5.3
float GalaxyWars.Graphics.Model.Size [get]
Size.
Returns:
Float
Definition at line 127 of file Model.cs.
6.11.5.4
int GalaxyWars.Graphics.Model.NumOfMeshParts [get]
Number of mesh parts.
Returns:
Int
Definition at line 139 of file Model.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.11 GalaxyWars.Graphics.Model Class Reference
6.11.5.5
int GalaxyWars.Graphics.Model.MaxViewDistance [static, get, set]
Maximum view distance.
Returns:
Int
Definition at line 304 of file Model.cs.
6.11.5.6
IEnumerable<Vector3> GalaxyWars.Graphics.Model.Positions [get]
Provides positions of all vertices in the vertex buffer.
Definition at line 387 of file Model.cs.
The documentation for this class was generated from the following file:
• Model.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
123
124
Class Documentation
6.12
GalaxyWars.Graphics.Texture Class Reference
Texture class helping you with using DirectX Textures and handling possible errors that can happen while
loading (stupid DirectX error messages telling you absolutly nothing, so a lot of pre-checks help you
determinate the error before even calling DirectX methods).
Inheritance diagram for GalaxyWars.Graphics.Texture:
GalaxyWars.Graphics.Texture
GalaxyWars.Shaders.RenderToTexture
Collaboration diagram for GalaxyWars.Graphics.Texture:
Texture2D
internalXnaTexture
GalaxyWars.Graphics.Texture
Public Member Functions
• Texture (string setFilename)
Create texture from given filename.
• Texture (Texture2D tex)
Create texture by just assigning a Texture2D.
• void Dispose ()
Dispose.
• void RenderOnScreen (Rectangle rect, Rectangle pixelRect)
Render texture at rect directly on screen using pixelRect.
• void RenderOnScreen (Rectangle rect, int pixelX, int pixelY, int pixelWidth, int pixelHeight)
Render on screen.
• void RenderOnScreen (Point pos)
Render on screen.
• void RenderOnScreen (Rectangle renderRect)
Render on screen.
• void RenderOnScreenRelative16To9 (int relX, int relY, Rectangle pixelRect)
Render on screen relative for 1024x640 (16:9) graphics.
• void RenderOnScreenRelative4To3 (int relX, int relY, Rectangle pixelRect)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.12 GalaxyWars.Graphics.Texture Class Reference
125
Render on screen relative 1024x786 (4:3).
• void RenderOnScreenRelative1600 (int relX, int relY, Rectangle pixelRect)
Render on screen relative for 1600px width graphics.
• void RenderOnScreen (Rectangle rect, Rectangle pixelRect, Color color)
Render texture at rect directly on screen using texture cordinates. This method allows to render with specific
color and alpha values.
• void RenderOnScreen (Rectangle rect, Rectangle pixelRect, Color color, SpriteBlendMode blendMode)
Render on screen.
• void RenderOnScreenWithRotation (Rectangle rect, Rectangle pixelRect, float rotation, Vector2 rotationPoint)
Render on screen with rotation.
• override string ToString ()
To string.
Static Public Attributes
• static SpriteBatch AlphaSprite
• static SpriteBatch AdditiveSprite
Protected Member Functions
• void CalcHalfPixelSize ()
Calc half pixel size.
• Texture ()
Create texture, protected version for derived classes.
• virtual void Dispose (bool disposing)
Dispose.
Protected Attributes
• string texFilename = ""
Texture filename.
• int texWidth
Size of texture.
• int texHeight
• Texture2D internalXnaTexture
XNA Framework Graphic Texture.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
126
Class Documentation
• bool loaded = true
Loading succeeded?
• string error = ""
Error?
• bool hasAlpha = false
Has alpha?
Properties
• string Filename [get]
Get filename of texture.
• int Width [get]
Width of texture.
• int Height [get]
Height of texture.
• Rectangle GfxRectangle [get]
Gfx rectangle.
• Vector2 HalfPixelSize [get]
Get the size of half a pixel, used to correct texture coordinates when rendering on screen, see Texture.RenderOnScreen.
• virtual Texture2D XnaTexture [get]
XNA Framework texture.
• virtual bool Valid [get]
Is texture valid? Will be false if loading failed.
• bool HasAlphaPixels [get]
Has texture alpha information?
Private Attributes
• Vector2 precaledHalfPixelSize = Vector2.Zero
Size of half a pixel, will be calculated when size is set.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.12 GalaxyWars.Graphics.Texture Class Reference
6.12.1
127
Detailed Description
Texture class helping you with using DirectX Textures and handling possible errors that can happen while
loading (stupid DirectX error messages telling you absolutly nothing, so a lot of pre-checks help you
determinate the error before even calling DirectX methods).
Definition at line 19 of file Texture.cs.
6.12.2
Constructor & Destructor Documentation
6.12.2.1
GalaxyWars.Graphics.Texture.Texture (string setFilename)
Create texture from given filename.
Parameters:
setFilename Set filename, must be relative and be a valid file in the textures directory.
Definition at line 166 of file Texture.cs.
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
6.12.2.2
{
if (AlphaSprite == null)
AlphaSprite = new SpriteBatch(BaseGame.Device);
if (AdditiveSprite == null)
AdditiveSprite = new SpriteBatch(BaseGame.Device);
if (String.IsNullOrEmpty(setFilename))
throw new ArgumentNullException("setFilename",
"Unable to create texture without valid filename.");
// Set content name (cut off extension!)
texFilename = Path.GetFileNameWithoutExtension(setFilename);
string fullFilename =
Path.Combine(Directories.ContentDirectory + "\\textures", texFilename);
// Try loading as 2d texture
internalXnaTexture = BaseGame.Content.Load<Texture2D>(fullFilename);
// Get info from the texture directly.
texWidth = internalXnaTexture.Width;
texHeight = internalXnaTexture.Height;
// We will use alpha for Dxt3 and Dxt5 textures.
hasAlpha = (internalXnaTexture.Format == SurfaceFormat.Dxt5 ||
internalXnaTexture.Format == SurfaceFormat.Dxt3);
loaded = true;
CalcHalfPixelSize();
}
GalaxyWars.Graphics.Texture.Texture () [protected]
Create texture, protected version for derived classes.
Definition at line 202 of file Texture.cs.
203
204
{
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
128
Class Documentation
6.12.2.3
GalaxyWars.Graphics.Texture.Texture (Texture2D tex)
Create texture by just assigning a Texture2D.
Parameters:
tex Tex
Definition at line 210 of file Texture.cs.
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
{
if (AlphaSprite == null)
AlphaSprite = new SpriteBatch(BaseGame.Device);
if (AdditiveSprite == null)
AdditiveSprite = new SpriteBatch(BaseGame.Device);
if (tex == null)
throw new ArgumentNullException("tex");
internalXnaTexture = tex;
// Get info from the texture directly.
texWidth = internalXnaTexture.Width;
texHeight = internalXnaTexture.Height;
loaded = true;
// We will use alpha for Dxt3 and Dxt5 textures
hasAlpha = (internalXnaTexture.Format == SurfaceFormat.Dxt5 ||
internalXnaTexture.Format == SurfaceFormat.Dxt3);
CalcHalfPixelSize();
}
6.12.3
Member Function Documentation
6.12.3.1
void GalaxyWars.Graphics.Texture.CalcHalfPixelSize () [protected]
Calc half pixel size.
Definition at line 100 of file Texture.cs.
101
102
103
104
105
6.12.3.2
{
precaledHalfPixelSize = new Vector2(
(1.0f / (float)texWidth) / 2.0f,
(1.0f / (float)texHeight) / 2.0f);
}
void GalaxyWars.Graphics.Texture.Dispose ()
Dispose.
Definition at line 241 of file Texture.cs.
242
243
244
245
{
Dispose(true);
GC.SuppressFinalize(this);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.12 GalaxyWars.Graphics.Texture Class Reference
6.12.3.3
virtual void GalaxyWars.Graphics.Texture.Dispose (bool disposing) [protected,
virtual]
Dispose.
Parameters:
disposing Disposing
Definition at line 251 of file Texture.cs.
252
253
254
255
256
257
258
259
260
261
{
if (disposing)
{
if (internalXnaTexture != null)
internalXnaTexture.Dispose();
internalXnaTexture = null;
}
loaded = false;
}
6.12.3.4
void GalaxyWars.Graphics.Texture.RenderOnScreen (Rectangle rect, Rectangle
pixelRect)
Render texture at rect directly on screen using pixelRect.
Parameters:
rect Rectangle
pixelRect Pixel rectangle
Definition at line 270 of file Texture.cs.
271
272
273
274
{
AlphaSprite.Draw(internalXnaTexture, rect, pixelRect, Color.White);
//SpriteHelper.AddSpriteToRender(this, rect, pixelRect);
}
6.12.3.5
void GalaxyWars.Graphics.Texture.RenderOnScreen (Rectangle rect, int pixelX, int
pixelY, int pixelWidth, int pixelHeight)
Render on screen.
Parameters:
rect Rectangle
pixelX Pixel x
pixelY Pixel y
pixelWidth Pixel width
pixelHeight Pixel height
Definition at line 284 of file Texture.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
129
130
Class Documentation
286
287
288
289
{
AlphaSprite.Draw(internalXnaTexture, rect, new Rectangle(pixelX, pixelY,
pixelWidth, pixelHeight), Color.White);
}
6.12.3.6
void GalaxyWars.Graphics.Texture.RenderOnScreen (Point pos)
Render on screen.
Parameters:
pos Position
Definition at line 295 of file Texture.cs.
296
297
298
299
300
{
AlphaSprite.Draw(internalXnaTexture,
new Rectangle(pos.X, pos.Y, texWidth, texHeight),
new Rectangle(0, 0, texWidth, texHeight), Color.White);
}
6.12.3.7
void GalaxyWars.Graphics.Texture.RenderOnScreen (Rectangle renderRect)
Render on screen.
Parameters:
renderRect Render rectangle
Definition at line 306 of file Texture.cs.
307
308
309
310
311
{
AlphaSprite.Draw(internalXnaTexture, renderRect, GfxRectangle, Color.White);
//SpriteHelper.AddSpriteToRender(this,
//
renderRect, GfxRectangle);
}
6.12.3.8
void GalaxyWars.Graphics.Texture.RenderOnScreenRelative16To9 (int relX, int relY,
Rectangle pixelRect)
Render on screen relative for 1024x640 (16:9) graphics.
Parameters:
relX Rel x
relY Rel y
pixelRect Pixel rectangle
Definition at line 319 of file Texture.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.12 GalaxyWars.Graphics.Texture Class Reference
321
322
323
324
325
326
327
328
329
330
131
{
AlphaSprite.Draw(internalXnaTexture, BaseGame.CalcRectangle(
relX, relY, pixelRect.Width, pixelRect.Height),
pixelRect, Color.White);
//SpriteHelper.AddSpriteToRender(this,
//
BaseGame.CalcRectangle(
//
relX, relY, pixelRect.Width, pixelRect.Height),
//
pixelRect);
}
6.12.3.9
void GalaxyWars.Graphics.Texture.RenderOnScreenRelative4To3 (int relX, int relY,
Rectangle pixelRect)
Render on screen relative 1024x786 (4:3).
Parameters:
relX Rel x
relY Rel y
pixelRect Pixel rectangle
Definition at line 338 of file Texture.cs.
340
341
342
343
344
345
346
347
348
349
{
AlphaSprite.Draw(internalXnaTexture, BaseGame.CalcRectangleKeep4To3(
relX, relY, pixelRect.Width, pixelRect.Height),
pixelRect, Color.White);
//SpriteHelper.AddSpriteToRender(this,
//
BaseGame.CalcRectangleKeep4To3(
//
relX, relY, pixelRect.Width, pixelRect.Height),
//
pixelRect);
}
6.12.3.10
void GalaxyWars.Graphics.Texture.RenderOnScreenRelative1600 (int relX, int relY,
Rectangle pixelRect)
Render on screen relative for 1600px width graphics.
Parameters:
relX Rel x
relY Rel y
pixelRect Pixel rectangle
Definition at line 357 of file Texture.cs.
359
360
361
362
363
364
365
366
367
368
{
AlphaSprite.Draw(internalXnaTexture, BaseGame.CalcRectangle1600(
relX, relY, pixelRect.Width, pixelRect.Height),
pixelRect, Color.White);
//SpriteHelper.AddSpriteToRender(this,
//
BaseGame.CalcRectangle1600(
//
relX, relY, pixelRect.Width, pixelRect.Height),
//
pixelRect);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
132
Class Documentation
6.12.3.11
void GalaxyWars.Graphics.Texture.RenderOnScreen (Rectangle rect, Rectangle
pixelRect, Color color)
Render texture at rect directly on screen using texture cordinates. This method allows to render with
specific color and alpha values.
Parameters:
rect Rectangle
pixelRect Pixel rectangle
color Color
Definition at line 377 of file Texture.cs.
379
380
381
382
{
AlphaSprite.Draw(internalXnaTexture, rect, pixelRect, color);
//SpriteHelper.AddSpriteToRender(this, rect, pixelRect, color);
}
6.12.3.12
void GalaxyWars.Graphics.Texture.RenderOnScreen (Rectangle rect, Rectangle
pixelRect, Color color, SpriteBlendMode blendMode)
Render on screen.
Parameters:
rect Rectangle
pixelRect Pixel rectangle
color Color
blendMode Blend mode
Definition at line 391 of file Texture.cs.
393
394
395
396
397
398
399
{
if (blendMode == SpriteBlendMode.Additive)
AdditiveSprite.Draw(internalXnaTexture, rect, pixelRect, color);
else
AlphaSprite.Draw(internalXnaTexture, rect, pixelRect, color);
//SpriteHelper.AddSpriteToRender(this, rect, pixelRect, color, blendMode);
}
6.12.3.13
void GalaxyWars.Graphics.Texture.RenderOnScreenWithRotation (Rectangle rect,
Rectangle pixelRect, float rotation, Vector2 rotationPoint)
Render on screen with rotation.
Parameters:
pos Position
pixelRect Pixel rectangle
rotation Rotation
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.12 GalaxyWars.Graphics.Texture Class Reference
133
Definition at line 409 of file Texture.cs.
412
413
414
415
6.12.3.14
{
AlphaSprite.Draw(internalXnaTexture, rect, pixelRect, Color.White, rotation,
rotationPoint, SpriteEffects.None, 0);
}
override string GalaxyWars.Graphics.Texture.ToString ()
To string.
Definition at line 422 of file Texture.cs.
423
424
425
426
427
428
{
return
",
",
",
"Texture(filename=" + texFilename +
width=" + texWidth +
height=" + texHeight +
xnaTexture=" + (internalXnaTexture != null ? "valid" : "null") + ")";
}
6.12.4
Member Data Documentation
6.12.4.1
SpriteBatch GalaxyWars.Graphics.Texture.AlphaSprite [static]
Definition at line 22 of file Texture.cs.
6.12.4.2
SpriteBatch GalaxyWars.Graphics.Texture.AdditiveSprite [static]
Definition at line 23 of file Texture.cs.
6.12.4.3
string GalaxyWars.Graphics.Texture.texFilename = "" [protected]
Texture filename.
Definition at line 28 of file Texture.cs.
6.12.4.4
int GalaxyWars.Graphics.Texture.texWidth [protected]
Size of texture.
Definition at line 44 of file Texture.cs.
6.12.4.5
int GalaxyWars.Graphics.Texture.texHeight [protected]
Definition at line 44 of file Texture.cs.
6.12.4.6
Vector2 GalaxyWars.Graphics.Texture.precaledHalfPixelSize = Vector2.Zero
[private]
Size of half a pixel, will be calculated when size is set.
Definition at line 83 of file Texture.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
134
Class Documentation
6.12.4.7
Texture2D GalaxyWars.Graphics.Texture.internalXnaTexture [protected]
XNA Framework Graphic Texture.
Definition at line 110 of file Texture.cs.
6.12.4.8
bool GalaxyWars.Graphics.Texture.loaded = true [protected]
Loading succeeded?
Definition at line 126 of file Texture.cs.
6.12.4.9
string GalaxyWars.Graphics.Texture.error = "" [protected]
Error?
Definition at line 131 of file Texture.cs.
6.12.4.10
bool GalaxyWars.Graphics.Texture.hasAlpha = false [protected]
Has alpha?
Definition at line 147 of file Texture.cs.
6.12.5
Property Documentation
6.12.5.1
string GalaxyWars.Graphics.Texture.Filename [get]
Get filename of texture.
Definition at line 34 of file Texture.cs.
6.12.5.2
int GalaxyWars.Graphics.Texture.Width [get]
Width of texture.
Definition at line 50 of file Texture.cs.
6.12.5.3
int GalaxyWars.Graphics.Texture.Height [get]
Height of texture.
Definition at line 61 of file Texture.cs.
6.12.5.4
Rectangle GalaxyWars.Graphics.Texture.GfxRectangle [get]
Gfx rectangle.
Returns:
Rectangle
Definition at line 73 of file Texture.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.12 GalaxyWars.Graphics.Texture Class Reference
6.12.5.5
135
Vector2 GalaxyWars.Graphics.Texture.HalfPixelSize [get]
Get the size of half a pixel, used to correct texture coordinates when rendering on screen, see Texture.RenderOnScreen.
Definition at line 90 of file Texture.cs.
6.12.5.6
virtual Texture2D GalaxyWars.Graphics.Texture.XnaTexture [get]
XNA Framework texture.
Reimplemented in GalaxyWars.Shaders.RenderToTexture.
Definition at line 116 of file Texture.cs.
Referenced by GalaxyWars.Shaders.ShaderEffect.SetParametersOptimized().
6.12.5.7
virtual bool GalaxyWars.Graphics.Texture.Valid [get]
Is texture valid? Will be false if loading failed.
Definition at line 137 of file Texture.cs.
6.12.5.8
bool GalaxyWars.Graphics.Texture.HasAlphaPixels [get]
Has texture alpha information?
Definition at line 152 of file Texture.cs.
The documentation for this class was generated from the following file:
• Texture.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
136
Class Documentation
6.13
GalaxyWars.GalaxyWarsManager Class Reference
Manager class of the game. Handles all game screens, which themself handle all the game logic.
Inheritance diagram for GalaxyWars.GalaxyWarsManager:
GalaxyWars.Graphics.BaseGame
GalaxyWars.GalaxyWarsManager
Collaboration diagram for GalaxyWars.GalaxyWarsManager:
shipTextures
fontTexture
font
GalaxyWars.Graphics.TextureFont
flareTextures
Texture2D
internalXnaTexture
headers
buttons
ingame
background
optionsScreen
helpScreen
trophies
mouseCursor
GalaxyWars.Graphics.Texture
GalaxyWars.Graphics.LensFlare.FlareData
lensFlare
flareTypes
GalaxyWars.Graphics.LensFlare
lensFlare
color
noiseMapTexture
radialSceneMapTexture
blurMap1Texture
blurMap2Texture
sceneMapTexture
downsampleMapTexture
GalaxyWars.Shaders.RenderToTexture
XnaTexture
lastUsedHeightTexture
lastUsedNormalTexture
lastUsedDiffuseTexture
lastUsedDetailTexture
lastUsedAmbientColor
lastUsedSpecularColor
lastUsedDiffuseColor
lastUsedCarHueColorChange
lighting
normalMapping
landscapeNormalMapping
lineRendering
GalaxyWars.Shaders.PostScreenGlow
postScreenGameShader
GalaxyWars.Graphics.UIRenderer
postScreenMenuShader
GalaxyWars.Shaders.PostScreenMenu
skyCube
screenBorderFadeoutMapTexture
ui
GalaxyWars.Shaders.ShaderEffect
GalaxyWars.Graphics.MeshRenderManager
GalaxyWars.Shaders.PreScreenSkyCubeMapping
meshRenderManager
DefaultSkyColor
GalaxyWars.Graphics.LineManager2D
randomCarColor
lineManager2D
cube
lineManager3D
Color
GalaxyWars.Graphics.BaseGame
GalaxyWars.Graphics.LineManager3D
BackgroundColor
MaxColor
MinColor
shipModel
GalaxyWars.Particles.ParticleSettings
Random
GalaxyWars.Particles.ParticleVertex
settings
particles
xnaModel
XnaModel
GalaxyWars.Graphics.Model
asteroidModels
GalaxyWars.Scenes.Asteroids
asteroids
GalaxyWars.GalaxyWarsManager
particleSystem
GalaxyWars.Particles.ParticleSystem
GalaxyWars.Particles.FireParticleSystem
player
GalaxyWars.GameLogic.BasePlayer
GalaxyWars.GameLogic.SpaceshipPhysics
GalaxyWars.GameLogic.ChaseCamera
GalaxyWars.GameLogic.Player
primitivesRenderer
GalaxyWars.Graphics.PrimitivesRenderer
trippSystem
TrippSystem
Public Member Functions
• GalaxyWarsManager ()
Creates the game, prepares all necessary screens.
• GalaxyWarsManager (string unitTestName)
Create the game for unit tests, not used for anything else.
Static Public Member Functions
• static void AddGameScreen (IGameScreen gameScreen)
Adds specified game screen to the stack.
Protected Member Functions
• override void Initialize ()
Load the spaceship stuff.
• override void Update (GameTime gameTime)
Updates the game.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.13 GalaxyWars.GalaxyWarsManager Class Reference
137
• override void Render ()
Renders the active screen.
• override void PostUIRender ()
Post user interface rendering, in case we need it.
Properties
• static PrimitivesRenderer PrimitivesRenderer [get]
• static bool MenuActive [get]
Checks if the menu is currently active.
• static bool GameActive [get]
Checks if the game is currently active.
• static bool ShowCursor [get]
Checks whether to show the mouse cursor.
• static Player Player [get]
Player for the game, also allows us to control the car and contains all the required code for the ship
physics, chase camera and basic player values and the game time because this is the top class of many
derived classes. Easy access here with a static property in case we need the player somewhere in the game.
• static Model SpaceshipModel [get]
Ship model.
• static Asteroids Asteroids [get]
Asteroids swarm.
• static TrippSystem.TrippSystem TrippSys [get]
• static LensFlare LensFlare [get]
Lens flare effect.
• static FireParticleSystem ParticleSystem [get]
Particle system.
Static Private Attributes
• static TrippSystem.TrippSystem trippSystem
• static PrimitivesRenderer primitivesRenderer
• static Stack< IGameScreen > gameScreens = new Stack<IGameScreen>()
Game screens stack. We can easily add and remove game screens and they follow the game logic automatically.
• static Player player = new Player(new Vector3(0, 0, 0))
Player for the game, also allows us to control the ship and contains all the required code for the ship
physics, chase camera and basic player values and the game time because this is the top class of many
derived classes. Player, ship and camera position is set when the game starts depending on the selected
level.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
138
Class Documentation
• static Model shipModel = null
Spaceship model.
• static Asteroids asteroids = null
Swarm of randomly positioned (with zero velocity) asteroids to fly through.
• static LensFlare lensFlare = null
Graphics elements to represent a light source with its lens flare effects.
• static FireParticleSystem particleSystem = null
Particles system for the flame effect of the spaceship jets.
• static Texture[ ] shipTextures = null
Ship textures we exchange for our ship model.
6.13.1
Detailed Description
Manager class of the game. Handles all game screens, which themself handle all the game logic.
Definition at line 32 of file GalaxyWarsManager.cs.
6.13.2
Constructor & Destructor Documentation
6.13.2.1
GalaxyWars.GalaxyWarsManager.GalaxyWarsManager ()
Creates the game, prepares all necessary screens.
Definition at line 202 of file GalaxyWarsManager.cs.
References GalaxyWars.GalaxyWarsManager.gameScreens.
202
203
204
205
206
207
208
209
210
211
212
6.13.2.2
: base("GalaxyWars")
{
Plane p = new Plane();
// Start playing the menu music
Music.PlayMusic(Music.MenuMusic);
// Create main menu at our main entry point
gameScreens.Push(new MainMenu());
// But start with splash screen, if user clicks or presses Start, we are back in the main
gameScreens.Push(new SplashScreen());
}
GalaxyWars.GalaxyWarsManager.GalaxyWarsManager (string unitTestName)
Create the game for unit tests, not used for anything else.
Definition at line 217 of file GalaxyWarsManager.cs.
217
218
219
220
: base(unitTestName)
{
// Don’t add game screens here
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.13 GalaxyWars.GalaxyWarsManager Class Reference
6.13.3
Member Function Documentation
6.13.3.1
override void GalaxyWars.GalaxyWarsManager.Initialize () [protected]
139
Load the spaceship stuff.
Reimplemented from GalaxyWars.Graphics.BaseGame.
Definition at line 225 of file GalaxyWarsManager.cs.
References GalaxyWars.Scenes.Asteroids.ActiveAsteroids, GalaxyWars.GalaxyWarsManager.Asteroids,
GalaxyWars.GalaxyWarsManager.asteroids,
GalaxyWars.GalaxyWarsManager.LensFlare,
GalaxyWars.GalaxyWarsManager.lensFlare,
GalaxyWars.GalaxyWarsManager.particleSystem,
GalaxyWars.GalaxyWarsManager.PrimitivesRenderer,
GalaxyWars.GalaxyWarsManager.primitivesRenderer,
GalaxyWars.GalaxyWarsManager.shipModel, and GalaxyWars.GalaxyWarsManager.trippSystem.
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
{
base.Initialize();
// Load model of the spaceship
shipModel = new Model("Spaceship");
// Prepare the primitives renderer
primitivesRenderer = new PrimitivesRenderer();
// Prepare the swarm of asteroids
asteroids = new Asteroids(new Vector3(0, 0, 0), new Vector3(1024, 1024, 1024));
// Prepare the lens flare effect (position of its light source)
lensFlare = new LensFlare(new Vector3(1024, 1024, 1024));
// Prepare the particle system for the jets
particleSystem = new FireParticleSystem(BaseGame.Content);
List<Obstacle> obstacles = new List<Obstacle>();
foreach (Asteroid a in asteroids.ActiveAsteroids)
obstacles.Add(a);
trippSystem = new TrippSystem.TrippSystem(obstacles);
}
6.13.3.2
static void GalaxyWars.GalaxyWarsManager.AddGameScreen (IGameScreen
gameScreen) [static]
Adds specified game screen to the stack.
Parameters:
gameScreen New game screen.
Definition at line 255 of file GalaxyWarsManager.cs.
References GalaxyWars.GalaxyWarsManager.gameScreens.
256
257
258
259
6.13.3.3
{
Sound.Play(Sound.Sounds.ScreenClick); // Play sound for screen click
gameScreens.Push(gameScreen); // Add the game screen
}
override void GalaxyWars.GalaxyWarsManager.Update (GameTime gameTime)
[protected]
Updates the game.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
140
Class Documentation
Reimplemented from GalaxyWars.Graphics.BaseGame.
Definition at line 268 of file GalaxyWarsManager.cs.
References GalaxyWars.GalaxyWarsManager.particleSystem, GalaxyWars.GalaxyWarsManager.player,
GalaxyWars.Particles.ParticleSystem.Update(), and GalaxyWars.GameLogic.Player.Update().
269
270
271
272
273
{
base.Update(gameTime); // Update game engine
player.Update(); // Update player and game logic
particleSystem.Update(gameTime); // Update the particles animation
}
Here is the call graph for this function:
GalaxyWars.Particles.ParticleSystem.Update
GalaxyWars.GalaxyWarsManager.Update
GalaxyWars.GameLogic.Player.Update
6.13.3.4
override void GalaxyWars.GalaxyWarsManager.Render () [protected, virtual]
Renders the active screen.
Reimplemented from GalaxyWars.Graphics.BaseGame.
Definition at line 282 of file GalaxyWarsManager.cs.
References GalaxyWars.GalaxyWarsManager.gameScreens.
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
6.13.3.5
{
if (gameScreens.Count == 0)
{
Music.StopMusic();
Exit();
return;
}
// Handle current screen
if (gameScreens.Peek().Render())
{
// If this was the options screen and the resolution has changed, apply the changes
if (gameScreens.Peek().GetType() == typeof(Options) &&
(BaseGame.Width != GameSettings.Default.ResolutionWidth ||
BaseGame.Height != GameSettings.Default.ResolutionHeight ||
BaseGame.Fullscreen != GameSettings.Default.Fullscreen))
{
BaseGame.ApplyResolutionChange();
}
// Play sound for screen back
Sound.Play(Sound.Sounds.ScreenBack);
gameScreens.Pop();
}
}
override void GalaxyWars.GalaxyWarsManager.PostUIRender () [protected,
virtual]
Post user interface rendering, in case we need it.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.13 GalaxyWars.GalaxyWarsManager Class Reference
141
Reimplemented from GalaxyWars.Graphics.BaseGame.
Definition at line 312 of file GalaxyWarsManager.cs.
References
GalaxyWars.Graphics.UIRenderer.PostScreenMenuShader,
Wars.Shaders.PostScreenMenu.Show(), and GalaxyWars.Graphics.BaseGame.UI.
313
314
315
316
317
318
319
320
Galaxy-
{
// Enable depth buffer again
BaseGame.Device.RenderState.DepthBufferEnable = true;
// Do menu shader after everything
if (GalaxyWarsManager.MenuActive && PostScreenMenu.Started)
UI.PostScreenMenuShader.Show();
}
Here is the call graph for this function:
GalaxyWars.GalaxyWarsManager.PostUIRender
GalaxyWars.Shaders.PostScreenMenu.Show
6.13.4
Member Data Documentation
6.13.4.1
TrippSystem.TrippSystem GalaxyWars.GalaxyWarsManager.trippSystem [static,
private]
Definition at line 36 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
6.13.4.2
PrimitivesRenderer GalaxyWars.GalaxyWarsManager.primitivesRenderer [static,
private]
Definition at line 38 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
6.13.4.3
Stack<IGameScreen> GalaxyWars.GalaxyWarsManager.gameScreens = new
Stack<IGameScreen>() [static, private]
Game screens stack. We can easily add and remove game screens and they follow the game logic automatically.
Definition at line 44 of file GalaxyWarsManager.cs.
Referenced
by
GalaxyWars.GalaxyWarsManager.AddGameScreen(),
GalaxyWars.GalaxyWarsManager.GalaxyWarsManager(), and GalaxyWars.GalaxyWarsManager.Render().
6.13.4.4
Player GalaxyWars.GalaxyWarsManager.player = new Player(new Vector3(0, 0, 0))
[static, private]
Player for the game, also allows us to control the ship and contains all the required code for the ship
physics, chase camera and basic player values and the game time because this is the top class of many
derived classes. Player, ship and camera position is set when the game starts depending on the selected
level.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
142
Class Documentation
Definition at line 53 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Update().
6.13.4.5
Model GalaxyWars.GalaxyWarsManager.shipModel = null [static, private]
Spaceship model.
Definition at line 58 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
6.13.4.6
Asteroids GalaxyWars.GalaxyWarsManager.asteroids = null [static, private]
Swarm of randomly positioned (with zero velocity) asteroids to fly through.
Definition at line 63 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
6.13.4.7
LensFlare GalaxyWars.GalaxyWarsManager.lensFlare = null [static, private]
Graphics elements to represent a light source with its lens flare effects.
Definition at line 68 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
6.13.4.8
FireParticleSystem GalaxyWars.GalaxyWarsManager.particleSystem = null [static,
private]
Particles system for the flame effect of the spaceship jets.
Definition at line 73 of file GalaxyWarsManager.cs.
Referenced
by
GalaxyWars.GalaxyWarsManager.Initialize(),
Wars.GalaxyWarsManager.Update().
6.13.4.9
and
Galaxy-
Texture [ ] GalaxyWars.GalaxyWarsManager.shipTextures = null [static,
private]
Ship textures we exchange for our ship model.
Definition at line 78 of file GalaxyWarsManager.cs.
6.13.5
Property Documentation
6.13.5.1
PrimitivesRenderer GalaxyWars.GalaxyWarsManager.PrimitivesRenderer [static,
get]
Definition at line 85 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.13 GalaxyWars.GalaxyWarsManager Class Reference
6.13.5.2
143
bool GalaxyWars.GalaxyWarsManager.MenuActive [static, get]
Checks if the menu is currently active.
Returns:
Menu screen is active.
Definition at line 94 of file GalaxyWarsManager.cs.
6.13.5.3
bool GalaxyWars.GalaxyWarsManager.GameActive [static, get]
Checks if the game is currently active.
Returns:
Game screen is active.
Definition at line 106 of file GalaxyWarsManager.cs.
6.13.5.4
bool GalaxyWars.GalaxyWarsManager.ShowCursor [static, get]
Checks whether to show the mouse cursor.
Definition at line 117 of file GalaxyWarsManager.cs.
6.13.5.5
Player GalaxyWars.GalaxyWarsManager.Player [static, get]
Player for the game, also allows us to control the car and contains all the required code for the ship physics,
chase camera and basic player values and the game time because this is the top class of many derived
classes. Easy access here with a static property in case we need the player somewhere in the game.
Definition at line 136 of file GalaxyWarsManager.cs.
6.13.5.6
Model GalaxyWars.GalaxyWarsManager.SpaceshipModel [static, get]
Ship model.
Definition at line 147 of file GalaxyWarsManager.cs.
6.13.5.7
Asteroids GalaxyWars.GalaxyWarsManager.Asteroids [static, get]
Asteroids swarm.
Definition at line 158 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
6.13.5.8
TrippSystem.TrippSystem GalaxyWars.GalaxyWarsManager.TrippSys [static,
get]
Definition at line 166 of file GalaxyWarsManager.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
144
Class Documentation
6.13.5.9
LensFlare GalaxyWars.GalaxyWarsManager.LensFlare [static, get]
Lens flare effect.
Definition at line 177 of file GalaxyWarsManager.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Initialize().
6.13.5.10
FireParticleSystem GalaxyWars.GalaxyWarsManager.ParticleSystem [static,
get]
Particle system.
Definition at line 188 of file GalaxyWarsManager.cs.
The documentation for this class was generated from the following file:
• GalaxyWarsManager.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.14 GalaxyWars.GameScreens.GameScreen Class Reference
6.14
GalaxyWars.GameScreens.GameScreen Class Reference
GameScreen, just manages the on screen display for the game.
Inheritance diagram for GalaxyWars.GameScreens.GameScreen:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.GameScreen
Collaboration diagram for GalaxyWars.GameScreens.GameScreen:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.GameScreen
Public Member Functions
• GameScreen ()
Creates game screen.
• bool Render ()
Renders game screen.
Private Member Functions
• XnaColor DangerColor (Vertex v)
Private Attributes
• float maxDanger = 1000
• List< Vertex > path = null
6.14.1
Detailed Description
GameScreen, just manages the on screen display for the game.
Definition at line 27 of file GameScreen.cs.
6.14.2
Constructor & Destructor Documentation
6.14.2.1
GalaxyWars.GameScreens.GameScreen.GameScreen ()
Creates game screen.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
145
146
Class Documentation
Definition at line 32 of file GameScreen.cs.
33
34
35
36
37
38
39
40
41
{
// Reset player variables (start new game, reset time and position)
GalaxyWarsManager.Player.Reset();
// Fix light direction
BaseGame.LightDirection = LensFlare.DefaultLightPos;
// Play game music
// Sound.Play(Sound.Sounds.GameMusic);
Music.PlayMusic(Music.GameMusic);
}
6.14.3
Member Function Documentation
6.14.3.1
XnaColor GalaxyWars.GameScreens.GameScreen.DangerColor (Vertex v) [private]
Definition at line 44 of file GameScreen.cs.
45
46
47
48
49
6.14.3.2
{
//maxDanger = Math.Max(maxDanger, v.Danger);
float ratio = Math.Min(Math.Max(v.Danger, 0) / maxDanger, 1);
return new XnaColor((byte)((1 - ratio) * 255), 0, (byte)(ratio * 255));
}
bool GalaxyWars.GameScreens.GameScreen.Render ()
Renders game screen.
Implements GalaxyWars.GameScreens.IGameScreen.
Definition at line 55 of file GameScreen.cs.
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
GalaxyWarsManager.Asteroids.Update(null);
// This starts both menu and in game post screen shader!
BaseGame.UI.PostScreenGlowShader.Start();
// Render background sky and lensflare.
if (GameSettings.Default.ShowBackground)
{
BaseGame.UI.RenderGameBackground();
GalaxyWarsManager.LensFlare.Render(Microsoft.Xna.Framework.Graphics.Color.White);
}
GalaxyWarsManager.Asteroids.Render();
if (GameSettings.Default.ShowVertices)
foreach (Vertex v in GalaxyWarsManager.TrippSys.GraphVertices())
GalaxyWarsManager.PrimitivesRenderer.RenderCube(new Vector3(v.Position.X, v.Positio
3.0f,
DangerColor(v));
if (GameSettings.Default.ShowDiagram)
foreach (Edge e in GalaxyWarsManager.TrippSys.GraphEdges())
GalaxyWarsManager.LineManager.AddLine(new Vector3(e.A.Position.X, e.A.Position.Y, e
DangerColor(e.A),
new Vector3(e.B.Position.X, e.B.Position.Y, e
DangerColor(e.B));
if (GameSettings.Default.ShowPath)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.14 GalaxyWars.GameScreens.GameScreen Class Reference
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
147
{
GalaxyWarsManager.TrippSys.Algorithm = PathPlanningAlgorithm.AStar;
if (path == null)
{
path = GalaxyWarsManager.TrippSys.Path(new TrippVector(-312), new TrippVector(+312)
}
else
{
path = GalaxyWarsManager.TrippSys.Path(new TrippVector(-312), new TrippVector(+312)
}
Vertex a = null;
foreach (Vertex b in path)
{
if (a != null)
GalaxyWarsManager.LineManager.AddLine(new Vector3(a.Position.X, a.Position.Y,
DangerColor(a),
new Vector3(b.Position.X, b.Position.Y, b.Po
DangerColor(b));
a = b;
}
}
GalaxyWarsManager.SpaceshipModel.Render(GalaxyWarsManager.Player.ShipRenderMatrix);
// And flush all models to be rendered
BaseGame.MeshRenderManager.Render();
// BaseGame.LineManager.AddLine(new Vector3(-100, -100, -100), new Vector3(100, 100, 100),
BaseGame.LineManager.Render();
// Apply post screen shader here before doing the UI
BaseGame.UI.PostScreenGlowShader.Show();
// Show on screen UI for the game.
// Note: Could be improved by using the latest checkpoints and
// check times this way!
BaseGame.UI.RenderGameUI(
(int)GalaxyWarsManager.Player.GameTimeMilliseconds,
// Best time and current lap
0, 0,
GalaxyWarsManager.Player.Speed,
1 + (int)(5 * GalaxyWarsManager.Player.Speed / SpaceshipPhysics.MaxPossibleSpeed),
// Motormeter
0.5f * GalaxyWarsManager.Player.Speed / SpaceshipPhysics.MaxPossibleSpeed +
// This could be improved
0.5f * GalaxyWarsManager.Player.Acceleration,
"Galaxy Arena");
// Render flames only if the ship doesn’t follow the path
if (GalaxyWarsManager.Player.Path == null)
{
GalaxyWarsManager.ParticleSystem.SetCamera(BaseGame.ViewMatrix, BaseGame.ProjectionMat
GalaxyWarsManager.ParticleSystem.Draw();
}
if (Input.KeyboardKeyJustPressed(Microsoft.Xna.Framework.Input.Keys.P))
GameSettings.Default.ShowPath = !GameSettings.Default.ShowPath;
if (Input.KeyboardKeyJustPressed(Microsoft.Xna.Framework.Input.Keys.V))
GameSettings.Default.ShowVertices = !GameSettings.Default.ShowVertices;
if (Input.KeyboardKeyJustPressed(Microsoft.Xna.Framework.Input.Keys.D))
GameSettings.Default.ShowDiagram = !GameSettings.Default.ShowDiagram;
if (Input.KeyboardKeyJustPressed(Microsoft.Xna.Framework.Input.Keys.S))
GameSettings.Default.ShowBackground = !GameSettings.Default.ShowBackground;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
148
Class Documentation
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
if (Input.KeyboardKeyJustPressed(Microsoft.Xna.Framework.Input.Keys.F))
{
if (GalaxyWarsManager.Player.Path == null)
{
GalaxyWarsManager.Player.Path = path;
GalaxyWarsManager.Player.PathTime = 0;
}
else
GalaxyWarsManager.Player.Path = null;
}
if (Input.KeyboardKeyJustPressed(Microsoft.Xna.Framework.Input.Keys.R))
GalaxyWarsManager.Player.PathTime = 0;
if (Input.KeyboardEscapeJustPressed || Input.GamePadBackJustPressed ||
(GalaxyWarsManager.Player.GameOver &&
(Input.KeyboardSpaceJustPressed ||
Input.GamePadAJustPressed ||
Input.GamePadBJustPressed ||
Input.GamePadXJustPressed ||
Input.GamePadYJustPressed ||
Input.MouseLeftButtonJustPressed)))
{
// Play menu music again
// Sound.Play(Sound.Sounds.MenuMusic);
Music.PlayMusic(Music.MenuMusic);
// Return to menu
return true;
}
return false;
}
6.14.4
Member Data Documentation
6.14.4.1
float GalaxyWars.GameScreens.GameScreen.maxDanger = 1000 [private]
Definition at line 43 of file GameScreen.cs.
6.14.4.2
List<Vertex> GalaxyWars.GameScreens.GameScreen.path = null [private]
Definition at line 51 of file GameScreen.cs.
The documentation for this class was generated from the following file:
• GameScreen.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.15 GalaxyWars.Properties.GameSettings Class Reference
6.15
149
GalaxyWars.Properties.GameSettings Class Reference
Game settings, stored in a custom XML file. The reason for this is we want to be able to store our game data
on the Xbox360 too. On the PC we could just use a Settings/config file and have all the code autogenerated
for us, but this way it works both on PC and Xbox. Note: The default instance for the game settings is in
this class, this way we get the same behaviour as for normal Settings files!
Collaboration diagram for GalaxyWars.Properties.GameSettings:
GalaxyWars.Properties.GameSettings
defaultInstance
Static Public Member Functions
• static void Initialize ()
Create game settings. This constructor helps us to only load the GameSettings once, not again if GameSettings is recreated by the Deserialization process.
• static void Load ()
Loads the game settings.
• static void Save ()
Saves the game settings.
• static void SetMinimumGraphics ()
Sets all of the graphical settings to their minimum possible values and saves the changes.
Public Attributes
• const int MinimumResolutionWidth = 640
• const int MinimumResolutionHeight = 480
Properties
• static GameSettings Default [get]
Default settings property.
• bool ShowBackground [get, set]
Show the star background.
• bool ShowDiagram [get, set]
Show the power diagram from the TrippSys.
• bool ShowVertices [get, set]
Show the power diagram vertices from the TrippSys.
• bool ShowPath [get, set]
Show the path found by the TrippSys.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
150
Class Documentation
• string Highscores [get, set]
Highscores.
• string PlayerName [get, set]
Player name.
• int ResolutionWidth [get, set]
Resolution width.
• int ResolutionHeight [get, set]
Resolution height.
• bool Fullscreen [get, set]
Fullscreen.
• bool PostScreenEffects [get, set]
Post screen effects.
• bool ShadowMapping [get, set]
ShadowMapping.
• bool HighDetail [get, set]
HighDetail.
• float SoundVolume [get, set]
Sound volume.
• float MusicVolume [get, set]
Music volume.
• float ControllerSensitivity [get, set]
Controller sensitivity.
Private Member Functions
• GameSettings ()
Create game settings, don’t allow public constructor!
Private Attributes
• const string SettingsFilename = "GalaxyWars.settings"
Filename for our game settings file.
• bool showBackground = true
Show the star background.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.15 GalaxyWars.Properties.GameSettings Class Reference
• bool showDiagram = false
Show the power diagram from the TrippSys.
• bool showVertices = false
Show the power diagram vertices from the TrippSys.
• bool showPath = false
Show the path found by the TrippSys.
• string highscores = ""
Highscores.
• string playerName = "Galaxy Warrior"
Player name.
• int resolutionWidth = 0
Resolution width.
• int resolutionHeight = 0
Resolution height.
• bool fullscreen = true
Fullscreen.
•
•
•
•
bool postScreenEffects = true
bool shadowMapping = true
bool highDetail = true
float soundVolume = 0.8f
Sound volume.
• float musicVolume = 0.6f
Music volume.
• float controllerSensitivity = 0.5f
Controller sensitivity.
Static Private Attributes
• static GameSettings defaultInstance = null
Default instance for our game settings.
• static bool needSave = false
Need saving the game settings file? Only set to true if we really changed some game setting here.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
151
152
Class Documentation
6.15.1
Detailed Description
Game settings, stored in a custom XML file. The reason for this is we want to be able to store our game data
on the Xbox360 too. On the PC we could just use a Settings/config file and have all the code autogenerated
for us, but this way it works both on PC and Xbox. Note: The default instance for the game settings is in
this class, this way we get the same behaviour as for normal Settings files!
Definition at line 27 of file GameSettings.cs.
6.15.2
Constructor & Destructor Documentation
6.15.2.1
GalaxyWars.Properties.GameSettings.GameSettings () [private]
Create game settings, don’t allow public constructor!
Definition at line 62 of file GameSettings.cs.
63
64
{
}
6.15.3
Member Function Documentation
6.15.3.1
static void GalaxyWars.Properties.GameSettings.Initialize () [static]
Create game settings. This constructor helps us to only load the GameSettings once, not again if GameSettings is recreated by the Deserialization process.
Parameters:
loadSettings Load settings.
Definition at line 72 of file GameSettings.cs.
73
74
75
76
6.15.3.2
{
defaultInstance = new GameSettings();
Load();
}
static void GalaxyWars.Properties.GameSettings.Load () [static]
Loads the game settings.
Definition at line 85 of file GameSettings.cs.
86
87
88
89
90
91
92
93
94
95
96
{
needSave = false;
FileStream file = FileHelper.LoadGameContentFile(SettingsFilename);
if (file == null)
{
needSave = true; // Create new file after quitting
return;
}
// If the file is empty, just create a new file with the default settings.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.15 GalaxyWars.Properties.GameSettings Class Reference
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
6.15.3.3
153
if (file.Length == 0)
{
file.Close(); // Close the file
// But first check if there is maybe a file in the game directory
// to load the default game settings from.
file = FileHelper.LoadGameContentFile(SettingsFilename);
if (file != null)
{
// Load everything into this class
GameSettings loadedGameSettings =
(GameSettings)new XmlSerializer(typeof(GameSettings)).Deserialize(file);
if (loadedGameSettings != null)
defaultInstance = loadedGameSettings;
file.Close(); // Close the file
}
// Save user settings file
needSave = true;
Save();
}
else
{
// Else load everything into this class with help of the XmlSerializer.
GameSettings loadedGameSettings =
(GameSettings)new XmlSerializer(typeof(GameSettings)).Deserialize(file);
if (loadedGameSettings != null)
defaultInstance = loadedGameSettings;
file.Close(); // Close the file
}
}
static void GalaxyWars.Properties.GameSettings.Save () [static]
Saves the game settings.
Definition at line 138 of file GameSettings.cs.
139
140
141
142
143
144
145
146
147
148
149
6.15.3.4
{
// No need to save if everything is up to date.
if (needSave == false)
return;
needSave = false;
FileStream file = FileHelper.SaveGameContentFile(SettingsFilename);
// Save everything in this class with help of the XmlSerializer.
new XmlSerializer(typeof(GameSettings)).Serialize(file, defaultInstance);
file.Close(); // Close the file
}
static void GalaxyWars.Properties.GameSettings.SetMinimumGraphics () [static]
Sets all of the graphical settings to their minimum possible values and saves the changes.
Definition at line 155 of file GameSettings.cs.
References
GalaxyWars.Properties.GameSettings.Default,
Wars.Properties.GameSettings.ResolutionWidth.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
and
Galaxy-
154
156
157
158
159
160
161
162
163
Class Documentation
{
GameSettings.Default.ResolutionWidth = GameSettings.MinimumResolutionWidth;
GameSettings.Default.ResolutionHeight = GameSettings.MinimumResolutionHeight;
GameSettings.Default.ShadowMapping = false;
GameSettings.Default.HighDetail = false;
GameSettings.Default.PostScreenEffects = false;
GameSettings.Save();
}
6.15.4
Member Data Documentation
6.15.4.1
const string GalaxyWars.Properties.GameSettings.SettingsFilename =
"GalaxyWars.settings" [private]
Filename for our game settings file.
Definition at line 32 of file GameSettings.cs.
6.15.4.2
GameSettings GalaxyWars.Properties.GameSettings.defaultInstance = null [static,
private]
Default instance for our game settings.
Definition at line 37 of file GameSettings.cs.
6.15.4.3
bool GalaxyWars.Properties.GameSettings.needSave = false [static, private]
Need saving the game settings file? Only set to true if we really changed some game setting here.
Definition at line 43 of file GameSettings.cs.
6.15.4.4
bool GalaxyWars.Properties.GameSettings.showBackground = true [private]
Show the star background.
Definition at line 172 of file GameSettings.cs.
6.15.4.5
bool GalaxyWars.Properties.GameSettings.showDiagram = false [private]
Show the power diagram from the TrippSys.
Definition at line 193 of file GameSettings.cs.
6.15.4.6
bool GalaxyWars.Properties.GameSettings.showVertices = false [private]
Show the power diagram vertices from the TrippSys.
Definition at line 214 of file GameSettings.cs.
6.15.4.7
bool GalaxyWars.Properties.GameSettings.showPath = false [private]
Show the path found by the TrippSys.
Definition at line 235 of file GameSettings.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.15 GalaxyWars.Properties.GameSettings Class Reference
6.15.4.8
string GalaxyWars.Properties.GameSettings.highscores = "" [private]
Highscores.
Definition at line 256 of file GameSettings.cs.
6.15.4.9
string GalaxyWars.Properties.GameSettings.playerName = "Galaxy Warrior"
[private]
Player name.
Definition at line 279 of file GameSettings.cs.
6.15.4.10
const int GalaxyWars.Properties.GameSettings.MinimumResolutionWidth = 640
Definition at line 299 of file GameSettings.cs.
6.15.4.11
int GalaxyWars.Properties.GameSettings.resolutionWidth = 0 [private]
Resolution width.
Definition at line 304 of file GameSettings.cs.
6.15.4.12
const int GalaxyWars.Properties.GameSettings.MinimumResolutionHeight = 480
Definition at line 324 of file GameSettings.cs.
6.15.4.13
int GalaxyWars.Properties.GameSettings.resolutionHeight = 0 [private]
Resolution height.
Definition at line 329 of file GameSettings.cs.
6.15.4.14
bool GalaxyWars.Properties.GameSettings.fullscreen = true [private]
Fullscreen.
Definition at line 352 of file GameSettings.cs.
6.15.4.15
bool GalaxyWars.Properties.GameSettings.postScreenEffects = true [private]
Definition at line 372 of file GameSettings.cs.
6.15.4.16
bool GalaxyWars.Properties.GameSettings.shadowMapping = true [private]
Definition at line 392 of file GameSettings.cs.
6.15.4.17
bool GalaxyWars.Properties.GameSettings.highDetail = true [private]
Definition at line 412 of file GameSettings.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
155
156
Class Documentation
6.15.4.18
float GalaxyWars.Properties.GameSettings.soundVolume = 0.8f [private]
Sound volume.
Definition at line 435 of file GameSettings.cs.
6.15.4.19
float GalaxyWars.Properties.GameSettings.musicVolume = 0.6f [private]
Music volume.
Definition at line 458 of file GameSettings.cs.
6.15.4.20
float GalaxyWars.Properties.GameSettings.controllerSensitivity = 0.5f [private]
Controller sensitivity.
Definition at line 481 of file GameSettings.cs.
6.15.5
Property Documentation
6.15.5.1
GameSettings GalaxyWars.Properties.GameSettings.Default [static, get]
Default settings property.
Returns:
Game settings.
Definition at line 50 of file GameSettings.cs.
Referenced by GalaxyWars.Properties.GameSettings.SetMinimumGraphics().
6.15.5.2
bool GalaxyWars.Properties.GameSettings.ShowBackground [get, set]
Show the star background.
Definition at line 178 of file GameSettings.cs.
6.15.5.3
bool GalaxyWars.Properties.GameSettings.ShowDiagram [get, set]
Show the power diagram from the TrippSys.
Definition at line 199 of file GameSettings.cs.
6.15.5.4
bool GalaxyWars.Properties.GameSettings.ShowVertices [get, set]
Show the power diagram vertices from the TrippSys.
Definition at line 220 of file GameSettings.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.15 GalaxyWars.Properties.GameSettings Class Reference
6.15.5.5
bool GalaxyWars.Properties.GameSettings.ShowPath [get, set]
Show the path found by the TrippSys.
Definition at line 241 of file GameSettings.cs.
6.15.5.6
string GalaxyWars.Properties.GameSettings.Highscores [get, set]
Highscores.
Returns:
String
Definition at line 263 of file GameSettings.cs.
6.15.5.7
string GalaxyWars.Properties.GameSettings.PlayerName [get, set]
Player name.
Returns:
String
Definition at line 286 of file GameSettings.cs.
6.15.5.8
int GalaxyWars.Properties.GameSettings.ResolutionWidth [get, set]
Resolution width.
Returns:
Int
Definition at line 311 of file GameSettings.cs.
Referenced by GalaxyWars.Properties.GameSettings.SetMinimumGraphics().
6.15.5.9
int GalaxyWars.Properties.GameSettings.ResolutionHeight [get, set]
Resolution height.
Returns:
Int
Definition at line 336 of file GameSettings.cs.
6.15.5.10
bool GalaxyWars.Properties.GameSettings.Fullscreen [get, set]
Fullscreen.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
157
158
Class Documentation
Returns:
Bool
Definition at line 359 of file GameSettings.cs.
6.15.5.11
bool GalaxyWars.Properties.GameSettings.PostScreenEffects [get, set]
Post screen effects.
Returns:
Bool
Definition at line 379 of file GameSettings.cs.
6.15.5.12
bool GalaxyWars.Properties.GameSettings.ShadowMapping [get, set]
ShadowMapping.
Returns:
Bool
Definition at line 399 of file GameSettings.cs.
6.15.5.13
bool GalaxyWars.Properties.GameSettings.HighDetail [get, set]
HighDetail.
Returns:
Bool
Definition at line 419 of file GameSettings.cs.
6.15.5.14
float GalaxyWars.Properties.GameSettings.SoundVolume [get, set]
Sound volume.
Returns:
Float
Definition at line 442 of file GameSettings.cs.
6.15.5.15
float GalaxyWars.Properties.GameSettings.MusicVolume [get, set]
Music volume.
Returns:
Float
Definition at line 465 of file GameSettings.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.15 GalaxyWars.Properties.GameSettings Class Reference
6.15.5.16
float GalaxyWars.Properties.GameSettings.ControllerSensitivity [get, set]
Controller sensitivity.
Returns:
Float
Definition at line 488 of file GameSettings.cs.
The documentation for this class was generated from the following file:
• GameSettings.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
159
160
Class Documentation
6.16
GalaxyWars.GameScreens.Help Class Reference
Help.
Inheritance diagram for GalaxyWars.GameScreens.Help:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.Help
Collaboration diagram for GalaxyWars.GameScreens.Help:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.Help
Public Member Functions
• bool Render ()
Render game screen. Called each frame.
6.16.1
Detailed Description
Help.
Definition at line 18 of file Help.cs.
6.16.2
Member Function Documentation
6.16.2.1
bool GalaxyWars.GameScreens.Help.Render ()
Render game screen. Called each frame.
Implements GalaxyWars.GameScreens.IGameScreen.
Definition at line 23 of file Help.cs.
24
25
26
27
28
29
30
31
32
33
34
35
{
// This starts both menu and in game post screen shader!
BaseGame.UI.PostScreenMenuShader.Start();
// Render background and black bar
BaseGame.UI.RenderMenuBackground();
// Help header
int posX = 10, posY = 18;
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
posX += 36;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.16 GalaxyWars.GameScreens.Help Class Reference
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
161
posY += 26;
}
BaseGame.UI.Headers.RenderOnScreenRelative1600(posX, posY, UIRenderer.HeaderHelpGfxRect);
// Help
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
BaseGame.UI.HelpScreen.RenderOnScreen(
BaseGame.CalcRectangleKeep4To3(
25, 130, BaseGame.UI.HelpScreen.GfxRectangle.Width - 50,
BaseGame.UI.HelpScreen.GfxRectangle.Height - 12),
BaseGame.UI.HelpScreen.GfxRectangle);
}
else
{
BaseGame.UI.HelpScreen.RenderOnScreenRelative4To3(
0, 125, BaseGame.UI.HelpScreen.GfxRectangle);
}
BaseGame.UI.RenderBottomButtons(true);
if (Input.KeyboardEscapeJustPressed ||
Input.GamePadBJustPressed ||
Input.GamePadBackJustPressed ||
Input.MouseLeftButtonJustPressed)
return true;
return false;
}
The documentation for this class was generated from the following file:
• Help.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
162
Class Documentation
6.17
GalaxyWars.GameScreens.IGameScreen Interface Reference
Game screen helper interface for all game screens of our game. Helps us to put them all into one list and
manage them in our RaceGame.
Inheritance diagram for GalaxyWars.GameScreens.IGameScreen:
GalaxyWars.GameScreens.GameScreen
GalaxyWars.GameScreens.Help
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.MainMenu
GalaxyWars.GameScreens.Options
GalaxyWars.GameScreens.SplashScreen
Public Member Functions
• bool Render ()
Run game screen. Called each frame. Returns true if we want to exit it.
6.17.1
Detailed Description
Game screen helper interface for all game screens of our game. Helps us to put them all into one list and
manage them in our RaceGame.
Definition at line 15 of file IGameScreen.cs.
6.17.2
Member Function Documentation
6.17.2.1
bool GalaxyWars.GameScreens.IGameScreen.Render ()
Run game screen. Called each frame. Returns true if we want to exit it.
Implemented
in
GalaxyWars.GameScreens.GameScreen,
GalaxyWars.GameScreens.Help,
GalaxyWars.GameScreens.MainMenu,
GalaxyWars.GameScreens.Options,
and
GalaxyWars.GameScreens.SplashScreen.
The documentation for this interface was generated from the following file:
• IGameScreen.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
6.18
163
GalaxyWars.GameLogic.Input Class Reference
Input helper class, captures all the mouse, keyboard and XBox 360 controller input and provides some nice
helper methods and properties. Will also keep track of the last frame states for comparison if a button was
just pressed this frame, but not already in the last frame.
Static Public Member Functions
• static void ResetMouseDraggingAmount ()
Reset mouse dragging amount.
• static bool MouseInBox (Rectangle rect)
Mouse in box.
• static bool MouseInBoxRelative (Rectangle rect)
Mouse in box relative.
• static bool IsSpecialKey (Keys key)
• static char KeyToChar (Keys key, bool shiftPressed)
Key to char helper conversion method. Note: If the keys are mapped other than on a default QWERTY
keyboard, this method will not work properly. Most keyboards will return the same for A-Z and 0-9, but the
special keys might be different.
• static void HandleKeyboardInput (ref string inputText)
Handle keyboard input helper method to catch keyboard input for an input text. Only used to enter the
player name in the game.
• static bool KeyboardKeyJustPressed (Keys key)
Keyboard key just pressed.
Properties
• static bool MouseDetected [get]
Was a mouse detected? Returns true if the user moves the mouse. On the Xbox 360 there will be no mouse
movement and theirfore we know that we don’t have to display the mouse.
• static Point MousePos [get]
Mouse position.
• static float MouseXMovement [get]
Mouse x movement.
• static float MouseYMovement [get]
Mouse y movement.
• static bool HasMouseMoved [get]
Mouse has moved in either the X or Y direction.
• static bool MouseLeftButtonPressed [get]
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
164
Class Documentation
Mouse left button pressed.
• static bool MouseRightButtonPressed [get]
Mouse right button pressed.
• static bool MouseMiddleButtonPressed [get]
Mouse middle button pressed.
• static bool MouseLeftButtonJustPressed [get]
Mouse left button just pressed.
• static bool MouseRightButtonJustPressed [get]
Mouse right button just pressed.
• static Point MouseDraggingAmount [get]
Mouse dragging amount.
• static int MouseWheelDelta [get]
Mouse wheel delta.
• static KeyboardState Keyboard [get]
Keyboard.
• static bool KeyboardSpaceJustPressed [get]
Keyboard space just pressed.
• static bool KeyboardF1JustPressed [get]
Keyboard F1 just pressed.
• static bool KeyboardEscapeJustPressed [get]
Keyboard escape just pressed.
• static bool KeyboardLeftJustPressed [get]
Keyboard left just pressed.
• static bool KeyboardRightJustPressed [get]
Keyboard right just pressed.
• static bool KeyboardUpJustPressed [get]
Keyboard up just pressed.
• static bool KeyboardDownJustPressed [get]
Keyboard down just pressed.
• static bool KeyboardLeftPressed [get]
Keyboard left pressed.
• static bool KeyboardRightPressed [get]
Keyboard right pressed.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
• static bool KeyboardUpPressed [get]
Keyboard up pressed.
• static bool KeyboardDownPressed [get]
Keyboard down pressed.
• static GamePadState GamePad [get]
Game pad.
• static bool IsGamePadConnected [get]
Is game pad connected.
• static bool GamePadStartPressed [get]
Game pad start pressed.
• static bool GamePadAPressed [get]
Game pad a pressed.
• static bool GamePadBPressed [get]
Game pad b pressed.
• static bool GamePadXPressed [get]
Game pad x pressed.
• static bool GamePadYPressed [get]
Game pad y pressed.
• static bool GamePadLeftPressed [get]
Game pad left pressed.
• static bool GamePadRightPressed [get]
Game pad right pressed.
• static bool GamePadLeftJustPressed [get]
Game pad left just pressed.
• static bool GamePadRightJustPressed [get]
Game pad right just pressed.
• static bool GamePadUpJustPressed [get]
Game pad up just pressed.
• static bool GamePadDownJustPressed [get]
Game pad down just pressed.
• static bool GamePadUpPressed [get]
Game pad up pressed.
• static bool GamePadDownPressed [get]
Game pad down pressed.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
165
166
Class Documentation
• static bool GamePadAJustPressed [get]
Game pad a just pressed.
• static bool GamePadBJustPressed [get]
Game pad b just pressed.
• static bool GamePadXJustPressed [get]
Game pad x just pressed.
• static bool GamePadYJustPressed [get]
Game pad y just pressed.
• static bool GamePadBackJustPressed [get]
Game pad back just pressed.
Static Private Member Functions
• static internal void Update ()
Update, called from BaseGame.Update(). Will catch all new states for keyboard, mouse and the gamepad.
Static Private Attributes
• static MouseState mouseState
Mouse state, set every frame in the Update method.
• static MouseState mouseStateLastFrame
• static bool mouseDetected = false
Was a mouse detected? Returns true if the user moves the mouse. On the Xbox 360 there will be no mouse
movement and theirfore we know that we don’t have to display the mouse.
• static KeyboardState keyboardState
Keyboard state, set every frame in the Update method. Note: KeyboardState is a class and not a struct,
we have to initialize it here, else we might run into trouble when accessing any keyboardState data before BaseGame.Update() is called. We can also NOT use the last state because everytime we call Keyboard.GetState() the old state is useless (see XNA help for more information, section Input). We store our
own array of keys from the last frame for comparing stuff.
• static List< Keys > keysPressedLastFrame = new List<Keys>()
Keys pressed last frame, for comparison if a key was just pressed.
• static GamePadState gamePadState
GamePad state, set every frame in the Update method.
• static GamePadState gamePadStateLastFrame
• static int mouseWheelDelta = 0
Mouse wheel delta this frame. XNA does report only the total scroll value, but we usually need the current
delta!
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
167
• static int mouseWheelValue = 0
• static Point startDraggingPos
Start dragging pos, will be set when we just pressed the left mouse button. Used for the MouseDraggingAmount property.
• static float mouseXMovement
X and y movements of the mouse this frame.
• static float mouseYMovement
• static float lastMouseXMovement
• static float lastMouseYMovement
6.18.1
Detailed Description
Input helper class, captures all the mouse, keyboard and XBox 360 controller input and provides some nice
helper methods and properties. Will also keep track of the last frame states for comparison if a button was
just pressed this frame, but not already in the last frame.
Definition at line 23 of file Input.cs.
6.18.2
Member Function Documentation
6.18.2.1
static void GalaxyWars.GameLogic.Input.ResetMouseDraggingAmount () [static]
Reset mouse dragging amount.
Definition at line 237 of file Input.cs.
238
239
240
{
startDraggingPos = MousePos;
}
6.18.2.2
static bool GalaxyWars.GameLogic.Input.MouseInBox (Rectangle rect) [static]
Mouse in box.
Parameters:
rect Rectangle
Returns:
Bool
Definition at line 259 of file Input.cs.
260
261
262
263
264
265
{
bool ret = mouseState.X >= rect.X &&
mouseState.Y >= rect.Y &&
mouseState.X < rect.Right &&
mouseState.Y < rect.Bottom;
bool lastRet = mouseStateLastFrame.X >= rect.X &&
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
168
Class Documentation
266
267
268
269
270
271
272
273
274
275
276
mouseStateLastFrame.Y >= rect.Y &&
mouseStateLastFrame.X < rect.Right &&
mouseStateLastFrame.Y < rect.Bottom;
// Highlight happend?
if (ret &&
lastRet == false)
Sound.Play(Sound.Sounds.Highlight);
return ret;
}
6.18.2.3
static bool GalaxyWars.GameLogic.Input.MouseInBoxRelative (Rectangle rect)
[static]
Mouse in box relative.
Parameters:
rect Rectangle
Returns:
Bool
Definition at line 283 of file Input.cs.
284
285
286
287
288
289
290
291
292
6.18.2.4
{
float widthFactor = BaseGame.Width / 1024.0f;
float heightFactor = BaseGame.Height / 640.0f;
return MouseInBox(new Rectangle(
(int)Math.Round(rect.X * widthFactor),
(int)Math.Round(rect.Y * heightFactor),
(int)Math.Round(rect.Right * widthFactor),
(int)Math.Round(rect.Bottom * heightFactor)));
}
static bool GalaxyWars.GameLogic.Input.IsSpecialKey (Keys key) [static]
Definition at line 310 of file Input.cs.
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
{
// All keys except A-Z, 0-9 and ‘-\[];’,./= (and space) are special keys.
// With shift pressed this also results in this keys:
// ~_|{}:"<>? !@#$%^&*().
int keyNum = (int)key;
if ((keyNum >= (int)Keys.A && keyNum <= (int)Keys.Z) ||
(keyNum >= (int)Keys.D0 && keyNum <= (int)Keys.D9) ||
key == Keys.Space || // well, space ^^
key == Keys.OemTilde || // ‘~
key == Keys.OemMinus || // -_
key == Keys.OemPipe || // \|
key == Keys.OemOpenBrackets || // [{
key == Keys.OemCloseBrackets || // ]}
key == Keys.OemQuotes || // ’"
key == Keys.OemQuestion || // /?
key == Keys.OemPlus) // =+
{
return false;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
329
330
331
332
333
169
}
// Else is is a special key
return true;
}
6.18.2.5
static char GalaxyWars.GameLogic.Input.KeyToChar (Keys key, bool shiftPressed)
[static]
Key to char helper conversion method. Note: If the keys are mapped other than on a default QWERTY
keyboard, this method will not work properly. Most keyboards will return the same for A-Z and 0-9, but
the special keys might be different.
Parameters:
key Key
Returns:
Char
Definition at line 344 of file Input.cs.
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
{
// If key will not be found, just return space
char ret = ’ ’;
int keyNum = (int)key;
if (keyNum >= (int)Keys.A && keyNum <= (int)Keys.Z)
{
if (shiftPressed)
ret = key.ToString()[0];
else
ret = key.ToString().ToLower()[0];
}
else if (keyNum >= (int)Keys.D0 && keyNum <= (int)Keys.D9 &&
shiftPressed == false)
{
ret = (char)((int)’0’ + (keyNum - Keys.D0));
}
else if (key == Keys.D1 && shiftPressed)
ret = ’!’;
else if (key == Keys.D2 && shiftPressed)
ret = ’@’;
else if (key == Keys.D3 && shiftPressed)
ret = ’#’;
else if (key == Keys.D4 && shiftPressed)
ret = ’$’;
else if (key == Keys.D5 && shiftPressed)
ret = ’%’;
else if (key == Keys.D6 && shiftPressed)
ret = ’^’;
else if (key == Keys.D7 && shiftPressed)
ret = ’&’;
else if (key == Keys.D8 && shiftPressed)
ret = ’*’;
else if (key == Keys.D9 && shiftPressed)
ret = ’(’;
else if (key == Keys.D0 && shiftPressed)
ret = ’)’;
else if (key == Keys.OemTilde)
ret = shiftPressed ? ’~’ : ’‘’;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
170
Class Documentation
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
else if
ret
else if
ret
else if
ret
else if
ret
else if
ret
else if
ret
else if
ret
else if
ret
else if
ret
else if
ret
(key == Keys.OemMinus)
= shiftPressed ? ’_’ : ’-’;
(key == Keys.OemPipe)
= shiftPressed ? ’|’ : ’\\’;
(key == Keys.OemOpenBrackets)
= shiftPressed ? ’{’ : ’[’;
(key == Keys.OemCloseBrackets)
= shiftPressed ? ’}’ : ’]’;
(key == Keys.OemSemicolon)
= shiftPressed ? ’:’ : ’;’;
(key == Keys.OemQuotes)
= shiftPressed ? ’"’ : ’\’’;
(key == Keys.OemComma)
= shiftPressed ? ’<’ : ’.’;
(key == Keys.OemPeriod)
= shiftPressed ? ’>’ : ’,’;
(key == Keys.OemQuestion)
= shiftPressed ? ’?’ : ’/’;
(key == Keys.OemPlus)
= shiftPressed ? ’+’ : ’=’;
// Return result
return ret;
}
6.18.2.6
static void GalaxyWars.GameLogic.Input.HandleKeyboardInput (ref string inputText)
[static]
Handle keyboard input helper method to catch keyboard input for an input text. Only used to enter the
player name in the game.
Parameters:
inputText Input text
Definition at line 413 of file Input.cs.
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
{
// Is a shift key pressed (we have to check both, left and right)
bool isShiftPressed =
keyboardState.IsKeyDown(Keys.LeftShift) ||
keyboardState.IsKeyDown(Keys.RightShift);
// Go through all pressed keys
foreach (Keys pressedKey in keyboardState.GetPressedKeys())
// Only process if it was not pressed last frame
if (keysPressedLastFrame.Contains(pressedKey) == false)
{
// No special key?
if (IsSpecialKey(pressedKey) == false &&
// Max. allow 32 chars
inputText.Length < 32)
{
// Then add the letter to our inputText.
// Check also the shift state!
inputText += KeyToChar(pressedKey, isShiftPressed);
}
else if (pressedKey == Keys.Back &&
inputText.Length > 0)
{
// Remove 1 character at end
inputText = inputText.Substring(0, inputText.Length - 1);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
439
440
441
171
}
}
}
6.18.2.7
static bool GalaxyWars.GameLogic.Input.KeyboardKeyJustPressed (Keys key)
[static]
Keyboard key just pressed.
Returns:
Bool
Definition at line 447 of file Input.cs.
448
449
450
451
6.18.2.8
{
return keyboardState.IsKeyDown(key) &&
keysPressedLastFrame.Contains(key) == false;
}
static internal void GalaxyWars.GameLogic.Input.Update () [static, private]
Update, called from BaseGame.Update(). Will catch all new states for keyboard, mouse and the gamepad.
Definition at line 868 of file Input.cs.
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
{
// Handle mouse input variables
mouseStateLastFrame = mouseState;
mouseState = Microsoft.Xna.Framework.Input.Mouse.GetState();
// Update mouseXMovement and mouseYMovement
lastMouseXMovement += mouseState.X - mouseStateLastFrame.X;
lastMouseYMovement += mouseState.Y - mouseStateLastFrame.Y;
mouseXMovement = lastMouseXMovement / 2.0f;
mouseYMovement = lastMouseYMovement / 2.0f;
lastMouseXMovement -= lastMouseXMovement / 2.0f;
lastMouseYMovement -= lastMouseYMovement / 2.0f;
if (MouseLeftButtonPressed == false)
startDraggingPos = MousePos;
mouseWheelDelta = mouseState.ScrollWheelValue - mouseWheelValue;
mouseWheelValue = mouseState.ScrollWheelValue;
// If we are in the game and don’t show the mouse cursor anyway,
// reset it to the center to allow moving it around.
if (GalaxyWarsManager.MenuActive == false &&
// App must be active
GalaxyWarsManager.IsAppActive)
{
Microsoft.Xna.Framework.Input.Mouse.SetPosition(
BaseGame.Width / 2, BaseGame.Height / 2);
// Also use this for the current mouse pos for next frame,
// else the mouseXMovement is messed up!
mouseState = Microsoft.Xna.Framework.Input.Mouse.GetState();
}
// Check if mouse was moved this frame if it is not detected yet.
// This allows us to ignore the mouse even when it is captured
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
172
Class Documentation
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
// on a windows machine if just the gamepad or keyboard is used.
if (mouseDetected == false)// &&
//always returns false: Microsoft.Xna.Framework.Input.Mouse.IsCaptured)
mouseDetected = mouseState.X != mouseStateLastFrame.X ||
mouseState.Y != mouseStateLastFrame.Y ||
mouseState.LeftButton != mouseStateLastFrame.LeftButton;
// Handle keyboard input
keysPressedLastFrame = new List<Keys>(keyboardState.GetPressedKeys());
keyboardState = Microsoft.Xna.Framework.Input.Keyboard.GetState();
// And finally catch the XBox Controller input (only use 1 player here)
gamePadStateLastFrame = gamePadState;
gamePadState =
Microsoft.Xna.Framework.Input.GamePad.GetState(PlayerIndex.One);
}
6.18.3
Member Data Documentation
6.18.3.1
MouseState GalaxyWars.GameLogic.Input.mouseState [static, private]
Mouse state, set every frame in the Update method.
Definition at line 30 of file Input.cs.
6.18.3.2
MouseState GalaxyWars.GameLogic.Input.mouseStateLastFrame [static,
private]
Definition at line 30 of file Input.cs.
6.18.3.3
bool GalaxyWars.GameLogic.Input.mouseDetected = false [static, private]
Was a mouse detected? Returns true if the user moves the mouse. On the Xbox 360 there will be no mouse
movement and theirfore we know that we don’t have to display the mouse.
Definition at line 37 of file Input.cs.
6.18.3.4
KeyboardState GalaxyWars.GameLogic.Input.keyboardState [static, private]
Initial value:
Microsoft.Xna.Framework.Input.Keyboard.GetState()
Keyboard state, set every frame in the Update method. Note: KeyboardState is a class and not a struct,
we have to initialize it here, else we might run into trouble when accessing any keyboardState data before BaseGame.Update() is called. We can also NOT use the last state because everytime we call Keyboard.GetState() the old state is useless (see XNA help for more information, section Input). We store our
own array of keys from the last frame for comparing stuff.
Definition at line 49 of file Input.cs.
6.18.3.5
List<Keys> GalaxyWars.GameLogic.Input.keysPressedLastFrame = new List<Keys>()
[static, private]
Keys pressed last frame, for comparison if a key was just pressed.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
173
Definition at line 55 of file Input.cs.
6.18.3.6
GamePadState GalaxyWars.GameLogic.Input.gamePadState [static, private]
GamePad state, set every frame in the Update method.
Definition at line 60 of file Input.cs.
6.18.3.7
GamePadState GalaxyWars.GameLogic.Input.gamePadStateLastFrame [static,
private]
Definition at line 60 of file Input.cs.
6.18.3.8
int GalaxyWars.GameLogic.Input.mouseWheelDelta = 0 [static, private]
Mouse wheel delta this frame. XNA does report only the total scroll value, but we usually need the current
delta!
Returns:
0
Definition at line 67 of file Input.cs.
6.18.3.9
int GalaxyWars.GameLogic.Input.mouseWheelValue = 0 [static, private]
Definition at line 69 of file Input.cs.
6.18.3.10
Point GalaxyWars.GameLogic.Input.startDraggingPos [static, private]
Start dragging pos, will be set when we just pressed the left mouse button. Used for the MouseDraggingAmount property.
Definition at line 75 of file Input.cs.
6.18.3.11
float GalaxyWars.GameLogic.Input.mouseXMovement [static, private]
X and y movements of the mouse this frame.
Definition at line 110 of file Input.cs.
6.18.3.12
float GalaxyWars.GameLogic.Input.mouseYMovement [static, private]
Definition at line 110 of file Input.cs.
6.18.3.13
float GalaxyWars.GameLogic.Input.lastMouseXMovement [static, private]
Definition at line 111 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
174
Class Documentation
6.18.3.14
float GalaxyWars.GameLogic.Input.lastMouseYMovement [static, private]
Definition at line 111 of file Input.cs.
6.18.4
Property Documentation
6.18.4.1
bool GalaxyWars.GameLogic.Input.MouseDetected [static, get]
Was a mouse detected? Returns true if the user moves the mouse. On the Xbox 360 there will be no mouse
movement and theirfore we know that we don’t have to display the mouse.
Returns:
Bool
Definition at line 88 of file Input.cs.
6.18.4.2
Point GalaxyWars.GameLogic.Input.MousePos [static, get]
Mouse position.
Returns:
Point
Definition at line 100 of file Input.cs.
6.18.4.3
float GalaxyWars.GameLogic.Input.MouseXMovement [static, get]
Mouse x movement.
Returns:
Float
Definition at line 118 of file Input.cs.
6.18.4.4
float GalaxyWars.GameLogic.Input.MouseYMovement [static, get]
Mouse y movement.
Returns:
Float
Definition at line 130 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
6.18.4.5
175
bool GalaxyWars.GameLogic.Input.HasMouseMoved [static, get]
Mouse has moved in either the X or Y direction.
Returns:
Boolean
Definition at line 142 of file Input.cs.
6.18.4.6
bool GalaxyWars.GameLogic.Input.MouseLeftButtonPressed [static, get]
Mouse left button pressed.
Returns:
Bool
Definition at line 157 of file Input.cs.
6.18.4.7
bool GalaxyWars.GameLogic.Input.MouseRightButtonPressed [static, get]
Mouse right button pressed.
Returns:
Bool
Definition at line 169 of file Input.cs.
6.18.4.8
bool GalaxyWars.GameLogic.Input.MouseMiddleButtonPressed [static, get]
Mouse middle button pressed.
Returns:
Bool
Definition at line 181 of file Input.cs.
6.18.4.9
bool GalaxyWars.GameLogic.Input.MouseLeftButtonJustPressed [static, get]
Mouse left button just pressed.
Returns:
Bool
Definition at line 193 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
176
Class Documentation
6.18.4.10
bool GalaxyWars.GameLogic.Input.MouseRightButtonJustPressed [static, get]
Mouse right button just pressed.
Returns:
Bool
Definition at line 209 of file Input.cs.
6.18.4.11
Point GalaxyWars.GameLogic.Input.MouseDraggingAmount [static, get]
Mouse dragging amount.
Returns:
Point
Definition at line 225 of file Input.cs.
6.18.4.12
int GalaxyWars.GameLogic.Input.MouseWheelDelta [static, get]
Mouse wheel delta.
Returns:
Int
Definition at line 247 of file Input.cs.
6.18.4.13
KeyboardState GalaxyWars.GameLogic.Input.Keyboard [static, get]
Keyboard.
Returns:
Keyboard state
Definition at line 303 of file Input.cs.
6.18.4.14
bool GalaxyWars.GameLogic.Input.KeyboardSpaceJustPressed [static, get]
Keyboard space just pressed.
Returns:
Bool
Definition at line 458 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
6.18.4.15
177
bool GalaxyWars.GameLogic.Input.KeyboardF1JustPressed [static, get]
Keyboard F1 just pressed.
Returns:
Bool
Definition at line 471 of file Input.cs.
6.18.4.16
bool GalaxyWars.GameLogic.Input.KeyboardEscapeJustPressed [static, get]
Keyboard escape just pressed.
Returns:
Bool
Definition at line 484 of file Input.cs.
6.18.4.17
bool GalaxyWars.GameLogic.Input.KeyboardLeftJustPressed [static, get]
Keyboard left just pressed.
Returns:
Bool
Definition at line 497 of file Input.cs.
6.18.4.18
bool GalaxyWars.GameLogic.Input.KeyboardRightJustPressed [static, get]
Keyboard right just pressed.
Returns:
Bool
Definition at line 510 of file Input.cs.
6.18.4.19
bool GalaxyWars.GameLogic.Input.KeyboardUpJustPressed [static, get]
Keyboard up just pressed.
Returns:
Bool
Definition at line 523 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
178
Class Documentation
6.18.4.20
bool GalaxyWars.GameLogic.Input.KeyboardDownJustPressed [static, get]
Keyboard down just pressed.
Returns:
Bool
Definition at line 536 of file Input.cs.
6.18.4.21
bool GalaxyWars.GameLogic.Input.KeyboardLeftPressed [static, get]
Keyboard left pressed.
Returns:
Bool
Definition at line 549 of file Input.cs.
6.18.4.22
bool GalaxyWars.GameLogic.Input.KeyboardRightPressed [static, get]
Keyboard right pressed.
Returns:
Bool
Definition at line 561 of file Input.cs.
6.18.4.23
bool GalaxyWars.GameLogic.Input.KeyboardUpPressed [static, get]
Keyboard up pressed.
Returns:
Bool
Definition at line 573 of file Input.cs.
6.18.4.24
bool GalaxyWars.GameLogic.Input.KeyboardDownPressed [static, get]
Keyboard down pressed.
Returns:
Bool
Definition at line 585 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
6.18.4.25
GamePadState GalaxyWars.GameLogic.Input.GamePad [static, get]
Game pad.
Returns:
Game pad state
Definition at line 601 of file Input.cs.
6.18.4.26
bool GalaxyWars.GameLogic.Input.IsGamePadConnected [static, get]
Is game pad connected.
Returns:
Bool
Definition at line 613 of file Input.cs.
6.18.4.27
bool GalaxyWars.GameLogic.Input.GamePadStartPressed [static, get]
Game pad start pressed.
Returns:
Bool
Definition at line 625 of file Input.cs.
6.18.4.28
bool GalaxyWars.GameLogic.Input.GamePadAPressed [static, get]
Game pad a pressed.
Returns:
Bool
Definition at line 637 of file Input.cs.
6.18.4.29
bool GalaxyWars.GameLogic.Input.GamePadBPressed [static, get]
Game pad b pressed.
Returns:
Bool
Definition at line 649 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
179
180
Class Documentation
6.18.4.30
bool GalaxyWars.GameLogic.Input.GamePadXPressed [static, get]
Game pad x pressed.
Returns:
Bool
Definition at line 661 of file Input.cs.
6.18.4.31
bool GalaxyWars.GameLogic.Input.GamePadYPressed [static, get]
Game pad y pressed.
Returns:
Bool
Definition at line 673 of file Input.cs.
6.18.4.32
bool GalaxyWars.GameLogic.Input.GamePadLeftPressed [static, get]
Game pad left pressed.
Returns:
Bool
Definition at line 685 of file Input.cs.
6.18.4.33
bool GalaxyWars.GameLogic.Input.GamePadRightPressed [static, get]
Game pad right pressed.
Returns:
Bool
Definition at line 698 of file Input.cs.
6.18.4.34
bool GalaxyWars.GameLogic.Input.GamePadLeftJustPressed [static, get]
Game pad left just pressed.
Returns:
Bool
Definition at line 711 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.18 GalaxyWars.GameLogic.Input Class Reference
6.18.4.35
bool GalaxyWars.GameLogic.Input.GamePadRightJustPressed [static, get]
Game pad right just pressed.
Returns:
Bool
Definition at line 726 of file Input.cs.
6.18.4.36
bool GalaxyWars.GameLogic.Input.GamePadUpJustPressed [static, get]
Game pad up just pressed.
Returns:
Bool
Definition at line 741 of file Input.cs.
6.18.4.37
bool GalaxyWars.GameLogic.Input.GamePadDownJustPressed [static, get]
Game pad down just pressed.
Returns:
Bool
Definition at line 756 of file Input.cs.
6.18.4.38
bool GalaxyWars.GameLogic.Input.GamePadUpPressed [static, get]
Game pad up pressed.
Returns:
Bool
Definition at line 771 of file Input.cs.
6.18.4.39
bool GalaxyWars.GameLogic.Input.GamePadDownPressed [static, get]
Game pad down pressed.
Returns:
Bool
Definition at line 784 of file Input.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
181
182
Class Documentation
6.18.4.40
bool GalaxyWars.GameLogic.Input.GamePadAJustPressed [static, get]
Game pad a just pressed.
Returns:
Bool
Definition at line 797 of file Input.cs.
6.18.4.41
bool GalaxyWars.GameLogic.Input.GamePadBJustPressed [static, get]
Game pad b just pressed.
Returns:
Bool
Definition at line 810 of file Input.cs.
6.18.4.42
bool GalaxyWars.GameLogic.Input.GamePadXJustPressed [static, get]
Game pad x just pressed.
Returns:
Bool
Definition at line 826 of file Input.cs.
6.18.4.43
bool GalaxyWars.GameLogic.Input.GamePadYJustPressed [static, get]
Game pad y just pressed.
Returns:
Bool
Definition at line 839 of file Input.cs.
6.18.4.44
bool GalaxyWars.GameLogic.Input.GamePadBackJustPressed [static, get]
Game pad back just pressed.
Returns:
Bool
Definition at line 852 of file Input.cs.
The documentation for this class was generated from the following file:
• Input.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.19 GalaxyWars.Graphics.LensFlare Class Reference
6.19
183
GalaxyWars.Graphics.LensFlare Class Reference
Lens flare class for simple 2d lens flare rendering.
Collaboration diagram for GalaxyWars.Graphics.LensFlare:
Color
Texture2D
color
internalXnaTexture
GalaxyWars.Graphics.LensFlare.FlareData
flareTypes
GalaxyWars.Graphics.Texture
flareTextures
GalaxyWars.Graphics.LensFlare
Public Member Functions
• LensFlare (Vector3 setLensOrigin3D)
Create lens flare base.
• void Dispose ()
Dispose.
• void Render (Color sunColor)
Render lens flare. Checks the zbuffer if objects are occluding the lensflare sun.
Static Public Member Functions
• static Vector3 RotateSun (float rotation)
Returns rotated sun position for the game.
Static Public Attributes
• static Vector3 DefaultSunPos
Default sun position!
• static Vector3 DefaultLightPos
Put light at a little different location because we want to see the sun, but still have the light come more from
the top.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
184
Class Documentation
Protected Member Functions
• virtual void Dispose (bool disposing)
Dispose.
Protected Attributes
• const int SunFlareType = 0
Flare texture types.
•
•
•
•
•
•
•
•
const int GlowFlareType = 1
const int LensFlareType = 2
const int StreaksType = 3
const int RingType = 4
const int HaloType = 5
const int CircleType = 6
const int NumberOfFlareTypes = 7
Texture[ ] flareTextures
Flare textures.
• FlareData[ ] flareTypes
Flare types for the lens flares.
Properties
• static Vector3 Origin3D [get, set]
Origin 3D.
Private Member Functions
• void LoadTextures ()
Load textures, should be called in constructor.
Private Attributes
• string[ ] flareTextureNames
Flare texture names.
• float sunIntensity = 0.0f
Current sun intensity used for our lens flare effect.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.19 GalaxyWars.Graphics.LensFlare Class Reference
185
Static Private Attributes
• static Vector3 lensOrigin3D
Lens flare origin in 3D.
• static int ScreenFlareSize = 225
Screen flare size (resolution dependant, 250 is for 1024∗768).
Classes
• struct FlareData
Flare data struct for the quick and easy flare type list below.
6.19.1
Detailed Description
Lens flare class for simple 2d lens flare rendering.
If you want to read more about lens flares I suggest the following articles:
http://www.gamedev.net/reference/articles/article813.asp
http://www.gamedev.net/reference/articles/article874.asp Game Programming Gems, Chapter 5.1 Game Programming Gems 2, Chapter 5.5
Note: This class is not as powerful as the lensflares in Rocket Commander because occlusion querying is
not possible in XNA yet!
Definition at line 29 of file LensFlare.cs.
6.19.2
Constructor & Destructor Documentation
6.19.2.1
GalaxyWars.Graphics.LensFlare.LensFlare (Vector3 setLensOrigin3D)
Create lens flare base.
Definition at line 247 of file LensFlare.cs.
248
249
250
251
{
lensOrigin3D = setLensOrigin3D;
LoadTextures();
}
6.19.3
Member Function Documentation
6.19.3.1
static Vector3 GalaxyWars.Graphics.LensFlare.RotateSun (float rotation) [static]
Returns rotated sun position for the game.
Parameters:
rotation Rotation
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
186
Class Documentation
Returns:
Vector 3
Definition at line 51 of file LensFlare.cs.
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
Vector3 sunPos = DefaultSunPos;
Vector2 right = new Vector2(
+(float)Math.Cos(rotation),
+(float)Math.Sin(rotation));
Vector2 up = new Vector2(
+(float)Math.Sin(rotation),
-(float)Math.Cos(rotation));
// Only rotate x and z
return new Vector3(
-right.X * sunPos.X - up.X * sunPos.Z,
sunPos.Y,
-right.Y * sunPos.X - up.Y * sunPos.Z);
}
6.19.3.2
void GalaxyWars.Graphics.LensFlare.LoadTextures () [private]
Load textures, should be called in constructor.
Definition at line 114 of file LensFlare.cs.
115
116
117
118
{
for (int num = 0; num < NumberOfFlareTypes; num++)
flareTextures[num] = new Texture(flareTextureNames[num]);
}
6.19.3.3
void GalaxyWars.Graphics.LensFlare.Dispose ()
Dispose.
Definition at line 258 of file LensFlare.cs.
259
260
261
262
{
Dispose(true);
GC.SuppressFinalize(this);
}
6.19.3.4
virtual void GalaxyWars.Graphics.LensFlare.Dispose (bool disposing) [protected,
virtual]
Dispose.
Parameters:
disposing Disposing
Definition at line 268 of file LensFlare.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.19 GalaxyWars.Graphics.LensFlare Class Reference
269
270
271
272
273
274
275
276
6.19.3.5
187
{
if (disposing)
{
for (int num = 0; num < NumberOfFlareTypes; num++)
if (flareTextures[num] != null)
flareTextures[num].Dispose();
}
}
void GalaxyWars.Graphics.LensFlare.Render (Color sunColor)
Render lens flare. Checks the zbuffer if objects are occluding the lensflare sun.
Definition at line 289 of file LensFlare.cs.
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
{
ScreenFlareSize = 250 * BaseGame.Width / 1024;
Vector3 relativeLensPos = lensOrigin3D + BaseGame.CameraPos;
// Only show lens flare if facing in the right direction
if (BaseGame.PointInFront(relativeLensPos) == false)
return;
// Convert 3D point to 2D!
Point lensOrigin =
BaseGame.Convert3DPointTo2D(relativeLensPos);
// Check sun occlusion itensity and fade it in and out!
float thisSunIntensity = 0.75f;
/*unsupported in XNA: BaseGame.OcclusionIntensity(
flareMaterials[SunFlareType].diffuseTexture,
lensOrigin, ScreenFlareSize / 5);
*/
sunIntensity = thisSunIntensity * 0.1f + sunIntensity * 0.9f;
// We can skip rendering the sun if the itensity is to low
if (sunIntensity < 0.01f)
return;
int resWidth = BaseGame.Width,
resHeight = BaseGame.Height;
Point center = new Point(resWidth / 2, resHeight / 2);
Point relOrigin = new Point(
center.X - lensOrigin.X, center.Y - lensOrigin.Y);
// Check if origin is on screen, fade out at borders
float alpha = 1.0f;
float distance = Math.Abs(Math.Max(relOrigin.X, relOrigin.Y));
if (distance > resHeight / 1.75f)
{
distance -= resHeight / 1.75f;
// If distance is more than half the resolution, don’t show anything!
if (distance > resHeight / 1.75f)
return;
alpha = 1.0f - (distance / ((float)resHeight / 1.75f));
if (alpha > 1.0f)
alpha = 1.0f;
}
// Use square of sunIntensity for lens flares because we want
// them to get very weak if sun is not fully visible.
alpha *= sunIntensity * sunIntensity;
foreach (FlareData data in flareTypes)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
188
Class Documentation
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
{
int size = (int)(ScreenFlareSize * data.scale);
flareTextures[data.type].RenderOnScreen(
new Rectangle(
(int)(center.X - relOrigin.X * data.position - size / 2),
(int)(center.Y - relOrigin.Y * data.position - size / 2),
size, size),
flareTextures[data.type].GfxRectangle,
ColorHelper.ApplyAlphaToColor(//MixAlphaToColor(
ColorHelper.MultiplyColors(sunColor, data.color),
((float)data.color.A / 255.0f) *
// For the sun and glow flares try always to use max. intensity
(data.type == SunFlareType || data.type == GlowFlareType ?
sunIntensity : alpha)),
SpriteBlendMode.Additive);
}
}
6.19.4
Member Data Documentation
6.19.4.1
Vector3 GalaxyWars.Graphics.LensFlare.DefaultSunPos [static]
Initial value:
new Vector3(+2500, -22500, +15000)
Default sun position!
Definition at line 35 of file LensFlare.cs.
6.19.4.2
Vector3 GalaxyWars.Graphics.LensFlare.DefaultLightPos [static]
Initial value:
new Vector3(+8500, -7250, +15000)
Put light at a little different location because we want to see the sun, but still have the light come more from
the top.
Definition at line 42 of file LensFlare.cs.
6.19.4.3
Vector3 GalaxyWars.Graphics.LensFlare.lensOrigin3D [static, private]
Lens flare origin in 3D.
Definition at line 71 of file LensFlare.cs.
6.19.4.4
int GalaxyWars.Graphics.LensFlare.ScreenFlareSize = 225 [static, private]
Screen flare size (resolution dependant, 250 is for 1024∗768).
Definition at line 76 of file LensFlare.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.19 GalaxyWars.Graphics.LensFlare Class Reference
6.19.4.5
189
const int GalaxyWars.Graphics.LensFlare.SunFlareType = 0 [protected]
Flare texture types.
Definition at line 82 of file LensFlare.cs.
6.19.4.6
const int GalaxyWars.Graphics.LensFlare.GlowFlareType = 1 [protected]
Definition at line 83 of file LensFlare.cs.
6.19.4.7
const int GalaxyWars.Graphics.LensFlare.LensFlareType = 2 [protected]
Definition at line 84 of file LensFlare.cs.
6.19.4.8
const int GalaxyWars.Graphics.LensFlare.StreaksType = 3 [protected]
Definition at line 85 of file LensFlare.cs.
6.19.4.9
const int GalaxyWars.Graphics.LensFlare.RingType = 4 [protected]
Definition at line 86 of file LensFlare.cs.
6.19.4.10
const int GalaxyWars.Graphics.LensFlare.HaloType = 5 [protected]
Definition at line 87 of file LensFlare.cs.
6.19.4.11
const int GalaxyWars.Graphics.LensFlare.CircleType = 6 [protected]
Definition at line 88 of file LensFlare.cs.
6.19.4.12
const int GalaxyWars.Graphics.LensFlare.NumberOfFlareTypes = 7 [protected]
Definition at line 89 of file LensFlare.cs.
6.19.4.13
Texture [ ] GalaxyWars.Graphics.LensFlare.flareTextures [protected]
Initial value:
new Texture[NumberOfFlareTypes]
Flare textures.
Definition at line 94 of file LensFlare.cs.
6.19.4.14
string [ ] GalaxyWars.Graphics.LensFlare.flareTextureNames [private]
Initial value:
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
190
Class Documentation
new string[]
{
"Sun",
"Glow",
"Lens",
"Streaks",
"Ring",
"Halo",
"Circle",
}
Flare texture names.
Definition at line 100 of file LensFlare.cs.
6.19.4.15
FlareData [ ] GalaxyWars.Graphics.LensFlare.flareTypes [protected]
Flare types for the lens flares.
Definition at line 164 of file LensFlare.cs.
6.19.4.16
float GalaxyWars.Graphics.LensFlare.sunIntensity = 0.0f [private]
Current sun intensity used for our lens flare effect.
Definition at line 283 of file LensFlare.cs.
6.19.5
Property Documentation
6.19.5.1
Vector3 GalaxyWars.Graphics.LensFlare.Origin3D [static, get, set]
Origin 3D.
Returns:
Vector3
Definition at line 231 of file LensFlare.cs.
The documentation for this class was generated from the following file:
• LensFlare.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.20 GalaxyWars.Graphics.LensFlare.FlareData Struct Reference
6.20
191
GalaxyWars.Graphics.LensFlare.FlareData Struct Reference
Flare data struct for the quick and easy flare type list below.
Collaboration diagram for GalaxyWars.Graphics.LensFlare.FlareData:
Color
color
GalaxyWars.Graphics.LensFlare.FlareData
Public Member Functions
• FlareData (int setType, float setPosition, float setScale, Color setColor)
Constructor to set all values.
Public Attributes
• int type
Type of flare, see above.
• float position
Position of flare (1=origin, 0=center of screen, -1=other side).
• float scale
Scale of flare in relation to MaxFlareSize.
• Color color
Color of this flare.
6.20.1
Detailed Description
Flare data struct for the quick and easy flare type list below.
Definition at line 125 of file LensFlare.cs.
6.20.2
Constructor & Destructor Documentation
6.20.2.1
GalaxyWars.Graphics.LensFlare.FlareData.FlareData (int setType, float setPosition, float
setScale, Color setColor)
Constructor to set all values.
Parameters:
setType Set type
setPosition Set position
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
192
Class Documentation
setScale Set scale
setColor Set Color
Definition at line 151 of file LensFlare.cs.
153
154
155
156
157
158
{
type = setType;
position = setPosition;
scale = setScale;
color = setColor;
}
6.20.3
Member Data Documentation
6.20.3.1
int GalaxyWars.Graphics.LensFlare.FlareData.type
Type of flare, see above.
Definition at line 130 of file LensFlare.cs.
6.20.3.2
float GalaxyWars.Graphics.LensFlare.FlareData.position
Position of flare (1=origin, 0=center of screen, -1=other side).
Definition at line 134 of file LensFlare.cs.
6.20.3.3
float GalaxyWars.Graphics.LensFlare.FlareData.scale
Scale of flare in relation to MaxFlareSize.
Definition at line 138 of file LensFlare.cs.
6.20.3.4
Color GalaxyWars.Graphics.LensFlare.FlareData.color
Color of this flare.
Definition at line 142 of file LensFlare.cs.
The documentation for this struct was generated from the following file:
• LensFlare.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.21 GalaxyWars.Graphics.LineManager2D Class Reference
6.21
193
GalaxyWars.Graphics.LineManager2D Class Reference
LineManager class, used for drawing lines. We can’t simply draw lines like in OpenGL (glLine) because
we need to do everything with vertex buffers, which is a bit more work (and using DrawPrimitives directly
produces way worse code).
Public Member Functions
• LineManager2D ()
Create LineManager.
• void Dispose ()
Dispose.
• void AddLine (Point startPoint, Point endPoint, Color color)
Add line.
• void AddLineWithShadow (Point startPoint, Point endPoint, Color color)
Add line with shadow.
• virtual void Render ()
Render all lines added this frame.
Protected Member Functions
• virtual void Dispose (bool disposing)
Dispose.
Private Member Functions
• void UpdateVertexBuffer ()
Update vertex buffer.
Private Attributes
• int numOfLines = 0
Number of lines used this frame, will be set to 0 when rendering.
• List< Line > lines = new List<Line>()
The actual list for all the lines, it will NOT be reseted each frame like numOfLines! We will remember the
last lines and only change this list when anything changes (new line, old line missing, changing line data).
When this happens buildVertexBuffer will be set to true.
• bool buildVertexBuffer = false
Build vertex buffer this frame because the line list was changed? Note: The vertex buffer implementation
was removed some time ago, but this variable is still used to check for updates to lineVertices!
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
194
Class Documentation
• VertexPositionColor[ ] lineVertices
Vertex buffer for all lines.
• int numOfPrimitives = 0
Real number of primitives currently used.
• const int MaxNumOfLines = 64
Max. number of lines allowed.
• VertexDeclaration decl = null
Vertex declaration for our lines.
Classes
• struct Line
Struct for a line, instances of this struct will be added to lines.
6.21.1
Detailed Description
LineManager class, used for drawing lines. We can’t simply draw lines like in OpenGL (glLine) because
we need to do everything with vertex buffers, which is a bit more work (and using DrawPrimitives directly
produces way worse code).
Definition at line 20 of file LineManager2D.cs.
6.21.2
Constructor & Destructor Documentation
6.21.2.1
GalaxyWars.Graphics.LineManager2D.LineManager2D ()
Create LineManager.
Definition at line 145 of file LineManager2D.cs.
146
147
148
149
{
decl = new VertexDeclaration(
GalaxyWarsManager.Device, VertexPositionColor.VertexElements);
}
6.21.3
Member Function Documentation
6.21.3.1
void GalaxyWars.Graphics.LineManager2D.Dispose ()
Dispose.
Definition at line 156 of file LineManager2D.cs.
157
158
159
160
{
Dispose(true);
GC.SuppressFinalize(this);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.21 GalaxyWars.Graphics.LineManager2D Class Reference
6.21.3.2
195
virtual void GalaxyWars.Graphics.LineManager2D.Dispose (bool disposing)
[protected, virtual]
Dispose.
Parameters:
disposing Disposing
Definition at line 166 of file LineManager2D.cs.
167
168
169
170
171
172
6.21.3.3
{
if (disposing)
{
decl.Dispose();
}
}
void GalaxyWars.Graphics.LineManager2D.UpdateVertexBuffer () [private]
Update vertex buffer.
Definition at line 179 of file LineManager2D.cs.
References
GalaxyWars.Graphics.LineManager2D.Line.color,
GalaxyWars.Graphics.LineManager2D.Line.endPoint, and GalaxyWars.Graphics.LineManager2D.Line.startPoint.
180
{
181
// Don’t do anything if we got no lines.
182
if (numOfLines == 0 ||
183
// Or if some data is invalid
184
lines.Count < numOfLines)
185
{
186
numOfPrimitives = 0;
187
return;
188
}
189 #if LOG_STUFF
190
Log.Write("LineManager.UpdateVertexBuffer() numOfLines=" +
191
numOfLines + ", buildVertexBuffer=" + buildVertexBuffer);
192 #endif
193
194
// Set all lines
195
for (int lineNum = 0; lineNum < numOfLines; lineNum++)
196
{
197
Line line = (Line)lines[lineNum];
198
lineVertices[lineNum * 2 + 0] = new VertexPositionColor(
199
new Vector3(
200
-1.0f + 2.0f * line.startPoint.X / BaseGame.Width,
201
-(-1.0f + 2.0f * line.startPoint.Y / BaseGame.Height), 0),
202
line.color);
203
lineVertices[lineNum * 2 + 1] = new VertexPositionColor(
204
new Vector3(
205
-1.0f + 2.0f * line.endPoint.X / BaseGame.Width,
206
-(-1.0f + 2.0f * line.endPoint.Y / BaseGame.Height), 0),
207
line.color);
208
}
209
numOfPrimitives = numOfLines;
210
211
// Vertex buffer was build
212
buildVertexBuffer = false;
213
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
196
Class Documentation
6.21.3.4
void GalaxyWars.Graphics.LineManager2D.AddLine (Point startPoint, Point endPoint,
Color color)
Add line.
Definition at line 220 of file LineManager2D.cs.
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
{
// Don’t add new lines if limit is reached
if (numOfLines >= MaxNumOfLines)
{
Log.Write("Too many lines requested in LineManager2D. " +
"Max lines = " + MaxNumOfLines);
return;
}
// Build line
Line line = new Line(startPoint, endPoint, color);
// Check if this exact line exists at the current lines position.
if (lines.Count > numOfLines)
{
if ((Line)lines[numOfLines] != line)
{
// overwrite old line, otherwise just increase numOfLines
lines[numOfLines] = line;
// Remember to build vertex buffer in Render()
buildVertexBuffer = true;
}
}
else
{
// Then just add new line
lines.Add(line);
// Remember to build vertex buffer in Render()
buildVertexBuffer = true;
}
// nextUpValue line
numOfLines++;
}
6.21.3.5
void GalaxyWars.Graphics.LineManager2D.AddLineWithShadow (Point startPoint,
Point endPoint, Color color)
Add line with shadow.
Parameters:
startPoint Start point
endPoint End point
color Color
Definition at line 262 of file LineManager2D.cs.
264
265
266
267
268
{
AddLine(new Point(startPoint.X, startPoint.Y + 1),
new Point(endPoint.X, endPoint.Y + 1), Color.Black);
AddLine(startPoint, endPoint, color);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.21 GalaxyWars.Graphics.LineManager2D Class Reference
6.21.3.6
197
virtual void GalaxyWars.Graphics.LineManager2D.Render () [virtual]
Render all lines added this frame.
Definition at line 275 of file LineManager2D.cs.
Referenced by GalaxyWars.Graphics.UIRenderer.Render().
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
{
// Need to build vertex buffer?
if (buildVertexBuffer ||
numOfPrimitives != numOfLines)
{
UpdateVertexBuffer();
}
// Render lines if we got any lines to render
if (numOfPrimitives > 0)
{
BaseGame.SetAlphaBlendingEnabled(true);
BaseGame.WorldMatrix = Matrix.Identity;
ShaderEffect.lineRendering.Render(
"LineRendering2D",
delegate
{
BaseGame.Device.VertexDeclaration = decl;
BaseGame.Device.DrawUserPrimitives<VertexPositionColor>(
PrimitiveType.LineList, lineVertices, 0, numOfPrimitives);
});
}
// Ok, finally reset numOfLines for next frame
numOfLines = 0;
}
6.21.4
Member Data Documentation
6.21.4.1
int GalaxyWars.Graphics.LineManager2D.numOfLines = 0 [private]
Number of lines used this frame, will be set to 0 when rendering.
Definition at line 26 of file LineManager2D.cs.
6.21.4.2
List<Line> GalaxyWars.Graphics.LineManager2D.lines = new List<Line>()
[private]
The actual list for all the lines, it will NOT be reseted each frame like numOfLines! We will remember the
last lines and only change this list when anything changes (new line, old line missing, changing line data).
When this happens buildVertexBuffer will be set to true.
Definition at line 35 of file LineManager2D.cs.
6.21.4.3
bool GalaxyWars.Graphics.LineManager2D.buildVertexBuffer = false [private]
Build vertex buffer this frame because the line list was changed? Note: The vertex buffer implementation
was removed some time ago, but this variable is still used to check for updates to lineVertices!
Definition at line 118 of file LineManager2D.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
198
Class Documentation
6.21.4.4
VertexPositionColor [ ] GalaxyWars.Graphics.LineManager2D.lineVertices [private]
Initial value:
new VertexPositionColor[MaxNumOfLines * 2]
Vertex buffer for all lines.
Definition at line 123 of file LineManager2D.cs.
6.21.4.5
int GalaxyWars.Graphics.LineManager2D.numOfPrimitives = 0 [private]
Real number of primitives currently used.
Definition at line 128 of file LineManager2D.cs.
6.21.4.6
const int GalaxyWars.Graphics.LineManager2D.MaxNumOfLines = 64 [private]
Max. number of lines allowed.
Definition at line 133 of file LineManager2D.cs.
6.21.4.7
VertexDeclaration GalaxyWars.Graphics.LineManager2D.decl = null [private]
Vertex declaration for our lines.
Definition at line 138 of file LineManager2D.cs.
The documentation for this class was generated from the following file:
• LineManager2D.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.22 GalaxyWars.Graphics.LineManager2D.Line Struct Reference
6.22
GalaxyWars.Graphics.LineManager2D.Line Struct Reference
Struct for a line, instances of this struct will be added to lines.
Collaboration diagram for GalaxyWars.Graphics.LineManager2D.Line:
Color
color
GalaxyWars.Graphics.LineManager2D.Line
Public Member Functions
• Line (Point setStartPoint, Point setEndPoint, Color setColor)
Create line.
• override bool Equals (object a)
Support Equals(.) to keep the compiler happy (because we used == and !=).
• override int GetHashCode ()
Support GetHashCode() to keep the compiler happy (because we used == and !=).
Static Public Member Functions
• static bool operator== (Line a, Line b)
Are these two Lines equal?
• static bool operator!= (Line a, Line b)
Are these two Lines not equal?
Public Attributes
• Point startPoint
Positions.
• Point endPoint
• Color color
Color.
6.22.1
199
Detailed Description
Struct for a line, instances of this struct will be added to lines.
Definition at line 40 of file LineManager2D.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
200
Class Documentation
6.22.2
Constructor & Destructor Documentation
6.22.2.1
GalaxyWars.Graphics.LineManager2D.Line.Line (Point setStartPoint, Point setEndPoint,
Color setColor)
Create line.
Parameters:
setStartPoint Set start point
setEndPoint Set end point
setColor Set color
Definition at line 60 of file LineManager2D.cs.
62
63
64
65
66
{
startPoint = setStartPoint;
endPoint = setEndPoint;
color = setColor;
}
6.22.3
Member Function Documentation
6.22.3.1
static bool GalaxyWars.Graphics.LineManager2D.Line.operator== (Line a, Line b)
[static]
Are these two Lines equal?
Definition at line 73 of file LineManager2D.cs.
74
75
76
77
78
6.22.3.2
{
return a.startPoint == b.startPoint &&
a.endPoint == b.endPoint &&
a.color == b.color;
}
static bool GalaxyWars.Graphics.LineManager2D.Line.operator!= (Line a, Line b)
[static]
Are these two Lines not equal?
Definition at line 83 of file LineManager2D.cs.
References
GalaxyWars.Graphics.LineManager2D.Line.color,
GalaxyWars.Graphics.LineManager2D.Line.endPoint, and GalaxyWars.Graphics.LineManager2D.Line.startPoint.
84
85
86
87
88
{
return a.startPoint != b.startPoint ||
a.endPoint != b.endPoint ||
a.color != b.color;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.22 GalaxyWars.Graphics.LineManager2D.Line Struct Reference
6.22.3.3
201
override bool GalaxyWars.Graphics.LineManager2D.Line.Equals (object a)
Support Equals(.) to keep the compiler happy (because we used == and !=).
Definition at line 94 of file LineManager2D.cs.
95
96
97
98
99
100
{
if (a is Line)
return (Line)a == this;
return false;
}
6.22.3.4
override int GalaxyWars.Graphics.LineManager2D.Line.GetHashCode ()
Support GetHashCode() to keep the compiler happy (because we used == and !=).
Definition at line 106 of file LineManager2D.cs.
107
108
109
{
return 0; // Not supported or nessescary
}
6.22.4
Member Data Documentation
6.22.4.1
Point GalaxyWars.Graphics.LineManager2D.Line.startPoint
Positions.
Definition at line 46 of file LineManager2D.cs.
Referenced
by
GalaxyWars.Graphics.LineManager2D.Line.operator!=(),
Wars.Graphics.LineManager2D.UpdateVertexBuffer().
6.22.4.2
and
Galaxy-
and
Galaxy-
and
Galaxy-
Point GalaxyWars.Graphics.LineManager2D.Line.endPoint
Definition at line 46 of file LineManager2D.cs.
Referenced
by
GalaxyWars.Graphics.LineManager2D.Line.operator!=(),
Wars.Graphics.LineManager2D.UpdateVertexBuffer().
6.22.4.3
Color GalaxyWars.Graphics.LineManager2D.Line.color
Color.
Definition at line 50 of file LineManager2D.cs.
Referenced
by
GalaxyWars.Graphics.LineManager2D.Line.operator!=(),
Wars.Graphics.LineManager2D.UpdateVertexBuffer().
The documentation for this struct was generated from the following file:
• LineManager2D.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
202
Class Documentation
6.23
GalaxyWars.Graphics.LineManager3D Class Reference
Helper class for game for rendering lines. This class will collect all line calls, then build a new vertex buffer
if any line has changed or the line number changed and finally will render all lines in the vertex buffer at
the end of the frame (so this class is obviously only for 2D lines directly on screen, no z buffer and no stuff
will be in front of the lines, because everything is rendered at the end of the frame).
Public Member Functions
• LineManager3D ()
Init LineManager.
• void Dispose ()
Dispose.
• void AddLine (Vector3 startPoint, Color startColor, Vector3 endPoint, Color endColor)
Add line.
• void AddLine (Vector3 startPoint, Vector3 endPoint, Color color)
Add line (only 1 color for start and end version).
• void Render ()
Render all lines added this frame.
Protected Member Functions
• virtual void Dispose (bool disposing)
Dispose.
• void UpdateVertexBuffer ()
Protected Attributes
• const int MaxNumOfLines = 65535
Max. number of lines allowed to prevent to big buffer, will never be reached, but in case something goes
wrong or numOfLines is not reseted each frame, we won’t add unlimited lines (all new lines will be ignored
if this max. number is reached).
Private Attributes
• int numOfLines = 0
Number of lines used this frame, will be set to 0 when rendering.
• List< Line > lines = new List<Line>()
The actual list for all the lines, it will NOT be reseted each frame like numOfLines! We will remember the
last lines and only change this list when anything changes (new line, old line missing, changing line data).
When this happens buildVertexBuffer will be set to true.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.23 GalaxyWars.Graphics.LineManager3D Class Reference
203
• bool buildVertexBuffer = false
Build vertex buffer this frame because the line list was changed?
• VertexPositionColor[ ] lineVertices
Vertex buffer for all lines.
• int numOfPrimitives = 0
Real number of primitives currently used.
• VertexDeclaration decl = null
Vertex declaration for our lines.
Classes
• struct Line
Struct for a line, instances of this class will be added to lines.
6.23.1
Detailed Description
Helper class for game for rendering lines. This class will collect all line calls, then build a new vertex buffer
if any line has changed or the line number changed and finally will render all lines in the vertex buffer at
the end of the frame (so this class is obviously only for 2D lines directly on screen, no z buffer and no stuff
will be in front of the lines, because everything is rendered at the end of the frame).
Definition at line 24 of file LineManager3D.cs.
6.23.2
Constructor & Destructor Documentation
6.23.2.1
GalaxyWars.Graphics.LineManager3D.LineManager3D ()
Init LineManager.
Definition at line 151 of file LineManager3D.cs.
152
153
154
155
156
157
158
159
{
if (BaseGame.Device == null)
throw new ArgumentNullException(
"XNA device is not initialized, can’t init line manager.");
decl = new VertexDeclaration(
BaseGame.Device, VertexPositionColor.VertexElements);
}
6.23.3
Member Function Documentation
6.23.3.1
void GalaxyWars.Graphics.LineManager3D.Dispose ()
Dispose.
Definition at line 167 of file LineManager3D.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
204
Class Documentation
168
169
170
171
{
Dispose(true);
GC.SuppressFinalize(this);
}
6.23.3.2
virtual void GalaxyWars.Graphics.LineManager3D.Dispose (bool disposing)
[protected, virtual]
Dispose.
Parameters:
disposing Disposing
Definition at line 177 of file LineManager3D.cs.
178
179
180
181
182
183
6.23.3.3
{
if (disposing)
{
decl.Dispose();
}
}
void GalaxyWars.Graphics.LineManager3D.AddLine (Vector3 startPoint, Color
startColor, Vector3 endPoint, Color endColor)
Add line.
Definition at line 191 of file LineManager3D.cs.
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
{
// Don’t add new lines if limit is reached
if (numOfLines >= MaxNumOfLines)
{
/*ignore
Log.Write("Too many lines requested in LineManager3D. " +
"Max lines = " + MaxNumOfLines);
*/
return;
}
// Build line
Line line = new Line(startPoint, startColor, endPoint, endColor);
// Check if this exact line exists at the current lines position.
if (lines.Count > numOfLines)
{
if ((Line)lines[numOfLines] != line)
{
// overwrite old line, otherwise just increase numOfLines
lines[numOfLines] = line;
// Remember to build vertex buffer in Render()
buildVertexBuffer = true;
}
}
else
{
// Then just add new line
lines.Add(line);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.23 GalaxyWars.Graphics.LineManager3D Class Reference
223
224
225
226
227
228
229
6.23.3.4
205
// Remember to build vertex buffer in Render()
buildVertexBuffer = true;
}
// nextUpValue line
numOfLines++;
}
void GalaxyWars.Graphics.LineManager3D.AddLine (Vector3 startPoint, Vector3
endPoint, Color color)
Add line (only 1 color for start and end version).
Definition at line 234 of file LineManager3D.cs.
236
237
238
6.23.3.5
{
AddLine(startPoint, color, endPoint, color);
}
void GalaxyWars.Graphics.LineManager3D.UpdateVertexBuffer () [protected]
Definition at line 243 of file LineManager3D.cs.
References
GalaxyWars.Graphics.LineManager3D.Line.endColor,
GalaxyWars.Graphics.LineManager3D.Line.endPoint, GalaxyWars.Graphics.LineManager3D.Line.startColor,
and GalaxyWars.Graphics.LineManager3D.Line.startPoint.
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
6.23.3.6
{
// Don’t do anything if we got no lines.
if (numOfLines == 0 ||
// Or if some data is invalid
lines.Count < numOfLines)
{
numOfPrimitives = 0;
return;
}
// Set all lines
for (int lineNum = 0; lineNum < numOfLines; lineNum++)
{
Line line = (Line)lines[lineNum];
lineVertices[lineNum * 2 + 0] = new VertexPositionColor(
line.startPoint, line.startColor);
lineVertices[lineNum * 2 + 1] = new VertexPositionColor(
line.endPoint, line.endColor);
}
numOfPrimitives = numOfLines;
// Vertex buffer was build
buildVertexBuffer = false;
}
void GalaxyWars.Graphics.LineManager3D.Render ()
Render all lines added this frame.
Definition at line 276 of file LineManager3D.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
206
Class Documentation
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
{
// Need to build vertex buffer?
if (buildVertexBuffer ||
numOfPrimitives != numOfLines)
{
UpdateVertexBuffer();
}
// Render lines if we got any lines to render
if (numOfPrimitives > 0)
{
BaseGame.WorldMatrix = Matrix.Identity;
ShaderEffect.lineRendering.Render(
"LineRendering3D",
delegate
{
BaseGame.SetAlphaBlendingEnabled(true);
BaseGame.Device.VertexDeclaration = decl;
BaseGame.Device.DrawUserPrimitives<VertexPositionColor>(
PrimitiveType.LineList, lineVertices, 0, numOfPrimitives);
});
}
// Ok, finally reset numOfLines for next frame
numOfLines = 0;
}
6.23.4
Member Data Documentation
6.23.4.1
int GalaxyWars.Graphics.LineManager3D.numOfLines = 0 [private]
Number of lines used this frame, will be set to 0 when rendering.
Definition at line 104 of file LineManager3D.cs.
6.23.4.2
List<Line> GalaxyWars.Graphics.LineManager3D.lines = new List<Line>()
[private]
The actual list for all the lines, it will NOT be reseted each frame like numOfLines! We will remember the
last lines and only change this list when anything changes (new line, old line missing, changing line data).
When this happens buildVertexBuffer will be set to true.
Definition at line 113 of file LineManager3D.cs.
6.23.4.3
bool GalaxyWars.Graphics.LineManager3D.buildVertexBuffer = false [private]
Build vertex buffer this frame because the line list was changed?
Definition at line 118 of file LineManager3D.cs.
6.23.4.4
VertexPositionColor [ ] GalaxyWars.Graphics.LineManager3D.lineVertices [private]
Initial value:
new VertexPositionColor[MaxNumOfLines * 2]
Vertex buffer for all lines.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.23 GalaxyWars.Graphics.LineManager3D Class Reference
207
Definition at line 123 of file LineManager3D.cs.
6.23.4.5
int GalaxyWars.Graphics.LineManager3D.numOfPrimitives = 0 [private]
Real number of primitives currently used.
Definition at line 129 of file LineManager3D.cs.
6.23.4.6
const int GalaxyWars.Graphics.LineManager3D.MaxNumOfLines = 65535
[protected]
Max. number of lines allowed to prevent to big buffer, will never be reached, but in case something goes
wrong or numOfLines is not reseted each frame, we won’t add unlimited lines (all new lines will be ignored
if this max. number is reached).
Definition at line 137 of file LineManager3D.cs.
6.23.4.7
VertexDeclaration GalaxyWars.Graphics.LineManager3D.decl = null [private]
Vertex declaration for our lines.
Definition at line 142 of file LineManager3D.cs.
The documentation for this class was generated from the following file:
• LineManager3D.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
208
Class Documentation
6.24
GalaxyWars.Graphics.LineManager3D.Line Struct Reference
Struct for a line, instances of this class will be added to lines.
Collaboration diagram for GalaxyWars.Graphics.LineManager3D.Line:
Color
endColor
startColor
GalaxyWars.Graphics.LineManager3D.Line
Public Member Functions
• Line (Vector3 setStartPoint, Color setStartColor, Vector3 setEndPoint, Color setEndColor)
Constructor.
• override bool Equals (object a)
Support Equals(.) to keep the compiler happy (because we used == and !=).
• override int GetHashCode ()
Support GetHashCode() to keep the compiler happy (because we used == and !=).
Static Public Member Functions
• static bool operator== (Line a, Line b)
Are these two Lines equal?
• static bool operator!= (Line a, Line b)
Are these two Lines not equal?
Public Attributes
•
•
•
•
Vector3 startPoint
Vector3 endPoint
Color startColor
Color endColor
6.24.1
Detailed Description
Struct for a line, instances of this class will be added to lines.
Definition at line 31 of file LineManager3D.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.24 GalaxyWars.Graphics.LineManager3D.Line Struct Reference
6.24.2
Constructor & Destructor Documentation
6.24.2.1
GalaxyWars.Graphics.LineManager3D.Line.Line (Vector3 setStartPoint, Color
setStartColor, Vector3 setEndPoint, Color setEndColor)
209
Constructor.
Definition at line 41 of file LineManager3D.cs.
44
45
46
47
48
49
{
startPoint
startColor
endPoint =
endColor =
= setStartPoint;
= setStartColor;
setEndPoint;
setEndColor;
}
6.24.3
Member Function Documentation
6.24.3.1
static bool GalaxyWars.Graphics.LineManager3D.Line.operator== (Line a, Line b)
[static]
Are these two Lines equal?
Definition at line 54 of file LineManager3D.cs.
References
GalaxyWars.Graphics.LineManager3D.Line.endColor,
GalaxyWars.Graphics.LineManager3D.Line.endPoint, GalaxyWars.Graphics.LineManager3D.Line.startColor,
and GalaxyWars.Graphics.LineManager3D.Line.startPoint.
55
56
57
58
59
60
61
6.24.3.2
{
return
a.startPoint == b.startPoint &&
a.endPoint == b.endPoint &&
a.startColor == b.startColor &&
a.endColor == b.endColor;
}
static bool GalaxyWars.Graphics.LineManager3D.Line.operator!= (Line a, Line b)
[static]
Are these two Lines not equal?
Definition at line 66 of file LineManager3D.cs.
References
GalaxyWars.Graphics.LineManager3D.Line.endColor,
GalaxyWars.Graphics.LineManager3D.Line.endPoint, GalaxyWars.Graphics.LineManager3D.Line.startColor,
and GalaxyWars.Graphics.LineManager3D.Line.startPoint.
67
68
69
70
71
72
73
{
return
a.startPoint != b.startPoint ||
a.endPoint != b.endPoint ||
a.startColor != b.startColor ||
a.endColor != b.endColor;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
210
6.24.3.3
Class Documentation
override bool GalaxyWars.Graphics.LineManager3D.Line.Equals (object a)
Support Equals(.) to keep the compiler happy (because we used == and !=).
Definition at line 79 of file LineManager3D.cs.
80
81
82
83
84
85
6.24.3.4
{
if (a is Line)
return (Line)a == this;
return false;
}
override int GalaxyWars.Graphics.LineManager3D.Line.GetHashCode ()
Support GetHashCode() to keep the compiler happy (because we used == and !=).
Definition at line 91 of file LineManager3D.cs.
92
93
94
{
return 0; // Not supported or nessescary
}
6.24.4
Member Data Documentation
6.24.4.1
Vector3 GalaxyWars.Graphics.LineManager3D.Line.startPoint
Definition at line 34 of file LineManager3D.cs.
Referenced
by
GalaxyWars.Graphics.LineManager3D.Line.operator!=(),
GalaxyWars.Graphics.LineManager3D.Line.operator==(),
and
GalaxyWars.Graphics.LineManager3D.UpdateVertexBuffer().
6.24.4.2
Vector3 GalaxyWars.Graphics.LineManager3D.Line.endPoint
Definition at line 34 of file LineManager3D.cs.
Referenced
by
GalaxyWars.Graphics.LineManager3D.Line.operator!=(),
GalaxyWars.Graphics.LineManager3D.Line.operator==(),
and
GalaxyWars.Graphics.LineManager3D.UpdateVertexBuffer().
6.24.4.3
Color GalaxyWars.Graphics.LineManager3D.Line.startColor
Definition at line 36 of file LineManager3D.cs.
Referenced
by
GalaxyWars.Graphics.LineManager3D.Line.operator!=(),
GalaxyWars.Graphics.LineManager3D.Line.operator==(),
and
GalaxyWars.Graphics.LineManager3D.UpdateVertexBuffer().
6.24.4.4
Color GalaxyWars.Graphics.LineManager3D.Line.endColor
Definition at line 36 of file LineManager3D.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.24 GalaxyWars.Graphics.LineManager3D.Line Struct Reference
211
Referenced
by
GalaxyWars.Graphics.LineManager3D.Line.operator!=(),
GalaxyWars.Graphics.LineManager3D.Line.operator==(),
and
GalaxyWars.Graphics.LineManager3D.UpdateVertexBuffer().
The documentation for this struct was generated from the following file:
• LineManager3D.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
212
Class Documentation
6.25
GalaxyWars.Helpers.Log Class Reference
Log will create automatically a log file and write log/error/debug info for simple runtime error checking,
very useful for minor errors, such as finding not files. The application can still continue working, but this
log provides an easy support to find out what files are missing (in this example).
Static Public Member Functions
• static void Initialize ()
Initializes the logger.
• static void Write (string message)
Writes a LogType and info/error message string to the Log file.
Private Attributes
• const string LogFilename = "GalaxyWars.log"
Log filename.
Static Private Attributes
• static StreamWriter writer = null
Output stream.
6.25.1
Detailed Description
Log will create automatically a log file and write log/error/debug info for simple runtime error checking,
very useful for minor errors, such as finding not files. The application can still continue working, but this
log provides an easy support to find out what files are missing (in this example).
Definition at line 18 of file Log.cs.
6.25.2
Member Function Documentation
6.25.2.1
static void GalaxyWars.Helpers.Log.Initialize () [static]
Initializes the logger.
Definition at line 39 of file Log.cs.
40
41
42
43
44
45
46
47
{
try
{
// Open file
FileStream file = FileHelper.CreateGameContentFile(LogFilename, false);
// Check if file is too big (more than 2 MB),
// in this case we just kill it and create a new one :)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.25 GalaxyWars.Helpers.Log Class Reference
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
6.25.2.2
213
if (file.Length > 2 * 1024 * 1024)
{
file.Close();
file = FileHelper.CreateGameContentFile(LogFilename, false);
}
// Associate writer with that, when writing to a new file,
// make sure UTF-8 sign is written, else don’t write it again!
if (file.Length == 0)
writer = new StreamWriter(file, System.Text.Encoding.UTF8);
else
writer = new StreamWriter(file);
// Go to end of file
writer.BaseStream.Seek(0, SeekOrigin.End);
// Enable auto flush (always be up to date when reading!)
writer.AutoFlush = true;
// Add some info about this session
writer.WriteLine("");
writer.WriteLine("/// Session started at: " + DateTime.Now.ToString());
writer.WriteLine("/// GalaxyWars");
writer.WriteLine("");
}
catch (IOException)
{
// Ignore any file exceptions, if file is not
// createable (e.g. on a CD-Rom) it doesn’t matter.
}
catch (UnauthorizedAccessException)
{
// Ignore any file exceptions, if file is not
// createable (e.g. on a CD-Rom) it doesn’t matter.
}
}
static void GalaxyWars.Helpers.Log.Write (string message) [static]
Writes a LogType and info/error message string to the Log file.
Definition at line 92 of file Log.cs.
93
{
94
95
96
97
98
99
100
101
102
103
104
105
106
107 #if DEBUG
108
109
110 #endif
111
112
113
// Can’t continue without valid writer
if (writer == null)
return;
try
{
DateTime ct = DateTime.Now;
string s = "[" + ct.Hour.ToString("00") + ":" +
ct.Minute.ToString("00") + ":" +
ct.Second.ToString("00") + "] " +
message;
writer.WriteLine(s);
// In debug mode write that message to the console as well!
System.Console.WriteLine(s);
}
catch (IOException)
{
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
214
Class Documentation
114
115
116
117
118
119
120
121
122
// Ignore any file exceptions, if file is not
// createable (e.g. on a CD-Rom) it doesn’t matter.
}
catch (UnauthorizedAccessException)
{
// Ignore any file exceptions, if file is not
// createable (e.g. on a CD-Rom) it doesn’t matter.
}
}
6.25.3
Member Data Documentation
6.25.3.1
StreamWriter GalaxyWars.Helpers.Log.writer = null [static, private]
Output stream.
Definition at line 25 of file Log.cs.
6.25.3.2
const string GalaxyWars.Helpers.Log.LogFilename = "GalaxyWars.log" [private]
Log filename.
Definition at line 30 of file Log.cs.
The documentation for this class was generated from the following file:
• Log.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.26 GalaxyWars.GameScreens.MainMenu Class Reference
6.26
GalaxyWars.GameScreens.MainMenu Class Reference
Main menu.
Inheritance diagram for GalaxyWars.GameScreens.MainMenu:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.MainMenu
Collaboration diagram for GalaxyWars.GameScreens.MainMenu:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.MainMenu
Public Member Functions
• bool Render ()
Render.
Properties
• int SelectedButton [get, set]
Static Private Member Functions
• static internal Rectangle InterpolateRect (Rectangle rect1, Rectangle rect2, float interpolation)
Interpolate rectangle.
Private Attributes
•
•
•
•
•
const int NumberOfButtons = 4
const int ActiveButtonWidth = 132
const int InactiveButtonWidth = 108
const int DistanceBetweenButtons = 14
const float TimeOutMenu = 60000.0f
The amount of time idle at the menu before returning to the splash screen.
• int selectedButton = 0
Start with button 0 being selected (play game).
• float[ ] currentButtonSizes
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
215
216
Class Documentation
Current button sizes for scaling up/down smooth effect.
• bool ignoreMouse = true
Ignore the mouse unless it moves; this is so the mouse does not disrupt game pads and keyboard.
• float idleTime = 0.0f
• float pressedLeftMs = 0
• float pressedRightMs = 0
Static Private Attributes
• static readonly Rectangle[ ] ButtonRects
• static readonly Rectangle[ ] TextRects
6.26.1
Detailed Description
Main menu.
Definition at line 21 of file MainMenu.cs.
6.26.2
Member Function Documentation
6.26.2.1
static internal Rectangle GalaxyWars.GameScreens.MainMenu.InterpolateRect
(Rectangle rect1, Rectangle rect2, float interpolation) [static, private]
Interpolate rectangle.
Parameters:
rect1 Rectangle 1
rect2 Rectangle 2
interpolation Interpolation
Definition at line 96 of file MainMenu.cs.
97
98
99
100
101
102
103
6.26.2.2
{
return new Rectangle(
(int)Math.Round(rect1.X * interpolation + rect2.X * (1 - interpolation)),
(int)Math.Round(rect1.Y * interpolation + rect2.Y * (1 - interpolation)),
(int)Math.Round(rect1.Width * interpolation + rect2.Width * (1 - interpolation)),
(int)Math.Round(rect1.Height * interpolation + rect2.Height * (1 - interpolation)));
}
bool GalaxyWars.GameScreens.MainMenu.Render ()
Render.
Implements GalaxyWars.GameScreens.IGameScreen.
Definition at line 111 of file MainMenu.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.26 GalaxyWars.GameScreens.MainMenu Class Reference
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
217
{
// This starts both menu and in game post screen shader!
BaseGame.UI.PostScreenMenuShader.Start();
// Render background and black bar
BaseGame.UI.RenderMenuBackground();
BaseGame.UI.RenderBlackBar(280, 192);
// Show logos
// Little helper to keep track if mouse is actually over a button.
// Required because buttons are selected even when not hovering over
// them for GamePad support, but we still want the mouse only to
// be apply when we are actually over the button.
int mouseIsOverButton = -1;
// If the user manipulated the mouse, stop ignoring the mouse
// This allows the mouse to override the game pad or keyboard selection
if (Input.HasMouseMoved || Input.MouseLeftButtonJustPressed)
ignoreMouse = false;
// Show buttons
// Part 1: Calculate global variables for our buttons
Rectangle activeRect = BaseGame.CalcRectangleCenteredWithGivenHeight(
0, 0, ActiveButtonWidth, ButtonRects[0]);
Rectangle inactiveRect = BaseGame.CalcRectangleCenteredWithGivenHeight(
0, 0, InactiveButtonWidth, ButtonRects[0]);
int totalWidth = activeRect.Width +
(NumberOfButtons - 1) * inactiveRect.Width +
(NumberOfButtons - 1) * BaseGame.XToRes(DistanceBetweenButtons);
int xPos = BaseGame.XToRes(512) - totalWidth / 2;
int yPos = BaseGame.YToRes(316);
for (int num = 0; num < NumberOfButtons; num++)
{
// Is this button currently selected?
bool selected = num == SelectedButton;
// Increase size if selected, decrease otherwise
currentButtonSizes[num] +=
(selected ? 1 : -1) * BaseGame.MoveFactorPerSecond * 2;
if (currentButtonSizes[num] < 0)
currentButtonSizes[num] = 0;
if (currentButtonSizes[num] > 1)
currentButtonSizes[num] = 1;
// Use this size to build rect
Rectangle thisRect =
InterpolateRect(activeRect, inactiveRect, currentButtonSizes[num]);
Rectangle renderRect = new Rectangle(
xPos, yPos - (thisRect.Height - inactiveRect.Height) / 2,
thisRect.Width, thisRect.Height);
BaseGame.UI.Buttons.RenderOnScreen(renderRect, ButtonRects[num],
selected ? Color.White : new Color(192, 192, 192, 192));
// Add border effect if selected
if (selected)
BaseGame.UI.Buttons.RenderOnScreen(renderRect, UIRenderer.MenuButtonSelectionGfxRe
// Also add text below button
Rectangle textRenderRect = new Rectangle(
xPos, renderRect.Bottom + BaseGame.YToRes(5),
renderRect.Width,
renderRect.Height * TextRects[0].Height / ButtonRects[0].Height);
if (selected)
BaseGame.UI.Buttons.RenderOnScreen(textRenderRect, TextRects[num],
selected ? Color.White : new Color(192, 192, 192, 192));
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
218
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
Class Documentation
// Also check if the user hovers with the mouse over this button
if (Input.MouseInBox(renderRect))
mouseIsOverButton = num;
xPos += thisRect.Width + BaseGame.XToRes(DistanceBetweenButtons);
}
if (!ignoreMouse && mouseIsOverButton >= 0)
SelectedButton = mouseIsOverButton;
//
//
//
if
Handle input, we have 2 modes: Immediate response if one of the
keys is pressed to move our selected menu entry and after a timeout we
move even more. Controlling feels more natural this way.
(Input.KeyboardLeftPressed ||
Input.GamePadLeftPressed)
pressedLeftMs += BaseGame.ElapsedTimeThisFrameInMilliseconds;
else
pressedLeftMs = 0;
if (Input.KeyboardRightPressed ||
Input.GamePadRightPressed)
pressedRightMs += BaseGame.ElapsedTimeThisFrameInMilliseconds;
else
pressedRightMs = 0;
// Handle GamePad input, and also allow keyboard input
if (Input.GamePadLeftJustPressed ||
Input.KeyboardLeftJustPressed ||
(pressedLeftMs > 250 &&
(Input.KeyboardLeftPressed ||
Input.GamePadLeftPressed)))
{
pressedLeftMs -= 250;
Sound.Play(Sound.Sounds.Highlight);
SelectedButton =
(SelectedButton + NumberOfButtons - 1) % NumberOfButtons;
ignoreMouse = true;
}
else if (Input.GamePadRightJustPressed ||
Input.KeyboardRightJustPressed ||
(pressedRightMs > 250 &&
(Input.KeyboardRightPressed ||
Input.GamePadRightPressed)))
{
pressedRightMs -= 250;
Sound.Play(Sound.Sounds.Highlight);
SelectedButton = (SelectedButton + 1) % NumberOfButtons;
ignoreMouse = true;
}
// If user presses the mouse button or the game pad A or Space,
// start the game screen for the currently selected game part.
if ((mouseIsOverButton >= 0 && Input.MouseLeftButtonJustPressed) ||
Input.GamePadAJustPressed ||
Input.KeyboardSpaceJustPressed)
{
idleTime = 0.0f;
// Start game screen
switch (SelectedButton)
{
case 0:
GalaxyWarsManager.AddGameScreen(new GameScreen());
break;
case 1:
GalaxyWarsManager.AddGameScreen(new Options());
break;
case 2:
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.26 GalaxyWars.GameScreens.MainMenu Class Reference
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
219
GalaxyWarsManager.AddGameScreen(new Help());
break;
case 3:
return true;
}
}
if (Input.KeyboardEscapeJustPressed ||
Input.GamePadBackJustPressed)
return true;
// If the game sits idle at the menu for too long,
// return to the splash screen
idleTime += BaseGame.ElapsedTimeThisFrameInMilliseconds;
if (idleTime > TimeOutMenu)
{
idleTime = 0.0f;
GalaxyWarsManager.AddGameScreen(new SplashScreen());
}
return false;
}
6.26.3
Member Data Documentation
6.26.3.1
readonly Rectangle [ ] GalaxyWars.GameScreens.MainMenu.ButtonRects [static,
private]
Initial value:
new Rectangle[]
{
UIRenderer.MenuButtonPlayGfxRect,
UIRenderer.MenuButtonOptionsGfxRect,
UIRenderer.MenuButtonHelpGfxRect,
UIRenderer.MenuButtonQuitGfxRect,
}
Definition at line 25 of file MainMenu.cs.
6.26.3.2
readonly Rectangle [ ] GalaxyWars.GameScreens.MainMenu.TextRects [static,
private]
Initial value:
new Rectangle[]
{
UIRenderer.MenuTextPlayGfxRect,
UIRenderer.MenuTextOptionsGfxRect,
UIRenderer.MenuTextHelpGfxRect,
UIRenderer.MenuTextQuitGfxRect,
}
Definition at line 33 of file MainMenu.cs.
6.26.3.3
const int GalaxyWars.GameScreens.MainMenu.NumberOfButtons = 4 [private]
Definition at line 41 of file MainMenu.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
220
6.26.3.4
Class Documentation
const int GalaxyWars.GameScreens.MainMenu.ActiveButtonWidth = 132 [private]
Definition at line 42 of file MainMenu.cs.
6.26.3.5
const int GalaxyWars.GameScreens.MainMenu.InactiveButtonWidth = 108
[private]
Definition at line 43 of file MainMenu.cs.
6.26.3.6
const int GalaxyWars.GameScreens.MainMenu.DistanceBetweenButtons = 14
[private]
Definition at line 44 of file MainMenu.cs.
6.26.3.7
const float GalaxyWars.GameScreens.MainMenu.TimeOutMenu = 60000.0f
[private]
The amount of time idle at the menu before returning to the splash screen.
Definition at line 49 of file MainMenu.cs.
6.26.3.8
int GalaxyWars.GameScreens.MainMenu.selectedButton = 0 [private]
Start with button 0 being selected (play game).
Definition at line 58 of file MainMenu.cs.
6.26.3.9
float [ ] GalaxyWars.GameScreens.MainMenu.currentButtonSizes [private]
Initial value:
new float[NumberOfButtons] { 1, 0, 0, 0 }
Current button sizes for scaling up/down smooth effect.
Definition at line 77 of file MainMenu.cs.
6.26.3.10
bool GalaxyWars.GameScreens.MainMenu.ignoreMouse = true [private]
Ignore the mouse unless it moves; this is so the mouse does not disrupt game pads and keyboard.
Definition at line 84 of file MainMenu.cs.
6.26.3.11
float GalaxyWars.GameScreens.MainMenu.idleTime = 0.0f [private]
Definition at line 86 of file MainMenu.cs.
6.26.3.12
float GalaxyWars.GameScreens.MainMenu.pressedLeftMs = 0 [private]
Definition at line 105 of file MainMenu.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.26 GalaxyWars.GameScreens.MainMenu Class Reference
6.26.3.13
221
float GalaxyWars.GameScreens.MainMenu.pressedRightMs = 0 [private]
Definition at line 106 of file MainMenu.cs.
6.26.4
Property Documentation
6.26.4.1
int GalaxyWars.GameScreens.MainMenu.SelectedButton [get, set, private]
Definition at line 61 of file MainMenu.cs.
The documentation for this class was generated from the following file:
• MainMenu.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
222
Class Documentation
6.27
GalaxyWars.Graphics.MeshRenderManager Class Reference
Mesh render manager, a little helper class which allows us to render all our models with much faster
performance through sorting by material and shader techniques.
Public Member Functions
• RenderableMesh Add (VertexBuffer vertexBuffer, IndexBuffer indexBuffer, ModelMeshPart part,
Effect effect)
Add model mesh part with the used effect to our sortedMeshes list. Neither the model mesh part nor the
effect is directly used, we will extract all data from the model and only render the index and vertex buffers
later. The model mesh part must use the TangentVertex format.
• void Render ()
Render all meshes we collected this frame sorted by techniques and materials. This method is about 3-5
times faster than just using Model’s Mesh.Draw method (see commented out code there). The reason for
that is that we require only very few state changes and render everthing down as fast as we can. The only
optimization left would be to put vertices of several meshes together if they are static and use the same
technique and material. But since meshes have WriteOnly vertex and index buffers, we can’t do that without
using a custom model format.
Private Attributes
• List< MeshesPerMaterialPerTechniques > sortedMeshes
Sorted meshes we got. Everything is sorted by techniques and then sorted by materials. This all happens
at construction time. For rendering use renderMatrices list, which is directly in the most inner list of
sortedMeshes (the RenderableMesh objects).
Static Private Attributes
• static VertexBuffer lastVertexBufferSet = null
Don’t set vertex and index buffers again if they are already set this frame.
• static IndexBuffer lastIndexBufferSet = null
Classes
• class MeshesPerMaterial
Meshes per material.
• class MeshesPerMaterialPerTechniques
Meshes per material per techniques.
• class RenderableMesh
Renderable mesh, created in the Model constructor and is rendered when we render all the models at once
at the end of each frame!
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.27 GalaxyWars.Graphics.MeshRenderManager Class Reference
6.27.1
223
Detailed Description
Mesh render manager, a little helper class which allows us to render all our models with much faster
performance through sorting by material and shader techniques.
We keep a list of lists of lists for rendering our RenderableMeshes sorted by techniques first and materials
second. The most outer list contains all techniques (see MeshesPerMaterialPerTechniques). Then the first
inner list contains all materials (see MeshesPerMaterial). And finally the most inner list contains all meshes
that use the technique and material we got. Additionally we could also sort by shaders, but since all models
use the same shader (normalMapping), that is the only thing we support here. Improving it to support more
shaders is easily possible.
All this is created in the Model constructor. At runtime we just go through these lists and render everything
down as quickly as possible.
Definition at line 34 of file MeshRenderManager.cs.
6.27.2
Member Function Documentation
6.27.2.1
RenderableMesh GalaxyWars.Graphics.MeshRenderManager.Add (VertexBuffer
vertexBuffer, IndexBuffer indexBuffer, ModelMeshPart part, Effect effect)
Add model mesh part with the used effect to our sortedMeshes list. Neither the model mesh part nor the
effect is directly used, we will extract all data from the model and only render the index and vertex buffers
later. The model mesh part must use the TangentVertex format.
Parameters:
vertexBuffer Vertex buffer
indexBuffer Index buffer
part Part
effect Effect
Returns:
Renderable mesh
Definition at line 426 of file MeshRenderManager.cs.
References
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Add(),
GalaxyWars.Graphics.Material.ambientColor, GalaxyWars.Graphics.Material.diffuseColor, GalaxyWars.Graphics.Material.diffuseTexture, GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.material,
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.meshesPerMaterials,
GalaxyWars.Graphics.Material.normalTexture, GalaxyWars.Graphics.Material.specularColor, GalaxyWars.Graphics.Material.specularPower, and GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.tech
428
429
430
431
432
433
434
435
436
437
{
string techniqueName = effect.CurrentTechnique.Name;
// Does this technique already exists?
MeshesPerMaterialPerTechniques foundList = null;
for (int listNum = 0; listNum < sortedMeshes.Count; listNum++)
{
MeshesPerMaterialPerTechniques list = sortedMeshes[listNum];
if (list.technique != null && list.technique.Name == techniqueName)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
224
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
Class Documentation
{
foundList = list;
break;
}
}
// Did not found list? Create new one
if (foundList == null)
{
foundList = new MeshesPerMaterialPerTechniques(
ShaderEffect.normalMapping.GetTechnique(techniqueName));
sortedMeshes.Add(foundList);
}
// Create new material from the current effect parameters.
// This will create duplicate materials if the same material is used
// multiple times, we check this later.
Material material = new Material(effect);
// Search for material inside foundList.
for (int innerListNum = 0; innerListNum <
foundList.meshesPerMaterials.Count; innerListNum++)
{
MeshesPerMaterial innerList =
foundList.meshesPerMaterials[innerListNum];
// Check if this is the same material and we can use it instead.
// For our purposes it is sufficiant if we check textures and colors.
if (innerList.material.diffuseTexture == material.diffuseTexture &&
innerList.material.normalTexture == material.normalTexture &&
innerList.material.ambientColor == material.ambientColor &&
innerList.material.diffuseColor == material.diffuseColor &&
innerList.material.specularColor == material.specularColor &&
innerList.material.specularPower == material.specularPower)
{
// Reuse this material and quit this search
material = innerList.material;
break;
}
}
// Build new RenderableMesh object
RenderableMesh mesh = new RenderableMesh(
vertexBuffer, indexBuffer, material, foundList.technique,
ShaderEffect.normalMapping.WorldParameter,
part.VertexDeclaration,
part.StreamOffset, part.VertexStride, part.BaseVertex,
part.NumVertices, part.StartIndex, part.PrimitiveCount);
foundList.Add(mesh);
return mesh;
}
Here is the call graph for this function:
GalaxyWars.Graphics.MeshRenderManager.Add
6.27.2.2
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Add
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Add
void GalaxyWars.Graphics.MeshRenderManager.Render ()
Render all meshes we collected this frame sorted by techniques and materials. This method is about 35 times faster than just using Model’s Mesh.Draw method (see commented out code there). The reason
for that is that we require only very few state changes and render everthing down as fast as we can. The
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.27 GalaxyWars.Graphics.MeshRenderManager Class Reference
225
only optimization left would be to put vertices of several meshes together if they are static and use the
same technique and material. But since meshes have WriteOnly vertex and index buffers, we can’t do that
without using a custom model format.
Definition at line 504 of file MeshRenderManager.cs.
References GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.NumberOfRenderMatrices,
and GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Render().
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
{
// Make sure z buffer is on
BaseGame.Device.RenderState.DepthBufferEnable = true;
BaseGame.Device.RenderState.DepthBufferWriteEnable = true;
// We always use the normalMapping shader here.
Effect effect = ShaderEffect.normalMapping.Effect;
// Set general parameters for the shader
ShaderEffect.normalMapping.SetParametersOptimizedGeneral();
// Don’t set vertex buffer again if it does not change this frame.
// Clear these remember settings.
lastVertexBufferSet = null;
lastIndexBufferSet = null;
for (int listNum = 0; listNum < sortedMeshes.Count; listNum++)
{
MeshesPerMaterialPerTechniques list = sortedMeshes[listNum];
if (list.NumberOfRenderMatrices > 0)
list.Render(effect);
}
}
Here is the call graph for this function:
GalaxyWars.Graphics.MeshRenderManager.Render
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Render
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Render
GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.Render
6.27.3
Member Data Documentation
6.27.3.1
VertexBuffer GalaxyWars.Graphics.MeshRenderManager.lastVertexBufferSet = null
[static, private]
Don’t set vertex and index buffers again if they are already set this frame.
Definition at line 41 of file MeshRenderManager.cs.
6.27.3.2
IndexBuffer GalaxyWars.Graphics.MeshRenderManager.lastIndexBufferSet = null
[static, private]
Definition at line 42 of file MeshRenderManager.cs.
6.27.3.3
List<MeshesPerMaterialPerTechniques> GalaxyWars.Graphics.MeshRenderManager.sortedMeshes [private]
Initial value:
new List<MeshesPerMaterialPerTechniques>()
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
226
Class Documentation
Sorted meshes we got. Everything is sorted by techniques and then sorted by materials. This all happens
at construction time. For rendering use renderMatrices list, which is directly in the most inner list of
sortedMeshes (the RenderableMesh objects).
Definition at line 409 of file MeshRenderManager.cs.
The documentation for this class was generated from the following file:
• MeshRenderManager.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.28 GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial Class Reference
6.28
227
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial
Class Reference
Meshes per material.
Collaboration diagram for GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial:
Texture2D
internalXnaTexture
GalaxyWars.Graphics.Texture
Color
diffuseTexture
detailTexture
heightTexture
normalTexture
diffuseColor
specularColor
DefaultDiffuseColor
ambientColor
DefaultAmbientColor
DefaultSpecularColor
GalaxyWars.Graphics.Material
material
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial
Public Member Functions
• MeshesPerMaterial (Material setMaterial)
Create meshes per material for the setMaterial.
• void Add (RenderableMesh addMesh)
Adds a renderable mesh using this material.
• void Render ()
Render all meshes that use this material. This method is only called if we got any meshes to render, which
is determinated if NumberOfRenderMeshes is greater 0.
Public Attributes
• Material material
Material.
• List< RenderableMesh > meshes = new List<RenderableMesh>()
Meshes.
Properties
• int NumberOfRenderMatrices [get]
Number of render matrices this material uses this frame.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
228
Class Documentation
6.28.1
Detailed Description
Meshes per material.
Definition at line 184 of file MeshRenderManager.cs.
6.28.2
Constructor & Destructor Documentation
6.28.2.1
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.MeshesPerMaterial
(Material setMaterial)
Create meshes per material for the setMaterial.
Parameters:
setMaterial Set material
Definition at line 219 of file MeshRenderManager.cs.
220
221
222
{
material = setMaterial;
}
6.28.3
Member Function Documentation
6.28.3.1
void GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Add
(RenderableMesh addMesh)
Adds a renderable mesh using this material.
Parameters:
addMesh Add mesh
Definition at line 230 of file MeshRenderManager.cs.
Referenced by GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Add().
231
232
233
234
235
236
237
238
239
6.28.3.2
{
// Make sure this mesh uses the correct material
if (addMesh.material != material)
throw new ArgumentException("Invalid material, to add a mesh to " +
"MeshesPerMaterial it must use the specified material=" +
material);
meshes.Add(addMesh);
}
void GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Render ()
Render all meshes that use this material. This method is only called if we got any meshes to render, which
is determinated if NumberOfRenderMeshes is greater 0.
Definition at line 248 of file MeshRenderManager.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.28 GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial Class Reference
References GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.Render(),
Wars.Graphics.MeshRenderManager.RenderableMesh.renderMatrices.
and
229
Galaxy-
Referenced by GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Render().
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
{
// Set material settings. We don’t have to update the shader here,
// it will be done in RenderableMesh.Render anyway because of
// updating the world matrix!
ShaderEffect.normalMapping.SetParametersOptimized(material);
// Set vertex declaration
//always true: if (meshes.Count > 0)
BaseGame.Device.VertexDeclaration = meshes[0].vertexDeclaration;
// Enable alpha if this material uses alpha
if (material.HasAlpha)
{
BaseGame.Device.RenderState.AlphaTestEnable = true;
BaseGame.Device.RenderState.ReferenceAlpha = 128;
// Make 2sided, we use alpha mainly for our palms.
BaseGame.Device.RenderState.CullMode = CullMode.None;
}
// Render all meshes that use this material.
for (int meshNum = 0; meshNum < meshes.Count; meshNum++)
{
RenderableMesh mesh = meshes[meshNum];
if (mesh.renderMatrices.Count > 0)
mesh.Render();
}
// Disable alpha testing again and restore culling
if (material.HasAlpha)
{
BaseGame.Device.RenderState.AlphaTestEnable = false;
BaseGame.Device.RenderState.CullMode =
CullMode.CullCounterClockwiseFace;
}
}
Here is the call graph for this function:
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Render
GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.Render
6.28.4
Member Data Documentation
6.28.4.1
Material GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.material
Material.
Definition at line 190 of file MeshRenderManager.cs.
Referenced
by
GalaxyWars.Graphics.MeshRenderManager.Add(),
Wars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Add().
6.28.4.2
and
List<RenderableMesh> GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.meshes = new
List<RenderableMesh>()
Meshes.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Galaxy-
230
Class Documentation
Definition at line 194 of file MeshRenderManager.cs.
6.28.5
Property Documentation
6.28.5.1
int GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.NumberOfRenderMatrices
[get]
Number of render matrices this material uses this frame.
Returns:
Int
Definition at line 203 of file MeshRenderManager.cs.
Referenced by GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Render().
The documentation for this class was generated from the following file:
• MeshRenderManager.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.29 GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques Class
Reference
6.29
231
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniq
Class Reference
Meshes per material per techniques.
Public Member Functions
• MeshesPerMaterialPerTechniques (EffectTechnique setTechnique)
Create meshes per material per techniques.
• void Add (RenderableMesh addMesh)
Adds a renderable mesh using this technique.
• void Render (Effect effect)
Render all meshes that use this technique sorted by the materials. This method is only called if we got any
meshes to render, which is determinated if NumberOfRenderMeshes is greater 0.
Public Attributes
• EffectTechnique technique
Technique.
• List< MeshesPerMaterial > meshesPerMaterials
Meshes per materials.
Properties
• int NumberOfRenderMatrices [get]
Number of render matrices this technique uses this frame.
6.29.1
Detailed Description
Meshes per material per techniques.
Definition at line 290 of file MeshRenderManager.cs.
6.29.2
Constructor & Destructor Documentation
6.29.2.1
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.MeshesPerMaterialPerTechn
(EffectTechnique setTechnique)
Create meshes per material per techniques.
Parameters:
setTechnique Set technique
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
232
Class Documentation
Definition at line 326 of file MeshRenderManager.cs.
327
328
329
{
technique = setTechnique;
}
6.29.3
Member Function Documentation
6.29.3.1
void GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Add
(RenderableMesh addMesh)
Adds a renderable mesh using this technique.
Parameters:
addMesh Add mesh
Definition at line 337 of file MeshRenderManager.cs.
References GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Add(),
Wars.Graphics.MeshRenderManager.MeshesPerMaterial.material.
and
Galaxy-
Referenced by GalaxyWars.Graphics.MeshRenderManager.Add().
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
{
// Make sure this mesh uses the correct material
if (addMesh.usedTechnique != technique)
throw new ArgumentException("Invalid technique, to add a mesh to " +
"MeshesPerMaterialPerTechniques it must use the specified " +
"technique=" + technique.Name);
// Search for the used material, maybe we have it already in list.
for (int listNum = 0; listNum < meshesPerMaterials.Count; listNum++)
{
MeshesPerMaterial existingList = meshesPerMaterials[listNum];
if (existingList.material == addMesh.material)
{
// Just add
existingList.Add(addMesh);
return;
}
}
// Not found, create new list and add mesh there.
MeshesPerMaterial newList = new MeshesPerMaterial(addMesh.material);
newList.Add(addMesh);
meshesPerMaterials.Add(newList);
}
Here is the call graph for this function:
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Add
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Add
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.29 GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques Class
Reference
6.29.3.2
233
void GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Render (Effect
effect)
Render all meshes that use this technique sorted by the materials. This method is only called if we got any
meshes to render, which is determinated if NumberOfRenderMeshes is greater 0.
Parameters:
effect Effect
Definition at line 371 of file MeshRenderManager.cs.
References GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.NumberOfRenderMatrices,
and GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Render().
Referenced by GalaxyWars.Graphics.MeshRenderManager.Render().
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
{
// Start effect for this technique
effect.CurrentTechnique = technique;
try
{
effect.Begin(SaveStateMode.None);
// Render all pass (we always just have one)
EffectPass pass = effect.CurrentTechnique.Passes[0];
pass.Begin();
// Render all meshes sorted by all materials.
for (int listNum = 0; listNum < meshesPerMaterials.Count; listNum++)
{
MeshesPerMaterial list = meshesPerMaterials[listNum];
if (list.NumberOfRenderMatrices > 0)
list.Render();
}
pass.End();
}
finally
{
// End shader
effect.End();
}
}
Here is the call graph for this function:
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.Render
GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Render
GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.Render
6.29.4
Member Data Documentation
6.29.4.1
EffectTechnique GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.technique
Technique.
Definition at line 296 of file MeshRenderManager.cs.
Referenced by GalaxyWars.Graphics.MeshRenderManager.Add().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
234
Class Documentation
6.29.4.2
List<MeshesPerMaterial> GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.meshesPerMaterials
Initial value:
new List<MeshesPerMaterial>()
Meshes per materials.
Definition at line 300 of file MeshRenderManager.cs.
Referenced by GalaxyWars.Graphics.MeshRenderManager.Add().
6.29.5
Property Documentation
6.29.5.1
int GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques.NumberOfRenderMatrices
[get]
Number of render matrices this technique uses this frame.
Returns:
Int
Definition at line 310 of file MeshRenderManager.cs.
Referenced by GalaxyWars.Graphics.MeshRenderManager.Render().
The documentation for this class was generated from the following file:
• MeshRenderManager.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.30 GalaxyWars.Graphics.MeshRenderManager.RenderableMesh Class Reference
6.30
235
GalaxyWars.Graphics.MeshRenderManager.RenderableMesh
Class Reference
Renderable mesh, created in the Model constructor and is rendered when we render all the models at once
at the end of each frame!
Collaboration diagram for GalaxyWars.Graphics.MeshRenderManager.RenderableMesh:
Texture2D
internalXnaTexture
GalaxyWars.Graphics.Texture
Color
diffuseTexture
detailTexture
heightTexture
normalTexture
diffuseColor
specularColor
DefaultDiffuseColor
ambientColor
DefaultAmbientColor
DefaultSpecularColor
GalaxyWars.Graphics.Material
material
GalaxyWars.Graphics.MeshRenderManager.RenderableMesh
Public Member Functions
• RenderableMesh (VertexBuffer setVertexBuffer, IndexBuffer setIndexBuffer, Material setMaterial,
EffectTechnique setUsedTechnique, EffectParameter setWorldParameter, VertexDeclaration setVertexDeclaration, int setStreamOffset, int setVertexStride, int setBaseVertex, int setNumVertices, int
setStartIndex, int setPrimitiveCount)
Create renderable mesh.
• void RenderMesh (Matrix worldMatrix)
Render this renderable mesh, MUST be called inside of the render method of ShaderEffect.normalMapping!
• void Render ()
Render.
Public Attributes
• VertexBuffer vertexBuffer
Vertex buffer.
• IndexBuffer indexBuffer
Index buffer.
• Material material
Material.
• EffectTechnique usedTechnique
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
236
Class Documentation
Used technique.
• EffectParameter worldParameter
World parameter.
• VertexDeclaration vertexDeclaration
Vertex declaration.
• int streamOffset
Stream offset, vertex stride, etc. All parameters we need for rendering.
•
•
•
•
•
•
int vertexStride
int baseVertex
int numVertices
int startIndex
int primitiveCount
List< Matrix > renderMatrices = new List<Matrix>()
List of render matrices we use every frame. At creation time this list is unused and empty, but for each frame
we use this list to remember which objects we want to render. Of course rendering happens only if this list
is not empty. After each frame this list is cleared again.
6.30.1
Detailed Description
Renderable mesh, created in the Model constructor and is rendered when we render all the models at once
at the end of each frame!
Definition at line 50 of file MeshRenderManager.cs.
6.30.2
Constructor & Destructor Documentation
6.30.2.1
GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.RenderableMesh
(VertexBuffer setVertexBuffer, IndexBuffer setIndexBuffer, Material setMaterial,
EffectTechnique setUsedTechnique, EffectParameter setWorldParameter,
VertexDeclaration setVertexDeclaration, int setStreamOffset, int setVertexStride, int
setBaseVertex, int setNumVertices, int setStartIndex, int setPrimitiveCount)
Create renderable mesh.
Parameters:
setVertexBuffer Set vertex buffer
setIndexBuffer Set index buffer
setMaterial Set material
setUsedTechnique Set used technique
setWorldParameter Set world parameter
setVertexDeclaration Set vertex declaration
setStreamOffset Set stream offset
setVertexStride Set vertex stride
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.30 GalaxyWars.Graphics.MeshRenderManager.RenderableMesh Class Reference
237
setBaseVertex Set base vertex
setNumVertices Set number vertices
setStartIndex Set start index
setPrimitiveCount Set primitive count
Definition at line 110 of file MeshRenderManager.cs.
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{
vertexBuffer = setVertexBuffer;
indexBuffer = setIndexBuffer;
material = setMaterial;
usedTechnique = setUsedTechnique;
worldParameter = setWorldParameter;
vertexDeclaration = setVertexDeclaration;
streamOffset = setStreamOffset;
vertexStride = setVertexStride;
baseVertex = setBaseVertex;
numVertices = setNumVertices;
startIndex = setStartIndex;
primitiveCount = setPrimitiveCount;
}
6.30.3
Member Function Documentation
6.30.3.1
void GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.RenderMesh (Matrix
worldMatrix)
Render this renderable mesh, MUST be called inside of the render method of ShaderEffect.normalMapping!
Parameters:
worldMatrix World matrix
Definition at line 138 of file MeshRenderManager.cs.
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
// Update world matrix
ShaderEffect.normalMapping.WorldMatrix = worldMatrix;
ShaderEffect.normalMapping.Effect.CommitChanges();//.Update();
// Set vertex buffer and index buffer
if (lastVertexBufferSet != vertexBuffer ||
lastIndexBufferSet != indexBuffer)
{
lastVertexBufferSet = vertexBuffer;
lastIndexBufferSet = indexBuffer;
BaseGame.Device.Vertices[0].SetSource(
vertexBuffer, streamOffset, vertexStride);
BaseGame.Device.Indices = indexBuffer;
}
// And render (this call takes the longest, we can’t optimize
// it any further because the vertexBuffer and indexBuffer are
// WriteOnly, we can’t combine it or optimize it any more).
BaseGame.Device.DrawIndexedPrimitives(
PrimitiveType.TriangleList,
baseVertex, 0, numVertices, startIndex, primitiveCount);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
238
6.30.3.2
Class Documentation
void GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.Render ()
Render.
Definition at line 166 of file MeshRenderManager.cs.
Referenced by GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Render().
167
168
169
170
171
172
173
174
175
{
// Render all meshes we have requested this frame.
for (int matrixNum = 0; matrixNum < renderMatrices.Count; matrixNum++)
RenderMesh(renderMatrices[matrixNum]);
// Clear all meshes, don’t render them again.
// Next frame everything will be created again.
renderMatrices.Clear();
}
6.30.4
Member Data Documentation
6.30.4.1
VertexBuffer GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.vertexBuffer
Vertex buffer.
Definition at line 56 of file MeshRenderManager.cs.
6.30.4.2
IndexBuffer GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.indexBuffer
Index buffer.
Definition at line 60 of file MeshRenderManager.cs.
6.30.4.3
Material GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.material
Material.
Definition at line 64 of file MeshRenderManager.cs.
6.30.4.4
EffectTechnique GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.usedTechnique
Used technique.
Definition at line 68 of file MeshRenderManager.cs.
6.30.4.5
EffectParameter GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.worldParameter
World parameter.
Definition at line 72 of file MeshRenderManager.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.30 GalaxyWars.Graphics.MeshRenderManager.RenderableMesh Class Reference
6.30.4.6
239
VertexDeclaration GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.vertexDeclaration
Vertex declaration.
Definition at line 76 of file MeshRenderManager.cs.
6.30.4.7
int GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.streamOffset
Stream offset, vertex stride, etc. All parameters we need for rendering.
Definition at line 81 of file MeshRenderManager.cs.
6.30.4.8
int GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.vertexStride
Definition at line 81 of file MeshRenderManager.cs.
6.30.4.9
int GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.baseVertex
Definition at line 81 of file MeshRenderManager.cs.
6.30.4.10
int GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.numVertices
Definition at line 81 of file MeshRenderManager.cs.
6.30.4.11
int GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.startIndex
Definition at line 81 of file MeshRenderManager.cs.
6.30.4.12
int GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.primitiveCount
Definition at line 81 of file MeshRenderManager.cs.
6.30.4.13
List<Matrix> GalaxyWars.Graphics.MeshRenderManager.RenderableMesh.renderMatrices
= new List<Matrix>()
List of render matrices we use every frame. At creation time this list is unused and empty, but for each
frame we use this list to remember which objects we want to render. Of course rendering happens only if
this list is not empty. After each frame this list is cleared again.
Definition at line 91 of file MeshRenderManager.cs.
Referenced by GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial.Render().
The documentation for this class was generated from the following file:
• MeshRenderManager.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
240
Class Documentation
6.31
GalaxyWars.Sounds.Music Class Reference
Collaboration diagram for GalaxyWars.Sounds.Music:
FMOD
musicChannel
system
music
GalaxyWars.Sounds.Music
Static Public Member Functions
• static bool Initialize ()
• static void PlayMusic (string fileName)
• static void StopMusic ()
Public Attributes
• const string MenuMusic = @"Content\Audio\MP3\GalaxyWars Menu.mp3"
• const string GameMusic = @"Content\Audio\MP3\GalaxyWars Game.mp3"
Static Private Member Functions
• static void ErrorCheck (RESULT result)
Static Private Attributes
•
•
•
•
•
static FMOD.System system = null
static Dictionary< string, Sound > soundDictionary
static FMOD.Sound music = null
static string currentMusicPath
static FMOD.Channel musicChannel = null
6.31.1
Detailed Description
Definition at line 8 of file Music.cs.
6.31.2
Member Function Documentation
6.31.2.1
static bool GalaxyWars.Sounds.Music.Initialize () [static]
Definition at line 19 of file Music.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.31 GalaxyWars.Sounds.Music Class Reference
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
6.31.2.2
241
{
RESULT result;
uint version = 0;
result = Factory.System_Create(ref system);
ErrorCheck(result);
result = system.getVersion(ref version);
ErrorCheck(result);
if (version < VERSION.number)
{
throw new ApplicationException("Error! You are using an old version of FMOD " +
version.ToString("X") + ". This program requires " + VERSION.number.ToString("X") + "
}
result = system.init(32, INITFLAG.NORMAL, (IntPtr)null);
ErrorCheck(result);
soundDictionary = new Dictionary<string, Sound>();
return true;
}
static void GalaxyWars.Sounds.Music.PlayMusic (string fileName) [static]
Definition at line 44 of file Music.cs.
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
bool isPlaying = false;
RESULT result;
if (musicChannel != null)
result = musicChannel.isPlaying(ref isPlaying);
else
isPlaying = false;
if (currentMusicPath == fileName && isPlaying)
return;
else if (currentMusicPath == fileName)
{
result = system.playSound(FMOD.CHANNELINDEX.FREE, music, false, ref musicChannel);
ErrorCheck(result);
}
else
{
if (music != null)
{
result = music.release();
ErrorCheck(result);
}
result = system.createSound
(fileName, FMOD.MODE.SOFTWARE | FMOD.MODE.CREATECOMPRESSEDSAMPLE | FMOD.MODE.LOOP_N
ErrorCheck(result);
result = system.playSound(FMOD.CHANNELINDEX.FREE, music, false, ref musicChannel);
ErrorCheck(result);
currentMusicPath = fileName;
}
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
242
6.31.2.3
Class Documentation
static void GalaxyWars.Sounds.Music.StopMusic () [static]
Definition at line 80 of file Music.cs.
81
82
83
84
85
86
87
88
6.31.2.4
{
if (musicChannel != null)
{
RESULT result = musicChannel.stop();
musicChannel = null;
ErrorCheck(result);
}
}
static void GalaxyWars.Sounds.Music.ErrorCheck (RESULT result) [static,
private]
Definition at line 90 of file Music.cs.
91
92
93
94
95
96
{
if (result != RESULT.OK)
{
throw new ApplicationException("FMOD error! " + result + " - " + Error.String(result));
}
}
6.31.3
Member Data Documentation
6.31.3.1
FMOD.System GalaxyWars.Sounds.Music.system = null [static, private]
Definition at line 10 of file Music.cs.
6.31.3.2
Dictionary<string, Sound> GalaxyWars.Sounds.Music.soundDictionary [static,
private]
Definition at line 11 of file Music.cs.
6.31.3.3
FMOD.Sound GalaxyWars.Sounds.Music.music = null [static, private]
Definition at line 12 of file Music.cs.
6.31.3.4
string GalaxyWars.Sounds.Music.currentMusicPath [static, private]
Definition at line 13 of file Music.cs.
6.31.3.5
FMOD.Channel GalaxyWars.Sounds.Music.musicChannel = null [static,
private]
Definition at line 14 of file Music.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.31 GalaxyWars.Sounds.Music Class Reference
6.31.3.6
const string GalaxyWars.Sounds.Music.MenuMusic =
@"Content\Audio\MP3\GalaxyWars Menu.mp3"
Definition at line 16 of file Music.cs.
6.31.3.7
const string GalaxyWars.Sounds.Music.GameMusic =
@"Content\Audio\MP3\GalaxyWars Game.mp3"
Definition at line 17 of file Music.cs.
The documentation for this class was generated from the following file:
• Music.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
243
244
Class Documentation
6.32
GalaxyWars.GameScreens.Options Class Reference
Options.
Inheritance diagram for GalaxyWars.GameScreens.Options:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.Options
Collaboration diagram for GalaxyWars.GameScreens.Options:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.Options
Public Member Functions
• Options ()
Create options.
• bool Render ()
Render game screen. Called each frame.
Private Attributes
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
readonly Rectangle Line4ArrowGfxRect = new Rectangle(154, 284, 62, 39)
readonly Rectangle Line5ArrowGfxRect = new Rectangle(160, 354, 62, 39)
readonly Rectangle Line6ArrowGfxRect = new Rectangle(72, 437, 62, 39)
readonly Rectangle Resolution640x480GfxRect = new Rectangle(339, 112, 98, 32)
readonly Rectangle Resolution800x600GfxRect = new Rectangle(454, 112, 98, 32)
readonly Rectangle Resolution1024x768GfxRect = new Rectangle(575, 112, 108, 32)
readonly Rectangle Resolution1280x1024GfxRect = new Rectangle(704, 112, 116, 32)
readonly Rectangle ResolutionAutoGfxRect = new Rectangle(838, 112, 69, 32)
readonly Rectangle FullscreenGfxRect = new Rectangle(339, 182, 105, 36)
readonly Rectangle PostScreenEffectsGfxRect = new Rectangle(339, 226, 206, 36)
readonly Rectangle ShadowsGfxRect = new Rectangle(616, 226, 90, 36)
readonly Rectangle HighDetailGfxRect = new Rectangle(784, 226, 120, 36)
readonly Rectangle SoundGfxRect = new Rectangle(384, 281, 448, 39)
readonly Rectangle MusicGfxRect = new Rectangle(384, 354, 448, 39)
readonly Rectangle SensitivityGfxRect = new Rectangle(384, 428, 448, 39)
string currentPlayerName = GameSettings.Default.PlayerName
Current player name, copied from the settings file. Can be changed in this screen and will be saved to the
settings file. Just a variable here to make it easier to change the name and because of performance (reading
Settings every frame is not good).
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.32 GalaxyWars.GameScreens.Options Class Reference
•
•
•
•
•
•
•
•
•
int currentOptionsNumber = 0
int currentResolution = 4
bool fullscreen = true
bool usePostScreenShaders = true
bool useShadowMapping = true
bool useHighDetail = true
float currentMusicVolume = 1.0f
float currentSoundVolume = 1.0f
float currentSensitivity = 1.0f
6.32.1
Detailed Description
Options.
Returns:
IGame screen
Definition at line 23 of file Options.cs.
6.32.2
Constructor & Destructor Documentation
6.32.2.1
GalaxyWars.GameScreens.Options.Options ()
Create options.
Definition at line 73 of file Options.cs.
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
// Current resolution:
// 0=640x480, 1=800x600, 2=1024x768, 3=1280x1024, 4=auto (default)
if (BaseGame.Width == 640 && BaseGame.Height == 480)
currentResolution = 0;
if (BaseGame.Width == 800 && BaseGame.Height == 600)
currentResolution = 1;
if (BaseGame.Width == 1024 && BaseGame.Height == 768)
currentResolution = 2;
if (BaseGame.Width == 1280 && BaseGame.Height == 1024)
currentResolution = 3;
// Get graphics detail settings
fullscreen = BaseGame.Fullscreen;
usePostScreenShaders = BaseGame.UsePostScreenShaders;
useShadowMapping = BaseGame.AllowShadowMapping;
useHighDetail = BaseGame.HighDetail;
// Get music and sound volume
currentMusicVolume = GameSettings.Default.MusicVolume;
currentSoundVolume = GameSettings.Default.SoundVolume;
// Get sensitivity
currentSensitivity = GameSettings.Default.ControllerSensitivity;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
245
246
Class Documentation
6.32.3
Member Function Documentation
6.32.3.1
bool GalaxyWars.GameScreens.Options.Render ()
Render game screen. Called each frame.
Implements GalaxyWars.GameScreens.IGameScreen.
Definition at line 107 of file Options.cs.
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{
#region Background
// This starts both menu and in game post screen shader!
BaseGame.UI.PostScreenMenuShader.Start();
// Render background and black bar
BaseGame.UI.RenderMenuBackground();
// Options header
int posX = 10;
int posY = 18;
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
posX += 36;
posY += 26;
}
BaseGame.UI.Headers.RenderOnScreenRelative1600(
posX, posY, UIRenderer.HeaderOptionsGfxRect);
// Options background
BaseGame.UI.OptionsScreen.RenderOnScreenRelative4To3(
0, 125, BaseGame.UI.OptionsScreen.GfxRectangle);
#endregion
#region Edit player name
// Edit player name
int xPos = BaseGame.XToRes(352);
int yPos = BaseGame.YToRes768(125 + 65 - 20);
TextureFont.WriteText(xPos, yPos,
currentPlayerName +
// Add blinking |
((int)(BaseGame.TotalTime / 0.35f) % 2 == 0 ? "|" : ""));
Input.HandleKeyboardInput(ref currentPlayerName);
#endregion
#region Select resolution
// Select resolution
// Use inverted color for selection (see below for sprite blend mode)
Color selColor = new Color(255, 156, 0, 160);
Rectangle res0Rect = BaseGame.CalcRectangleKeep4To3(
Resolution640x480GfxRect);
res0Rect.Y += BaseGame.YToRes768(125);
bool inRes0Rect = Input.MouseInBox(res0Rect);
if (currentResolution == 0)
BaseGame.UI.OptionsScreen.RenderOnScreen(
res0Rect, Resolution640x480GfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inRes0Rect && Input.MouseLeftButtonJustPressed)
{
Sound.Play(Sound.Sounds.ButtonClick);
currentResolution = 0;
}
Rectangle res1Rect = BaseGame.CalcRectangleKeep4To3(
Resolution800x600GfxRect);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.32 GalaxyWars.GameScreens.Options Class Reference
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
res1Rect.Y += BaseGame.YToRes768(125);
bool inRes1Rect = Input.MouseInBox(res1Rect);
if (currentResolution == 1)
BaseGame.UI.OptionsScreen.RenderOnScreen(
res1Rect, Resolution800x600GfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inRes1Rect && Input.MouseLeftButtonJustPressed)
{
Sound.Play(Sound.Sounds.ButtonClick);
currentResolution = 1;
}
Rectangle res2Rect = BaseGame.CalcRectangleKeep4To3(
Resolution1024x768GfxRect);
res2Rect.Y += BaseGame.YToRes768(125);
bool inRes2Rect = Input.MouseInBox(res2Rect);
if (currentResolution == 2)
BaseGame.UI.OptionsScreen.RenderOnScreen(
res2Rect, Resolution1024x768GfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inRes2Rect && Input.MouseLeftButtonJustPressed)
{
Sound.Play(Sound.Sounds.ButtonClick);
currentResolution = 2;
}
Rectangle res3Rect = BaseGame.CalcRectangleKeep4To3(
Resolution1280x1024GfxRect);
res3Rect.Y += BaseGame.YToRes768(125);
bool inRes3Rect = Input.MouseInBox(res3Rect);
if (currentResolution == 3)
BaseGame.UI.OptionsScreen.RenderOnScreen(
res3Rect, Resolution1280x1024GfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inRes3Rect && Input.MouseLeftButtonJustPressed)
{
Sound.Play(Sound.Sounds.ButtonClick);
currentResolution = 3;
}
Rectangle res4Rect = BaseGame.CalcRectangleKeep4To3(
ResolutionAutoGfxRect);
res4Rect.Y += BaseGame.YToRes768(125);
bool inRes4Rect = Input.MouseInBox(res4Rect);
if (currentResolution == 4)
BaseGame.UI.OptionsScreen.RenderOnScreen(
res4Rect, ResolutionAutoGfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inRes4Rect && Input.MouseLeftButtonJustPressed)
{
Sound.Play(Sound.Sounds.ButtonClick);
currentResolution = 4;
}
#endregion
#region Graphics options
Rectangle fsRect = BaseGame.CalcRectangleKeep4To3(
FullscreenGfxRect);
fsRect.Y += BaseGame.YToRes768(125);
bool inFsRect = Input.MouseInBox(fsRect);
if (fullscreen)
BaseGame.UI.OptionsScreen.RenderOnScreen(
fsRect, FullscreenGfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inFsRect && Input.MouseLeftButtonJustPressed)
{
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
247
248
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
Class Documentation
Sound.Play(Sound.Sounds.ButtonClick);
fullscreen = !fullscreen;
}
Rectangle pseRect = BaseGame.CalcRectangleKeep4To3(
PostScreenEffectsGfxRect);
pseRect.Y += BaseGame.YToRes768(125);
bool inPseRect = Input.MouseInBox(pseRect);
if (usePostScreenShaders)
BaseGame.UI.OptionsScreen.RenderOnScreen(
pseRect, PostScreenEffectsGfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inPseRect && Input.MouseLeftButtonJustPressed)
{
Sound.Play(Sound.Sounds.ButtonClick);
usePostScreenShaders = !usePostScreenShaders;
}
Rectangle smRect = BaseGame.CalcRectangleKeep4To3(
ShadowsGfxRect);
smRect.Y += BaseGame.YToRes768(125);
bool inSmRect = Input.MouseInBox(smRect);
if (useShadowMapping)
BaseGame.UI.OptionsScreen.RenderOnScreen(
smRect, ShadowsGfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inSmRect && Input.MouseLeftButtonJustPressed)
{
Sound.Play(Sound.Sounds.ButtonClick);
useShadowMapping = !useShadowMapping;
}
Rectangle hdRect = BaseGame.CalcRectangleKeep4To3(
HighDetailGfxRect);
hdRect.Y += BaseGame.YToRes768(125);
bool inHdRect = Input.MouseInBox(hdRect);
if (useHighDetail)
BaseGame.UI.OptionsScreen.RenderOnScreen(
hdRect, HighDetailGfxRect,
selColor, SpriteBlendMode.AlphaBlend);
if (inHdRect && Input.MouseLeftButtonJustPressed)
{
Sound.Play(Sound.Sounds.ButtonClick);
useHighDetail = !useHighDetail;
}
#endregion
#region Sound volume
Rectangle soundRect = BaseGame.CalcRectangleKeep4To3(
SoundGfxRect);
soundRect.Y += BaseGame.YToRes768(125);
if (Input.MouseInBox(soundRect))
{
if (Input.MouseLeftButtonJustPressed)
{
currentSoundVolume =
(Input.MousePos.X - soundRect.X) / (float)soundRect.Width;
Sound.Play(Sound.Sounds.Highlight);
}
}
// Handel controller input
if (currentOptionsNumber == 0)
{
if (Input.GamePadLeftJustPressed ||
Input.KeyboardLeftJustPressed)
{
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.32 GalaxyWars.GameScreens.Options Class Reference
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
249
currentSoundVolume -= 0.1f;
Sound.Play(Sound.Sounds.Highlight);
}
if (Input.GamePadRightJustPressed ||
Input.KeyboardRightJustPressed)
{
currentSoundVolume += 0.1f;
Sound.Play(Sound.Sounds.Highlight);
}
if (currentSoundVolume < 0)
currentSoundVolume = 0;
if (currentSoundVolume > 1)
currentSoundVolume = 1;
}
// Render slider handle
Rectangle gfxRect = UIRenderer.SelectionRadioButtonGfxRect;
BaseGame.UI.Buttons.RenderOnScreen(new Rectangle(
soundRect.X + (int)(soundRect.Width * currentSoundVolume) BaseGame.XToRes(gfxRect.Width) / 2,
soundRect.Y,
BaseGame.XToRes(gfxRect.Width), BaseGame.YToRes768(gfxRect.Height)),
gfxRect);
#endregion
#region Music volume
Rectangle musicRect = BaseGame.CalcRectangleKeep4To3(
MusicGfxRect);
musicRect.Y += BaseGame.YToRes768(125);
if (Input.MouseInBox(musicRect))
{
if (Input.MouseLeftButtonJustPressed)
{
currentMusicVolume =
(Input.MousePos.X - musicRect.X) / (float)musicRect.Width;
Sound.Play(Sound.Sounds.Highlight);
}
}
// Handel controller input
if (currentOptionsNumber == 1)
{
if (Input.GamePadLeftJustPressed ||
Input.KeyboardLeftJustPressed)
{
currentMusicVolume -= 0.1f;
Sound.Play(Sound.Sounds.Highlight);
}
if (Input.GamePadRightJustPressed ||
Input.KeyboardRightJustPressed)
{
currentMusicVolume += 0.1f;
Sound.Play(Sound.Sounds.Highlight);
}
if (currentMusicVolume < 0)
currentMusicVolume = 0;
if (currentMusicVolume > 1)
currentMusicVolume = 1;
}
// Render slider handle
BaseGame.UI.Buttons.RenderOnScreen(new Rectangle(
musicRect.X + (int)(musicRect.Width * currentMusicVolume) BaseGame.XToRes(gfxRect.Width) / 2,
musicRect.Y,
BaseGame.XToRes(gfxRect.Width), BaseGame.YToRes768(gfxRect.Height)),
gfxRect);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
250
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
Class Documentation
#endregion
Sound.SetVolumes(currentSoundVolume, currentMusicVolume);
#region Controller sensitivity
Rectangle sensitivityRect = BaseGame.CalcRectangleKeep4To3(
SensitivityGfxRect);
sensitivityRect.Y += BaseGame.YToRes768(125);
if (Input.MouseInBox(sensitivityRect))
{
if (Input.MouseLeftButtonJustPressed)
{
currentSensitivity =
(Input.MousePos.X - sensitivityRect.X) /
(float)sensitivityRect.Width;
Sound.Play(Sound.Sounds.Highlight);
}
}
// Handel controller input
if (currentOptionsNumber == 2)
{
if (Input.GamePadLeftJustPressed ||
Input.KeyboardLeftJustPressed)
{
currentSensitivity -= 0.1f;
Sound.Play(Sound.Sounds.Highlight);
}
if (Input.GamePadRightJustPressed ||
Input.KeyboardRightJustPressed)
{
currentSensitivity += 0.1f;
Sound.Play(Sound.Sounds.Highlight);
}
if (currentSensitivity < 0)
currentSensitivity = 0;
if (currentSensitivity > 1)
currentSensitivity = 1;
}
// Render slider handle
BaseGame.UI.Buttons.RenderOnScreen(new Rectangle(
sensitivityRect.X +
(int)(sensitivityRect.Width * currentSensitivity) BaseGame.XToRes(gfxRect.Width) / 2,
sensitivityRect.Y,
BaseGame.XToRes(gfxRect.Width), BaseGame.YToRes768(gfxRect.Height)),
gfxRect);
#endregion
#region Show selected line
Rectangle[] lineArrowGfxRects = new Rectangle[]
{
Line4ArrowGfxRect,
Line5ArrowGfxRect,
Line6ArrowGfxRect,
};
for (int num = 0; num < lineArrowGfxRects.Length; num++)
{
Rectangle lineRect = BaseGame.CalcRectangleKeep4To3(
lineArrowGfxRects[num]);
lineRect.Y += BaseGame.YToRes768(125);
lineRect.X -= BaseGame.XToRes(8 + (int)Math.Round(8 *
Math.Sin(BaseGame.TotalTime / 0.21212f)));
// Draw selection arrow
if (currentOptionsNumber == num)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.32 GalaxyWars.GameScreens.Options Class Reference
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
BaseGame.UI.Buttons.RenderOnScreen(
lineRect, UIRenderer.SelectionArrowGfxRect, Color.White);
}
// Game pad selection
if (Input.GamePadUpJustPressed ||
Input.KeyboardUpJustPressed)
{
Sound.Play(Sound.Sounds.Highlight);
currentOptionsNumber = (lineArrowGfxRects.Length +
currentOptionsNumber - 1) % lineArrowGfxRects.Length;
}
else if (Input.GamePadDownJustPressed ||
Input.KeyboardDownJustPressed)
{
Sound.Play(Sound.Sounds.Highlight);
currentOptionsNumber = (currentOptionsNumber + 1) %
lineArrowGfxRects.Length;
}
#endregion
#region Bottom buttons
BaseGame.UI.RenderBottomButtons(true);
#endregion
#region Apply settings when quitting
if (Input.KeyboardEscapeJustPressed ||
Input.GamePadBJustPressed ||
Input.GamePadBackJustPressed ||
BaseGame.UI.backButtonPressed)
{
// Apply settings, for xbox only set music/sound and sensitivity!
GameSettings.Default.PlayerName = currentPlayerName;
switch (currentResolution)
{
case 0:
GameSettings.Default.ResolutionWidth = 640;
GameSettings.Default.ResolutionHeight = 480;
break;
case 1:
GameSettings.Default.ResolutionWidth = 800;
GameSettings.Default.ResolutionHeight = 600;
break;
case 2:
GameSettings.Default.ResolutionWidth = 1024;
GameSettings.Default.ResolutionHeight = 768;
break;
case 3:
GameSettings.Default.ResolutionWidth = 1280;
GameSettings.Default.ResolutionHeight = 1024;
break;
case 4:
// Try to use best resolution available
GameSettings.Default.ResolutionWidth = 0;
GameSettings.Default.ResolutionHeight = 0;
break;
}
GameSettings.Default.Fullscreen = fullscreen;
GameSettings.Default.PostScreenEffects = usePostScreenShaders;
GameSettings.Default.ShadowMapping = useShadowMapping;
GameSettings.Default.HighDetail = useHighDetail;
GameSettings.Default.MusicVolume = currentMusicVolume;
GameSettings.Default.SoundVolume = currentSoundVolume;
GameSettings.Default.ControllerSensitivity = currentSensitivity;
// Save all
GameSettings.Save();
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
251
252
499
500
501
502
503
504
505
506
507
Class Documentation
// Update game settings
BaseGame.CheckOptionsAndShaderVersion();
return true;
}
#endregion
return false;
}
6.32.4
Member Data Documentation
6.32.4.1
readonly Rectangle GalaxyWars.GameScreens.Options.Line4ArrowGfxRect = new
Rectangle(154, 284, 62, 39) [private]
Definition at line 28 of file Options.cs.
6.32.4.2
readonly Rectangle GalaxyWars.GameScreens.Options.Line5ArrowGfxRect = new
Rectangle(160, 354, 62, 39) [private]
Definition at line 29 of file Options.cs.
6.32.4.3
readonly Rectangle GalaxyWars.GameScreens.Options.Line6ArrowGfxRect = new
Rectangle(72, 437, 62, 39) [private]
Definition at line 30 of file Options.cs.
6.32.4.4
readonly Rectangle GalaxyWars.GameScreens.Options.Resolution640x480GfxRect = new
Rectangle(339, 112, 98, 32) [private]
Definition at line 31 of file Options.cs.
6.32.4.5
readonly Rectangle GalaxyWars.GameScreens.Options.Resolution800x600GfxRect = new
Rectangle(454, 112, 98, 32) [private]
Definition at line 32 of file Options.cs.
6.32.4.6
readonly Rectangle GalaxyWars.GameScreens.Options.Resolution1024x768GfxRect =
new Rectangle(575, 112, 108, 32) [private]
Definition at line 33 of file Options.cs.
6.32.4.7
readonly Rectangle GalaxyWars.GameScreens.Options.Resolution1280x1024GfxRect =
new Rectangle(704, 112, 116, 32) [private]
Definition at line 34 of file Options.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.32 GalaxyWars.GameScreens.Options Class Reference
6.32.4.8
253
readonly Rectangle GalaxyWars.GameScreens.Options.ResolutionAutoGfxRect = new
Rectangle(838, 112, 69, 32) [private]
Definition at line 35 of file Options.cs.
6.32.4.9
readonly Rectangle GalaxyWars.GameScreens.Options.FullscreenGfxRect = new
Rectangle(339, 182, 105, 36) [private]
Definition at line 36 of file Options.cs.
6.32.4.10
readonly Rectangle GalaxyWars.GameScreens.Options.PostScreenEffectsGfxRect = new
Rectangle(339, 226, 206, 36) [private]
Definition at line 37 of file Options.cs.
6.32.4.11
readonly Rectangle GalaxyWars.GameScreens.Options.ShadowsGfxRect = new
Rectangle(616, 226, 90, 36) [private]
Definition at line 38 of file Options.cs.
6.32.4.12
readonly Rectangle GalaxyWars.GameScreens.Options.HighDetailGfxRect = new
Rectangle(784, 226, 120, 36) [private]
Definition at line 39 of file Options.cs.
6.32.4.13
readonly Rectangle GalaxyWars.GameScreens.Options.SoundGfxRect = new
Rectangle(384, 281, 448, 39) [private]
Definition at line 40 of file Options.cs.
6.32.4.14
readonly Rectangle GalaxyWars.GameScreens.Options.MusicGfxRect = new
Rectangle(384, 354, 448, 39) [private]
Definition at line 41 of file Options.cs.
6.32.4.15
readonly Rectangle GalaxyWars.GameScreens.Options.SensitivityGfxRect = new
Rectangle(384, 428, 448, 39) [private]
Definition at line 42 of file Options.cs.
6.32.4.16
string GalaxyWars.GameScreens.Options.currentPlayerName =
GameSettings.Default.PlayerName [private]
Current player name, copied from the settings file. Can be changed in this screen and will be saved to the
settings file. Just a variable here to make it easier to change the name and because of performance (reading
Settings every frame is not good).
Definition at line 54 of file Options.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
254
Class Documentation
6.32.4.17
int GalaxyWars.GameScreens.Options.currentOptionsNumber = 0 [private]
Definition at line 60 of file Options.cs.
6.32.4.18
int GalaxyWars.GameScreens.Options.currentResolution = 4 [private]
Definition at line 61 of file Options.cs.
6.32.4.19
bool GalaxyWars.GameScreens.Options.fullscreen = true [private]
Definition at line 62 of file Options.cs.
6.32.4.20
bool GalaxyWars.GameScreens.Options.usePostScreenShaders = true [private]
Definition at line 63 of file Options.cs.
6.32.4.21
bool GalaxyWars.GameScreens.Options.useShadowMapping = true [private]
Definition at line 64 of file Options.cs.
6.32.4.22
bool GalaxyWars.GameScreens.Options.useHighDetail = true [private]
Definition at line 65 of file Options.cs.
6.32.4.23
float GalaxyWars.GameScreens.Options.currentMusicVolume = 1.0f [private]
Definition at line 66 of file Options.cs.
6.32.4.24
float GalaxyWars.GameScreens.Options.currentSoundVolume = 1.0f [private]
Definition at line 67 of file Options.cs.
6.32.4.25
float GalaxyWars.GameScreens.Options.currentSensitivity = 1.0f [private]
Definition at line 68 of file Options.cs.
The documentation for this class was generated from the following file:
• Options.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.33 GalaxyWars.Particles.ParticleEmitter Class Reference
6.33
255
GalaxyWars.Particles.ParticleEmitter Class Reference
Helper for objects that want to leave particles behind them as they move around the world. This emitter
implementation solves two related problems:.
Collaboration diagram for GalaxyWars.Particles.ParticleEmitter:
Color
MaxColor
MinColor
GalaxyWars.Particles.ParticleSettings
Random
GalaxyWars.Particles.ParticleVertex
settings
particles
GalaxyWars.Particles.ParticleSystem
particleSystem
GalaxyWars.Particles.ParticleEmitter
Public Member Functions
• ParticleEmitter (ParticleSystem particleSystem, float particlesPerSecond, Vector3 initialPosition)
Constructs a new particle emitter object.
• void Update (GameTime gameTime, Vector3 newPosition)
Updates the emitter, creating the appropriate number of particles in the appropriate positions.
Private Attributes
•
•
•
•
ParticleSystem particleSystem
float timeBetweenParticles
Vector3 previousPosition
float timeLeftOver
6.33.1
Detailed Description
Helper for objects that want to leave particles behind them as they move around the world. This emitter
implementation solves two related problems:.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
256
Class Documentation
If an object wants to create particles very slowly, less than once per frame, it can be a pain to keep track of
which updates ought to create a new particle versus which should not.
If an object is moving quickly and is creating many particles per frame, it will look ugly if these particles
are all bunched up together. Much better if they can be spread out along a line between where the object
is now and where it was on the previous frame. This is particularly important for leaving trails behind fast
moving objects such as rockets.
This emitter class keeps track of a moving object, remembering its previous position so it can calculate the
velocity of the object. It works out the perfect locations for creating particles at any frequency you specify,
regardless of whether this is faster or slower than the game update rate.
Definition at line 31 of file ParticleEmitter.cs.
6.33.2
Constructor & Destructor Documentation
6.33.2.1
GalaxyWars.Particles.ParticleEmitter.ParticleEmitter (ParticleSystem particleSystem,
float particlesPerSecond, Vector3 initialPosition)
Constructs a new particle emitter object.
Definition at line 45 of file ParticleEmitter.cs.
47
48
49
50
51
52
53
{
this.particleSystem = particleSystem;
timeBetweenParticles = 1.0f / particlesPerSecond;
previousPosition = initialPosition;
}
6.33.3
Member Function Documentation
6.33.3.1
void GalaxyWars.Particles.ParticleEmitter.Update (GameTime gameTime, Vector3
newPosition)
Updates the emitter, creating the appropriate number of particles in the appropriate positions.
Definition at line 60 of file ParticleEmitter.cs.
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
if (gameTime == null)
throw new ArgumentNullException("gameTime");
// Work out how much time has passed since the previous update.
float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
if (elapsedTime > 0)
{
// Work out how fast we are moving.
Vector3 velocity = (newPosition - previousPosition) / elapsedTime;
// If we had any time left over that we didn’t use during the
// previous update, add that to the current elapsed time.
float timeToSpend = timeLeftOver + elapsedTime;
// Counter for looping over the time interval.
float currentTime = -timeLeftOver;
// Create particles as long as we have a big enough time interval.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.33 GalaxyWars.Particles.ParticleEmitter Class Reference
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
257
while (timeToSpend > timeBetweenParticles)
{
currentTime += timeBetweenParticles;
timeToSpend -= timeBetweenParticles;
// Work out the optimal position for this particle. This will produce
// evenly spaced particles regardless of the object speed, particle
// creation frequency, or game update rate.
float mu = currentTime / elapsedTime;
Vector3 position = Vector3.Lerp(previousPosition, newPosition, mu);
// Create the particle.
particleSystem.AddParticle(position, velocity);
}
// Store any time we didn’t use, so it can be part of the next update.
timeLeftOver = timeToSpend;
}
previousPosition = newPosition;
}
6.33.4
Member Data Documentation
6.33.4.1
ParticleSystem GalaxyWars.Particles.ParticleEmitter.particleSystem [private]
Definition at line 35 of file ParticleEmitter.cs.
6.33.4.2
float GalaxyWars.Particles.ParticleEmitter.timeBetweenParticles [private]
Definition at line 36 of file ParticleEmitter.cs.
6.33.4.3
Vector3 GalaxyWars.Particles.ParticleEmitter.previousPosition [private]
Definition at line 37 of file ParticleEmitter.cs.
6.33.4.4
float GalaxyWars.Particles.ParticleEmitter.timeLeftOver [private]
Definition at line 38 of file ParticleEmitter.cs.
The documentation for this class was generated from the following file:
• ParticleEmitter.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
258
Class Documentation
6.34
GalaxyWars.Particles.ParticleSettings Class Reference
Settings class describes all the tweakable options used to control the appearance of a particle system.
Collaboration diagram for GalaxyWars.Particles.ParticleSettings:
Color
MaxColor
MinColor
GalaxyWars.Particles.ParticleSettings
Public Attributes
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
string TextureName = null
int MaxParticles = 100
TimeSpan Duration = TimeSpan.FromSeconds(1)
float DurationRandomness = 0
float EmitterVelocitySensitivity = 1
float MinHorizontalVelocity = 0
float MaxHorizontalVelocity = 0
float MinVerticalVelocity = 0
float MaxVerticalVelocity = 0
Vector3 Gravity = Vector3.Zero
float EndVelocity = 1
Color MinColor = Color.White
Color MaxColor = Color.White
float MinRotateSpeed = 0
float MaxRotateSpeed = 0
float MinStartSize = 100
float MaxStartSize = 100
float MinEndSize = 100
float MaxEndSize = 100
Blend SourceBlend = Blend.SourceAlpha
Blend DestinationBlend = Blend.InverseSourceAlpha
6.34.1
Detailed Description
Settings class describes all the tweakable options used to control the appearance of a particle system.
Definition at line 15 of file ParticleSettings.cs.
6.34.2
Member Data Documentation
6.34.2.1
string GalaxyWars.Particles.ParticleSettings.TextureName = null
Definition at line 18 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.34 GalaxyWars.Particles.ParticleSettings Class Reference
6.34.2.2
259
int GalaxyWars.Particles.ParticleSettings.MaxParticles = 100
Definition at line 22 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.3
TimeSpan GalaxyWars.Particles.ParticleSettings.Duration = TimeSpan.FromSeconds(1)
Definition at line 26 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.4
float GalaxyWars.Particles.ParticleSettings.DurationRandomness = 0
Definition at line 30 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.5
float GalaxyWars.Particles.ParticleSettings.EmitterVelocitySensitivity = 1
Definition at line 38 of file ParticleSettings.cs.
6.34.2.6
float GalaxyWars.Particles.ParticleSettings.MinHorizontalVelocity = 0
Definition at line 44 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.7
float GalaxyWars.Particles.ParticleSettings.MaxHorizontalVelocity = 0
Definition at line 45 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.8
float GalaxyWars.Particles.ParticleSettings.MinVerticalVelocity = 0
Definition at line 51 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.9
float GalaxyWars.Particles.ParticleSettings.MaxVerticalVelocity = 0
Definition at line 52 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.10
Vector3 GalaxyWars.Particles.ParticleSettings.Gravity = Vector3.Zero
Definition at line 58 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
260
6.34.2.11
Class Documentation
float GalaxyWars.Particles.ParticleSettings.EndVelocity = 1
Definition at line 65 of file ParticleSettings.cs.
6.34.2.12
Color GalaxyWars.Particles.ParticleSettings.MinColor = Color.White
Definition at line 70 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.13
Color GalaxyWars.Particles.ParticleSettings.MaxColor = Color.White
Definition at line 71 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.14
float GalaxyWars.Particles.ParticleSettings.MinRotateSpeed = 0
Definition at line 81 of file ParticleSettings.cs.
6.34.2.15
float GalaxyWars.Particles.ParticleSettings.MaxRotateSpeed = 0
Definition at line 82 of file ParticleSettings.cs.
6.34.2.16
float GalaxyWars.Particles.ParticleSettings.MinStartSize = 100
Definition at line 88 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.17
float GalaxyWars.Particles.ParticleSettings.MaxStartSize = 100
Definition at line 89 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.18
float GalaxyWars.Particles.ParticleSettings.MinEndSize = 100
Definition at line 95 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.19
float GalaxyWars.Particles.ParticleSettings.MaxEndSize = 100
Definition at line 96 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.34 GalaxyWars.Particles.ParticleSettings Class Reference
6.34.2.20
Blend GalaxyWars.Particles.ParticleSettings.SourceBlend = Blend.SourceAlpha
Definition at line 100 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
6.34.2.21
Blend GalaxyWars.Particles.ParticleSettings.DestinationBlend =
Blend.InverseSourceAlpha
Definition at line 101 of file ParticleSettings.cs.
Referenced by GalaxyWars.Particles.FireParticleSystem.InitializeSettings().
The documentation for this class was generated from the following file:
• ParticleSettings.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
261
262
Class Documentation
6.35
GalaxyWars.Particles.ParticleSystem Class Reference
The main component in charge of displaying particles.
Inheritance diagram for GalaxyWars.Particles.ParticleSystem:
GalaxyWars.Particles.ParticleSystem
GalaxyWars.Particles.FireParticleSystem
Collaboration diagram for GalaxyWars.Particles.ParticleSystem:
Color
MaxColor
MinColor
GalaxyWars.Particles.ParticleSettings
Random
GalaxyWars.Particles.ParticleVertex
settings
particles
GalaxyWars.Particles.ParticleSystem
Public Member Functions
• void Initialize ()
Initializes the component.
• void Update (GameTime gameTime)
Updates the particle system.
• void Draw ()
Draws the particle system.
• void SetCamera (Matrix view, Matrix projection)
Sets the camera view and projection matrices that will be used to draw this particle system.
• void AddParticle (Vector3 position, Vector3 velocity)
Adds a new particle to the system.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.35 GalaxyWars.Particles.ParticleSystem Class Reference
263
Protected Member Functions
• ParticleSystem (ContentManager content)
Constructor.
• abstract void InitializeSettings (ParticleSettings settings)
Derived particle system classes should override this method and use it to initalize their tweakable settings.
• void LoadGraphicsContent (bool loadAllContent)
Loads graphics for the particle system.
Private Member Functions
• void LoadParticleEffect ()
Helper for loading and initializing the particle effect.
• void RetireActiveParticles ()
Helper for checking when active particles have reached the end of their life. It moves old particles from the
active area of the queue to the retired section.
• void FreeRetiredParticles ()
Helper for checking when retired particles have been kept around long enough that we can be sure the GPU
is no longer using them. It moves old particles from the retired area of the queue to the free section.
• void AddNewParticlesToVertexBuffer ()
Helper for uploading new particles from our managed array to the GPU vertex buffer.
• void SetParticleRenderStates (RenderState renderState)
Helper for setting the renderstates used to draw particles.
Private Attributes
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
ParticleSettings settings = new ParticleSettings()
ContentManager content
Effect particleEffect
EffectParameter effectViewParameter
EffectParameter effectProjectionParameter
EffectParameter effectViewportHeightParameter
EffectParameter effectTimeParameter
ParticleVertex[ ] particles
VertexBuffer vertexBuffer
VertexDeclaration vertexDeclaration
int firstActiveParticle
int firstNewParticle
int firstFreeParticle
int firstRetiredParticle
float currentTime
int drawCounter
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
264
Class Documentation
Static Private Attributes
• static Random random = new Random()
6.35.1
Detailed Description
The main component in charge of displaying particles.
Definition at line 16 of file ParticleSystem.cs.
6.35.2
Constructor & Destructor Documentation
6.35.2.1
GalaxyWars.Particles.ParticleSystem.ParticleSystem (ContentManager content)
[protected]
Constructor.
Definition at line 139 of file ParticleSystem.cs.
140
141
142
143
{
this.content = content;
Initialize();
}
6.35.3
Member Function Documentation
6.35.3.1
void GalaxyWars.Particles.ParticleSystem.Initialize ()
Initializes the component.
Definition at line 148 of file ParticleSystem.cs.
149
150
151
152
153
6.35.3.2
{
InitializeSettings(settings);
particles = new ParticleVertex[settings.MaxParticles];
LoadGraphicsContent(true);
}
abstract void GalaxyWars.Particles.ParticleSystem.InitializeSettings (ParticleSettings
settings) [protected, pure virtual]
Derived particle system classes should override this method and use it to initalize their tweakable settings.
Implemented in GalaxyWars.Particles.FireParticleSystem.
6.35.3.3
void GalaxyWars.Particles.ParticleSystem.LoadGraphicsContent (bool loadAllContent)
[protected]
Loads graphics for the particle system.
Definition at line 164 of file ParticleSystem.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.35 GalaxyWars.Particles.ParticleSystem Class Reference
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
6.35.3.4
265
{
if (loadAllContent)
{
LoadParticleEffect();
vertexDeclaration = new VertexDeclaration(BaseGame.Device, ParticleVertex.VertexElemen
}
// Create a dynamic vertex buffer.
BufferUsage usage = BufferUsage.WriteOnly |
BufferUsage.Points;
int size = ParticleVertex.SizeInBytes * particles.Length;
vertexBuffer = new VertexBuffer(BaseGame.Device, size, usage);
// Initialize the vertex buffer contents. This is necessary in order
// to correctly restore any existing particles after a lost device.
vertexBuffer.SetData(particles);
}
void GalaxyWars.Particles.ParticleSystem.LoadParticleEffect () [private]
Helper for loading and initializing the particle effect.
Definition at line 187 of file ParticleSystem.cs.
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
{
Effect effect = content.Load<Effect>("Content/Shaders/ParticleEffect");
//
//
//
//
//
If we have several particle systems, the content manager will return
a single shared effect instance to them all. But we want to preconfigure
the effect with parameters that are specific to this particular
particle system. By cloning the effect, we prevent one particle system
from stomping over the parameter settings of another.
particleEffect = effect.Clone(BaseGame.Device);
EffectParameterCollection parameters = particleEffect.Parameters;
// Look up shortcuts for parameters that change every frame.
effectViewParameter = parameters["View"];
effectProjectionParameter = parameters["Projection"];
effectViewportHeightParameter = parameters["ViewportHeight"];
effectTimeParameter = parameters["CurrentTime"];
// Set the values of parameters that do not change.
parameters["Duration"].SetValue((float)settings.Duration.TotalSeconds);
parameters["DurationRandomness"].SetValue(settings.DurationRandomness);
parameters["Gravity"].SetValue(settings.Gravity);
parameters["EndVelocity"].SetValue(settings.EndVelocity);
parameters["MinColor"].SetValue(settings.MinColor.ToVector4());
parameters["MaxColor"].SetValue(settings.MaxColor.ToVector4());
parameters["RotateSpeed"].SetValue(
new Vector2(settings.MinRotateSpeed, settings.MaxRotateSpeed));
parameters["StartSize"].SetValue(
new Vector2(settings.MinStartSize, settings.MaxStartSize));
parameters["EndSize"].SetValue(
new Vector2(settings.MinEndSize, settings.MaxEndSize));
// Load the particle texture, and set it onto the effect.
Texture2D texture = content.Load<Texture2D>(settings.TextureName);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
266
227
228
229
230
231
232
233
234
235
236
237
238
239
6.35.3.5
Class Documentation
parameters["Texture"].SetValue(texture);
// Choose the appropriate effect technique. If these particles will never
// rotate, we can use a simpler pixel shader that requires less GPU power.
string techniqueName;
if ((settings.MinRotateSpeed == 0) && (settings.MaxRotateSpeed == 0))
techniqueName = "NonRotatingParticles";
else
techniqueName = "RotatingParticles";
particleEffect.CurrentTechnique = particleEffect.Techniques[techniqueName];
}
void GalaxyWars.Particles.ParticleSystem.Update (GameTime gameTime)
Updates the particle system.
Definition at line 248 of file ParticleSystem.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Update().
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
6.35.3.6
{
if (gameTime == null)
throw new ArgumentNullException("gameTime");
currentTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
RetireActiveParticles();
FreeRetiredParticles();
//
//
//
//
//
If we let our timer go on increasing for ever, it would eventually
run out of floating point precision, at which point the particles
would render incorrectly. An easy way to prevent this is to notice
that the time value doesn’t matter when no particles are being drawn,
so we can reset it back to zero any time the active queue is empty.
if (firstActiveParticle == firstFreeParticle)
currentTime = 0;
if (firstRetiredParticle == firstActiveParticle)
drawCounter = 0;
}
void GalaxyWars.Particles.ParticleSystem.RetireActiveParticles () [private]
Helper for checking when active particles have reached the end of their life. It moves old particles from
the active area of the queue to the retired section.
Definition at line 276 of file ParticleSystem.cs.
277
278
279
280
281
282
283
284
285
286
{
float particleDuration = (float)settings.Duration.TotalSeconds;
while (firstActiveParticle != firstNewParticle)
{
// Is this particle old enough to retire?
float particleAge = currentTime - particles[firstActiveParticle].Time;
if (particleAge < particleDuration)
break;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.35 GalaxyWars.Particles.ParticleSystem Class Reference
287
288
289
290
291
292
293
294
295
296
297
6.35.3.7
267
// Remember the time at which we retired this particle.
particles[firstActiveParticle].Time = drawCounter;
// Move the particle from the active to the retired queue.
firstActiveParticle++;
if (firstActiveParticle >= particles.Length)
firstActiveParticle = 0;
}
}
void GalaxyWars.Particles.ParticleSystem.FreeRetiredParticles () [private]
Helper for checking when retired particles have been kept around long enough that we can be sure the GPU
is no longer using them. It moves old particles from the retired area of the queue to the free section.
Definition at line 304 of file ParticleSystem.cs.
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
6.35.3.8
{
while (firstRetiredParticle != firstActiveParticle)
{
// Has this particle been unused long enough that
// the GPU is sure to be finished with it?
int age = drawCounter - (int)particles[firstRetiredParticle].Time;
//
//
//
if
The GPU is never supposed to get more than 2 frames behind the CPU.
We add 1 to that, just to be safe in case of buggy drivers that
might bend the rules and let the GPU get further behind.
(age < 3)
break;
// Move the particle from the retired to the free queue.
firstRetiredParticle++;
if (firstRetiredParticle >= particles.Length)
firstRetiredParticle = 0;
}
}
void GalaxyWars.Particles.ParticleSystem.Draw ()
Draws the particle system.
Definition at line 329 of file ParticleSystem.cs.
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
{
GraphicsDevice device = BaseGame.Device;
// If there are any particles waiting in the newly added queue,
// we’d better upload them to the GPU ready for drawing.
if (firstNewParticle != firstFreeParticle)
{
AddNewParticlesToVertexBuffer();
}
// If there are any active particles, draw them now!
if (firstActiveParticle != firstFreeParticle)
{
SetParticleRenderStates(device.RenderState);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
268
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
6.35.3.9
Class Documentation
// Set an effect parameter describing the viewport size. This is needed
// to convert particle sizes into screen space point sprite sizes.
effectViewportHeightParameter.SetValue(device.Viewport.Height);
// Set an effect parameter describing the current time. All the vertex
// shader particle animation is keyed off this value.
effectTimeParameter.SetValue(currentTime);
// Set the particle vertex buffer and vertex declaration.
device.Vertices[0].SetSource(vertexBuffer, 0, ParticleVertex.SizeInBytes);
device.VertexDeclaration = vertexDeclaration;
// Activate the particle effect.
particleEffect.Begin();
foreach (EffectPass pass in particleEffect.CurrentTechnique.Passes)
{
pass.Begin();
if (firstActiveParticle < firstFreeParticle)
{
// If the active particles are all in one consecutive range,
// we can draw them all in a single call.
device.DrawPrimitives(PrimitiveType.PointList,
firstActiveParticle,
firstFreeParticle - firstActiveParticle);
}
else
{
// If the active particle range wraps past the end of the queue
// back to the start, we must split them over two draw calls.
device.DrawPrimitives(PrimitiveType.PointList,
firstActiveParticle,
particles.Length - firstActiveParticle);
if (firstFreeParticle > 0)
{
device.DrawPrimitives(PrimitiveType.PointList, 0, firstFreeParticle);
}
}
pass.End();
}
particleEffect.End();
// Reset a couple of the more unusual renderstates that we changed,
// so as not to mess up any other subsequent drawing.
device.RenderState.PointSpriteEnable = false;
device.RenderState.DepthBufferWriteEnable = true;
}
drawCounter++;
}
void GalaxyWars.Particles.ParticleSystem.AddNewParticlesToVertexBuffer ()
[private]
Helper for uploading new particles from our managed array to the GPU vertex buffer.
Definition at line 405 of file ParticleSystem.cs.
406
{
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.35 GalaxyWars.Particles.ParticleSystem Class Reference
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
6.35.3.10
int stride = ParticleVertex.SizeInBytes;
if (firstNewParticle < firstFreeParticle)
{
// If the new particles are all in one consecutive range,
// we can upload them all in a single call.
vertexBuffer.SetData(firstNewParticle * stride, particles,
firstNewParticle,
firstFreeParticle - firstNewParticle,
stride);
}
else
{
// If the new particle range wraps past the end of the queue
// back to the start, we must split them over two upload calls.
vertexBuffer.SetData(firstNewParticle * stride, particles,
firstNewParticle,
particles.Length - firstNewParticle,
stride);
if (firstFreeParticle > 0)
{
vertexBuffer.SetData(0, particles,
0, firstFreeParticle,
stride);
}
}
// Move the particles we just uploaded from the new to the active queue.
firstNewParticle = firstFreeParticle;
}
void GalaxyWars.Particles.ParticleSystem.SetParticleRenderStates (RenderState
renderState) [private]
Helper for setting the renderstates used to draw particles.
Definition at line 443 of file ParticleSystem.cs.
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
269
{
// Enable point sprites.
renderState.PointSpriteEnable = true;
renderState.PointSizeMax = 256;
// Set the alpha blend mode.
renderState.AlphaBlendEnable = true;
renderState.AlphaBlendOperation = BlendFunction.Add;
renderState.SourceBlend = settings.SourceBlend;
renderState.DestinationBlend = settings.DestinationBlend;
// Set the alpha test mode.
renderState.AlphaTestEnable = true;
renderState.AlphaFunction = CompareFunction.Greater;
renderState.ReferenceAlpha = 0;
// Enable the depth buffer (so particles will not be visible through
// solid objects like the ground plane), but disable depth writes
// (so particles will not obscure other particles).
renderState.DepthBufferEnable = true;
renderState.DepthBufferWriteEnable = false;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
270
6.35.3.11
Class Documentation
void GalaxyWars.Particles.ParticleSystem.SetCamera (Matrix view, Matrix projection)
Sets the camera view and projection matrices that will be used to draw this particle system.
Definition at line 476 of file ParticleSystem.cs.
477
478
479
480
6.35.3.12
{
effectViewParameter.SetValue(view);
effectProjectionParameter.SetValue(projection);
}
void GalaxyWars.Particles.ParticleSystem.AddParticle (Vector3 position, Vector3
velocity)
Adds a new particle to the system.
Definition at line 485 of file ParticleSystem.cs.
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
{
// Figure out where in the circular queue to allocate the new particle.
int nextFreeParticle = firstFreeParticle + 1;
if (nextFreeParticle >= particles.Length)
nextFreeParticle = 0;
// If there are no free particles, we just have to give up.
if (nextFreeParticle == firstRetiredParticle)
return;
// Adjust the input velocity based on how much
// this particle system wants to be affected by it.
velocity *= settings.EmitterVelocitySensitivity;
// Add in some random amount of horizontal velocity.
float horizontalVelocity = MathHelper.Lerp(settings.MinHorizontalVelocity,
settings.MaxHorizontalVelocity,
(float)random.NextDouble());
double horizontalAngle = random.NextDouble() * MathHelper.TwoPi;
velocity.X += horizontalVelocity * (float)Math.Cos(horizontalAngle);
velocity.Z += horizontalVelocity * (float)Math.Sin(horizontalAngle);
// Add in some random amount of vertical velocity.
velocity.Y += MathHelper.Lerp(settings.MinVerticalVelocity,
settings.MaxVerticalVelocity,
(float)random.NextDouble());
// Choose four random control values. These will be used by the vertex
// shader to give each particle a different size, rotation, and color.
Color randomValues = new Color((byte)random.Next(255),
(byte)random.Next(255),
(byte)random.Next(255),
(byte)random.Next(255));
// Fill in the particle vertex structure.
particles[firstFreeParticle].Position = position;
particles[firstFreeParticle].Velocity = velocity;
particles[firstFreeParticle].Random = randomValues;
particles[firstFreeParticle].Time = currentTime;
firstFreeParticle = nextFreeParticle;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.35 GalaxyWars.Particles.ParticleSystem Class Reference
271
6.35.4
Member Data Documentation
6.35.4.1
ParticleSettings GalaxyWars.Particles.ParticleSystem.settings = new ParticleSettings()
[private]
Definition at line 21 of file ParticleSystem.cs.
6.35.4.2
ContentManager GalaxyWars.Particles.ParticleSystem.content [private]
Definition at line 24 of file ParticleSystem.cs.
6.35.4.3
Effect GalaxyWars.Particles.ParticleSystem.particleEffect [private]
Definition at line 28 of file ParticleSystem.cs.
6.35.4.4
EffectParameter GalaxyWars.Particles.ParticleSystem.effectViewParameter
[private]
Definition at line 31 of file ParticleSystem.cs.
6.35.4.5
EffectParameter GalaxyWars.Particles.ParticleSystem.effectProjectionParameter
[private]
Definition at line 32 of file ParticleSystem.cs.
6.35.4.6
EffectParameter GalaxyWars.Particles.ParticleSystem.effectViewportHeightParameter
[private]
Definition at line 33 of file ParticleSystem.cs.
6.35.4.7
EffectParameter GalaxyWars.Particles.ParticleSystem.effectTimeParameter
[private]
Definition at line 34 of file ParticleSystem.cs.
6.35.4.8
ParticleVertex [ ] GalaxyWars.Particles.ParticleSystem.particles [private]
Definition at line 37 of file ParticleSystem.cs.
6.35.4.9
VertexBuffer GalaxyWars.Particles.ParticleSystem.vertexBuffer [private]
Definition at line 41 of file ParticleSystem.cs.
6.35.4.10
VertexDeclaration GalaxyWars.Particles.ParticleSystem.vertexDeclaration
[private]
Definition at line 44 of file ParticleSystem.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
272
Class Documentation
6.35.4.11
int GalaxyWars.Particles.ParticleSystem.firstActiveParticle [private]
Definition at line 117 of file ParticleSystem.cs.
6.35.4.12
int GalaxyWars.Particles.ParticleSystem.firstNewParticle [private]
Definition at line 118 of file ParticleSystem.cs.
6.35.4.13
int GalaxyWars.Particles.ParticleSystem.firstFreeParticle [private]
Definition at line 119 of file ParticleSystem.cs.
6.35.4.14
int GalaxyWars.Particles.ParticleSystem.firstRetiredParticle [private]
Definition at line 120 of file ParticleSystem.cs.
6.35.4.15
float GalaxyWars.Particles.ParticleSystem.currentTime [private]
Definition at line 123 of file ParticleSystem.cs.
6.35.4.16
int GalaxyWars.Particles.ParticleSystem.drawCounter [private]
Definition at line 127 of file ParticleSystem.cs.
6.35.4.17
Random GalaxyWars.Particles.ParticleSystem.random = new Random() [static,
private]
Definition at line 130 of file ParticleSystem.cs.
The documentation for this class was generated from the following file:
• ParticleSystem.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.36 GalaxyWars.Particles.ParticleVertex Struct Reference
6.36
GalaxyWars.Particles.ParticleVertex Struct Reference
Custom vertex structure for drawing point sprite particles.
Collaboration diagram for GalaxyWars.Particles.ParticleVertex:
Color
Random
GalaxyWars.Particles.ParticleVertex
Public Attributes
•
•
•
•
•
Vector3 Position
Vector3 Velocity
Color Random
float Time
const int SizeInBytes = 32
Static Public Attributes
• static readonly VertexElement[ ] VertexElements
6.36.1
Detailed Description
Custom vertex structure for drawing point sprite particles.
Definition at line 13 of file ParticleVertex.cs.
6.36.2
Member Data Documentation
6.36.2.1
Vector3 GalaxyWars.Particles.ParticleVertex.Position
Definition at line 16 of file ParticleVertex.cs.
6.36.2.2
Vector3 GalaxyWars.Particles.ParticleVertex.Velocity
Definition at line 19 of file ParticleVertex.cs.
6.36.2.3
Color GalaxyWars.Particles.ParticleVertex.Random
Definition at line 22 of file ParticleVertex.cs.
6.36.2.4
float GalaxyWars.Particles.ParticleVertex.Time
Definition at line 25 of file ParticleVertex.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
273
274
Class Documentation
6.36.2.5
readonly VertexElement [ ] GalaxyWars.Particles.ParticleVertex.VertexElements
[static]
Initial value:
{
new VertexElement(0, 0, VertexElementFormat.Vector3,
VertexElementMethod.Default,
VertexElementUsage.Position, 0),
new VertexElement(0, 12, VertexElementFormat.Vector3,
VertexElementMethod.Default,
VertexElementUsage.Normal, 0),
new VertexElement(0, 24, VertexElementFormat.Color,
VertexElementMethod.Default,
VertexElementUsage.Color, 0),
new VertexElement(0, 28, VertexElementFormat.Single,
VertexElementMethod.Default,
VertexElementUsage.TextureCoordinate, 0),
}
Definition at line 29 of file ParticleVertex.cs.
6.36.2.6
const int GalaxyWars.Particles.ParticleVertex.SizeInBytes = 32
Definition at line 50 of file ParticleVertex.cs.
The documentation for this struct was generated from the following file:
• ParticleVertex.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.37 GalaxyWars.GameLogic.Player Class Reference
6.37
275
GalaxyWars.GameLogic.Player Class Reference
Player helper class, holds all the current game properties: Fuel, Health, Speed, Lifes and Score. Note: This
class is just used in GalaxyWars and we only have 1 instance of it for the current player for the current
game. If we want to have more than 1 player (e.g. in multiplayer mode) you should add a multiplayer class
and have all player instances there.
Inheritance diagram for GalaxyWars.GameLogic.Player:
GalaxyWars.GameLogic.BasePlayer
GalaxyWars.GameLogic.SpaceshipPhysics
GalaxyWars.GameLogic.ChaseCamera
GalaxyWars.GameLogic.Player
Collaboration diagram for GalaxyWars.GameLogic.Player:
GalaxyWars.GameLogic.BasePlayer
GalaxyWars.GameLogic.SpaceshipPhysics
GalaxyWars.GameLogic.ChaseCamera
GalaxyWars.GameLogic.Player
Public Member Functions
• Player (Vector3 setShipPosition)
Create chase camera.
• override void Reset ()
Reset player values.
• override void Update ()
Update game logic, called every frame.
6.37.1
Detailed Description
Player helper class, holds all the current game properties: Fuel, Health, Speed, Lifes and Score. Note: This
class is just used in GalaxyWars and we only have 1 instance of it for the current player for the current
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
276
Class Documentation
game. If we want to have more than 1 player (e.g. in multiplayer mode) you should add a multiplayer class
and have all player instances there.
Definition at line 27 of file Player.cs.
6.37.2
Constructor & Destructor Documentation
6.37.2.1
GalaxyWars.GameLogic.Player.Player (Vector3 setShipPosition)
Create chase camera.
Parameters:
setShipPosition Set ship position
setCameraPos Set camera pos
Definition at line 39 of file Player.cs.
39
40
41
: base(setShipPosition)
{
}
6.37.3
Member Function Documentation
6.37.3.1
override void GalaxyWars.GameLogic.Player.Reset () [virtual]
Reset player values.
Reimplemented from GalaxyWars.GameLogic.ChaseCamera.
Definition at line 50 of file Player.cs.
51
52
53
6.37.3.2
{
base.Reset();
}
override void GalaxyWars.GameLogic.Player.Update () [virtual]
Update game logic, called every frame.
Reimplemented from GalaxyWars.GameLogic.ChaseCamera.
Definition at line 62 of file Player.cs.
Referenced by GalaxyWars.GalaxyWarsManager.Update().
63
64
65
66
67
68
69
70
71
72
{
// Don’t handle any more game logic if game is over.
//if (GalaxyWarsManager.GameActive && ZoomInTime <= 0)
//{
// Game over? Then show end screen!
//
if (isGameOver)
//
{
//
// Just rotate around, don’t use camera class!
//
cameraPos = ShipPosition + new Vector3(0, -5, +20) +
//
Vector3.TransformNormal(new Vector3(30, 0, 0),
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.37 GalaxyWars.GameLogic.Player Class Reference
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
277
//
//
//
//
//
//
Matrix.CreateRotationZ(BaseGame.TotalTimeMilliseconds / 2593.0f));
BaseGame.ViewMatrix = Matrix.CreateLookAt(
cameraPos, ShipPosition, SpaceshipUpVector);
int rank = Highscores.GetRankFromCurrentTime(
this.levelNum, (int)this.BestTimeMilliseconds);
this.currentGameTimeMilliseconds = this.BestTimeMilliseconds;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
if (victory)
{
// Display Victory message
TextureFont.WriteTextCentered(
BaseGame.Width / 2, BaseGame.Height / 7,
"Victory! You won.",
Color.LightGreen, 1.25f);
}
else
{
// Display game over message
TextureFont.WriteTextCentered(
BaseGame.Width / 2, BaseGame.Height / 7,
"Game Over! You lost.",
Color.Red, 1.25f);
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
for (int num = 0; num < lapTimes.Count; num++)
TextureFont.WriteTextCentered(
BaseGame.Width / 2,
BaseGame.Height / 7 + BaseGame.YToRes(35) * (1 + num),
"Lap " + (num + 1) + " Time: " +
(((int)lapTimes[num]) / 60).ToString("00") + ":" +
(((int)lapTimes[num]) % 60).ToString("00") + "." +
(((int)(lapTimes[num] * 100)) % 100).ToString("00"),
Color.White, 1.25f);
TextureFont.WriteTextCentered(
BaseGame.Width / 2,
BaseGame.Height / 7 + BaseGame.YToRes(35) * (1 + lapTimes.Count),
"Rank: " + (1 + rank),
Color.White, 1.25f);
//
//
//
//}
// Don’t continue processing game logic
return;
}
base.Update();
}
The documentation for this class was generated from the following file:
• Player.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
278
Class Documentation
6.38
GalaxyWars.Shaders.PostScreenGlow Class Reference
Post screen glow shader based on PostScreenGlow.fx. Derive from PostScreenMenu, this way we can save
duplicating the effect parameters and use the same RenderToTextures.
Inheritance diagram for GalaxyWars.Shaders.PostScreenGlow:
GalaxyWars.Shaders.ShaderEffect
GalaxyWars.Shaders.PostScreenMenu
GalaxyWars.Shaders.PostScreenGlow
Collaboration diagram for GalaxyWars.Shaders.PostScreenGlow:
XnaTexture
Color
lastUsedHeightTexture
lastUsedNormalTexture
lastUsedDiffuseTexture
lastUsedDetailTexture
lastUsedAmbientColor
lastUsedSpecularColor
lastUsedDiffuseColor
lastUsedCarHueColorChange
lighting
normalMapping
landscapeNormalMapping
lineRendering
GalaxyWars.Shaders.ShaderEffect
noiseMapTexture
blurMap1Texture
blurMap2Texture
sceneMapTexture
downsampleMapTexture
Texture2D
internalXnaTexture
GalaxyWars.Graphics.Texture
GalaxyWars.Shaders.RenderToTexture
GalaxyWars.Shaders.PostScreenMenu
radialSceneMapTexture
screenBorderFadeoutMapTexture
GalaxyWars.Shaders.PostScreenGlow
Public Member Functions
• PostScreenGlow ()
Create post screen glow.
• override void Show ()
Execute shaders and show result on screen, Start(..) must have been called before and the scene should be
rendered to sceneMapTexture.
Protected Member Functions
• override void GetParameters ()
Reload.
Properties
• float RadialBlurScaleFactor [get, set]
Radial blur scale factor.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.38 GalaxyWars.Shaders.PostScreenGlow Class Reference
279
Private Attributes
• const string Filename = "PostScreenGlow.fx"
The shader effect filename for this shader.
• EffectParameter radialSceneMap
Effect handles for window size and scene map.
• EffectParameter radialBlurScaleFactor
• EffectParameter screenBorderFadeoutMap
• RenderToTexture radialSceneMapTexture
Links to the passTextures, easier to write code this way. This are just reference copies.
• Texture screenBorderFadeoutMapTexture = null
Helper texture for the screen border (darken the borders).
• float lastUsedRadialBlurScaleFactor = 0
Last used radial blur scale factor.
6.38.1
Detailed Description
Post screen glow shader based on PostScreenGlow.fx. Derive from PostScreenMenu, this way we can save
duplicating the effect parameters and use the same RenderToTextures.
Definition at line 22 of file PostScreenGlow.cs.
6.38.2
Constructor & Destructor Documentation
6.38.2.1
GalaxyWars.Shaders.PostScreenGlow.PostScreenGlow ()
Create post screen glow.
Definition at line 79 of file PostScreenGlow.cs.
80
81
82
83
84
85
: base(Filename)
{
// Final map for glow, used to perform radial blur next step
radialSceneMapTexture = new RenderToTexture(
RenderToTexture.SizeType.FullScreen);
}
6.38.3
Member Function Documentation
6.38.3.1
override void GalaxyWars.Shaders.PostScreenGlow.GetParameters () [protected,
virtual]
Reload.
Reimplemented from GalaxyWars.Shaders.PostScreenMenu.
Definition at line 92 of file PostScreenGlow.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
280
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
6.38.3.2
Class Documentation
{
// Can’t get parameters if loading failed!
if (effect == null)
return;
windowSize = effect.Parameters["windowSize"];
sceneMap = effect.Parameters["sceneMap"];
// We need both windowSize and sceneMap.
if (windowSize == null ||
sceneMap == null)
throw new NotSupportedException("windowSize and sceneMap must be " +
"valid in PostScreenShader=" + Filename);
// Init additional stuff
downsampleMap = effect.Parameters["downsampleMap"];
blurMap1 = effect.Parameters["blurMap1"];
blurMap2 = effect.Parameters["blurMap2"];
radialSceneMap = effect.Parameters["radialSceneMap"];
// Load screen border texture
screenBorderFadeoutMap = effect.Parameters["screenBorderFadeoutMap"];
screenBorderFadeoutMapTexture = new Texture("ScreenBorderFadeout.dds");
// Set texture
screenBorderFadeoutMap.SetValue(
screenBorderFadeoutMapTexture.XnaTexture);
radialBlurScaleFactor = effect.Parameters["radialBlurScaleFactor"];
}
override void GalaxyWars.Shaders.PostScreenGlow.Show () [virtual]
Execute shaders and show result on screen, Start(..) must have been called before and the scene should be
rendered to sceneMapTexture.
Reimplemented from GalaxyWars.Shaders.PostScreenMenu.
Definition at line 129 of file PostScreenGlow.cs.
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{
// Only apply post screen glow if texture is valid and effect is valid
if (sceneMapTexture == null ||
effect == null ||
started == false)
return;
started = false;
// Resolve sceneMapTexture render target for Xbox360 support
sceneMapTexture.Resolve();
// Don’t use or write to the z buffer
BaseGame.Device.RenderState.DepthBufferEnable = false;
BaseGame.Device.RenderState.DepthBufferWriteEnable = false;
// Also don’t use any kind of blending.
//Update: allow writing to alpha!
BaseGame.Device.RenderState.AlphaBlendEnable = false;
if (windowSize != null)
windowSize.SetValue(
new float[] { sceneMapTexture.Width, sceneMapTexture.Height });
if (sceneMap != null)
sceneMap.SetValue(sceneMapTexture.XnaTexture);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.38 GalaxyWars.Shaders.PostScreenGlow Class Reference
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
281
RadialBlurScaleFactor =
// Warning: To big values will make the motion blur look to
// stepy (we see each step and thats not good). -0.02 should be max.
-(0.0025f + GalaxyWarsManager.Player.Speed * 0.005f /
Player.DefaultMaxSpeed);
effect.CurrentTechnique = effect.Techniques["ScreenGlow20"];
// We must have exactly 5 passes!
if (effect.CurrentTechnique.Passes.Count != 5)
throw new InvalidOperationException(
"This shader should have exactly 5 passes!");
try
{
effect.Begin();
for (int pass = 0; pass < effect.CurrentTechnique.Passes.Count;
pass++)
{
if (pass == 0)
radialSceneMapTexture.SetRenderTarget();
else if (pass == 1)
downsampleMapTexture.SetRenderTarget();
else if (pass == 2)
blurMap1Texture.SetRenderTarget();
else if (pass == 3)
blurMap2Texture.SetRenderTarget();
else
// Do a full reset back to the back buffer
BaseGame.ResetRenderTarget(true);
EffectPass effectPass = effect.CurrentTechnique.Passes[pass];
effectPass.Begin();
// For first effect we use radial blur, draw it with a grid
// to get cooler results (more blur at borders than in middle).
if (pass == 0)
VBScreenHelper.Render10x10Grid();
else
VBScreenHelper.Render();
effectPass.End();
if (pass == 0)
{
radialSceneMapTexture.Resolve();
if (radialSceneMap != null)
radialSceneMap.SetValue(radialSceneMapTexture.XnaTexture);
effect.CommitChanges();
}
else if (pass == 1)
{
downsampleMapTexture.Resolve();
if (downsampleMap != null)
downsampleMap.SetValue(downsampleMapTexture.XnaTexture);
effect.CommitChanges();
}
else if (pass == 2)
{
blurMap1Texture.Resolve();
if (blurMap1 != null)
blurMap1.SetValue(blurMap1Texture.XnaTexture);
effect.CommitChanges();
}
else if (pass == 3)
{
blurMap2Texture.Resolve();
if (blurMap2 != null)
blurMap2.SetValue(blurMap2Texture.XnaTexture);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
282
222
223
224
225
226
227
228
229
230
231
232
233
234
Class Documentation
effect.CommitChanges();
}
}
}
finally
{
effect.End();
// Restore z buffer state
BaseGame.Device.RenderState.DepthBufferEnable = true;
BaseGame.Device.RenderState.DepthBufferWriteEnable = true;
}
}
6.38.4
Member Data Documentation
6.38.4.1
const string GalaxyWars.Shaders.PostScreenGlow.Filename = "PostScreenGlow.fx"
[private]
The shader effect filename for this shader.
Reimplemented from GalaxyWars.Shaders.PostScreenMenu.
Definition at line 28 of file PostScreenGlow.cs.
6.38.4.2
EffectParameter GalaxyWars.Shaders.PostScreenGlow.radialSceneMap [private]
Effect handles for window size and scene map.
Definition at line 33 of file PostScreenGlow.cs.
6.38.4.3
EffectParameter GalaxyWars.Shaders.PostScreenGlow.radialBlurScaleFactor
[private]
Definition at line 33 of file PostScreenGlow.cs.
6.38.4.4
EffectParameter GalaxyWars.Shaders.PostScreenGlow.screenBorderFadeoutMap
[private]
Definition at line 33 of file PostScreenGlow.cs.
6.38.4.5
RenderToTexture GalaxyWars.Shaders.PostScreenGlow.radialSceneMapTexture
[private]
Links to the passTextures, easier to write code this way. This are just reference copies.
Definition at line 41 of file PostScreenGlow.cs.
6.38.4.6
Texture GalaxyWars.Shaders.PostScreenGlow.screenBorderFadeoutMapTexture = null
[private]
Helper texture for the screen border (darken the borders).
Definition at line 46 of file PostScreenGlow.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.38 GalaxyWars.Shaders.PostScreenGlow Class Reference
6.38.4.7
float GalaxyWars.Shaders.PostScreenGlow.lastUsedRadialBlurScaleFactor = 0
[private]
Last used radial blur scale factor.
Definition at line 53 of file PostScreenGlow.cs.
6.38.5
Property Documentation
6.38.5.1
float GalaxyWars.Shaders.PostScreenGlow.RadialBlurScaleFactor [get, set]
Radial blur scale factor.
Definition at line 58 of file PostScreenGlow.cs.
The documentation for this class was generated from the following file:
• PostScreenGlow.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
283
284
Class Documentation
6.39
GalaxyWars.Shaders.PostScreenMenu Class Reference
Post screen glow shader based on PostScreenMenu.fx.
Inheritance diagram for GalaxyWars.Shaders.PostScreenMenu:
GalaxyWars.Shaders.ShaderEffect
GalaxyWars.Shaders.PostScreenMenu
GalaxyWars.Shaders.PostScreenGlow
Collaboration diagram for GalaxyWars.Shaders.PostScreenMenu:
lastUsedHeightTexture
lastUsedNormalTexture
lastUsedDiffuseTexture
lastUsedDetailTexture
XnaTexture
Color
lastUsedAmbientColor
lastUsedSpecularColor
lastUsedDiffuseColor
lastUsedCarHueColorChange
lighting
normalMapping
landscapeNormalMapping
lineRendering
GalaxyWars.Shaders.ShaderEffect
GalaxyWars.Shaders.PostScreenMenu
noiseMapTexture
Texture2D
internalXnaTexture
GalaxyWars.Graphics.Texture
GalaxyWars.Shaders.RenderToTexture
blurMap1Texture
blurMap2Texture
sceneMapTexture
downsampleMapTexture
Public Member Functions
• PostScreenMenu ()
Create post screen menu.
• void Start ()
Start this post screen shader, will just call SetRenderTarget. All render calls will now be drawn on the
sceneMapTexture. Make sure you don’t reset the RenderTarget until you call Show()!
• virtual void Show ()
Execute shaders and show result on screen, Start(..) must have been called before and the scene should be
rendered to sceneMapTexture.
Protected Member Functions
• PostScreenMenu (string shaderFilename)
Create post screen menu. Also used for the constructor of PostScreenGlow (same RenderToTextures used
there).
• override void GetParameters ()
Reload.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.39 GalaxyWars.Shaders.PostScreenMenu Class Reference
285
Protected Attributes
• EffectParameter windowSize
Effect handles for window size and scene map.
•
•
•
•
•
•
EffectParameter sceneMap
EffectParameter downsampleMap
EffectParameter blurMap1
EffectParameter blurMap2
EffectParameter noiseMap
EffectParameter timer
Static Protected Attributes
• static RenderToTexture sceneMapTexture
Links to the passTextures, easier to write code this way. This are just reference copies. Static to load them
only once (used for both PostScreenMenu and PostScreenGlow).
•
•
•
•
static RenderToTexture downsampleMapTexture
static RenderToTexture blurMap1Texture
static RenderToTexture blurMap2Texture
static bool started = false
Is this post screen shader started? Else don’t execute Show if it is called.
Properties
• static bool Started [get]
Started.
Private Attributes
• const string Filename = "PostScreenMenu.fx"
The shader effect filename for this shader.
• Texture noiseMapTexture = null
Helper texture for the noise and film effects.
6.39.1
Detailed Description
Post screen glow shader based on PostScreenMenu.fx.
Returns:
Shader effect
Definition at line 23 of file PostScreenMenu.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
286
Class Documentation
6.39.2
Constructor & Destructor Documentation
6.39.2.1
GalaxyWars.Shaders.PostScreenMenu.PostScreenMenu (string shaderFilename)
[protected]
Create post screen menu. Also used for the constructor of PostScreenGlow (same RenderToTextures used
there).
Definition at line 86 of file PostScreenMenu.cs.
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
6.39.2.2
: base(shaderFilename)
{
// Scene map texture
if (sceneMapTexture == null)
sceneMapTexture = new RenderToTexture(RenderToTexture.SizeType.FullScreen);
// Downsample map texture (to 1/4 of the screen)
if (downsampleMapTexture == null)
downsampleMapTexture = new RenderToTexture(RenderToTexture.SizeType.QuarterScreen);
// Blur map texture
if (blurMap1Texture == null)
blurMap1Texture = new RenderToTexture(RenderToTexture.SizeType.QuarterScreen);
// Blur map texture
if (blurMap2Texture == null)
blurMap2Texture = new RenderToTexture(RenderToTexture.SizeType.QuarterScreen);
}
GalaxyWars.Shaders.PostScreenMenu.PostScreenMenu ()
Create post screen menu.
Definition at line 106 of file PostScreenMenu.cs.
106
107
108
: this(Filename)
{
}
6.39.3
Member Function Documentation
6.39.3.1
override void GalaxyWars.Shaders.PostScreenMenu.GetParameters () [protected,
virtual]
Reload.
Reimplemented from GalaxyWars.Shaders.ShaderEffect.
Reimplemented in GalaxyWars.Shaders.PostScreenGlow.
Definition at line 117 of file PostScreenMenu.cs.
118
119
120
121
122
123
124
125
126
{
// Can’t get parameters if loading failed!
if (effect == null)
return;
windowSize = effect.Parameters["windowSize"];
sceneMap = effect.Parameters["sceneMap"];
// We need both windowSize and sceneMap.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.39 GalaxyWars.Shaders.PostScreenMenu Class Reference
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
6.39.3.2
287
if (windowSize == null || sceneMap == null)
throw new NotSupportedException("windowSize and sceneMap must be " +
"valid in PostScreenShader=" + Filename);
// Init additional stuff
downsampleMap = effect.Parameters["downsampleMap"];
blurMap1 = effect.Parameters["blurMap1"];
blurMap2 = effect.Parameters["blurMap2"];
timer = effect.Parameters["Timer"];
// Load noise texture for stripes effect
noiseMap = effect.Parameters["noiseMap"];
noiseMapTexture = new Texture("Noise128x128.dds");
// Set texture
noiseMap.SetValue(noiseMapTexture.XnaTexture);
}
void GalaxyWars.Shaders.PostScreenMenu.Start ()
Start this post screen shader, will just call SetRenderTarget. All render calls will now be drawn on the
sceneMapTexture. Make sure you don’t reset the RenderTarget until you call Show()!
Definition at line 153 of file PostScreenMenu.cs.
154
155
156
157
158
159
160
161
162
163
6.39.3.3
{
// Only apply post screen shader if texture is valid and effect is valid
if (sceneMapTexture == null || effect == null || started == true ||
// Also skip if we don’t use post screen shaders at all!
BaseGame.UsePostScreenShaders == false)
return;
BaseGame.SetRenderTarget(sceneMapTexture.RenderTarget, true);
started = true;
}
virtual void GalaxyWars.Shaders.PostScreenMenu.Show () [virtual]
Execute shaders and show result on screen, Start(..) must have been called before and the scene should be
rendered to sceneMapTexture.
Reimplemented in GalaxyWars.Shaders.PostScreenGlow.
Definition at line 173 of file PostScreenMenu.cs.
Referenced by GalaxyWars.GalaxyWarsManager.PostUIRender().
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
{
// Only apply post screen glow if texture is valid and effect is valid
if (sceneMapTexture == null || Valid == false || started == false)
return;
started = false;
// Resolve sceneMapTexture render target for Xbox360 support
sceneMapTexture.Resolve();
// Don’t use or write to the z buffer
BaseGame.Device.RenderState.DepthBufferEnable = false;
BaseGame.Device.RenderState.DepthBufferWriteEnable = false;
// Also don’t use any kind of blending.
BaseGame.Device.RenderState.AlphaBlendEnable = false;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
288
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
Class Documentation
if (windowSize != null)
windowSize.SetValue(new float[] { sceneMapTexture.Width, sceneMapTexture.Height });
if (sceneMap != null)
sceneMap.SetValue(sceneMapTexture.XnaTexture);
if (timer != null)
// Add a little offset to prevent first effect.
timer.SetValue(BaseGame.TotalTime + 0.25f);
effect.CurrentTechnique = effect.Techniques["ScreenGlow20"];
// We must have exactly 4 passes!
if (effect.CurrentTechnique.Passes.Count != 4)
throw new InvalidOperationException("This shader should have exactly 4 passes!");
try
{
effect.Begin();
for (int pass = 0; pass < effect.CurrentTechnique.Passes.Count; pass++)
{
if (pass == 0)
downsampleMapTexture.SetRenderTarget();
else if (pass == 1)
blurMap1Texture.SetRenderTarget();
else if (pass == 2)
blurMap2Texture.SetRenderTarget();
else
// Do a full reset back to the back buffer
BaseGame.ResetRenderTarget(true);
EffectPass effectPass = effect.CurrentTechnique.Passes[pass];
effectPass.Begin();
VBScreenHelper.Render();
effectPass.End();
if (pass == 0)
{
downsampleMapTexture.Resolve();
if (downsampleMap != null)
downsampleMap.SetValue(downsampleMapTexture.XnaTexture);
effect.CommitChanges();
}
else if (pass == 1)
{
blurMap1Texture.Resolve();
if (blurMap1 != null)
blurMap1.SetValue(blurMap1Texture.XnaTexture);
effect.CommitChanges();
}
else if (pass == 2)
{
blurMap2Texture.Resolve();
if (blurMap2 != null)
blurMap2.SetValue(blurMap2Texture.XnaTexture);
effect.CommitChanges();
}
}
}
finally
{
effect.End();
// Restore z buffer state
BaseGame.Device.RenderState.DepthBufferEnable = true;
BaseGame.Device.RenderState.DepthBufferWriteEnable = true;
}
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.39 GalaxyWars.Shaders.PostScreenMenu Class Reference
6.39.4
Member Data Documentation
6.39.4.1
const string GalaxyWars.Shaders.PostScreenMenu.Filename = "PostScreenMenu.fx"
[private]
289
The shader effect filename for this shader.
Reimplemented in GalaxyWars.Shaders.PostScreenGlow.
Definition at line 30 of file PostScreenMenu.cs.
6.39.4.2
EffectParameter GalaxyWars.Shaders.PostScreenMenu.windowSize [protected]
Effect handles for window size and scene map.
Definition at line 35 of file PostScreenMenu.cs.
6.39.4.3
EffectParameter GalaxyWars.Shaders.PostScreenMenu.sceneMap [protected]
Definition at line 35 of file PostScreenMenu.cs.
6.39.4.4
EffectParameter GalaxyWars.Shaders.PostScreenMenu.downsampleMap
[protected]
Definition at line 35 of file PostScreenMenu.cs.
6.39.4.5
EffectParameter GalaxyWars.Shaders.PostScreenMenu.blurMap1 [protected]
Definition at line 35 of file PostScreenMenu.cs.
6.39.4.6
EffectParameter GalaxyWars.Shaders.PostScreenMenu.blurMap2 [protected]
Definition at line 35 of file PostScreenMenu.cs.
6.39.4.7
EffectParameter GalaxyWars.Shaders.PostScreenMenu.noiseMap [protected]
Definition at line 35 of file PostScreenMenu.cs.
6.39.4.8
EffectParameter GalaxyWars.Shaders.PostScreenMenu.timer [protected]
Definition at line 35 of file PostScreenMenu.cs.
6.39.4.9
RenderToTexture GalaxyWars.Shaders.PostScreenMenu.sceneMapTexture [static,
protected]
Links to the passTextures, easier to write code this way. This are just reference copies. Static to load them
only once (used for both PostScreenMenu and PostScreenGlow).
Definition at line 49 of file PostScreenMenu.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
290
Class Documentation
6.39.4.10
RenderToTexture GalaxyWars.Shaders.PostScreenMenu.downsampleMapTexture
[static, protected]
Definition at line 49 of file PostScreenMenu.cs.
6.39.4.11
RenderToTexture GalaxyWars.Shaders.PostScreenMenu.blurMap1Texture
[static, protected]
Definition at line 49 of file PostScreenMenu.cs.
6.39.4.12
RenderToTexture GalaxyWars.Shaders.PostScreenMenu.blurMap2Texture
[static, protected]
Definition at line 49 of file PostScreenMenu.cs.
6.39.4.13
Texture GalaxyWars.Shaders.PostScreenMenu.noiseMapTexture = null [private]
Helper texture for the noise and film effects.
Definition at line 59 of file PostScreenMenu.cs.
6.39.4.14
bool GalaxyWars.Shaders.PostScreenMenu.started = false [static, protected]
Is this post screen shader started? Else don’t execute Show if it is called.
Definition at line 65 of file PostScreenMenu.cs.
6.39.5
Property Documentation
6.39.5.1
bool GalaxyWars.Shaders.PostScreenMenu.Started [static, get]
Started.
Definition at line 71 of file PostScreenMenu.cs.
The documentation for this class was generated from the following file:
• PostScreenMenu.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.40 GalaxyWars.Shaders.PreScreenSkyCubeMapping Class Reference
6.40
291
GalaxyWars.Shaders.PreScreenSkyCubeMapping Class Reference
Pre screen sky cube mapping.
Inheritance diagram for GalaxyWars.Shaders.PreScreenSkyCubeMapping:
GalaxyWars.Shaders.ShaderEffect
GalaxyWars.Shaders.PreScreenSkyCubeMapping
Collaboration diagram for GalaxyWars.Shaders.PreScreenSkyCubeMapping:
XnaTexture
Color
lastUsedHeightTexture
lastUsedNormalTexture
lastUsedDiffuseTexture
lastUsedDetailTexture
GalaxyWars.Shaders.ShaderEffect
lastUsedAmbientColor
lastUsedSpecularColor
lastUsedDiffuseColor
lastUsedCarHueColorChange
lighting
normalMapping
landscapeNormalMapping
lineRendering
DefaultSkyColor
XnaModel
cube
GalaxyWars.Shaders.PreScreenSkyCubeMapping
Public Member Functions
• PreScreenSkyCubeMapping ()
Create pre screen sky cube mapping.
• void RenderSky (Color setSkyColor)
Render sky with help of shader.
• void RenderSky ()
Render sky.
Protected Member Functions
• override void GetParameters ()
Reload.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
292
Class Documentation
Properties
• TextureCube SkyCubeMapTexture [get]
Sky cube map texture.
Private Attributes
• const string Filename = "PreScreenSkyCubeMapping.fx"
Shader effect filename.
• const string SkyCubeMapFilename = "SkyCubeMap"
Sky cube map texture filename.
• TextureCube skyCubeMapTexture = null
The Cube Map texture for the sky!
• XnaModel cube
Static Private Attributes
• static readonly Color DefaultSkyColor = new Color(232, 232, 232)
Default sky color.
6.40.1
Detailed Description
Pre screen sky cube mapping.
Definition at line 20 of file PreScreenSkyCubeMapping.cs.
6.40.2
Constructor & Destructor Documentation
6.40.2.1
GalaxyWars.Shaders.PreScreenSkyCubeMapping.PreScreenSkyCubeMapping ()
Create pre screen sky cube mapping.
Definition at line 62 of file PreScreenSkyCubeMapping.cs.
63
64
65
66
: base(Filename)
{
cube = BaseGame.Content.Load<XnaModel>(@"Content\models\Cube");
}
6.40.3
Member Function Documentation
6.40.3.1
override void GalaxyWars.Shaders.PreScreenSkyCubeMapping.GetParameters ()
[protected, virtual]
Reload.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.40 GalaxyWars.Shaders.PreScreenSkyCubeMapping Class Reference
293
Reimplemented from GalaxyWars.Shaders.ShaderEffect.
Definition at line 73 of file PreScreenSkyCubeMapping.cs.
74
75
76
77
78
79
80
81
82
83
84
85
6.40.3.2
{
base.GetParameters();
// Load and set cube map texture
skyCubeMapTexture = BaseGame.Content.Load<TextureCube>(
Path.Combine(Directories.ContentDirectory + "\\textures",
SkyCubeMapFilename));
diffuseTexture.SetValue(skyCubeMapTexture);
// Set sky color to nearly white
AmbientColor = DefaultSkyColor;
}
void GalaxyWars.Shaders.PreScreenSkyCubeMapping.RenderSky (Color setSkyColor)
Render sky with help of shader.
Definition at line 92 of file PreScreenSkyCubeMapping.cs.
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
6.40.3.3
{
// Can’t render with shader if shader is not valid!
if (this.Valid == false)
return;
// Don’t use or write to the z buffer
BaseGame.Device.RenderState.DepthBufferEnable = false;
BaseGame.Device.RenderState.DepthBufferWriteEnable = false;
BaseGame.Device.RenderState.CullMode = CullMode.None;
// Also don’t use any kind of blending.
BaseGame.Device.RenderState.AlphaBlendEnable = false;
// Set effect parameters
AmbientColor = setSkyColor;
effect.Parameters["view"].SetValue(BaseGame.ViewMatrix);
ProjectionMatrix = BaseGame.ProjectionMatrix;
// Override model’s effect and render
cube.Meshes[0].MeshParts[0].Effect = effect;
cube.Meshes[0].Draw();
// Reset previous render states
BaseGame.Device.RenderState.DepthBufferEnable = true;
BaseGame.Device.RenderState.DepthBufferWriteEnable = true;
BaseGame.Device.RenderState.CullMode = CullMode.CullCounterClockwiseFace;
}
void GalaxyWars.Shaders.PreScreenSkyCubeMapping.RenderSky ()
Render sky.
Definition at line 124 of file PreScreenSkyCubeMapping.cs.
125
126
127
{
RenderSky(lastUsedAmbientColor);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
294
Class Documentation
6.40.4
Member Data Documentation
6.40.4.1
const string GalaxyWars.Shaders.PreScreenSkyCubeMapping.Filename =
"PreScreenSkyCubeMapping.fx" [private]
Shader effect filename.
Definition at line 26 of file PreScreenSkyCubeMapping.cs.
6.40.4.2
const string GalaxyWars.Shaders.PreScreenSkyCubeMapping.SkyCubeMapFilename =
"SkyCubeMap" [private]
Sky cube map texture filename.
Definition at line 31 of file PreScreenSkyCubeMapping.cs.
6.40.4.3
readonly Color GalaxyWars.Shaders.PreScreenSkyCubeMapping.DefaultSkyColor =
new Color(232, 232, 232) [static, private]
Default sky color.
Definition at line 36 of file PreScreenSkyCubeMapping.cs.
6.40.4.4
TextureCube GalaxyWars.Shaders.PreScreenSkyCubeMapping.skyCubeMapTexture =
null [private]
The Cube Map texture for the sky!
Definition at line 41 of file PreScreenSkyCubeMapping.cs.
6.40.4.5
XnaModel GalaxyWars.Shaders.PreScreenSkyCubeMapping.cube [private]
Definition at line 55 of file PreScreenSkyCubeMapping.cs.
6.40.5
Property Documentation
6.40.5.1
TextureCube GalaxyWars.Shaders.PreScreenSkyCubeMapping.SkyCubeMapTexture
[get]
Sky cube map texture.
Returns:
Texture cube
Definition at line 48 of file PreScreenSkyCubeMapping.cs.
The documentation for this class was generated from the following file:
• PreScreenSkyCubeMapping.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.41 GalaxyWars.Graphics.PrimitivesRenderer Class Reference
6.41
295
GalaxyWars.Graphics.PrimitivesRenderer Class Reference
Public Member Functions
•
•
•
•
•
•
•
•
•
PrimitivesRenderer ()
void RenderCross (Vector3 position)
void RenderCross (Vector3 position, float size, Color color)
void RenderTriangle (Vector3 position)
void RenderTriangle (Vector3 position, float size, Color color)
void RenderCube (Vector3 position)
void RenderCube (Vector3 position, float size, Color color)
void RenderSphere (Vector3 position)
void RenderSphere (Vector3 position, float size, Color color)
Public Attributes
• const int SphereQuality = 4
Protected Attributes
•
•
•
•
•
•
VertexDeclaration vertexDecl
VertexPositionColor[ ] triangleVertices
VertexPositionColor[ ] cubeVertices
VertexPositionColor[ ] sphereVertices
short[ ] cubeIndices
short[ ] sphereIndices
6.41.1
Detailed Description
Definition at line 12 of file PrimitivesRenderer.cs.
6.41.2
Constructor & Destructor Documentation
6.41.2.1
GalaxyWars.Graphics.PrimitivesRenderer.PrimitivesRenderer ()
Definition at line 24 of file PrimitivesRenderer.cs.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
vertexDecl = new VertexDeclaration(BaseGame.Device, VertexPositionColor.VertexElements);
// Prepare triangle vertices
triangleVertices = new VertexPositionColor[3];
triangleVertices[0] = new VertexPositionColor(new Vector3(-0.5f, -0.5f, 0), Color.White);
triangleVertices[1] = new VertexPositionColor(new Vector3(+0.5f, -0.5f, 0), Color.White);
triangleVertices[2] = new VertexPositionColor(new Vector3(0, +0.5f, 0), Color.White);
// Prepare cube vertices and indices
cubeVertices = new VertexPositionColor[8];
cubeVertices[0] = new VertexPositionColor(new
cubeVertices[1] = new VertexPositionColor(new
cubeVertices[2] = new VertexPositionColor(new
cubeVertices[3] = new VertexPositionColor(new
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Vector3(-0.5f,
Vector3(-0.5f,
Vector3(+0.5f,
Vector3(+0.5f,
-0.5f,
-0.5f,
-0.5f,
-0.5f,
-0.5f),
+0.5f),
+0.5f),
-0.5f),
Color.White);
Color.White);
Color.White);
Color.White);
296
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Class Documentation
cubeVertices[4] =
cubeVertices[5] =
cubeVertices[6] =
cubeVertices[7] =
cubeIndices = new
new VertexPositionColor(new
new VertexPositionColor(new
new VertexPositionColor(new
new VertexPositionColor(new
short[] { 0, 3, 2, 2, 1, 0,
4, 5, 6, 6, 7, 4,
0, 4, 7, 7, 3, 0,
2, 6, 5, 5, 1, 2,
5, 4, 0, 0, 1, 5,
3, 7, 6, 6, 2, 3
};
Vector3(-0.5f,
Vector3(-0.5f,
Vector3(+0.5f,
Vector3(+0.5f,
// Bottom side
// Top side
// Front side
// Back side
// Left side
// Right side
+0.5f,
+0.5f,
+0.5f,
+0.5f,
-0.5f),
+0.5f),
+0.5f),
-0.5f),
Color.White);
Color.White);
Color.White);
Color.White);
// Prepare sphere vertices and indices
sphereVertices = new VertexPositionColor[2 + SphereQuality * SphereQuality];
sphereVertices[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.White);
sphereVertices[1 + SphereQuality * SphereQuality] = new VertexPositionColor(new Vector3(0,
sphereIndices = new short[3 * SphereQuality // Top faces
+ 3 * SphereQuality // Bottom faces
+ 3 * 2 * (SphereQuality - 1) * SphereQuality // Rest
];
float dAngle = 360.0f / (SphereQuality + 2),
theta = 0, phi = 0;
int u, v, verticesIndex = 1, indicesIndex = 0;
Vector3 point = new Vector3();
for (v = 1; v <= SphereQuality; v++)
{
phi = v * dAngle;
for (u = 1; u <= SphereQuality; u++)
{
theta = u * dAngle;
point.X = (float)(Math.Cos(theta) * Math.Sin(phi));
point.Y = (float)(Math.Sin(theta) * Math.Sin(phi));
point.Z = (float)Math.Cos(phi);
sphereVertices[verticesIndex++] = new VertexPositionColor(point, Color.White);
}
}
}
6.41.3
Member Function Documentation
6.41.3.1
void GalaxyWars.Graphics.PrimitivesRenderer.RenderCross (Vector3 position)
Definition at line 81 of file PrimitivesRenderer.cs.
82
6.41.3.2
{ RenderCross(position, 1.0f, Color.White); }
void GalaxyWars.Graphics.PrimitivesRenderer.RenderCross (Vector3 position, float size,
Color color)
Definition at line 84 of file PrimitivesRenderer.cs.
85
86
87
88
89
90
91
{
Vector3 right = new Vector3(size, 0, 0), top = new Vector3(0, size, 0), front = new Vector3
GalaxyWarsManager.LineManager.AddLine(position - right, position + right, color);
GalaxyWarsManager.LineManager.AddLine(position - top, position + top, color);
GalaxyWarsManager.LineManager.AddLine(position - front, position + front, color);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.41 GalaxyWars.Graphics.PrimitivesRenderer Class Reference
6.41.3.3
297
void GalaxyWars.Graphics.PrimitivesRenderer.RenderTriangle (Vector3 position)
Definition at line 93 of file PrimitivesRenderer.cs.
94
6.41.3.4
{ RenderTriangle(position, 1.0f, Color.White); }
void GalaxyWars.Graphics.PrimitivesRenderer.RenderTriangle (Vector3 position, float
size, Color color)
Definition at line 96 of file PrimitivesRenderer.cs.
97
98
99
100
101
102
103
104
105
106
107
108
109
6.41.3.5
{
Matrix m = Matrix.CreateScale(size) * Matrix.CreateTranslation(position);
BaseGame.WorldMatrix = m;
ShaderEffect.lineRendering.Render(
"LineRendering3D",
delegate
{
BaseGame.SetAlphaBlendingEnabled(true);
BaseGame.Device.VertexDeclaration = vertexDecl;
BaseGame.Device.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleList
});
}
void GalaxyWars.Graphics.PrimitivesRenderer.RenderCube (Vector3 position)
Definition at line 111 of file PrimitivesRenderer.cs.
112
6.41.3.6
{ RenderCube(position, 1.0f, Color.White); }
void GalaxyWars.Graphics.PrimitivesRenderer.RenderCube (Vector3 position, float size,
Color color)
Definition at line 114 of file PrimitivesRenderer.cs.
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{
BaseGame.WorldMatrix = Matrix.CreateScale(size) * Matrix.CreateTranslation(position);
for (int i = 0; i < cubeVertices.Length; i++)
cubeVertices[i].Color = color;
ShaderEffect.lineRendering.Render(
"LineRendering3D",
delegate
{
BaseGame.SetAlphaBlendingEnabled(true);
BaseGame.Device.VertexDeclaration = vertexDecl;
BaseGame.Device.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.Trian
cubeVertices, 0, c
cubeIndices, 0, cu
});
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
298
6.41.3.7
Class Documentation
void GalaxyWars.Graphics.PrimitivesRenderer.RenderSphere (Vector3 position)
Definition at line 133 of file PrimitivesRenderer.cs.
134
6.41.3.8
{ RenderSphere(position, 1.0f, Color.White); }
void GalaxyWars.Graphics.PrimitivesRenderer.RenderSphere (Vector3 position, float
size, Color color)
Definition at line 136 of file PrimitivesRenderer.cs.
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{
BaseGame.WorldMatrix = Matrix.CreateScale(size) * Matrix.CreateTranslation(position);
for (int i = 0; i < sphereVertices.Length; i++)
sphereVertices[i].Color = color;
ShaderEffect.lineRendering.Render(
"LineRendering3D",
delegate
{
BaseGame.SetAlphaBlendingEnabled(true);
BaseGame.Device.VertexDeclaration = vertexDecl;
BaseGame.Device.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.PointList,
sphereVertices, 0, sphereV
});
}
6.41.4
Member Data Documentation
6.41.4.1
const int GalaxyWars.Graphics.PrimitivesRenderer.SphereQuality = 4
Definition at line 14 of file PrimitivesRenderer.cs.
6.41.4.2
VertexDeclaration GalaxyWars.Graphics.PrimitivesRenderer.vertexDecl
[protected]
Definition at line 16 of file PrimitivesRenderer.cs.
6.41.4.3
VertexPositionColor [ ] GalaxyWars.Graphics.PrimitivesRenderer.triangleVertices
[protected]
Definition at line 18 of file PrimitivesRenderer.cs.
6.41.4.4
VertexPositionColor [ ] GalaxyWars.Graphics.PrimitivesRenderer.cubeVertices
[protected]
Definition at line 19 of file PrimitivesRenderer.cs.
6.41.4.5
VertexPositionColor [ ] GalaxyWars.Graphics.PrimitivesRenderer.sphereVertices
[protected]
Definition at line 20 of file PrimitivesRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.41 GalaxyWars.Graphics.PrimitivesRenderer Class Reference
6.41.4.6
short [ ] GalaxyWars.Graphics.PrimitivesRenderer.cubeIndices [protected]
Definition at line 21 of file PrimitivesRenderer.cs.
6.41.4.7
short [ ] GalaxyWars.Graphics.PrimitivesRenderer.sphereIndices [protected]
Definition at line 22 of file PrimitivesRenderer.cs.
The documentation for this class was generated from the following file:
• PrimitivesRenderer.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
299
300
Class Documentation
6.42
GalaxyWars.Program Class Reference
Main class of the Galaxy Wars game.
Static Public Member Functions
• static void StartGame ()
Start game, is in a seperate method for 2 reasons: We want to catch any exceptions here, but not for the unit
tests and we also allow the unit tests to call this method if we don’t want to unit test in debug mode.
Static Private Member Functions
• static void Main ()
The main entry point for the application.
6.42.1
Detailed Description
Main class of the Galaxy Wars game.
Definition at line 17 of file Program.cs.
6.42.2
Member Function Documentation
6.42.2.1
static void GalaxyWars.Program.Main () [static, private]
The main entry point for the application.
Definition at line 22 of file Program.cs.
References GalaxyWars.Program.StartGame().
23
24
25
{
StartGame();
}
Here is the call graph for this function:
GalaxyWars.Program.Main
6.42.2.2
GalaxyWars.Program.StartGame
static void GalaxyWars.Program.StartGame () [static]
Start game, is in a seperate method for 2 reasons: We want to catch any exceptions here, but not for the
unit tests and we also allow the unit tests to call this method if we don’t want to unit test in debug mode.
Definition at line 33 of file Program.cs.
Referenced by GalaxyWars.Program.Main().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.42 GalaxyWars.Program Class Reference
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
301
{
try
{
using (GalaxyWarsManager game = new GalaxyWarsManager())
{
game.Run();
}
}
catch (NoSuitableGraphicsDeviceException)
{
MessageBox.Show("Pixel and vertex shaders 2.0 or greater are required.", "Galaxy Wars",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (OutOfVideoMemoryException)
{
GameSettings.SetMinimumGraphics();
MessageBox.Show("Insufficent video memory.\n\n" +
"The graphics settings have been reconfigured to the minimum. " +
"Please restart the application. \n\nIf you continue to receive " +
"this error message, your system may not meet the " +
"minimum requirements.",
"Galaxy Wars",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
The documentation for this class was generated from the following file:
• Program.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
302
Class Documentation
6.43
GalaxyWars.Helpers.RandomHelper Class Reference
Random helper.
Static Public Member Functions
• static Random GenerateNewRandomGenerator ()
Generate a new random generator with help of WindowsHelper.GetPerformanceCounter. Also used for all
GetRandom methods here.
• static int GetRandomInt (int max)
Get random int.
• static float GetRandomFloat (float min, float max)
Get random float between min and max.
• static byte GetRandomByte (byte min, byte max)
Get random byte between min and max.
• static Vector2 GetRandomVector2 (float min, float max)
Get random Vector2.
• static Vector3 GetRandomVector3 (float min, float max)
Get random Vector3.
Static Public Attributes
• static Random globalRandomGenerator
Global random generator.
Properties
• static Color RandomColor [get]
Get random color.
• static Vector3 RandomNormalVector3 [get]
Get random normal Vector3.
6.43.1
Detailed Description
Random helper.
Definition at line 14 of file RandomHelper.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.43 GalaxyWars.Helpers.RandomHelper Class Reference
303
6.43.2
Member Function Documentation
6.43.2.1
static Random GalaxyWars.Helpers.RandomHelper.GenerateNewRandomGenerator ()
[static]
Generate a new random generator with help of WindowsHelper.GetPerformanceCounter. Also used for all
GetRandom methods here.
Returns:
Random
Definition at line 31 of file RandomHelper.cs.
32
33
34
35
36
37
{
globalRandomGenerator =
new Random((int)DateTime.Now.Ticks);
//needs Interop: (int)WindowsHelper.GetPerformanceCounter());
return globalRandomGenerator;
}
6.43.2.2
static int GalaxyWars.Helpers.RandomHelper.GetRandomInt (int max) [static]
Get random int.
Parameters:
max Maximum
Returns:
Int
Definition at line 46 of file RandomHelper.cs.
47
48
49
{
return globalRandomGenerator.Next(max);
}
6.43.2.3
static float GalaxyWars.Helpers.RandomHelper.GetRandomFloat (float min, float max)
[static]
Get random float between min and max.
Parameters:
min Min
max Max
Returns:
Float
Definition at line 57 of file RandomHelper.cs.
58
59
60
{
return (float)globalRandomGenerator.NextDouble() * (max - min) + min;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
304
Class Documentation
6.43.2.4
static byte GalaxyWars.Helpers.RandomHelper.GetRandomByte (byte min, byte max)
[static]
Get random byte between min and max.
Parameters:
min Min
max Max
Returns:
Byte
Definition at line 68 of file RandomHelper.cs.
69
70
71
{
return (byte)(globalRandomGenerator.Next(min, max));
}
6.43.2.5
static Vector2 GalaxyWars.Helpers.RandomHelper.GetRandomVector2 (float min, float
max) [static]
Get random Vector2.
Parameters:
min Minimum for each component
max Maximum for each component
Returns:
Vector2
Definition at line 79 of file RandomHelper.cs.
80
81
82
83
84
{
return new Vector2(
GetRandomFloat(min, max),
GetRandomFloat(min, max));
}
6.43.2.6
static Vector3 GalaxyWars.Helpers.RandomHelper.GetRandomVector3 (float min, float
max) [static]
Get random Vector3.
Parameters:
min Minimum for each component
max Maximum for each component
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.43 GalaxyWars.Helpers.RandomHelper Class Reference
Returns:
Vector3
Definition at line 92 of file RandomHelper.cs.
93
94
95
96
97
98
{
return new Vector3(
GetRandomFloat(min, max),
GetRandomFloat(min, max),
GetRandomFloat(min, max));
}
6.43.3
Member Data Documentation
6.43.3.1
Random GalaxyWars.Helpers.RandomHelper.globalRandomGenerator [static]
Initial value:
GenerateNewRandomGenerator()
Global random generator.
Definition at line 20 of file RandomHelper.cs.
6.43.4
Property Documentation
6.43.4.1
Color GalaxyWars.Helpers.RandomHelper.RandomColor [static, get]
Get random color.
Returns:
Color
Definition at line 105 of file RandomHelper.cs.
6.43.4.2
Vector3 GalaxyWars.Helpers.RandomHelper.RandomNormalVector3 [static,
get]
Get random normal Vector3.
Returns:
Vector3
Definition at line 120 of file RandomHelper.cs.
The documentation for this class was generated from the following file:
• RandomHelper.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
305
306
Class Documentation
6.44
GalaxyWars.Shaders.RenderToTexture Class Reference
Render to texture helper class based on the Texture class. This class allows to render stuff onto textures, if
thats not supported, it will just not work and report an engine log message. This class is required for most
PostScreenShaders.
Inheritance diagram for GalaxyWars.Shaders.RenderToTexture:
GalaxyWars.Graphics.Texture
GalaxyWars.Shaders.RenderToTexture
Collaboration diagram for GalaxyWars.Shaders.RenderToTexture:
Texture2D
internalXnaTexture
GalaxyWars.Graphics.Texture
GalaxyWars.Shaders.RenderToTexture
Public Types
• enum SizeType
Posible size types for creating a RenderToTexture object.
Public Member Functions
• RenderToTexture (SizeType setSizeType)
Creates an offscreen texture with the specified size which can be used for render to texture.
• void HandleDeviceReset ()
Handle the DeviceReset event, we have to re-create all our render targets.
• void Clear (Color clearColor)
Clear render target (call SetRenderTarget first).
• bool SetRenderTarget ()
Set render target to this texture to render stuff on it.
• void Resolve ()
Resolve render target. For windows developers this method may seem strange, why not just use the rendertarget’s texture? Well, this is just for the Xbox360 support. The Xbox requires that you call Resolve first
before using the rendertarget texture. The reason for that is copying the data over from the EPRAM to the
video memory, for more details read the XNA docs. Note: This method will only work if the render target
was set before with SetRenderTarget, else an exception will be thrown to ensure correct calling order.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.44 GalaxyWars.Shaders.RenderToTexture Class Reference
307
Properties
• DepthStencilBuffer ZBufferSurface [get]
ZBuffer surface.
• RenderTarget2D RenderTarget [get]
Render target.
• override XnaTexture XnaTexture [get]
Override how to get XnaTexture, we have to resolve the render target for supporting the Xbox, which requires
calling Resolve first! After that you can call this property to get the current texture.
• bool UsesHighPercisionFormat [get]
Does this texture use some high percision format? Better than 8 bit color?
Private Member Functions
• void CalcSize ()
Calc size.
• void Create ()
Create.
Static Private Member Functions
• static bool CheckRenderTargetFormat (SurfaceFormat format)
Check if we can use a specific surface format for render targets.
Private Attributes
• RenderTarget2D renderTarget = null
Our render target we are going to render to. Much easier than in MDX where you have to use Surfaces, etc.
Also supports the Xbox360 model of resolving the render target texture before we can use it, otherwise the
RenderToTexture class would not work on the Xbox360.
• DepthStencilBuffer zBufferSurface = null
Z buffer surface for shadow mapping render targets that do not fit in our resolution. Usually unused!
• SizeType sizeType
Size type.
• bool usesHighPercisionFormat = false
Does this texture use some high percision format? Better than 8 bit color?
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
308
Class Documentation
• bool alreadyResolved = false
Make sure we don’t call XnaTexture before resolving for the first time!
Static Private Attributes
• static int RenderToTextureGlobalInstanceId = 0
Id for each created RenderToTexture for the generated filename.
6.44.1
Detailed Description
Render to texture helper class based on the Texture class. This class allows to render stuff onto textures, if
thats not supported, it will just not work and report an engine log message. This class is required for most
PostScreenShaders.
Definition at line 24 of file RenderToTexture.cs.
6.44.2
Member Enumeration Documentation
6.44.2.1
enum GalaxyWars::Shaders::RenderToTexture::SizeType
Posible size types for creating a RenderToTexture object.
Enumerator:
FullScreen Uses the full screen size for this texture.
HalfScreen Uses half the full screen size, e.g. 800x600 becomes 400x300.
QuarterScreen Uses a quarter of the full screen size, e.g. 800x600 becomes 200x150.
ShadowMap Shadow map texture, usually 1024x1024, but can also be better like 2048x2048 or
4096x4096.
Definition at line 55 of file RenderToTexture.cs.
56
60
64
68
73
74
{
FullScreen,
HalfScreen,
QuarterScreen,
ShadowMap,
}
6.44.3
Constructor & Destructor Documentation
6.44.3.1
GalaxyWars.Shaders.RenderToTexture.RenderToTexture (SizeType setSizeType)
Creates an offscreen texture with the specified size which can be used for render to texture.
Definition at line 174 of file RenderToTexture.cs.
175
176
{
sizeType = setSizeType;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.44 GalaxyWars.Shaders.RenderToTexture Class Reference
177
178
179
180
181
182
183
184
185
CalcSize();
texFilename = "RenderToTexture instance " +
RenderToTextureGlobalInstanceId++;
Create();
BaseGame.AddRemRenderToTexture(this);
}
6.44.4
Member Function Documentation
6.44.4.1
void GalaxyWars.Shaders.RenderToTexture.CalcSize () [private]
Calc size.
Definition at line 84 of file RenderToTexture.cs.
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
6.44.4.2
{
switch (sizeType)
{
case SizeType.FullScreen:
texWidth = BaseGame.Width;
texHeight = BaseGame.Height;
break;
case SizeType.HalfScreen:
texWidth = BaseGame.Width / 2;
texHeight = BaseGame.Height / 2;
break;
case SizeType.QuarterScreen:
texWidth = BaseGame.Width / 4;
texHeight = BaseGame.Height / 4;
break;
case SizeType.ShadowMap:
// Use a larger texture for high detail
if (BaseGame.HighDetail)
{
texWidth = 2048;
texHeight = 2048;
}
else
{
texWidth = 1024;
texHeight = 1024;
}
break;
}
CalcHalfPixelSize();
}
void GalaxyWars.Shaders.RenderToTexture.HandleDeviceReset ()
Handle the DeviceReset event, we have to re-create all our render targets.
Definition at line 192 of file RenderToTexture.cs.
193
194
195
196
197
{
// Respond to resolution changes
CalcSize();
// Clear resolved texture
alreadyResolved = false;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
309
310
Class Documentation
198
199
200
201
internalXnaTexture = null;
// Re-create
Create();
}
6.44.4.3
static bool GalaxyWars.Shaders.RenderToTexture.CheckRenderTargetFormat
(SurfaceFormat format) [static, private]
Check if we can use a specific surface format for render targets.
Parameters:
format
Returns:
Definition at line 210 of file RenderToTexture.cs.
211
212
213
214
215
216
217
218
219
6.44.4.4
{
return BaseGame.Device.CreationParameters.Adapter.CheckDeviceFormat(
BaseGame.Device.CreationParameters.DeviceType,
BaseGame.Device.DisplayMode.Format,
TextureUsage.None,
QueryUsages.None,
ResourceType.RenderTarget,
format);
}
void GalaxyWars.Shaders.RenderToTexture.Create () [private]
Create.
Definition at line 224 of file RenderToTexture.cs.
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
{
SurfaceFormat format = SurfaceFormat.Color;
// Try to use R32F format for shadow mapping if possible (ps20),
// else just use A8R8G8B8 format for shadow mapping and
// for normal RenderToTextures too.
if (sizeType == SizeType.ShadowMap)
{
// Can do R32F format?
if (CheckRenderTargetFormat(SurfaceFormat.Single))
format = SurfaceFormat.Single;
// Else try R16F format, thats still much better than A8R8G8B8
else if (CheckRenderTargetFormat(SurfaceFormat.HalfSingle))
format = SurfaceFormat.HalfSingle;
// And check a couple more formats (mainly for the Xbox360 support)
else if (CheckRenderTargetFormat(SurfaceFormat.HalfVector2))
format = SurfaceFormat.HalfVector2;
else if (CheckRenderTargetFormat(SurfaceFormat.Luminance16))
format = SurfaceFormat.Luminance16;
// Else nothing found, well, then just use the 8 bit Color format.
}
MultiSampleType aaType = MultiSampleType.TwoSamples;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.44 GalaxyWars.Shaders.RenderToTexture Class Reference
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
6.44.4.5
if (BaseGame.Device.PresentationParameters.BackBufferHeight == 720)
{
aaType = MultiSampleType.FourSamples;
}
if (sizeType == SizeType.ShadowMap ||
BaseGame.CurrentPlatform == PlatformID.Win32NT)
{
aaType = MultiSampleType.None;
}
// Create render target of specified size.
renderTarget = new RenderTarget2D(
BaseGame.Device,
texWidth, texHeight, 1,
format, aaType, 0, RenderTargetUsage.DiscardContents);
if (format != SurfaceFormat.Color)
usesHighPercisionFormat = true;
// Create z buffer surface for shadow map render targets
// if they don’t fit in our current resolution.
if (sizeType == SizeType.ShadowMap &&
(texWidth > BaseGame.Width || texHeight > BaseGame.Height))
{
zBufferSurface =
new DepthStencilBuffer(
BaseGame.Device,
texWidth, texHeight,
// Lets use the same stuff as the back buffer.
BaseGame.BackBufferDepthFormat,
// Don’t use multisampling, render target does not support that.
MultiSampleType.None, 0);
}
loaded = true;
}
void GalaxyWars.Shaders.RenderToTexture.Clear (Color clearColor)
Clear render target (call SetRenderTarget first).
Definition at line 289 of file RenderToTexture.cs.
290
291
292
293
294
295
296
297
298
6.44.4.6
{
if (loaded == false ||
renderTarget == null)
return;
BaseGame.Device.Clear(
ClearOptions.Target | ClearOptions.DepthBuffer,
clearColor, 1.0f, 0);
}
bool GalaxyWars.Shaders.RenderToTexture.SetRenderTarget ()
Set render target to this texture to render stuff on it.
Definition at line 305 of file RenderToTexture.cs.
306
307
311
{
if (loaded == false ||
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
312
308
309
310
311
312
313
6.44.4.7
Class Documentation
renderTarget == null)
return false;
BaseGame.SetRenderTarget(renderTarget, false);
return true;
}
void GalaxyWars.Shaders.RenderToTexture.Resolve ()
Resolve render target. For windows developers this method may seem strange, why not just use the rendertarget’s texture? Well, this is just for the Xbox360 support. The Xbox requires that you call Resolve first
before using the rendertarget texture. The reason for that is copying the data over from the EPRAM to the
video memory, for more details read the XNA docs. Note: This method will only work if the render target
was set before with SetRenderTarget, else an exception will be thrown to ensure correct calling order.
Definition at line 332 of file RenderToTexture.cs.
333
334
335
336
337
338
339
340
341
{
// Make sure this render target is currently set!
if (BaseGame.CurrentRenderTarget != renderTarget)
throw new InvalidOperationException(
"You can’t call Resolve without first setting the render target!");
alreadyResolved = true;
BaseGame.Device.SetRenderTarget(0, null);
}
6.44.5
Member Data Documentation
6.44.5.1
RenderTarget2D GalaxyWars.Shaders.RenderToTexture.renderTarget = null
[private]
Our render target we are going to render to. Much easier than in MDX where you have to use Surfaces, etc.
Also supports the Xbox360 model of resolving the render target texture before we can use it, otherwise the
RenderToTexture class would not work on the Xbox360.
Definition at line 33 of file RenderToTexture.cs.
6.44.5.2
DepthStencilBuffer GalaxyWars.Shaders.RenderToTexture.zBufferSurface = null
[private]
Z buffer surface for shadow mapping render targets that do not fit in our resolution. Usually unused!
Definition at line 39 of file RenderToTexture.cs.
6.44.5.3
SizeType GalaxyWars.Shaders.RenderToTexture.sizeType [private]
Size type.
Definition at line 79 of file RenderToTexture.cs.
6.44.5.4
bool GalaxyWars.Shaders.RenderToTexture.usesHighPercisionFormat = false
[private]
Does this texture use some high percision format? Better than 8 bit color?
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.44 GalaxyWars.Shaders.RenderToTexture Class Reference
313
Definition at line 120 of file RenderToTexture.cs.
6.44.5.5
int GalaxyWars.Shaders.RenderToTexture.RenderToTextureGlobalInstanceId = 0
[static, private]
Id for each created RenderToTexture for the generated filename.
Definition at line 169 of file RenderToTexture.cs.
6.44.5.6
bool GalaxyWars.Shaders.RenderToTexture.alreadyResolved = false [private]
Make sure we don’t call XnaTexture before resolving for the first time!
Definition at line 320 of file RenderToTexture.cs.
6.44.6
Property Documentation
6.44.6.1
DepthStencilBuffer GalaxyWars.Shaders.RenderToTexture.ZBufferSurface [get]
ZBuffer surface.
Returns:
Surface
Definition at line 45 of file RenderToTexture.cs.
6.44.6.2
RenderTarget2D GalaxyWars.Shaders.RenderToTexture.RenderTarget [get]
Render target.
Returns:
Render target 2D
Definition at line 129 of file RenderToTexture.cs.
6.44.6.3
override XnaTexture GalaxyWars.Shaders.RenderToTexture.XnaTexture [get]
Override how to get XnaTexture, we have to resolve the render target for supporting the Xbox, which
requires calling Resolve first! After that you can call this property to get the current texture.
Returns:
XnaTexture
Reimplemented from GalaxyWars.Graphics.Texture.
Definition at line 143 of file RenderToTexture.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
314
Class Documentation
6.44.6.4
bool GalaxyWars.Shaders.RenderToTexture.UsesHighPercisionFormat [get]
Does this texture use some high percision format? Better than 8 bit color?
Definition at line 157 of file RenderToTexture.cs.
The documentation for this class was generated from the following file:
• RenderToTexture.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.45 GalaxyWars.GameLogic.ScreenshotCapturer Class Reference
6.45
315
GalaxyWars.GameLogic.ScreenshotCapturer Class Reference
This is a game component that implements IUpdateable.
Collaboration diagram for GalaxyWars.GameLogic.ScreenshotCapturer:
GalaxyWars.Graphics.MeshRenderManager
meshRenderManager
GalaxyWars.Graphics.LineManager2D
GalaxyWars.Graphics.LineManager3D
lineManager2D
lineManager3D
GalaxyWars.Graphics.BaseGame
game
GalaxyWars.GameLogic.ScreenshotCapturer
BackgroundColor
randomCarColor
ui
Color
color
flareTypes
GalaxyWars.Graphics.LensFlare.FlareData
DefaultSkyColor
lastUsedAmbientColor
lastUsedSpecularColor
lastUsedDiffuseColor
lastUsedCarHueColorChange
flareTextures
GalaxyWars.Graphics.LensFlare
lensFlare
cube
XnaModel
XnaTexture
lastUsedHeightTexture
lastUsedNormalTexture
lastUsedDiffuseTexture
lastUsedDetailTexture
GalaxyWars.Shaders.PreScreenSkyCubeMapping
skyCube
GalaxyWars.Graphics.UIRenderer
lighting
normalMapping
landscapeNormalMapping
lineRendering
postScreenMenuShader
postScreenGameShader
GalaxyWars.Shaders.ShaderEffect
GalaxyWars.Shaders.PostScreenMenu
blurMap1Texture
blurMap2Texture
sceneMapTexture
downsampleMapTexture
noiseMapTexture
GalaxyWars.Shaders.PostScreenGlow
radialSceneMapTexture
GalaxyWars.Shaders.RenderToTexture
Texture2D
internalXnaTexture
screenBorderFadeoutMapTexture
GalaxyWars.Graphics.Texture
fontTexture
font
GalaxyWars.Graphics.TextureFont
headers
buttons
ingame
background
optionsScreen
helpScreen
trophies
mouseCursor
Public Member Functions
• ScreenshotCapturer (BaseGame setGame)
• override void Update (GameTime gameTime)
Allows the game component to update itself.
Private Member Functions
• string ScreenshotNameBuilder (int num)
Screenshot name builder.
• int GetCurrentScreenshotNum ()
Get current screenshot num.
• void MakeScreenshot ()
Make screenshot.
Private Attributes
• int screenshotNum = 0
Internal screenshot number (will increase by one each screenshot).
• BaseGame game
Link to BaseGame class instance.
tion.ProgramName.
Also holds windows title, which is used instead of Applica-
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
316
Class Documentation
6.45.1
Detailed Description
This is a game component that implements IUpdateable.
Definition at line 19 of file ScreenshotCapturer.cs.
6.45.2
Constructor & Destructor Documentation
6.45.2.1
GalaxyWars.GameLogic.ScreenshotCapturer.ScreenshotCapturer (BaseGame setGame)
Definition at line 38 of file ScreenshotCapturer.cs.
38
39
40
41
42
: base(setGame)
{
game = setGame;
screenshotNum = GetCurrentScreenshotNum();
}
6.45.3
Member Function Documentation
6.45.3.1
string GalaxyWars.GameLogic.ScreenshotCapturer.ScreenshotNameBuilder (int num)
[private]
Screenshot name builder.
Parameters:
num Num
Returns:
String
Definition at line 54 of file ScreenshotCapturer.cs.
55
56
57
58
59
{
return Directories.ScreenshotsDirectory + "\\" +
game.Window.Title + " Screenshot " +
num.ToString("0000") + ".jpg";
}
6.45.3.2
int GalaxyWars.GameLogic.ScreenshotCapturer.GetCurrentScreenshotNum ()
[private]
Get current screenshot num.
Returns:
Int
Definition at line 67 of file ScreenshotCapturer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.45 GalaxyWars.GameLogic.ScreenshotCapturer Class Reference
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
6.45.3.3
{
// We must search for last screenshot we can found in list using own
// fast filesearch
int i = 0, j = 0, k = 0, l = -1;
// First check if at least 1 screenshot exist
if (File.Exists(ScreenshotNameBuilder(0)) == true)
{
// First scan for screenshot num/1000
for (i = 1; i < 10; i++)
{
if (File.Exists(ScreenshotNameBuilder(i * 1000)) == false)
break;
}
// This i*1000 does not exist, continue scan next level
// screenshotnr/100
i--;
for (j = 1; j < 10; j++)
{
if (File.Exists(ScreenshotNameBuilder(i * 1000 + j * 100)) == false)
break;
}
// This i*1000+j*100 does not exist, continue scan next level
// screenshotnr/10
j--;
for (k = 1; k < 10; k++)
{
if (File.Exists(ScreenshotNameBuilder(
i * 1000 + j * 100 + k * 10)) == false)
break;
}
// This i*1000+j*100+k*10 does not exist, continue scan next level
// screenshotnr/1
k--;
for (l = 1; l < 10; l++)
{
if (File.Exists(ScreenshotNameBuilder(
i * 1000 + j * 100 + k * 10 + l)) == false)
break;
}
// This i*1000+j*100+k*10+l does not exist, we have now last
// screenshot nr!!!
l--;
}
return i * 1000 + j * 100 + k * 10 + l;
}
void GalaxyWars.GameLogic.ScreenshotCapturer.MakeScreenshot () [private]
Make screenshot.
Definition at line 127 of file ScreenshotCapturer.cs.
128
129
130
131
132
133
134
317
{
try
{
//NOTE: This doesn’t always work on all cards, especially if
// desktop mode switches in fullscreen mode!
screenshotNum++;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
318
Class Documentation
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// Make sure screenshots directory exists
if (Directory.Exists(Directories.ScreenshotsDirectory) == false)
Directory.CreateDirectory(Directories.ScreenshotsDirectory);
using (ResolveTexture2D dstTexture = new ResolveTexture2D(
BaseGame.Device,
BaseGame.Width, BaseGame.Height, 1,
SurfaceFormat.Color))
{
// Get data with help of the resolve method
BaseGame.Device.ResolveBackBuffer(dstTexture);
dstTexture.Save(
ScreenshotNameBuilder(screenshotNum),
ImageFileFormat.Jpg);
}
}
catch (Exception ex)
{
Log.Write("Failed to save Screenshot: " + ex.ToString());
}
}
6.45.3.4
override void GalaxyWars.GameLogic.ScreenshotCapturer.Update (GameTime
gameTime)
Allows the game component to update itself.
Parameters:
gameTime Provides a snapshot of timing values.
Definition at line 165 of file ScreenshotCapturer.cs.
166
167
168
169
170
171
{
if (Input.KeyboardKeyJustPressed(Keys.PrintScreen))
MakeScreenshot();
base.Update(gameTime);
}
6.45.4
Member Data Documentation
6.45.4.1
int GalaxyWars.GameLogic.ScreenshotCapturer.screenshotNum = 0 [private]
Internal screenshot number (will increase by one each screenshot).
Definition at line 26 of file ScreenshotCapturer.cs.
6.45.4.2
BaseGame GalaxyWars.GameLogic.ScreenshotCapturer.game [private]
Link to BaseGame class instance.
tion.ProgramName.
Also holds windows title, which is used instead of Applica-
Definition at line 32 of file ScreenshotCapturer.cs.
The documentation for this class was generated from the following file:
• ScreenshotCapturer.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
6.46
319
GalaxyWars.Shaders.ShaderEffect Class Reference
Shader effect class. You can either directly use this class by providing a fx filename in the constructor or
derive from this class for special shader functionality (see post screen shaders for a more complex example).
Inheritance diagram for GalaxyWars.Shaders.ShaderEffect:
GalaxyWars.Shaders.ShaderEffect
GalaxyWars.Shaders.PostScreenMenu
GalaxyWars.Shaders.PreScreenSkyCubeMapping
GalaxyWars.Shaders.PostScreenGlow
Collaboration diagram for GalaxyWars.Shaders.ShaderEffect:
XnaTexture
Color
lastUsedHeightTexture
lastUsedNormalTexture
lastUsedDiffuseTexture
lastUsedDetailTexture
lastUsedAmbientColor
lastUsedSpecularColor
lastUsedDiffuseColor
lastUsedCarHueColorChange
GalaxyWars.Shaders.ShaderEffect
lighting
normalMapping
landscapeNormalMapping
lineRendering
Public Member Functions
• EffectTechnique GetTechnique (string techniqueName)
Get technique.
• ShaderEffect (string shaderName)
• void Dispose ()
Dispose.
• void Reload ()
Reload effect (can be useful if we change the fx file dynamically).
• virtual void SetParameters (Material setMat)
Set parameters, this overload sets all material parameters too.
• virtual void SetParameters ()
Set parameters, override to set more.
• virtual void SetParametersOptimizedGeneral ()
Set parameters, this overload sets all material parameters too.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
320
Class Documentation
• virtual void SetParametersOptimized (Material setMat)
Set parameters, this overload sets all material parameters too.
• void Update ()
Update.
• void Render (Material setMat, string techniqueName, BaseGame.RenderHandler renderCode)
Render.
• void Render (string techniqueName, BaseGame.RenderHandler renderDelegate)
Render.
• void RenderSinglePassShader (BaseGame.RenderHandler renderCode)
Render single pass shader.
Static Public Attributes
• static ShaderEffect lineRendering
Line rendering shader.
• static ShaderEffect lighting
Simple shader with just per pixel lighting for testing.
• static ShaderEffect normalMapping
Normal mapping shader for simple objects and the landscape rendering.
• static ShaderEffect landscapeNormalMapping
Landscape normal mapping shader for the landscape rendering with detail texture support, everything else
should use normalMapping.
Protected Member Functions
• virtual void Dispose (bool disposing)
Dispose.
• virtual void ResetParameters ()
Reset parameters.
• virtual void GetParameters ()
Get parameters, override to support more.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
Protected Attributes
• Effect effect = null
Effect.
• EffectParameter worldViewProj
Effect handles for shaders.
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
EffectParameter viewProj
EffectParameter world
EffectParameter viewInverse
EffectParameter projection
EffectParameter lightDir
EffectParameter ambientColor
EffectParameter diffuseColor
EffectParameter specularColor
EffectParameter specularPower
EffectParameter alphaFactor
EffectParameter scale
EffectParameter diffuseTexture
EffectParameter normalTexture
EffectParameter heightTexture
EffectParameter reflectionCubeTexture
EffectParameter detailTexture
EffectParameter parallaxAmount
EffectParameter carHueColorChange
Matrix lastUsedWorldViewProjMatrix = Matrix.Identity
Matrix lastUsedViewProjMatrix = Matrix.Identity
Matrix lastUsedInverseViewMatrix = Matrix.Identity
Matrix lastUsedProjectionMatrix = Matrix.Identity
Vector3 lastUsedLightDir = Vector3.Zero
Color lastUsedAmbientColor = ColorHelper.Empty
Color lastUsedDiffuseColor = ColorHelper.Empty
Color lastUsedSpecularColor = ColorHelper.Empty
XnaTexture lastUsedDiffuseTexture = null
XnaTexture lastUsedNormalTexture = null
XnaTexture lastUsedHeightTexture = null
TextureCube lastUsedReflectionCubeTexture = null
XnaTexture lastUsedDetailTexture = null
float lastUsedParallaxAmount = -1.0f
Color lastUsedCarHueColorChange = ColorHelper.Empty
Properties
• bool Valid [get]
Is this shader valid to render? If not we can’t perform any rendering.
• Effect Effect [get]
Effect.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
321
322
Class Documentation
• int NumberOfTechniques [get]
Number of techniques.
• EffectParameter WorldParameter [get]
World parameter.
• Matrix WorldViewProjMatrix [get, set]
Set world view proj matrix.
• Matrix ViewProjMatrix [get, set]
Set view proj matrix.
• Matrix WorldMatrix [get, set]
Set world matrix.
• Matrix InverseViewMatrix [get, set]
Set view inverse matrix.
• Matrix ProjectionMatrix [get, set]
Set projection matrix.
• Vector3 LightDir [get, set]
Set light direction.
• Color AmbientColor [get, set]
Ambient color.
• Color DiffuseColor [get, set]
Diffuse color.
• Color SpecularColor [get, set]
Specular color.
• float SpecularPower [get, set]
SpecularPower for specular color.
• float AlphaFactor [get, set]
Alpha factor.
• Texture DiffuseTexture [get, set]
Set diffuse texture.
• Texture NormalTexture [get, set]
Set normal texture for normal mapping.
• Texture HeightTexture [get, set]
Set height texture for parallax mapping.
• TextureCube ReflectionCubeTexture [get, set]
Set reflection cube map texture for reflection stuff.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
323
• Texture DetailTexture [get, set]
Set height texture for parallax mapping.
• float ParallaxAmount [get, set]
Parallax amount for parallax and offset shaders.
• Color CarHueColorChange [get, set]
Shadow car color for the special ShadowCar shader.
Static Private Member Functions
• static void SetValue (EffectParameter param, ref Matrix lastUsedMatrix, Matrix newMatrix)
Set value helper to set an effect parameter.
• static void SetValue (EffectParameter param, ref Vector3 lastUsedVector, Vector3 newVector)
Set value helper to set an effect parameter.
• static void SetValue (EffectParameter param, ref Color lastUsedColor, Color newColor)
Set value helper to set an effect parameter.
• static void SetValue (EffectParameter param, ref float lastUsedValue, float newValue)
Set value helper to set an effect parameter.
• static void SetValue (EffectParameter param, ref XnaTexture lastUsedValue, XnaTexture newValue)
Set value helper to set an effect parameter.
Private Attributes
• string shaderContentName = ""
Content name for this shader.
• float lastUsedSpecularPower = 0
• float lastUsedAlphaFactor = 0
6.46.1
Detailed Description
Shader effect class. You can either directly use this class by providing a fx filename in the constructor or
derive from this class for special shader functionality (see post screen shaders for a more complex example).
Definition at line 22 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
324
Class Documentation
6.46.2
Constructor & Destructor Documentation
6.46.2.1
GalaxyWars.Shaders.ShaderEffect.ShaderEffect (string shaderName)
Definition at line 570 of file ShaderEffect.cs.
571
572
573
574
575
576
577
578
579
{
if (BaseGame.Device == null)
throw new InvalidOperationException(
"XNA device is not initialized, can’t create ShaderEffect.");
shaderContentName = Path.GetFileNameWithoutExtension(shaderName);
Reload();
}
6.46.3
Member Function Documentation
6.46.3.1
EffectTechnique GalaxyWars.Shaders.ShaderEffect.GetTechnique (string
techniqueName)
Get technique.
Parameters:
techniqueName Technique name
Returns:
Effect technique
Definition at line 129 of file ShaderEffect.cs.
130
131
132
{
return effect.Techniques[techniqueName];
}
6.46.3.2
static void GalaxyWars.Shaders.ShaderEffect.SetValue (EffectParameter param, ref
Matrix lastUsedMatrix, Matrix newMatrix) [static, private]
Set value helper to set an effect parameter.
Parameters:
param Param
setMatrix Set matrix
Definition at line 151 of file ShaderEffect.cs.
153
154
155
156
157
{
// Always update, matrices change every frame anyway!
lastUsedMatrix = newMatrix;
param.SetValue(newMatrix);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
6.46.3.3
325
static void GalaxyWars.Shaders.ShaderEffect.SetValue (EffectParameter param, ref
Vector3 lastUsedVector, Vector3 newVector) [static, private]
Set value helper to set an effect parameter.
Parameters:
param Param
lastUsedVector Last used vector
newVector New vector
Definition at line 165 of file ShaderEffect.cs.
167
168
169
170
171
172
173
174
{
if (param != null &&
lastUsedVector != newVector)
{
lastUsedVector = newVector;
param.SetValue(newVector);
}
}
6.46.3.4
static void GalaxyWars.Shaders.ShaderEffect.SetValue (EffectParameter param, ref
Color lastUsedColor, Color newColor) [static, private]
Set value helper to set an effect parameter.
Parameters:
param Param
lastUsedColor Last used color
newColor New color
Definition at line 182 of file ShaderEffect.cs.
184
185
186
187
188
189
190
191
192
193
194
{
// Note: This check eats few % of the performance, but the color
// often stays the change (around 50%).
if (param != null &&
//slower: lastUsedColor != newColor)
lastUsedColor.PackedValue != newColor.PackedValue)
{
lastUsedColor = newColor;
param.SetValue(newColor.ToVector4());
}
}
6.46.3.5
static void GalaxyWars.Shaders.ShaderEffect.SetValue (EffectParameter param, ref float
lastUsedValue, float newValue) [static, private]
Set value helper to set an effect parameter.
Parameters:
param Param
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
326
Class Documentation
lastUsedValue Last used value
newValue New value
Definition at line 202 of file ShaderEffect.cs.
204
205
206
207
208
209
210
211
{
if (param != null &&
lastUsedValue != newValue)
{
lastUsedValue = newValue;
param.SetValue(newValue);
}
}
6.46.3.6
static void GalaxyWars.Shaders.ShaderEffect.SetValue (EffectParameter param, ref
XnaTexture lastUsedValue, XnaTexture newValue) [static, private]
Set value helper to set an effect parameter.
Parameters:
param Param
lastUsedValue Last used value
newValue New value
Definition at line 219 of file ShaderEffect.cs.
221
222
223
224
225
226
227
228
6.46.3.7
{
if (param != null &&
lastUsedValue != newValue)
{
lastUsedValue = newValue;
param.SetValue(newValue);
}
}
void GalaxyWars.Shaders.ShaderEffect.Dispose ()
Dispose.
Definition at line 586 of file ShaderEffect.cs.
587
588
589
590
6.46.3.8
{
Dispose(true);
GC.SuppressFinalize(this);
}
virtual void GalaxyWars.Shaders.ShaderEffect.Dispose (bool disposing) [protected,
virtual]
Dispose.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
327
Parameters:
disposing Disposing
Definition at line 596 of file ShaderEffect.cs.
597
598
599
600
601
602
603
604
6.46.3.9
{
if (disposing)
{
// Dispose shader effect
if (effect != null)
effect.Dispose();
}
}
void GalaxyWars.Shaders.ShaderEffect.Reload ()
Reload effect (can be useful if we change the fx file dynamically).
Definition at line 611 of file ShaderEffect.cs.
612
613
614
615
616
617
618
619
620
621
622
6.46.3.10
{
// Load shader
effect = BaseGame.Content.Load<Effect>(
Path.Combine(Directories.ContentDirectory + "\\shaders",
shaderContentName));
// Reset and get all avialable parameters.
// This is especially important for derived classes.
ResetParameters();
GetParameters();
}
virtual void GalaxyWars.Shaders.ShaderEffect.ResetParameters () [protected,
virtual]
Reset parameters.
Definition at line 629 of file ShaderEffect.cs.
630
631
632
633
634
6.46.3.11
{
lastUsedInverseViewMatrix = Matrix.Identity;
lastUsedAmbientColor = ColorHelper.Empty;
lastUsedDiffuseTexture = null;
}
virtual void GalaxyWars.Shaders.ShaderEffect.GetParameters () [protected,
virtual]
Get parameters, override to support more.
Reimplemented in GalaxyWars.Shaders.PostScreenGlow, GalaxyWars.Shaders.PostScreenMenu, and
GalaxyWars.Shaders.PreScreenSkyCubeMapping.
Definition at line 641 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
328
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
6.46.3.12
Class Documentation
{
worldViewProj = effect.Parameters["worldViewProj"];
viewProj = effect.Parameters["viewProj"];
world = effect.Parameters["world"];
viewInverse = effect.Parameters["viewInverse"];
projection = effect.Parameters["projection"];
lightDir = effect.Parameters["lightDir"];
ambientColor = effect.Parameters["ambientColor"];
diffuseColor = effect.Parameters["diffuseColor"];
specularColor = effect.Parameters["specularColor"];
specularPower = effect.Parameters["specularPower"];
alphaFactor = effect.Parameters["alphaFactor"];
// Default alpha factor to 1.0f for hotels and stuff
AlphaFactor = 1.0f;
scale = effect.Parameters["scale"];
diffuseTexture = effect.Parameters["diffuseTexture"];
normalTexture = effect.Parameters["normalTexture"];
heightTexture = effect.Parameters["heightTexture"];
reflectionCubeTexture = effect.Parameters["reflectionCubeTexture"];
detailTexture = effect.Parameters["detailTexture"];
parallaxAmount = effect.Parameters["parallaxAmount"];
carHueColorChange = effect.Parameters["carHueColorChange"];
}
virtual void GalaxyWars.Shaders.ShaderEffect.SetParameters (Material setMat)
[virtual]
Set parameters, this overload sets all material parameters too.
Definition at line 671 of file ShaderEffect.cs.
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
{
if (worldViewProj != null)
worldViewProj.SetValue(BaseGame.WorldViewProjectionMatrix);
if (viewProj != null)
viewProj.SetValue(BaseGame.ViewProjectionMatrix);
if (world != null)
world.SetValue(BaseGame.WorldMatrix);
if (viewInverse != null)
viewInverse.SetValue(BaseGame.InverseViewMatrix);
if (lightDir != null)
lightDir.SetValue(BaseGame.LightDirection);
// Set the reflection cube texture only once
if (lastUsedReflectionCubeTexture == null &&
reflectionCubeTexture != null)
{
ReflectionCubeTexture = BaseGame.UI.SkyCubeMapTexture;
}
// Set all material properties
if (setMat != null)
{
AmbientColor = setMat.ambientColor;
DiffuseColor = setMat.diffuseColor;
SpecularColor = setMat.specularColor;
SpecularPower = setMat.specularPower;
DiffuseTexture = setMat.diffuseTexture;
NormalTexture = setMat.normalTexture;
HeightTexture = setMat.heightTexture;
ParallaxAmount = setMat.parallaxAmount;
DetailTexture = setMat.detailTexture;
}
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
6.46.3.13
329
virtual void GalaxyWars.Shaders.ShaderEffect.SetParameters () [virtual]
Set parameters, override to set more.
Definition at line 709 of file ShaderEffect.cs.
710
711
712
6.46.3.14
{
SetParameters(null);
}
virtual void GalaxyWars.Shaders.ShaderEffect.SetParametersOptimizedGeneral ()
[virtual]
Set parameters, this overload sets all material parameters too.
Definition at line 717 of file ShaderEffect.cs.
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
6.46.3.15
{
if (worldViewProj != null)
worldViewProj.SetValue(BaseGame.WorldViewProjectionMatrix);
if (viewProj != null)
viewProj.SetValue(BaseGame.ViewProjectionMatrix);
if (world != null)
world.SetValue(BaseGame.WorldMatrix);
if (viewInverse != null)
viewInverse.SetValue(BaseGame.InverseViewMatrix);
if (lightDir != null)
lightDir.SetValue(BaseGame.LightDirection);
// Set the reflection cube texture only once
if (lastUsedReflectionCubeTexture == null &&
reflectionCubeTexture != null)
{
ReflectionCubeTexture = BaseGame.UI.SkyCubeMapTexture;
}
// lastUsed parameters for colors and textures are not used,
// but we overwrite the values in SetParametersOptimized.
// We fix this by clearing all lastUsed values we will use later.
lastUsedAmbientColor = ColorHelper.Empty;
lastUsedDiffuseColor = ColorHelper.Empty;
lastUsedSpecularColor = ColorHelper.Empty;
lastUsedDiffuseTexture = null;
lastUsedNormalTexture = null;
}
virtual void GalaxyWars.Shaders.ShaderEffect.SetParametersOptimized (Material
setMat) [virtual]
Set parameters, this overload sets all material parameters too.
Definition at line 750 of file ShaderEffect.cs.
References GalaxyWars.Graphics.Material.ambientColor, GalaxyWars.Graphics.Material.diffuseColor,
GalaxyWars.Graphics.Material.diffuseTexture, GalaxyWars.Graphics.Material.normalTexture, GalaxyWars.Graphics.Material.specularColor, and GalaxyWars.Graphics.Texture.XnaTexture.
751
752
{
if (setMat == null)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
330
Class Documentation
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
throw new ArgumentNullException("setMat");
// No need to set world matrix, will be done later in mesh rendering
// in the MeshRenderManager. All the rest is set with help of the
// SetParametersOptimizedGeneral above.
// Only update ambient, diffuse, specular and the textures, the rest
// will not change for a material change in MeshRenderManager.
ambientColor.SetValue(setMat.ambientColor.ToVector4());
diffuseColor.SetValue(setMat.diffuseColor.ToVector4());
specularColor.SetValue(setMat.specularColor.ToVector4());
if (setMat.diffuseTexture != null)
diffuseTexture.SetValue(setMat.diffuseTexture.XnaTexture);
if (setMat.normalTexture != null)
normalTexture.SetValue(setMat.normalTexture.XnaTexture);
}
6.46.3.16
void GalaxyWars.Shaders.ShaderEffect.Update ()
Update.
Definition at line 775 of file ShaderEffect.cs.
776
777
778
{
effect.CommitChanges();
}
6.46.3.17
void GalaxyWars.Shaders.ShaderEffect.Render (Material setMat, string
techniqueName, BaseGame.RenderHandler renderCode)
Render.
Parameters:
setMat Set matrix
passName Pass name
renderDelegate Render delegate
Definition at line 788 of file ShaderEffect.cs.
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
{
if (techniqueName == null)
throw new ArgumentNullException("techniqueName");
if (renderCode == null)
throw new ArgumentNullException("renderCode");
SetParameters(setMat);
// Start shader
effect.CurrentTechnique = effect.Techniques[techniqueName];
try
{
effect.Begin(SaveStateMode.None);
// Render all passes (usually just one)
//foreach (EffectPass pass in effect.CurrentTechnique.Passes)
for (int num = 0; num < effect.CurrentTechnique.Passes.Count; num++)
{
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
809
810
811
812
813
814
815
816
817
818
819
820
821
EffectPass pass = effect.CurrentTechnique.Passes[num];
pass.Begin();
renderCode();
pass.End();
}
}
finally
{
// End shader
effect.End();
}
}
6.46.3.18
void GalaxyWars.Shaders.ShaderEffect.Render (string techniqueName,
BaseGame.RenderHandler renderDelegate)
Render.
Parameters:
techniqueName Technique name
renderDelegate Render delegate
Definition at line 828 of file ShaderEffect.cs.
830
831
832
{
Render(null, techniqueName, renderDelegate);
}
6.46.3.19
void GalaxyWars.Shaders.ShaderEffect.RenderSinglePassShader
(BaseGame.RenderHandler renderCode)
Render single pass shader.
Parameters:
renderDelegate Render delegate
Definition at line 840 of file ShaderEffect.cs.
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
{
if (renderCode == null)
throw new ArgumentNullException("renderCode");
// Start effect (current technique should be set)
try
{
effect.Begin(SaveStateMode.None);
// Start first pass
effect.CurrentTechnique.Passes[0].Begin();
// Render
renderCode();
// End pass and shader
effect.CurrentTechnique.Passes[0].End();
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
331
332
Class Documentation
858
859
860
861
862
863
}
finally
{
effect.End();
}
}
6.46.4
Member Data Documentation
6.46.4.1
ShaderEffect GalaxyWars.Shaders.ShaderEffect.lineRendering [static]
Initial value:
new ShaderEffect("LineRendering.fx")
Line rendering shader.
Definition at line 29 of file ShaderEffect.cs.
6.46.4.2
ShaderEffect GalaxyWars.Shaders.ShaderEffect.lighting [static]
Initial value:
new ShaderEffect("LightingShader.fx")
Simple shader with just per pixel lighting for testing.
Definition at line 35 of file ShaderEffect.cs.
6.46.4.3
ShaderEffect GalaxyWars.Shaders.ShaderEffect.normalMapping [static]
Initial value:
new ShaderEffect("NormalMapping.fx")
Normal mapping shader for simple objects and the landscape rendering.
Definition at line 41 of file ShaderEffect.cs.
6.46.4.4
ShaderEffect GalaxyWars.Shaders.ShaderEffect.landscapeNormalMapping [static]
Initial value:
new ShaderEffect("LandscapeNormalMapping.fx")
Landscape normal mapping shader for the landscape rendering with detail texture support, everything else
should use normalMapping.
Definition at line 48 of file ShaderEffect.cs.
6.46.4.5
string GalaxyWars.Shaders.ShaderEffect.shaderContentName = "" [private]
Content name for this shader.
Definition at line 57 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
6.46.4.6
333
Effect GalaxyWars.Shaders.ShaderEffect.effect = null [protected]
Effect.
Definition at line 62 of file ShaderEffect.cs.
6.46.4.7
EffectParameter GalaxyWars.Shaders.ShaderEffect.worldViewProj [protected]
Effect handles for shaders.
Definition at line 66 of file ShaderEffect.cs.
6.46.4.8
EffectParameter GalaxyWars.Shaders.ShaderEffect.viewProj [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.9
EffectParameter GalaxyWars.Shaders.ShaderEffect.world [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.10
EffectParameter GalaxyWars.Shaders.ShaderEffect.viewInverse [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.11
EffectParameter GalaxyWars.Shaders.ShaderEffect.projection [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.12
EffectParameter GalaxyWars.Shaders.ShaderEffect.lightDir [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.13
EffectParameter GalaxyWars.Shaders.ShaderEffect.ambientColor [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.14
EffectParameter GalaxyWars.Shaders.ShaderEffect.diffuseColor [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.15
EffectParameter GalaxyWars.Shaders.ShaderEffect.specularColor [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.16
EffectParameter GalaxyWars.Shaders.ShaderEffect.specularPower [protected]
Definition at line 66 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
334
6.46.4.17
Class Documentation
EffectParameter GalaxyWars.Shaders.ShaderEffect.alphaFactor [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.18
EffectParameter GalaxyWars.Shaders.ShaderEffect.scale [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.19
EffectParameter GalaxyWars.Shaders.ShaderEffect.diffuseTexture [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.20
EffectParameter GalaxyWars.Shaders.ShaderEffect.normalTexture [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.21
EffectParameter GalaxyWars.Shaders.ShaderEffect.heightTexture [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.22
EffectParameter GalaxyWars.Shaders.ShaderEffect.reflectionCubeTexture
[protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.23
EffectParameter GalaxyWars.Shaders.ShaderEffect.detailTexture [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.24
EffectParameter GalaxyWars.Shaders.ShaderEffect.parallaxAmount [protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.25
EffectParameter GalaxyWars.Shaders.ShaderEffect.carHueColorChange
[protected]
Definition at line 66 of file ShaderEffect.cs.
6.46.4.26
Matrix GalaxyWars.Shaders.ShaderEffect.lastUsedWorldViewProjMatrix =
Matrix.Identity [protected]
Definition at line 230 of file ShaderEffect.cs.
6.46.4.27
Matrix GalaxyWars.Shaders.ShaderEffect.lastUsedViewProjMatrix = Matrix.Identity
[protected]
Definition at line 248 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
6.46.4.28
335
Matrix GalaxyWars.Shaders.ShaderEffect.lastUsedInverseViewMatrix =
Matrix.Identity [protected]
Definition at line 284 of file ShaderEffect.cs.
6.46.4.29
Matrix GalaxyWars.Shaders.ShaderEffect.lastUsedProjectionMatrix = Matrix.Identity
[protected]
Definition at line 302 of file ShaderEffect.cs.
6.46.4.30
Vector3 GalaxyWars.Shaders.ShaderEffect.lastUsedLightDir = Vector3.Zero
[protected]
Definition at line 320 of file ShaderEffect.cs.
6.46.4.31
Color GalaxyWars.Shaders.ShaderEffect.lastUsedAmbientColor = ColorHelper.Empty
[protected]
Definition at line 342 of file ShaderEffect.cs.
6.46.4.32
Color GalaxyWars.Shaders.ShaderEffect.lastUsedDiffuseColor = ColorHelper.Empty
[protected]
Definition at line 360 of file ShaderEffect.cs.
6.46.4.33
Color GalaxyWars.Shaders.ShaderEffect.lastUsedSpecularColor = ColorHelper.Empty
[protected]
Definition at line 378 of file ShaderEffect.cs.
6.46.4.34
float GalaxyWars.Shaders.ShaderEffect.lastUsedSpecularPower = 0 [private]
Definition at line 396 of file ShaderEffect.cs.
6.46.4.35
float GalaxyWars.Shaders.ShaderEffect.lastUsedAlphaFactor = 0 [private]
Definition at line 414 of file ShaderEffect.cs.
6.46.4.36
XnaTexture GalaxyWars.Shaders.ShaderEffect.lastUsedDiffuseTexture = null
[protected]
Definition at line 433 of file ShaderEffect.cs.
6.46.4.37
XnaTexture GalaxyWars.Shaders.ShaderEffect.lastUsedNormalTexture = null
[protected]
Definition at line 452 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
336
Class Documentation
6.46.4.38
XnaTexture GalaxyWars.Shaders.ShaderEffect.lastUsedHeightTexture = null
[protected]
Definition at line 471 of file ShaderEffect.cs.
6.46.4.39
TextureCube GalaxyWars.Shaders.ShaderEffect.lastUsedReflectionCubeTexture = null
[protected]
Definition at line 490 of file ShaderEffect.cs.
6.46.4.40
XnaTexture GalaxyWars.Shaders.ShaderEffect.lastUsedDetailTexture = null
[protected]
Definition at line 511 of file ShaderEffect.cs.
6.46.4.41
float GalaxyWars.Shaders.ShaderEffect.lastUsedParallaxAmount = -1.0f
[protected]
Definition at line 530 of file ShaderEffect.cs.
6.46.4.42
Color GalaxyWars.Shaders.ShaderEffect.lastUsedCarHueColorChange =
ColorHelper.Empty [protected]
Definition at line 548 of file ShaderEffect.cs.
6.46.5
Property Documentation
6.46.5.1
bool GalaxyWars.Shaders.ShaderEffect.Valid [get]
Is this shader valid to render? If not we can’t perform any rendering.
Returns:
Bool
Definition at line 93 of file ShaderEffect.cs.
6.46.5.2
Effect GalaxyWars.Shaders.ShaderEffect.Effect [get]
Effect.
Returns:
Effect
Definition at line 105 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
6.46.5.3
int GalaxyWars.Shaders.ShaderEffect.NumberOfTechniques [get]
Number of techniques.
Returns:
Int
Definition at line 117 of file ShaderEffect.cs.
6.46.5.4
EffectParameter GalaxyWars.Shaders.ShaderEffect.WorldParameter [get]
World parameter.
Returns:
Effect parameter
Definition at line 139 of file ShaderEffect.cs.
6.46.5.5
Matrix GalaxyWars.Shaders.ShaderEffect.WorldViewProjMatrix [get, set,
protected]
Set world view proj matrix.
Definition at line 235 of file ShaderEffect.cs.
6.46.5.6
Matrix GalaxyWars.Shaders.ShaderEffect.ViewProjMatrix [get, set,
protected]
Set view proj matrix.
Definition at line 253 of file ShaderEffect.cs.
6.46.5.7
Matrix GalaxyWars.Shaders.ShaderEffect.WorldMatrix [get, set]
Set world matrix.
Definition at line 270 of file ShaderEffect.cs.
6.46.5.8
Matrix GalaxyWars.Shaders.ShaderEffect.InverseViewMatrix [get, set,
protected]
Set view inverse matrix.
Definition at line 289 of file ShaderEffect.cs.
6.46.5.9
Matrix GalaxyWars.Shaders.ShaderEffect.ProjectionMatrix [get, set,
protected]
Set projection matrix.
Definition at line 307 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
337
338
Class Documentation
6.46.5.10
Vector3 GalaxyWars.Shaders.ShaderEffect.LightDir [get, set, protected]
Set light direction.
Definition at line 325 of file ShaderEffect.cs.
6.46.5.11
Color GalaxyWars.Shaders.ShaderEffect.AmbientColor [get, set]
Ambient color.
Definition at line 347 of file ShaderEffect.cs.
6.46.5.12
Color GalaxyWars.Shaders.ShaderEffect.DiffuseColor [get, set]
Diffuse color.
Definition at line 365 of file ShaderEffect.cs.
6.46.5.13
Color GalaxyWars.Shaders.ShaderEffect.SpecularColor [get, set]
Specular color.
Definition at line 383 of file ShaderEffect.cs.
6.46.5.14
float GalaxyWars.Shaders.ShaderEffect.SpecularPower [get, set]
SpecularPower for specular color.
Definition at line 401 of file ShaderEffect.cs.
6.46.5.15
float GalaxyWars.Shaders.ShaderEffect.AlphaFactor [get, set]
Alpha factor.
Returns:
Float
Definition at line 420 of file ShaderEffect.cs.
6.46.5.16
Texture GalaxyWars.Shaders.ShaderEffect.DiffuseTexture [get, set]
Set diffuse texture.
Definition at line 438 of file ShaderEffect.cs.
6.46.5.17
Texture GalaxyWars.Shaders.ShaderEffect.NormalTexture [get, set]
Set normal texture for normal mapping.
Definition at line 457 of file ShaderEffect.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.46 GalaxyWars.Shaders.ShaderEffect Class Reference
6.46.5.18
339
Texture GalaxyWars.Shaders.ShaderEffect.HeightTexture [get, set]
Set height texture for parallax mapping.
Definition at line 476 of file ShaderEffect.cs.
6.46.5.19
TextureCube GalaxyWars.Shaders.ShaderEffect.ReflectionCubeTexture [get, set]
Set reflection cube map texture for reflection stuff.
Definition at line 495 of file ShaderEffect.cs.
6.46.5.20
Texture GalaxyWars.Shaders.ShaderEffect.DetailTexture [get, set]
Set height texture for parallax mapping.
Definition at line 516 of file ShaderEffect.cs.
6.46.5.21
float GalaxyWars.Shaders.ShaderEffect.ParallaxAmount [get, set]
Parallax amount for parallax and offset shaders.
Definition at line 535 of file ShaderEffect.cs.
6.46.5.22
Color GalaxyWars.Shaders.ShaderEffect.CarHueColorChange [get, set]
Shadow car color for the special ShadowCar shader.
Definition at line 553 of file ShaderEffect.cs.
The documentation for this class was generated from the following file:
• ShaderEffect.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
340
Class Documentation
6.47
GalaxyWars.Sounds.Sound Class Reference
Sound.
Public Types
• enum Sounds
Sounds we use in this game. This are all the sounds and even the music, only the gear sounds are handled
seperately below.
Static Public Member Functions
• static void Initialize ()
Create sound.
• static void Play (string soundName)
Play.
• static void Play (Sounds sound)
Play.
• static void StopMusic ()
Stop music.
• static void PlayBrakeSound (Sounds soundBrakeType)
Play brake sound.
• static Sounds GetBreakSoundType (float speed, float speedChange, float rotationChange)
Determines the correct sound to play for a particular physical state.
• static void PlayCrashSound (bool totalCrash)
Play crash sound.
• static void Update ()
Update.
• static void SetVolumes (float soundVolume, float musicVolume)
Private Member Functions
• Sound ()
Private constructor to prevent instantiation.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.47 GalaxyWars.Sounds.Sound Class Reference
341
Static Private Attributes
• static AudioEngine audioEngine
Sound stuff for XAct.
• static WaveBank waveBank
Wave bank.
• static SoundBank soundBank
Sound bank.
• static AudioCategory defaultCategory
Default category to change volume of sounds.
• static AudioCategory musicCategory
Music category to change volume of music.
• static float brakeSoundStillPlayingMs = 1000
Prevent playing brake sounds on top of each other with help of this variable.
• static float crashSoundStillPlayingMs = 2000
Prevent playing brake sounds on top of each other with help of this variable.
6.47.1
Detailed Description
Sound.
Definition at line 21 of file Sound.cs.
6.47.2
Member Enumeration Documentation
6.47.2.1
enum GalaxyWars::Sounds::Sound::Sounds
Sounds we use in this game. This are all the sounds and even the music, only the gear sounds are handled
seperately below.
Returns:
Enum
Enumerator:
ButtonClick
ScreenClick
ScreenBack
Highlight
Beep
Bleep
BrakeCurveMajor
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
342
Class Documentation
BrakeCurveMinor
BrakeMajor
BrakeMinor
CarCrashMinor
CarCrashTotal
CheckpointBetter
CheckpointWorse
Victory
CarLose
MenuMusic
GameMusic
Definition at line 54 of file Sound.cs.
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
// Menu Sounds
ButtonClick,
ScreenClick,
ScreenBack,
Highlight,
// Game Sounds
Beep,
Bleep,
BrakeCurveMajor,
BrakeCurveMinor,
BrakeMajor,
BrakeMinor,
CarCrashMinor,
CarCrashTotal,
// Additional Game Sounds (gear sounds are extra)
CheckpointBetter,
CheckpointWorse,
Victory,
CarLose,
// Music
MenuMusic,
GameMusic,
}
6.47.3
Constructor & Destructor Documentation
6.47.3.1
GalaxyWars.Sounds.Sound.Sound () [private]
Private constructor to prevent instantiation.
Definition at line 85 of file Sound.cs.
86
87
{
}
6.47.4
Member Function Documentation
6.47.4.1
static void GalaxyWars.Sounds.Sound.Initialize () [static]
Create sound.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.47 GalaxyWars.Sounds.Sound Class Reference
343
Definition at line 93 of file Sound.cs.
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
try
{
string dir = Directories.SoundsDirectory;
audioEngine = new AudioEngine(Path.Combine(dir, "GalaxyWarsManager.xgs"));
waveBank = new WaveBank(audioEngine, Path.Combine(dir, "Wave Bank.xwb"));
if (waveBank != null)
{
soundBank = new SoundBank(audioEngine,
Path.Combine(dir, "Sound Bank.xsb"));
}
// Get the categories needed to change volume and pitching
defaultCategory = audioEngine.GetCategory("Default");
musicCategory = audioEngine.GetCategory("Music");
SetVolumes(GameSettings.Default.SoundVolume,
GameSettings.Default.MusicVolume);
}
catch (NoAudioHardwareException ex)
{
// Is they have no Audio hardware, note it and move on. Surface any
// other exception that occurs since something is actually wrong!
Log.Write("Failed to create sound class: " + ex.ToString());
}
}
6.47.4.2
static void GalaxyWars.Sounds.Sound.Play (string soundName) [static]
Play.
Parameters:
soundName Sound name
Definition at line 127 of file Sound.cs.
128
129
130
131
132
133
{
if (soundBank == null)
return;
soundBank.PlayCue(soundName);
}
6.47.4.3
static void GalaxyWars.Sounds.Sound.Play (Sounds sound) [static]
Play.
Parameters:
sound Sound
Definition at line 139 of file Sound.cs.
140
141
142
{
Play(sound.ToString());
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
344
Class Documentation
6.47.4.4
static void GalaxyWars.Sounds.Sound.StopMusic () [static]
Stop music.
Definition at line 149 of file Sound.cs.
150
151
152
153
154
155
156
157
158
159
160
161
{
if (soundBank == null)
return;
// Use a little trick, start new music, but use the cue. This will
// replace the old music, then stop the music and everything is stopped!
Cue musicCue = soundBank.GetCue("MenuMusic");
musicCue.Play();
// Wait for a short while to let Xact kick in ^^
Thread.Sleep(10);
musicCue.Stop(AudioStopOptions.Immediate);
}
6.47.4.5
static void GalaxyWars.Sounds.Sound.PlayBrakeSound (Sounds soundBrakeType)
[static]
Play brake sound.
Parameters:
soundBrakeType Sound to play
Definition at line 175 of file Sound.cs.
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
{
// Only start new brake sound if not currently playing one
if (brakeSoundStillPlayingMs <= 0 &&
// Don’t play anything like this sounds in the menu mode!
GalaxyWarsManager.MenuActive == false)
{
// Play sound
Play(soundBrakeType);
// Wait until sound is done (and
switch (soundBrakeType)
{
case Sounds.BrakeMinor:
brakeSoundStillPlayingMs
break;
case Sounds.BrakeMajor:
brakeSoundStillPlayingMs
break;
case Sounds.BrakeCurveMinor:
brakeSoundStillPlayingMs
break;
case Sounds.BrakeCurveMajor:
brakeSoundStillPlayingMs
break;
}
a little bit longer)
= 750;
= 2500;
= 1250;
= 3500;
}
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.47 GalaxyWars.Sounds.Sound Class Reference
6.47.4.6
345
static Sounds GalaxyWars.Sounds.Sound.GetBreakSoundType (float speed, float
speedChange, float rotationChange) [static]
Determines the correct sound to play for a particular physical state.
Parameters:
speed Speed
speedChange Speed change
rotationChange Rotation change
Definition at line 209 of file Sound.cs.
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
{
// Currently in heavy rotation?
bool inRotation = (rotationChange >
0.25f * Player.MaxRotationPerSec * BaseGame.MoveFactorPerSecond);
Sounds soundBrakeType = inRotation ?
Sounds.BrakeCurveMinor : Sounds.BrakeMinor;
if (speed > 1.5f &&
Math.Abs(speedChange) > 5 * BaseGame.MoveFactorPerSecond)
{
soundBrakeType = inRotation ?
Sounds.BrakeCurveMajor : Sounds.BrakeMajor;
}
return soundBrakeType;
}
6.47.4.7
static void GalaxyWars.Sounds.Sound.PlayCrashSound (bool totalCrash) [static]
Play crash sound.
Parameters:
totalCrash Total crash
Definition at line 240 of file Sound.cs.
241
242
243
244
245
246
247
248
249
250
251
6.47.4.8
{
// Only start new brake sound if not currently playing one
if (crashSoundStillPlayingMs <= 0 &&
// Don’t play anything like this sounds in the menu mode!
GalaxyWarsManager.MenuActive == false)
{
// Sound.Play(totalCrash ? Sounds.CarCrashTotal : Sounds.CarCrashMinor);
// Wait a while for the next crash sound
crashSoundStillPlayingMs = totalCrash ? 3456 : 2345;
}
}
static void GalaxyWars.Sounds.Sound.Update () [static]
Update.
Definition at line 258 of file Sound.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
346
Class Documentation
259
260
261
262
263
264
265
266
267
6.47.4.9
{
if (brakeSoundStillPlayingMs
brakeSoundStillPlayingMs
if (crashSoundStillPlayingMs
crashSoundStillPlayingMs
> 0)
-= BaseGame.ElapsedTimeThisFrameInMilliseconds;
> 0)
-= BaseGame.ElapsedTimeThisFrameInMilliseconds;
if (audioEngine != null)
audioEngine.Update();
}
static void GalaxyWars.Sounds.Sound.SetVolumes (float soundVolume, float
musicVolume) [static]
Definition at line 269 of file Sound.cs.
270
271
272
273
274
275
276
277
278
{
if (audioEngine != null)
{
// Update sound volumes
defaultCategory.SetVolume(soundVolume);
musicCategory.SetVolume(musicVolume);
// Volume of gears is updated each frame
}
}
6.47.5
Member Data Documentation
6.47.5.1
AudioEngine GalaxyWars.Sounds.Sound.audioEngine [static, private]
Sound stuff for XAct.
Definition at line 28 of file Sound.cs.
6.47.5.2
WaveBank GalaxyWars.Sounds.Sound.waveBank [static, private]
Wave bank.
Definition at line 32 of file Sound.cs.
6.47.5.3
SoundBank GalaxyWars.Sounds.Sound.soundBank [static, private]
Sound bank.
Definition at line 36 of file Sound.cs.
6.47.5.4
AudioCategory GalaxyWars.Sounds.Sound.defaultCategory [static, private]
Default category to change volume of sounds.
Definition at line 40 of file Sound.cs.
6.47.5.5
AudioCategory GalaxyWars.Sounds.Sound.musicCategory [static, private]
Music category to change volume of music.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.47 GalaxyWars.Sounds.Sound Class Reference
Definition at line 44 of file Sound.cs.
6.47.5.6
float GalaxyWars.Sounds.Sound.brakeSoundStillPlayingMs = 1000 [static,
private]
Prevent playing brake sounds on top of each other with help of this variable.
Definition at line 169 of file Sound.cs.
6.47.5.7
float GalaxyWars.Sounds.Sound.crashSoundStillPlayingMs = 2000 [static,
private]
Prevent playing brake sounds on top of each other with help of this variable.
Definition at line 234 of file Sound.cs.
The documentation for this class was generated from the following file:
• Sound.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
347
348
Class Documentation
6.48
GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
Spaceship controller class for controlling the ship we control. This class is derived from the BasePlayer
class, which stores all important game values for us (game time, game over, etc.). The ChaseCamera is
then derived from this class and finally we got the Player class itself at the top, which is deriven from all
these classes. This way we can easily access everything from the Player class.
Inheritance diagram for GalaxyWars.GameLogic.SpaceshipPhysics:
GalaxyWars.GameLogic.BasePlayer
GalaxyWars.GameLogic.SpaceshipPhysics
GalaxyWars.GameLogic.ChaseCamera
GalaxyWars.GameLogic.Player
Collaboration diagram for GalaxyWars.GameLogic.SpaceshipPhysics:
GalaxyWars.GameLogic.BasePlayer
GalaxyWars.GameLogic.SpaceshipPhysics
Public Member Functions
• SpaceshipPhysics (Vector3 setPosition)
Create ship physics controller.
• SpaceshipPhysics (Vector3 setPosition, Vector3 setDirection, Vector3 setUp)
Create ship physics controller.
• void SetShipPosition (Vector3 setNewPosition, Vector3 setDirection, Vector3 setUp)
Set ship position.
• override void Reset ()
Reset all player entries for restarting a game, just resets the ship speed here.
• override void ClearVariablesForGameOver ()
Clear variables for game over.
• override void Update ()
Update game logic for our ship.
• Matrix UpdateCarMatrixAndCamera ()
Update car matrix and camera.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
349
Public Attributes
• const float SpaceshipMass = 1000
Default spaceship mass (1000 kg).
• const float DefaultMaxSpeed = 275.0f
Max speed of the spaceship.
• const float MaxPossibleSpeed = 290.0f
• const float DefaultMaxAccelerationPerSec = 2.5f
Max. acceleration in m/s∧ 2 we can do per second. We have also to define the max and min overall accelleration we can do with our spaceship.
• const float MaxAcceleration = 5.75f
• const float MinAcceleration = -3.25f
• const float MaxRotationPerSec = 1.3f
Max rotation per second we use for our ship.
• const float MinSensitivity = 0.5f
Minimum controller sensitivity.
Protected Member Functions
• Vector3 GetPosition (List< Vertex > path, float t)
Protected Attributes
• const float SpaceshipHeight = 2.0f
This will be elevated above the ship position to let our camera look at the roof of it.
Static Protected Attributes
• static float maxSpeed = DefaultMaxSpeed ∗ 1.05f
Max speed of the ship. We start with the speed 0, then it is increased based on the current acceleration value
to this maxSpeed value.
• static float shipMass = SpaceshipMass ∗ 1.015f
Mass of the ship. Used for physics calculations.
• static float maxAccelerationPerSec = DefaultMaxAccelerationPerSec ∗ 0.85f
Current acceleration of the ship. Drive faster or break with up/down, left/right mouse or the gamepad
(left/right triggers or right thumb). The acceleration influcences the current speed of the ship.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
350
Class Documentation
Properties
• Vector3 SpaceshipUpVector [get]
Ship up vector.
• Vector3 ShipPosition [get]
Ship position.
• float Speed [get]
Speed.
• float Acceleration [get]
Acceleration.
• Vector3 LookAtPos [get]
Look at position.
• Vector3 ShipDirection [get]
Ship direction.
• Vector3 ShipRight [get]
Ship right.
• List< Vertex > Path [get, set]
Path to be followed by the spaceship.
• float PathTime [get, set]
Time (between 0 and 1) to specify the position on the path.
• Matrix ShipRenderMatrix [get]
Ship render matrix, this is the final matrix for rendering our ship, which is called by Update each frame.
Private Attributes
• const float AirFrictionPerSpeed = 0.66f
Air friction we get if we’re flying fast, this slows us down very fast if we’re flying fast. This could be
extended to include wind and then even at low speeds the air friction would slow us down or even influcene
our movement.
• const float MaxAirFriction = AirFrictionPerSpeed ∗ 200.0f
Max air friction, this way we can have a good air friction for low speeds.
• const float BrakeSlowdown = 10.0f
Break slowdown per second, 1.0 means we need 1 second to do a full break. Slowdown is also limited by
max. 100 per sec! Note: This would not make sense in a real world simulation because stopping the car
needs usually more time and is highly dependant on the speed resultin in bigger stopping distances. For this
game it is easier and more fun to just brake always the same.
• const float MinViewDistance = 0.2f
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
351
The closest the camera should ever come to the ship.
• const float MaxViewDistance = 1.8f
The furthest the camera should ever be from the ship. (This is ignored during at the start of the race for
zooming in).
• Vector3 shipPosition
Ship position, updated each frame by our current speed vector.
• Vector3 shipDirection
Direction the ship is currently heading.
• Vector3 shipUp
Ship up vector for orientation.
• Vector3 shipForce
Force we currently apply on our ship. Usually we determinate how much acceleration we get through
the controls and multiplying that with the current direction vector. But for gravity, staying on the ground,
crashes, collisions impulses and all other forces this vector might be somewhat different. Used each frame
to change the speed.
• float shipSpeed
Speed of our ship, just in the direction of our ship. Sliding is a nice feature, but it overcomplicates too much
and for this game sliding would be really bad and make it much harder to drive!
• float viewDistance = 1.0f
View distance, which we can change with page up/down and the mouse wheel, but it always moves back to
1. The real view distance is also changed depending on how fast we’re flying.
• float rotateShipAfterCollision = 0
Rotate ship after collision.
• List< Vertex > followPath = null
Path to be followed by the ship.
• float t = 0
Time parameter to get the position on the path (between 0 and 1).
• Matrix shipRenderMatrix = Matrix.Identity
Ship render matrix we calculate each frame.
• float lastAccelerationResult = 0.0f
• float virtualRotationAmount = 0.0f
• float verticalRotationAmount = 0.0f
• float rotationChange = 0.0f
• float verticalRotationChange = 0.0f
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
352
Class Documentation
6.48.1
Detailed Description
Spaceship controller class for controlling the ship we control. This class is derived from the BasePlayer
class, which stores all important game values for us (game time, game over, etc.). The ChaseCamera is
then derived from this class and finally we got the Player class itself at the top, which is deriven from all
these classes. This way we can easily access everything from the Player class.
Definition at line 31 of file SpaceshipPhysics.cs.
6.48.2
Constructor & Destructor Documentation
6.48.2.1
GalaxyWars.GameLogic.SpaceshipPhysics.SpaceshipPhysics (Vector3 setPosition)
Create ship physics controller.
Parameters:
setPosition Set ship position
Definition at line 322 of file SpaceshipPhysics.cs.
323
324
325
{
SetShipPosition(setPosition, new Vector3(0, 1, 0), new Vector3(0, 0, 1));
}
6.48.2.2
GalaxyWars.GameLogic.SpaceshipPhysics.SpaceshipPhysics (Vector3 setPosition,
Vector3 setDirection, Vector3 setUp)
Create ship physics controller.
Parameters:
setPosition Set ship position
setDirection Set ship direction
setUp Set up
Definition at line 333 of file SpaceshipPhysics.cs.
334
335
336
{
SetShipPosition(setPosition, setDirection, setUp);
}
6.48.3
Member Function Documentation
6.48.3.1
void GalaxyWars.GameLogic.SpaceshipPhysics.SetShipPosition (Vector3 setNewPosition,
Vector3 setDirection, Vector3 setUp)
Set ship position.
Parameters:
setNewPosition Set car position
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
353
setDirection Set direction
setUp Set up
Definition at line 348 of file SpaceshipPhysics.cs.
349
350
351
352
353
6.48.3.2
{
shipPosition = setNewPosition;
shipDirection = setDirection;
shipUp = setUp;
}
override void GalaxyWars.GameLogic.SpaceshipPhysics.Reset () [virtual]
Reset all player entries for restarting a game, just resets the ship speed here.
Reimplemented from GalaxyWars.GameLogic.BasePlayer.
Reimplemented in GalaxyWars.GameLogic.ChaseCamera, and GalaxyWars.GameLogic.Player.
Definition at line 363 of file SpaceshipPhysics.cs.
364
365
366
367
368
6.48.3.3
{
base.Reset();
shipSpeed = 0;
shipForce = Vector3.Zero;
}
override void GalaxyWars.GameLogic.SpaceshipPhysics.ClearVariablesForGameOver ()
[virtual]
Clear variables for game over.
Reimplemented from GalaxyWars.GameLogic.BasePlayer.
Reimplemented in GalaxyWars.GameLogic.ChaseCamera.
Definition at line 373 of file SpaceshipPhysics.cs.
374
375
376
377
378
6.48.3.4
{
base.ClearVariablesForGameOver();
shipSpeed = 0;
shipForce = Vector3.Zero;
}
override void GalaxyWars.GameLogic.SpaceshipPhysics.Update () [virtual]
Update game logic for our ship.
Reimplemented from GalaxyWars.GameLogic.BasePlayer.
Reimplemented in GalaxyWars.GameLogic.ChaseCamera, and GalaxyWars.GameLogic.Player.
Definition at line 390 of file SpaceshipPhysics.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
354
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
Class Documentation
{
base.Update();
// Don’t use the ship position and ship handling if in free camera mode.
if (GalaxyWarsManager.Player.FreeCamera)
return;
float moveFactor = BaseGame.MoveFactorPerSecond;
// Make sure this is never below 0.001f and never above 0.5f
// Else our formulas below might mess up!
if (moveFactor < 0.001f)
moveFactor = 0.001f;
if (moveFactor > 0.5f)
moveFactor = 0.5f;
#region Handle rotations
float effectiveSensitivity = MinSensitivity + GameSettings.Default.ControllerSensitivity;
// First handle rotations (reduce last value)
rotationChange *= 0.95f;
verticalRotationChange *= 0.95f;
// Left/right changes rotation
if (Input.KeyboardLeftPressed)
rotationChange += effectiveSensitivity * MaxRotationPerSec * moveFactor / 2.5f;
else if (Input.KeyboardRightPressed)
rotationChange -= effectiveSensitivity * MaxRotationPerSec * moveFactor / 2.5f;
else
rotationChange = 0;
if (Input.MouseXMovement != 0)
rotationChange -= effectiveSensitivity * (Input.MouseXMovement / 15.0f) * MaxRotationP
if (Input.IsGamePadConnected)
{
// More dynamic force changing with gamepad (slow, faster, etc.)
rotationChange -= effectiveSensitivity * Input.GamePad.ThumbSticks.Left.X
* MaxRotationPerSec * moveFactor / 1.12345f;
// Also allow pad to simulate same behaviour as on keyboard
if (Input.GamePad.DPad.Left == ButtonState.Pressed)
rotationChange += effectiveSensitivity * MaxRotationPerSec * moveFactor / 1.5f;
else if (Input.GamePad.DPad.Right == ButtonState.Pressed)
rotationChange -= effectiveSensitivity * MaxRotationPerSec * moveFactor / 1.5f;
}
// Up/down rotation
if (Input.KeyboardDownPressed)
verticalRotationChange += effectiveSensitivity * MaxRotationPerSec * moveFactor / 2.5f
else if (Input.KeyboardUpPressed)
verticalRotationChange -= effectiveSensitivity * MaxRotationPerSec * moveFactor / 2.5f
else
verticalRotationChange = 0;
if (Input.MouseYMovement != 0)
verticalRotationChange -= effectiveSensitivity * (Input.MouseYMovement / -15.0f) * Max
if (Input.IsGamePadConnected)
{
// More dynamic force changing with gamepad (slow, faster, etc.)
verticalRotationChange -= effectiveSensitivity * Input.GamePad.ThumbSticks.Left.Y
* MaxRotationPerSec * moveFactor / 1.12345f;
// Also allow pad to simulate same behaviour as on keyboard
if (Input.GamePad.DPad.Up == ButtonState.Pressed)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
355
verticalRotationChange += effectiveSensitivity * MaxRotationPerSec * moveFactor /
else if (Input.GamePad.DPad.Down == ButtonState.Pressed)
verticalRotationChange -= effectiveSensitivity * MaxRotationPerSec * moveFactor /
}
float maxRotation = MaxRotationPerSec * moveFactor * 1.25f;
// Handle ship rotation after collision
if (rotateShipAfterCollision != 0)
{
if (rotateShipAfterCollision > maxRotation)
{
rotationChange += maxRotation;
rotateShipAfterCollision -= maxRotation;
}
else if (rotateShipAfterCollision < -maxRotation)
{
rotationChange -= maxRotation;
rotateShipAfterCollision += maxRotation;
}
else
{
rotationChange += rotateShipAfterCollision;
rotateShipAfterCollision = 0;
}
}
else
{
// If we are staying or moving very slowly, limit rotation!
if (shipSpeed < 10.0f)
rotationChange *= 0.67f + 0.33f * shipSpeed / 10.0f;
else
rotationChange *= 1.0f + (shipSpeed - 10) / 100.0f;
}
//
if
if
if
if
Limit rotation change to MaxRotationPerSec * 1.5 (usually for mouse)
(rotationChange > maxRotation) rotationChange = maxRotation;
(rotationChange < -maxRotation) rotationChange = -maxRotation;
(verticalRotationChange > maxRotation) verticalRotationChange = maxRotation;
(verticalRotationChange < -maxRotation) verticalRotationChange = -maxRotation;
// Rotate dir around up vector
// Interpolate rotatation amount.
virtualRotationAmount += rotationChange;
verticalRotationAmount += verticalRotationChange;
// Smooth over 200ms
float interpolatedRotationChange = (rotationChange + virtualRotationAmount) * moveFactor /
float verticalInterpolatedRotation = (verticalRotationChange + verticalRotationAmount) * m
virtualRotationAmount -= interpolatedRotationChange;
verticalRotationAmount -= verticalInterpolatedRotation;
//shipDirection = Vector3.TransformNormal(shipDirection,
//
Matrix.CreateFromAxisAngle(shipUp, interpolatedRotationChange) *
//
Matrix.CreateFromAxisAngle(ShipRight, verticalInterpolatedRotation));
shipUp = Vector3.TransformNormal
(shipUp, Matrix.CreateFromAxisAngle(shipDirection, -interpolatedRotationChange));
Matrix pitch = Matrix.CreateFromAxisAngle(ShipRight, verticalInterpolatedRotation);
shipDirection = Vector3.TransformNormal(shipDirection, pitch);
shipUp = Vector3.TransformNormal(shipUp, pitch);
#endregion
#region Handle view distance (page up/down and mouse wheel)
if (Input.Keyboard.IsKeyDown(Keys.PageUp) ||
Input.GamePadXPressed)
viewDistance -= moveFactor * 2.0f;
if (Input.Keyboard.IsKeyDown(Keys.PageDown) ||
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
356
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
Class Documentation
Input.GamePadYPressed)
viewDistance += moveFactor * 2.0f;
if (Input.MouseWheelDelta != 0)
viewDistance -= Input.MouseWheelDelta / 500.0f;
// Restrict the camera’s distance to a range, but allow the camera
// to be as far as it likes during the start of race zoom in
if (ZoomInTime <= 0)
viewDistance =
MathHelper.Clamp(viewDistance, MinViewDistance, MaxViewDistance);
else
viewDistance = Math.Max(viewDistance, MinViewDistance);
#endregion
Vector3 bottomJetPosition = shipPosition + 0.3f * shipUp;
Vector3 leftJetPosition = shipPosition + 0.6f * shipUp - 0.2f * ShipRight;
Vector3 rightJetPosition = shipPosition + 0.6f * shipUp + 0.2f * ShipRight;
Vector3 particlesVelocity = Speed * shipDirection;
for (float i = 1.25f; i < 1.75f; i += 0.05f)
{
GalaxyWarsManager.ParticleSystem.AddParticle
(bottomJetPosition - i * shipDirection, particlesVelocity);
GalaxyWarsManager.ParticleSystem.AddParticle
(leftJetPosition - i * shipDirection, particlesVelocity);
GalaxyWarsManager.ParticleSystem.AddParticle
(rightJetPosition - i * shipDirection, particlesVelocity);
}
#region Handle speed
// With keyboard, do heavy changes, but still smooth over 200ms
// Up or left mouse button accelerates
// Also support ASDW (querty) and AOEW (dvorak) shooter like controlling!
float newAccelerationForce = 0.0f;
if (Input.Keyboard.IsKeyDown(Keys.A) || Input.MouseLeftButtonPressed)
{
newAccelerationForce += maxAccelerationPerSec; // * moveFactor;
}
// Down or right mouse button deccelerates
else if (Input.Keyboard.IsKeyDown(Keys.Y) || Input.MouseRightButtonPressed)
{
newAccelerationForce -= maxAccelerationPerSec; // * moveFactor;
}
else if (Input.IsGamePadConnected)
{
// More dynamic force changing with gamepad (slow, faster, etc.)
newAccelerationForce += (Input.GamePad.Triggers.Right) * maxAccelerationPerSec; // * m
}
// Limit acceleration (but drive as fast forwards as possible if we
// are moving backwards)
if (shipSpeed > 0 && newAccelerationForce > MaxAcceleration)
newAccelerationForce = MaxAcceleration;
if (newAccelerationForce < MinAcceleration)
newAccelerationForce = MinAcceleration;
// Add acceleration force to total ship force, but use the current carDir!
shipForce += shipDirection * newAccelerationForce * (moveFactor * 85);
// Change speed with standard formula, use acceleration as our force
float oldSpeed = shipSpeed;
Vector3 speedChangeVector = shipForce / shipMass;
// Only use the amount important for our current direction (slower rot)
if (speedChangeVector.Length() > 0)
{
float speedApplyFactor = Vector3.Dot(Vector3.Normalize(speedChangeVector), shipDirecti
if (speedApplyFactor > 1)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
357
speedApplyFactor = 1;
shipSpeed += speedChangeVector.Length() * speedApplyFactor;
}
//
//
//
//
//
//
//
//
//
//
//
Apply friction. Basically we have 2 frictions that slow us down:
The friction from the contact of the wheels with the road (rolling
friction) and the air friction, which becomes bigger as we drive
faster. We need more force to overcome the resistances if we drive
faster. Our engine is strong enough to overcome the initial
car friction and air friction, but we want simulate that we need
more force to overcome the resistances at high speeds.
Usually this would require a more complex formula and the car
should need more fuel and force at high speeds, we just simulate that
by reducing the force depending on the frictions to get the same
effect while having our constant forces that are calculated above.
// Max. air friction to MaxAirFiction, else driving very fast becomes
// too hard.
float airFriction = AirFrictionPerSpeed * Math.Abs(shipSpeed);
if (airFriction > MaxAirFriction)
airFriction = MaxAirFriction;
// Don’t use ground friction if we are not on the ground.
float groundFriction = 0;
shipForce *= 1.0f - (0.275f * 0.02125f *
0.2f * // 20% for force slowdown
(groundFriction + airFriction));
// Reduce the speed, but use very low values to make the game more fun!
float noFrictionSpeed = shipSpeed;
shipSpeed *= 1.0f - (0.01f * 0.1f * 0.02125f * (groundFriction + airFriction));
// Never change more than by 1
if (shipSpeed < noFrictionSpeed - 1)
shipSpeed = noFrictionSpeed - 1;
bool downPressed = Input.MouseRightButtonPressed;
if (Input.Keyboard.IsKeyDown(Keys.Space) ||
Input.MouseMiddleButtonPressed ||
Input.GamePad.Triggers.Left > 0.5f ||
Input.GamePadBPressed ||
// Also use back for this
downPressed)
{
float slowdown =
1.0f - moveFactor *
// Use only half if we just decelerate
(downPressed ? BrakeSlowdown / 2 : BrakeSlowdown) *
// Don’t brake so much if we are already driving backwards
(shipSpeed < 0 ? 0.33f : 1.0f);
shipSpeed *= Math.Max(0, slowdown);
// Limit to max. 100 mph slowdown per sec
if (shipSpeed > oldSpeed + 100 * moveFactor)
shipSpeed = (oldSpeed + 100 * moveFactor);
if (shipSpeed < oldSpeed - 100 * moveFactor)
shipSpeed = (oldSpeed - 100 * moveFactor);
// Remember that we slowed down for generating tracks.
downPressed = true;
}
// Calculate pitch depending on the force
float speedChange = shipSpeed - oldSpeed;
// Limit speed change, never apply more than 5 per sec.
if (speedChange < -8 * moveFactor)
speedChange = -8 * moveFactor;
if (speedChange > 8 * moveFactor)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
358
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
6.48.3.5
Class Documentation
speedChange = 8 * moveFactor;
// Limit speed
if (shipSpeed >
shipSpeed =
if (shipSpeed <
shipSpeed =
maxSpeed)
maxSpeed;
5)
5;
// Apply speed and calculate new car position.
if (followPath == null)
shipPosition += shipSpeed * shipDirection * moveFactor * 1.75f;
else
{
shipPosition = GetPosition(followPath, t);
shipDirection = GetPosition(followPath, t + 0.01f) - shipPosition;
shipDirection.Normalize();
t += 0.00005f * Speed;
if (t >= 0.9f)
t = 0;
}
#endregion
//GalaxyWarsManager.particleSystem.AddParticle(shipPosition, new Vector3());
#region Update track position and handle physics
shipRenderMatrix = GalaxyWarsManager.Player.UpdateCarMatrixAndCamera();
#endregion
}
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.GetPosition (List< Vertex > path,
float t) [protected]
Definition at line 693 of file SpaceshipPhysics.cs.
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
{
Vertex tmp = null;
float squaredLength = 0, squaredPosition = 0;
if (t > 1)
t = 1;
// Calculate total squared length of the path
foreach (Vertex v in path)
{
if (tmp == null)
{
tmp = v;
continue;
}
Vector dist = v.Position - tmp.Position;
squaredLength += dist.SquareLength();
tmp = v;
}
squaredPosition = t * squaredLength;
squaredLength = 0;
tmp = null;
// Find the corresponding position
foreach (Vertex v in path)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
6.48.3.6
359
{
if (tmp == null)
{
tmp = v;
continue;
}
Vector dist = v.Position - tmp.Position;
float length = dist.SquareLength();
if (squaredLength + length >= squaredPosition)
{
t = (squaredPosition - squaredLength) / length;
return new Vector3(tmp.Position.X + t * (v.Position.X - tmp.Position.X),
tmp.Position.Y + t * (v.Position.Y - tmp.Position.Y),
tmp.Position.Z + t * (v.Position.Z - tmp.Position.Z));
}
squaredLength += length;
tmp = v;
}
return Vector3.Zero;
}
Matrix GalaxyWars.GameLogic.SpaceshipPhysics.UpdateCarMatrixAndCamera ()
Update car matrix and camera.
Definition at line 751 of file SpaceshipPhysics.cs.
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
{
// Get car matrix with help of the current car position, dir and up
Matrix carMatrix = Matrix.Identity;
carMatrix.Right = ShipRight;
carMatrix.Up = shipUp;
carMatrix.Forward = shipDirection;
carMatrix.Translation = shipPosition;
// Change distance based on our speed
float chaseCamDistance = (4.25f + 9.75f * shipSpeed / maxSpeed) * viewDistance;
if (GalaxyWarsManager.MenuActive == false && ZoomInTime > 1500)
{
// Calculate zooming in camera position
Vector3 camPos =
shipPosition + shipUp * SpaceshipHeight +
carMatrix.Forward * (chaseCamDistance +
(MathHelper.Max(ZoomInTime - StartGameZoomedInTime, 0.0f)
/ ((float)StartGameZoomTimeMilliseconds)) * 250.0f)
- carMatrix.Up * (0.6f +
(MathHelper.Max(ZoomInTime - StartGameZoomedInTime, 0.0f)
/ ((float)StartGameZoomTimeMilliseconds)) * 200.0f);
// Make sure we don’t interpolate at the first time
if (ZoomInTime - BaseGame.ElapsedTimeThisFrameInMilliseconds >= 3000)
GalaxyWarsManager.Player.SetCameraPosition(camPos);
else
GalaxyWarsManager.Player.InterpolateCameraPosition(camPos);
}
else if (GalaxyWarsManager.Player.FreeCamera)
GalaxyWarsManager.Player.InterpolateCameraPosition(
shipPosition + shipUp * SpaceshipHeight +
carMatrix.Forward * chaseCamDistance carMatrix.Up * chaseCamDistance / (viewDistance + 6.0f) -
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
360
Class Documentation
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
carMatrix.Up * 1.0f);
else if (GalaxyWarsManager.MenuActive &&
BaseGame.TotalTimeMilliseconds < 100)
// No interpolation in menu, just set it (at least for the first ms)
GalaxyWarsManager.Player.SetCameraPosition(
shipPosition + shipUp * SpaceshipHeight +
carMatrix.Forward * chaseCamDistance carMatrix.Up * 0.6f);
else
GalaxyWarsManager.Player.InterpolateCameraPosition(
shipPosition + carMatrix.Up * SpaceshipHeight +
carMatrix.Forward * chaseCamDistance / 1.125f carMatrix.Up * 0.8f);
return carMatrix;
}
6.48.4
Member Data Documentation
6.48.4.1
const float GalaxyWars.GameLogic.SpaceshipPhysics.SpaceshipMass = 1000
Default spaceship mass (1000 kg).
Definition at line 38 of file SpaceshipPhysics.cs.
6.48.4.2
const float GalaxyWars.GameLogic.SpaceshipPhysics.DefaultMaxSpeed = 275.0f
Max speed of the spaceship.
Definition at line 43 of file SpaceshipPhysics.cs.
6.48.4.3
const float GalaxyWars.GameLogic.SpaceshipPhysics.MaxPossibleSpeed = 290.0f
Definition at line 44 of file SpaceshipPhysics.cs.
6.48.4.4
const float GalaxyWars.GameLogic.SpaceshipPhysics.DefaultMaxAccelerationPerSec =
2.5f
Max. acceleration in m/s∧ 2 we can do per second. We have also to define the max and min overall
accelleration we can do with our spaceship.
Definition at line 51 of file SpaceshipPhysics.cs.
6.48.4.5
const float GalaxyWars.GameLogic.SpaceshipPhysics.MaxAcceleration = 5.75f
Definition at line 52 of file SpaceshipPhysics.cs.
6.48.4.6
const float GalaxyWars.GameLogic.SpaceshipPhysics.MinAcceleration = -3.25f
Definition at line 53 of file SpaceshipPhysics.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
6.48.4.7
361
const float GalaxyWars.GameLogic.SpaceshipPhysics.AirFrictionPerSpeed = 0.66f
[private]
Air friction we get if we’re flying fast, this slows us down very fast if we’re flying fast. This could be
extended to include wind and then even at low speeds the air friction would slow us down or even influcene
our movement.
Definition at line 61 of file SpaceshipPhysics.cs.
6.48.4.8
const float GalaxyWars.GameLogic.SpaceshipPhysics.MaxAirFriction =
AirFrictionPerSpeed ∗ 200.0f [private]
Max air friction, this way we can have a good air friction for low speeds.
Definition at line 66 of file SpaceshipPhysics.cs.
6.48.4.9
const float GalaxyWars.GameLogic.SpaceshipPhysics.BrakeSlowdown = 10.0f
[private]
Break slowdown per second, 1.0 means we need 1 second to do a full break. Slowdown is also limited by
max. 100 per sec! Note: This would not make sense in a real world simulation because stopping the car
needs usually more time and is highly dependant on the speed resultin in bigger stopping distances. For
this game it is easier and more fun to just brake always the same.
Definition at line 76 of file SpaceshipPhysics.cs.
6.48.4.10
const float GalaxyWars.GameLogic.SpaceshipPhysics.MaxRotationPerSec = 1.3f
Max rotation per second we use for our ship.
Definition at line 81 of file SpaceshipPhysics.cs.
6.48.4.11
const float GalaxyWars.GameLogic.SpaceshipPhysics.MinSensitivity = 0.5f
Minimum controller sensitivity.
Definition at line 86 of file SpaceshipPhysics.cs.
6.48.4.12
const float GalaxyWars.GameLogic.SpaceshipPhysics.SpaceshipHeight = 2.0f
[protected]
This will be elevated above the ship position to let our camera look at the roof of it.
Definition at line 92 of file SpaceshipPhysics.cs.
6.48.4.13
const float GalaxyWars.GameLogic.SpaceshipPhysics.MinViewDistance = 0.2f
[private]
The closest the camera should ever come to the ship.
Definition at line 97 of file SpaceshipPhysics.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
362
6.48.4.14
Class Documentation
const float GalaxyWars.GameLogic.SpaceshipPhysics.MaxViewDistance = 1.8f
[private]
The furthest the camera should ever be from the ship. (This is ignored during at the start of the race for
zooming in).
Definition at line 103 of file SpaceshipPhysics.cs.
6.48.4.15
float GalaxyWars.GameLogic.SpaceshipPhysics.maxSpeed = DefaultMaxSpeed ∗ 1.05f
[static, protected]
Max speed of the ship. We start with the speed 0, then it is increased based on the current acceleration
value to this maxSpeed value.
Definition at line 115 of file SpaceshipPhysics.cs.
6.48.4.16
float GalaxyWars.GameLogic.SpaceshipPhysics.shipMass = SpaceshipMass ∗ 1.015f
[static, protected]
Mass of the ship. Used for physics calculations.
Definition at line 120 of file SpaceshipPhysics.cs.
6.48.4.17
float GalaxyWars.GameLogic.SpaceshipPhysics.maxAccelerationPerSec =
DefaultMaxAccelerationPerSec ∗ 0.85f [static, protected]
Current acceleration of the ship. Drive faster or break with up/down, left/right mouse or the gamepad
(left/right triggers or right thumb). The acceleration influcences the current speed of the ship.
Definition at line 127 of file SpaceshipPhysics.cs.
6.48.4.18
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.shipPosition [private]
Ship position, updated each frame by our current speed vector.
Definition at line 134 of file SpaceshipPhysics.cs.
6.48.4.19
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.shipDirection [private]
Direction the ship is currently heading.
Definition at line 139 of file SpaceshipPhysics.cs.
6.48.4.20
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.shipUp [private]
Ship up vector for orientation.
Definition at line 144 of file SpaceshipPhysics.cs.
6.48.4.21
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.shipForce [private]
Force we currently apply on our ship. Usually we determinate how much acceleration we get through
the controls and multiplying that with the current direction vector. But for gravity, staying on the ground,
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
363
crashes, collisions impulses and all other forces this vector might be somewhat different. Used each frame
to change the speed.
Definition at line 154 of file SpaceshipPhysics.cs.
6.48.4.22
float GalaxyWars.GameLogic.SpaceshipPhysics.shipSpeed [private]
Speed of our ship, just in the direction of our ship. Sliding is a nice feature, but it overcomplicates too
much and for this game sliding would be really bad and make it much harder to drive!
Definition at line 162 of file SpaceshipPhysics.cs.
6.48.4.23
float GalaxyWars.GameLogic.SpaceshipPhysics.viewDistance = 1.0f [private]
View distance, which we can change with page up/down and the mouse wheel, but it always moves back
to 1. The real view distance is also changed depending on how fast we’re flying.
Definition at line 181 of file SpaceshipPhysics.cs.
6.48.4.24
float GalaxyWars.GameLogic.SpaceshipPhysics.rotateShipAfterCollision = 0
[private]
Rotate ship after collision.
Definition at line 186 of file SpaceshipPhysics.cs.
6.48.4.25
List<Vertex> GalaxyWars.GameLogic.SpaceshipPhysics.followPath = null
[private]
Path to be followed by the ship.
Definition at line 191 of file SpaceshipPhysics.cs.
6.48.4.26
float GalaxyWars.GameLogic.SpaceshipPhysics.t = 0 [private]
Time parameter to get the position on the path (between 0 and 1).
Definition at line 196 of file SpaceshipPhysics.cs.
6.48.4.27
Matrix GalaxyWars.GameLogic.SpaceshipPhysics.shipRenderMatrix = Matrix.Identity
[private]
Ship render matrix we calculate each frame.
Definition at line 201 of file SpaceshipPhysics.cs.
6.48.4.28
float GalaxyWars.GameLogic.SpaceshipPhysics.lastAccelerationResult = 0.0f
[private]
Definition at line 231 of file SpaceshipPhysics.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
364
Class Documentation
6.48.4.29
float GalaxyWars.GameLogic.SpaceshipPhysics.virtualRotationAmount = 0.0f
[private]
Definition at line 384 of file SpaceshipPhysics.cs.
6.48.4.30
float GalaxyWars.GameLogic.SpaceshipPhysics.verticalRotationAmount = 0.0f
[private]
Definition at line 384 of file SpaceshipPhysics.cs.
6.48.4.31
float GalaxyWars.GameLogic.SpaceshipPhysics.rotationChange = 0.0f [private]
Definition at line 385 of file SpaceshipPhysics.cs.
6.48.4.32
float GalaxyWars.GameLogic.SpaceshipPhysics.verticalRotationChange = 0.0f
[private]
Definition at line 385 of file SpaceshipPhysics.cs.
6.48.5
Property Documentation
6.48.5.1
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.SpaceshipUpVector [get]
Ship up vector.
Returns:
Vector 3
Definition at line 169 of file SpaceshipPhysics.cs.
6.48.5.2
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.ShipPosition [get]
Ship position.
Returns:
Vector 3
Definition at line 212 of file SpaceshipPhysics.cs.
6.48.5.3
float GalaxyWars.GameLogic.SpaceshipPhysics.Speed [get]
Speed.
Returns:
Float
Definition at line 224 of file SpaceshipPhysics.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.48 GalaxyWars.GameLogic.SpaceshipPhysics Class Reference
6.48.5.4
float GalaxyWars.GameLogic.SpaceshipPhysics.Acceleration [get]
Acceleration.
Returns:
Float
Definition at line 238 of file SpaceshipPhysics.cs.
6.48.5.5
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.LookAtPos [get]
Look at position.
Returns:
Vector 3
Definition at line 258 of file SpaceshipPhysics.cs.
6.48.5.6
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.ShipDirection [get]
Ship direction.
Returns:
Vector 3
Definition at line 270 of file SpaceshipPhysics.cs.
6.48.5.7
Vector3 GalaxyWars.GameLogic.SpaceshipPhysics.ShipRight [get]
Ship right.
Returns:
Vector 3
Definition at line 282 of file SpaceshipPhysics.cs.
6.48.5.8
List<Vertex> GalaxyWars.GameLogic.SpaceshipPhysics.Path [get, set]
Path to be followed by the spaceship.
Definition at line 293 of file SpaceshipPhysics.cs.
6.48.5.9
float GalaxyWars.GameLogic.SpaceshipPhysics.PathTime [get, set]
Time (between 0 and 1) to specify the position on the path.
Definition at line 299 of file SpaceshipPhysics.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
365
366
Class Documentation
6.48.5.10
Matrix GalaxyWars.GameLogic.SpaceshipPhysics.ShipRenderMatrix [get]
Ship render matrix, this is the final matrix for rendering our ship, which is called by Update each frame.
Returns:
Matrix
Definition at line 307 of file SpaceshipPhysics.cs.
The documentation for this class was generated from the following file:
• SpaceshipPhysics.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.49 GalaxyWars.GameScreens.SplashScreen Class Reference
6.49
GalaxyWars.GameScreens.SplashScreen Class Reference
Splash screen.
Inheritance diagram for GalaxyWars.GameScreens.SplashScreen:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.SplashScreen
Collaboration diagram for GalaxyWars.GameScreens.SplashScreen:
GalaxyWars.GameScreens.IGameScreen
GalaxyWars.GameScreens.SplashScreen
Public Member Functions
• SplashScreen ()
• bool Render ()
Render splash screen.
6.49.1
Detailed Description
Splash screen.
Definition at line 18 of file SplashScreen.cs.
6.49.2
Constructor & Destructor Documentation
6.49.2.1
GalaxyWars.GameScreens.SplashScreen.SplashScreen ()
Definition at line 20 of file SplashScreen.cs.
21
22
{
}
6.49.3
Member Function Documentation
6.49.3.1
bool GalaxyWars.GameScreens.SplashScreen.Render ()
Render splash screen.
Implements GalaxyWars.GameScreens.IGameScreen.
Definition at line 27 of file SplashScreen.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
367
368
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Class Documentation
{
// Render background and black bar
BaseGame.UI.RenderGameBackground();
GalaxyWarsManager.Asteroids.Render();
//BaseGame.UI.RenderMenuTrackBackground();
BaseGame.UI.RenderBlackBar(518, 61);
// Show Press Start to continue.
if ((int)(BaseGame.TotalTime / 0.375f) % 3 != 0)
BaseGame.UI.Headers.RenderOnScreen(
BaseGame.CalcRectangleCenteredWithGivenHeight(
512, 518 + 61 / 2, 26, UIRenderer.PressStartGfxRect),
UIRenderer.PressStartGfxRect);
// Clicking or pressing start will go to the menu
return Input.MouseLeftButtonJustPressed ||
Input.KeyboardSpaceJustPressed ||
Input.KeyboardEscapeJustPressed ||
Input.GamePadStartPressed;
}
The documentation for this class was generated from the following file:
• SplashScreen.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.50 GalaxyWars.Graphics.TangentVertex Struct Reference
6.50
369
GalaxyWars.Graphics.TangentVertex Struct Reference
Tangent vertex format for shader vertex format used all over the place. It contains: Position, Normal vector,
texture coords, tangent vector.
Public Member Functions
• TangentVertex (Vector3 setPos, float setU, float setV, Vector3 setNormal, Vector3 setTangent)
Create tangent vertex.
• TangentVertex (Vector3 setPos, Vector2 setUv, Vector3 setNormal, Vector3 setTangent)
Create tangent vertex.
• override string ToString ()
To string.
Static Public Member Functions
• static bool IsTangentVertexDeclaration (VertexElement[ ] declaration)
Returns true if declaration is tangent vertex declaration.
Public Attributes
• Vector3 pos
Position.
• Vector2 uv
Texture coordinates.
• Vector3 normal
Normal.
• Vector3 tangent
Tangent.
Static Public Attributes
• static VertexDeclaration VertexDeclaration
Vertex declaration for vertex buffers.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
370
Class Documentation
Properties
• static int SizeInBytes [get]
Stride size, in XNA called SizeInBytes. I’m just conforming with that.
• float U [get]
U texture coordinate.
• float V [get]
V texture coordinate.
Static Private Member Functions
• static VertexElement[ ] GenerateVertexElements ()
Generate vertex declaration.
Static Private Attributes
• static readonly VertexElement[ ] VertexElements
Vertex elements for Mesh.Clone.
6.50.1
Detailed Description
Tangent vertex format for shader vertex format used all over the place. It contains: Position, Normal vector,
texture coords, tangent vector.
Definition at line 15 of file TangentVertex.cs.
6.50.2
Constructor & Destructor Documentation
6.50.2.1
GalaxyWars.Graphics.TangentVertex.TangentVertex (Vector3 setPos, float setU, float
setV, Vector3 setNormal, Vector3 setTangent)
Create tangent vertex.
Parameters:
setPos Set position
setU Set u texture coordinate
setV Set v texture coordinate
setNormal Set normal
setTangent Set tangent
Definition at line 96 of file TangentVertex.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.50 GalaxyWars.Graphics.TangentVertex Struct Reference
101
102
103
104
105
106
371
{
pos = setPos;
uv = new Vector2(setU, setV);
normal = setNormal;
tangent = setTangent;
}
6.50.2.2
GalaxyWars.Graphics.TangentVertex.TangentVertex (Vector3 setPos, Vector2 setUv,
Vector3 setNormal, Vector3 setTangent)
Create tangent vertex.
Parameters:
setPos Set position
setUv Set uv texture coordinates
setNormal Set normal
setTangent Set tangent
Definition at line 115 of file TangentVertex.cs.
120
121
122
123
124
125
{
pos = setPos;
uv = setUv;
normal = setNormal;
tangent = setTangent;
}
6.50.3
Member Function Documentation
6.50.3.1
override string GalaxyWars.Graphics.TangentVertex.ToString ()
To string.
Definition at line 132 of file TangentVertex.cs.
133
134
135
136
137
138
139
6.50.3.2
{
return "TangentVertex(pos=" + pos + ", " +
"u=" + uv.X + ", " +
"v=" + uv.Y + ", " +
"normal=" + normal + ", " +
"tangent=" + tangent + ")";
}
static VertexElement [ ] GalaxyWars.Graphics.TangentVertex.GenerateVertexElements ()
[static, private]
Generate vertex declaration.
Definition at line 158 of file TangentVertex.cs.
159
160
161
{
VertexElement[] decl = new VertexElement[]
{
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
372
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
6.50.3.3
Class Documentation
// Construct new vertex declaration with tangent info
// First the normal stuff (we should already have that)
new VertexElement(0, 0, VertexElementFormat.Vector3,
VertexElementMethod.Default, VertexElementUsage.Position, 0),
new VertexElement(0, 12, VertexElementFormat.Vector2,
VertexElementMethod.Default,
VertexElementUsage.TextureCoordinate, 0),
new VertexElement(0, 20, VertexElementFormat.Vector3,
VertexElementMethod.Default, VertexElementUsage.Normal, 0),
// And now the tangent
new VertexElement(0, 32, VertexElementFormat.Vector3,
VertexElementMethod.Default, VertexElementUsage.Tangent, 0),
};
return decl;
}
static bool GalaxyWars.Graphics.TangentVertex.IsTangentVertexDeclaration
(VertexElement[ ] declaration) [static]
Returns true if declaration is tangent vertex declaration.
Definition at line 183 of file TangentVertex.cs.
185
186
187
188
189
190
191
192
193
194
195
196
{
if (declaration == null)
throw new ArgumentNullException("declaration");
return
declaration.Length == 4 &&
declaration[0].VertexElementUsage ==
declaration[1].VertexElementUsage ==
VertexElementUsage.TextureCoordinate
declaration[2].VertexElementUsage ==
declaration[3].VertexElementUsage ==
VertexElementUsage.Position &&
&&
VertexElementUsage.Normal &&
VertexElementUsage.Tangent;
}
6.50.4
Member Data Documentation
6.50.4.1
Vector3 GalaxyWars.Graphics.TangentVertex.pos
Position.
Definition at line 21 of file TangentVertex.cs.
6.50.4.2
Vector2 GalaxyWars.Graphics.TangentVertex.uv
Texture coordinates.
Definition at line 25 of file TangentVertex.cs.
6.50.4.3
Vector3 GalaxyWars.Graphics.TangentVertex.normal
Normal.
Definition at line 29 of file TangentVertex.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.50 GalaxyWars.Graphics.TangentVertex Struct Reference
6.50.4.4
373
Vector3 GalaxyWars.Graphics.TangentVertex.tangent
Tangent.
Definition at line 33 of file TangentVertex.cs.
6.50.4.5
readonly VertexElement [ ] GalaxyWars.Graphics.TangentVertex.VertexElements
[static, private]
Initial value:
GenerateVertexElements()
Vertex elements for Mesh.Clone.
Definition at line 146 of file TangentVertex.cs.
6.50.4.6
VertexDeclaration GalaxyWars.Graphics.TangentVertex.VertexDeclaration [static]
Initial value:
new VertexDeclaration(BaseGame.Device, VertexElements)
Vertex declaration for vertex buffers.
Definition at line 152 of file TangentVertex.cs.
6.50.5
Property Documentation
6.50.5.1
int GalaxyWars.Graphics.TangentVertex.SizeInBytes [static, get]
Stride size, in XNA called SizeInBytes. I’m just conforming with that.
Definition at line 53 of file TangentVertex.cs.
6.50.5.2
float GalaxyWars.Graphics.TangentVertex.U [get]
U texture coordinate.
Returns:
Float
Definition at line 67 of file TangentVertex.cs.
6.50.5.3
float GalaxyWars.Graphics.TangentVertex.V [get]
V texture coordinate.
Returns:
Float
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
374
Class Documentation
Definition at line 79 of file TangentVertex.cs.
The documentation for this struct was generated from the following file:
• TangentVertex.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.51 GalaxyWars.Graphics.TextureFont Class Reference
6.51
375
GalaxyWars.Graphics.TextureFont Class Reference
Texture font for our game, uses GameFont.png. If you want to know more details about creating bitmap
fonts in XNA, how to generate the bitmaps and more details about using it, please check out the following links:
http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx
http://blogs.msdn.com/garykac/articles/732007.aspx
http://www.angelcode.com/products/bmfont/.
Collaboration diagram for GalaxyWars.Graphics.TextureFont:
Texture2D
internalXnaTexture
GalaxyWars.Graphics.Texture
fontTexture
GalaxyWars.Graphics.TextureFont
Public Member Functions
• TextureFont ()
Create texture font.
• void Dispose ()
Dispose.
• void WriteAll ()
Write all.
Static Public Member Functions
• static int GetTextWidth (string text)
Get the text width of a given text.
• static void WriteText (int x, int y, string text, Color color)
Write the given text at the specified position.
• static void WriteText (int x, int y, string text)
Write.
• static void WriteTextCentered (int x, int y, string text)
Write text centered.
• static void WriteTextCentered (int x, int y, string text, Color color, float scale)
Write text centered with scale factor.
• static void WriteGameTime (int x, int y, int timeMilliseconds, Color col)
Write game time.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
376
Class Documentation
Protected Member Functions
• virtual void Dispose (bool disposing)
Dispose.
Properties
• static int Height [get]
Height.
Private Attributes
• const string GameFontFilename = "GameFont.png"
Game font filename for our bitmap.
• const int FontHeight = 36
Font height.
• const int SubRenderHeight = 5
Substract this value from the y postion when rendering. Most letters start below the CharRects, this fixes
that issue.
• Texture fontTexture
Font texture.
• SpriteBatch fontSprite
Font sprite.
Static Private Attributes
• static Rectangle[ ] CharRects
Char rectangles, goes from space (32) to ∼ (126).
Height is not used (always the
same), instead we save the actual used width for rendering in the height value!
This are
the characters: !"#$%&’()∗+,-./0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]∧ _‘
abcdefghijklmnopqrstuvwxyz{|}∼ Then we also got 4 extra rects for the XBox Buttons: A, B, X, Y.
• static List< FontToRender > remTexts = new List<FontToRender>()
Remember font texts to render to render them all at once in our Render method (beween rest of the ui and
the mouse cursor).
Classes
• class FontToRender
TextureFont to render.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.51 GalaxyWars.Graphics.TextureFont Class Reference
6.51.1
377
Detailed Description
Texture font for our game, uses GameFont.png. If you want to know more details about creating bitmap
fonts in XNA, how to generate the bitmaps and more details about using it, please check out the following links:
http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx
http://blogs.msdn.com/garykac/articles/732007.aspx
http://www.angelcode.com/products/bmfont/.
Definition at line 21 of file TextureFont.cs.
6.51.2
Constructor & Destructor Documentation
6.51.2.1
GalaxyWars.Graphics.TextureFont.TextureFont ()
Create texture font.
Definition at line 185 of file TextureFont.cs.
186
187
188
189
{
fontTexture = new Texture(GameFontFilename);
fontSprite = new SpriteBatch(BaseGame.Device);
}
6.51.3
Member Function Documentation
6.51.3.1
void GalaxyWars.Graphics.TextureFont.Dispose ()
Dispose.
Definition at line 196 of file TextureFont.cs.
197
198
199
200
{
Dispose(true);
GC.SuppressFinalize(this);
}
6.51.3.2
virtual void GalaxyWars.Graphics.TextureFont.Dispose (bool disposing) [protected,
virtual]
Dispose.
Parameters:
disposing Disposing
Definition at line 206 of file TextureFont.cs.
207
208
209
210
211
212
213
214
215
{
if (disposing)
{
if (fontTexture != null)
fontTexture.Dispose();
if (fontSprite != null)
fontSprite.Dispose();
}
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
378
Class Documentation
6.51.3.3
static int GalaxyWars.Graphics.TextureFont.GetTextWidth (string text) [static]
Get the text width of a given text.
Parameters:
text Text
Returns:
Width (in pixels) of the text
Definition at line 224 of file TextureFont.cs.
225
226
227
228
229
230
231
232
233
234
235
236
237
{
int width = 0;
//foreach (char c in text)
char[] chars = text.ToCharArray();
for (int num = 0; num < chars.Length; num++)
{
int charNum = (int)chars[num];
if (charNum >= 32 &&
charNum - 32 < CharRects.Length)
width += BaseGame.XToRes1400(CharRects[charNum - 32].Height);
}
return width;
}
6.51.3.4
static void GalaxyWars.Graphics.TextureFont.WriteText (int x, int y, string text, Color
color) [static]
Write the given text at the specified position.
Parameters:
x X
y Y
text Text
color Color
Definition at line 316 of file TextureFont.cs.
317
318
319
{
remTexts.Add(new FontToRender(x, y, text, color));
}
6.51.3.5
static void GalaxyWars.Graphics.TextureFont.WriteText (int x, int y, string text)
[static]
Write.
Parameters:
x X
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.51 GalaxyWars.Graphics.TextureFont Class Reference
y Y
text Text
Definition at line 327 of file TextureFont.cs.
328
329
330
{
remTexts.Add(new FontToRender(x, y, text, Color.White));
}
6.51.3.6
static void GalaxyWars.Graphics.TextureFont.WriteTextCentered (int x, int y, string
text) [static]
Write text centered.
Parameters:
x X
y Y
text Text
Definition at line 338 of file TextureFont.cs.
339
340
341
{
WriteText(x - GetTextWidth(text) / 2, y - Height / 2, text);
}
6.51.3.7
static void GalaxyWars.Graphics.TextureFont.WriteTextCentered (int x, int y, string
text, Color color, float scale) [static]
Write text centered with scale factor.
Parameters:
x X
y Y
text Text
color Color
Definition at line 350 of file TextureFont.cs.
352
353
354
355
356
357
358
{
int width = TextureFont.GetTextWidth(text);
remTexts.Add(new FontToRender(
x - (int)Math.Round(width * scale / 2),
y - (int)Math.Round(TextureFont.Height * scale / 2),
text, color, scale));
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
379
380
Class Documentation
6.51.3.8
static void GalaxyWars.Graphics.TextureFont.WriteGameTime (int x, int y, int
timeMilliseconds, Color col) [static]
Write game time.
Parameters:
x X
y Y
timeMilliseconds Time Milliseconds
col Color
Definition at line 367 of file TextureFont.cs.
369
370
371
372
373
374
375
376
377
378
379
380
6.51.3.9
{
WriteText(x, y,
// negative?
(timeMilliseconds < 0 ? "-" : "") +
// Minutes
((Math.Abs(timeMilliseconds) / 1000) / 60) + ":" +
// Seconds
((Math.Abs(timeMilliseconds) / 1000) % 60).ToString("00") + "." +
// Milliseconds
((Math.Abs(timeMilliseconds) / 10) % 100).ToString("00"),
col);
}
void GalaxyWars.Graphics.TextureFont.WriteAll ()
Write all.
Definition at line 387 of file TextureFont.cs.
References
GalaxyWars.Graphics.TextureFont.FontToRender.color,
GalaxyWars.Graphics.TextureFont.FontToRender.scale, GalaxyWars.Graphics.TextureFont.FontToRender.text,
GalaxyWars.Graphics.TextureFont.FontToRender.x, and GalaxyWars.Graphics.TextureFont.FontToRender.y.
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
{
if (remTexts.Count == 0)
return;
// Start rendering
fontSprite.Begin(SpriteBlendMode.AlphaBlend);
// Draw each character in the text
//foreach (UIRenderer.FontToRender fontText in texts)
for (int textNum = 0; textNum < remTexts.Count; textNum++)
{
FontToRender fontText = remTexts[textNum];
int x = fontText.x;
int y = fontText.y;
Color color = fontText.color;
//foreach (char c in fontText.text)
char[] chars = fontText.text.ToCharArray();
for (int num = 0; num < chars.Length; num++)
{
int charNum = (int)chars[num];
if (charNum >= 32 &&
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.51 GalaxyWars.Graphics.TextureFont Class Reference
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
381
charNum - 32 < CharRects.Length)
{
// Draw this char
Rectangle rect = CharRects[charNum - 32];
// Reduce height to prevent overlapping pixels
rect.Y += 1;
rect.Height = FontHeight;
Rectangle destRect = new Rectangle(x,
y - BaseGame.YToRes1050(SubRenderHeight),
rect.Width, rect.Height);
// Scale destRect (1600x1200 is the base size)
destRect.Width = BaseGame.XToRes1400(
(int)Math.Round(destRect.Width * fontText.scale));
destRect.Height = BaseGame.YToRes1050(
(int)Math.Round(destRect.Height * fontText.scale));
// Since we want upscaling, we use the modified destRect
fontSprite.Draw(fontTexture.XnaTexture, destRect, rect, color);
// Increase x pos by width we use for this character
int charWidth = CharRects[charNum - 32].Height;
x += BaseGame.XToRes1400(
(int)Math.Round(charWidth * fontText.scale));
}
}
}
// End rendering
fontSprite.End();
remTexts.Clear();
}
6.51.4
Member Data Documentation
6.51.4.1
const string GalaxyWars.Graphics.TextureFont.GameFontFilename = "GameFont.png"
[private]
Game font filename for our bitmap.
Definition at line 27 of file TextureFont.cs.
6.51.4.2
const int GalaxyWars.Graphics.TextureFont.FontHeight = 36 [private]
Font height.
Definition at line 32 of file TextureFont.cs.
6.51.4.3
const int GalaxyWars.Graphics.TextureFont.SubRenderHeight = 5 [private]
Substract this value from the y postion when rendering. Most letters start below the CharRects, this fixes
that issue.
Definition at line 38 of file TextureFont.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
382
Class Documentation
6.51.4.4
Rectangle [ ] GalaxyWars.Graphics.TextureFont.CharRects [static, private]
Char rectangles, goes from space (32) to ∼ (126).
Height is not used (always the
same), instead we save the actual used width for rendering in the height value!
This are
the characters: !"#$%&’()∗+,-./0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]∧ _‘
abcdefghijklmnopqrstuvwxyz{|}∼ Then we also got 4 extra rects for the XBox Buttons: A, B, X, Y.
Definition at line 50 of file TextureFont.cs.
6.51.4.5
Texture GalaxyWars.Graphics.TextureFont.fontTexture [private]
Font texture.
Definition at line 160 of file TextureFont.cs.
6.51.4.6
SpriteBatch GalaxyWars.Graphics.TextureFont.fontSprite [private]
Font sprite.
Definition at line 164 of file TextureFont.cs.
6.51.4.7
List<FontToRender> GalaxyWars.Graphics.TextureFont.remTexts = new
List<FontToRender>() [static, private]
Remember font texts to render to render them all at once in our Render method (beween rest of the ui and
the mouse cursor).
Definition at line 307 of file TextureFont.cs.
6.51.5
Property Documentation
6.51.5.1
int GalaxyWars.Graphics.TextureFont.Height [static, get]
Height.
Returns:
Int
Definition at line 173 of file TextureFont.cs.
The documentation for this class was generated from the following file:
• TextureFont.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.52 GalaxyWars.Graphics.TextureFont.FontToRender Class Reference
6.52
GalaxyWars.Graphics.TextureFont.FontToRender Class Reference
TextureFont to render.
Collaboration diagram for GalaxyWars.Graphics.TextureFont.FontToRender:
Color
color
GalaxyWars.Graphics.TextureFont.FontToRender
Public Member Functions
• FontToRender (int setX, int setY, string setText, Color setColor)
Create font to render.
• FontToRender (int setX, int setY, string setText, Color setColor, float setScale)
Create font to render.
Public Attributes
• int x
X and y position.
• int y
• string text
Text.
• Color color
Color.
• float scale
Scale, usually just 1.
6.52.1
383
Detailed Description
TextureFont to render.
Definition at line 245 of file TextureFont.cs.
6.52.2
Constructor & Destructor Documentation
6.52.2.1
GalaxyWars.Graphics.TextureFont.FontToRender.FontToRender (int setX, int setY,
string setText, Color setColor)
Create font to render.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
384
Class Documentation
Parameters:
setX Set x
setY Set y
setText Set text
setColor Set color
Definition at line 274 of file TextureFont.cs.
275
276
277
278
279
280
281
{
x = setX;
y = setY;
text = setText;
color = setColor;
scale = 1.0f;
}
6.52.2.2
GalaxyWars.Graphics.TextureFont.FontToRender.FontToRender (int setX, int setY,
string setText, Color setColor, float setScale)
Create font to render.
Parameters:
setX Set x
setY Set y
setText Set text
setColor Set color
Definition at line 290 of file TextureFont.cs.
292
293
294
295
296
297
298
{
x = setX;
y = setY;
text = setText;
color = setColor;
scale = setScale;
}
6.52.3
Member Data Documentation
6.52.3.1
int GalaxyWars.Graphics.TextureFont.FontToRender.x
X and y position.
Definition at line 251 of file TextureFont.cs.
Referenced by GalaxyWars.Graphics.TextureFont.WriteAll().
6.52.3.2
int GalaxyWars.Graphics.TextureFont.FontToRender.y
Definition at line 251 of file TextureFont.cs.
Referenced by GalaxyWars.Graphics.TextureFont.WriteAll().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.52 GalaxyWars.Graphics.TextureFont.FontToRender Class Reference
6.52.3.3
string GalaxyWars.Graphics.TextureFont.FontToRender.text
Text.
Definition at line 255 of file TextureFont.cs.
Referenced by GalaxyWars.Graphics.TextureFont.WriteAll().
6.52.3.4
Color GalaxyWars.Graphics.TextureFont.FontToRender.color
Color.
Definition at line 259 of file TextureFont.cs.
Referenced by GalaxyWars.Graphics.TextureFont.WriteAll().
6.52.3.5
float GalaxyWars.Graphics.TextureFont.FontToRender.scale
Scale, usually just 1.
Definition at line 263 of file TextureFont.cs.
Referenced by GalaxyWars.Graphics.TextureFont.WriteAll().
The documentation for this class was generated from the following file:
• TextureFont.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
385
386
Class Documentation
6.53
GalaxyWars.Graphics.TextureFontBigNumbers Class Reference
TextureFontBigNumbers.
Static Public Member Functions
• static int WriteNumber (int x, int y, int number)
Write number.
• static int WriteNumber (int x, int y, int number, float alpha)
Write number.
• static int WriteNumber (int x, int y, int height, int number)
Write number.
• static void WriteNumberCentered (int x, int y, int number)
Write number centered.
• static void WriteNumberCentered (int x, int y, int number, float alpha)
Write number centered.
Static Private Member Functions
• static int WriteDigit (int x, int y, int digit)
Write digit.
• static int WriteDigit (int x, int y, int height, int digit)
Write digit.
• static int WriteDigit (int x, int y, int digit, float alpha)
Write digit.
Static Private Attributes
• static readonly Rectangle[ ] BigNumberRects
Big numbers in the Ingame.png graphic.
6.53.1
Detailed Description
TextureFontBigNumbers.
Definition at line 17 of file TextureFontBigNumbers.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.53 GalaxyWars.Graphics.TextureFontBigNumbers Class Reference
6.53.2
Member Function Documentation
6.53.2.1
static int GalaxyWars.Graphics.TextureFontBigNumbers.WriteDigit (int x, int y, int
digit) [static, private]
Write digit.
Parameters:
x X
y Y
digit Digit
Returns:
Int
Definition at line 56 of file TextureFontBigNumbers.cs.
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
if (digit < 0)
return 0;
float resScalingX = (float)BaseGame.Width / 1600.0f;
float resScalingY = (float)BaseGame.Height / 1200.0f;
Rectangle rect = BigNumberRects[digit % BigNumberRects.Length];
BaseGame.UI.Ingame.RenderOnScreen(new Rectangle(x, y,
(int)Math.Round(rect.Width * resScalingX),
(int)Math.Round(rect.Height * resScalingY)), rect);
return (int)Math.Round(rect.Width * resScalingX);
}
6.53.2.2
static int GalaxyWars.Graphics.TextureFontBigNumbers.WriteDigit (int x, int y, int
height, int digit) [static, private]
Write digit.
Parameters:
x X
y Y
height Height
digit Digit
Returns:
Int
Definition at line 80 of file TextureFontBigNumbers.cs.
81
82
83
{
if (digit < 0)
return 0;
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
387
388
Class Documentation
84
85
86
87
88
89
90
91
92
93
94
95
float resScalingX = (float)BaseGame.Width / 1600.0f;
float resScalingY = (float)BaseGame.Height / 1200.0f;
float scaleFactor = height / (float)BigNumberRects[0].Height;
Rectangle rect = BigNumberRects[digit % BigNumberRects.Length];
BaseGame.UI.Ingame.RenderOnScreen(new Rectangle(x, y,
(int)Math.Round(rect.Width * resScalingX * scaleFactor),
(int)Math.Round(rect.Height * resScalingY * scaleFactor)), rect);
return (int)Math.Round(rect.Width * resScalingX * scaleFactor);
}
6.53.2.3
static int GalaxyWars.Graphics.TextureFontBigNumbers.WriteDigit (int x, int y, int
digit, float alpha) [static, private]
Write digit.
Parameters:
x X
y Y
digit Digit
alpha Alpha
Returns:
Int
Definition at line 105 of file TextureFontBigNumbers.cs.
106
107
108
109
110
111
112
113
114
115
116
117
{
float resScalingX = (float)BaseGame.Width / 1600.0f;
float resScalingY = (float)BaseGame.Height / 1200.0f;
Rectangle rect = BigNumberRects[digit % BigNumberRects.Length];
BaseGame.UI.Ingame.RenderOnScreen(new Rectangle(x, y,
(int)Math.Round(rect.Width * resScalingX),
(int)Math.Round(rect.Height * resScalingY)), rect,
ColorHelper.ApplyAlphaToColor(Color.White, alpha));
return (int)Math.Round(rect.Width * resScalingX);
}
6.53.2.4
static int GalaxyWars.Graphics.TextureFontBigNumbers.WriteNumber (int x, int y, int
number) [static]
Write number.
Parameters:
x X
y Y
number Number
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.53 GalaxyWars.Graphics.TextureFontBigNumbers Class Reference
389
Returns:
Int
Definition at line 126 of file TextureFontBigNumbers.cs.
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
// Convert to string
string numberText = number.ToString();
int width = 0;
// And now process every letter
//foreach (char numberChar in numberText.ToCharArray())
char[] chars = numberText.ToCharArray();
for (int num = 0; num < chars.Length; num++)
{
width += WriteDigit(x + width, y, (int)chars[num] - (int)’0’);
}
return width;
}
6.53.2.5
static int GalaxyWars.Graphics.TextureFontBigNumbers.WriteNumber (int x, int y, int
number, float alpha) [static]
Write number.
Parameters:
x X
y Y
number Number
alpha Alpha
Returns:
Int
Definition at line 151 of file TextureFontBigNumbers.cs.
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{
// Convert to string
string numberText = number.ToString();
int width = 0;
// And now process every letter
//foreach (char numberChar in numberText.ToCharArray())
char[] chars = numberText.ToCharArray();
for (int num = 0; num < chars.Length; num++)
{
width += WriteDigit(
x + width, y, (int)chars[num] - (int)’0’, alpha);
}
return width;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
390
Class Documentation
6.53.2.6
static int GalaxyWars.Graphics.TextureFontBigNumbers.WriteNumber (int x, int y, int
height, int number) [static]
Write number.
Parameters:
x X
y Y
height Height
number Number
Returns:
Int
Definition at line 177 of file TextureFontBigNumbers.cs.
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
{
// Convert to string
string numberText = number.ToString();
int width = 0;
// And now process every letter
//foreach (char numberChar in numberText.ToCharArray())
char[] chars = numberText.ToCharArray();
for (int num = 0; num < chars.Length; num++)
{
width += WriteDigit(
x + width, y, height, (int)chars[num] - (int)’0’);
}
return width;
}
6.53.2.7
static void GalaxyWars.Graphics.TextureFontBigNumbers.WriteNumberCentered (int x,
int y, int number) [static]
Write number centered.
Parameters:
x X
y Y
number Number
Definition at line 201 of file TextureFontBigNumbers.cs.
202
203
204
205
206
207
{
WriteNumber(
(int)(x - (number.ToString().Length * BigNumberRects[0].Width / 2) *
((float)BaseGame.Width / 1600.0f)),
y, number);
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.53 GalaxyWars.Graphics.TextureFontBigNumbers Class Reference
6.53.2.8
391
static void GalaxyWars.Graphics.TextureFontBigNumbers.WriteNumberCentered (int x,
int y, int number, float alpha) [static]
Write number centered.
Parameters:
x X
y Y
number Number
alpha Alpha
Definition at line 216 of file TextureFontBigNumbers.cs.
217
218
219
220
221
222
{
WriteNumber(
(int)(x - (number.ToString().Length * BigNumberRects[0].Width / 2) *
((float)BaseGame.Width / 1600.0f)),
y, number, alpha);
}
6.53.3
Member Data Documentation
6.53.3.1
readonly Rectangle [ ] GalaxyWars.Graphics.TextureFontBigNumbers.BigNumberRects
[static, private]
Initial value:
{
new Rectangle(2, 342, 80, 133),
new Rectangle(84, 342, 80, 133),
new Rectangle(167, 342, 80, 133),
new Rectangle(247, 342, 78, 133),
new Rectangle(330, 342, 80, 133),
new Rectangle(411, 342, 80, 133),
new Rectangle(495, 342, 80, 133),
new Rectangle(578, 342, 80, 133),
new Rectangle(659, 342, 80, 133),
new Rectangle(749, 342, 80, 133),
}
Big numbers in the Ingame.png graphic.
Definition at line 23 of file TextureFontBigNumbers.cs.
The documentation for this class was generated from the following file:
• TextureFontBigNumbers.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
392
Class Documentation
6.54
GalaxyWars.Graphics.UIRenderer Class Reference
Helper class to render all UI 2D stuff. Rendering textures is very easy with XNA using the Sprite class, but
we still have to create SpriteBatches. This class helps and handles everything for us.
Collaboration diagram for GalaxyWars.Graphics.UIRenderer:
XnaModel
skyCube
cube
DefaultSkyColor
GalaxyWars.Shaders.PreScreenSkyCubeMapping
randomCarColor
Color
color
lastUsedAmbientColor
lastUsedSpecularColor
lastUsedDiffuseColor
lastUsedCarHueColorChange
XnaTexture
GalaxyWars.Graphics.LensFlare.FlareData
flareTypes
lighting
normalMapping
landscapeNormalMapping
lineRendering
lastUsedHeightTexture
lastUsedNormalTexture
lastUsedDiffuseTexture
lastUsedDetailTexture
GalaxyWars.Graphics.LensFlare
lensFlare
headers
buttons
ingame
background
optionsScreen
helpScreen
trophies
mouseCursor
GalaxyWars.Shaders.ShaderEffect
flareTextures
GalaxyWars.Graphics.UIRenderer
font
Texture2D
internalXnaTexture
GalaxyWars.Graphics.TextureFont
fontTexture
GalaxyWars.Graphics.Texture
noiseMapTexture
GalaxyWars.Shaders.RenderToTexture
blurMap1Texture
blurMap2Texture
sceneMapTexture
downsampleMapTexture
GalaxyWars.Shaders.PostScreenMenu
postScreenMenuShader
postScreenGameShader
radialSceneMapTexture
GalaxyWars.Shaders.PostScreenGlow
screenBorderFadeoutMapTexture
Public Types
• enum TrophyType
Trophy types we can get at the end of each game. Gold means new record. Silver means place 2 and Bronse
is used for everything below (since we won ∧∧ ).
• enum TimeFadeupMode
Time fadeup modes.
Public Member Functions
• Texture GetTrophyTexture (TrophyType trophyType)
Get trophy texture.
• UIRenderer ()
Create user interface renderer.
• void Dispose ()
Dispose.
• void AddTimeFadeupEffect (int timeMilliseconds, TimeFadeupMode mode)
Add time fadeup effect. Used in the game to show times, plus (green) means we took longer for this checkpoint, minus (green) means we did good.
• void RenderTimeFadeupEffects ()
Render all time fadeup effects, move them up and fade them out.
• void RenderGameBackground ()
Render game background.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
393
• void RenderMenuTrackBackground ()
Render menu track background.
• void UpdateCarInMenu ()
• void RenderMenuBackground ()
Render menu background.
• void RenderBlackBar (int yPos, int height)
Render black bar.
• bool RenderBottomButtons (bool onlyBack)
Render bottom buttons (select, back, etc.).
• void RenderGameUI (int currentGameTime, int bestLapTime, int lapNumber, float speed, int gear,
float acceleration, string trackName)
Render game user interface.
• void RenderTextsAndMouseCursor ()
Render texts and mouse cursor, which is done at the very end of our render loop.
Static Public Member Functions
• static void Render (LineManager2D lineManager2D)
Render all UI elements at the end of the frame, will also render the mouse cursor if we got a mouse attached.
Public Attributes
• bool backButtonPressed = false
Static Public Attributes
• static readonly Rectangle BackgroundGfxRect = new Rectangle(0, 0, 1024, 640)
Graphic rectangles for displaying UI stuff.
•
•
•
•
•
•
•
•
•
•
•
•
•
static readonly Rectangle GalaxyWarsLogoGfxRect = new Rectangle(0, 1024 - 375, 1024, 374)
static readonly Rectangle BottomLeftBorderGfxRect = new Rectangle(2, 984, 38, 37)
static readonly Rectangle BottomRightBorderGfxRect = new Rectangle(42, 984, 38, 37)
static readonly Rectangle PressStartGfxRect = new Rectangle(2, 1, 631, 45)
static readonly Rectangle HeaderChooseCarGfxRect = new Rectangle(0, 212, 512, 100)
static readonly Rectangle HeaderOptionsGfxRect = new Rectangle(512, 212, 512, 100)
static readonly Rectangle HeaderSelectTrackGfxRect = new Rectangle(0, 312, 512, 100)
static readonly Rectangle HeaderHelpGfxRect = new Rectangle(512, 312, 512, 100)
static readonly Rectangle HeaderHighscoresGfxRect = new Rectangle(0, 412, 512, 100)
static readonly Rectangle BlackBarGfxRect = new Rectangle(99, 999, 1, 1)
static readonly Rectangle OptionsRadioButtonGfxRect = new Rectangle(128, 980, 25, 25)
static readonly Rectangle MenuButtonPlayGfxRect = new Rectangle(0, 0, 212, 212)
static readonly Rectangle MenuButtonHighscoresGfxRect = new Rectangle(212, 0, 212, 212)
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
394
Class Documentation
• static readonly Rectangle MenuButtonOptionsGfxRect = new Rectangle(2 ∗ 212, 0, 212, 212)
• static readonly Rectangle MenuButtonHelpGfxRect = new Rectangle(3 ∗ 212, 0, 212, 212)
• static readonly Rectangle MenuButtonQuitGfxRect = new Rectangle(212, 240, 212, 212)
• static readonly Rectangle MenuButtonSelectionGfxRect = new Rectangle(3 ∗ 212, 240, 212, 212)
• static readonly Rectangle MenuTextPlayGfxRect = new Rectangle(0, 214, 212, 24)
• static readonly Rectangle MenuTextHighscoresGfxRect = new Rectangle(212, 214, 212, 24)
• static readonly Rectangle MenuTextOptionsGfxRect = new Rectangle(2 ∗ 212, 214, 212, 24)
• static readonly Rectangle MenuTextHelpGfxRect = new Rectangle(3 ∗ 212, 214, 212, 24)
• static readonly Rectangle MenuTextQuitGfxRect = new Rectangle(212, 240 + 214, 212, 24)
• static readonly Rectangle BigArrowGfxRect = new Rectangle(867, 242, 127, 178)
• static readonly Rectangle TrackButtonBeginnerGfxRect = new Rectangle(0, 480, 212, 352)
• static readonly Rectangle TrackButtonAdvancedGfxRect = new Rectangle(212, 480, 212, 352)
• static readonly Rectangle TrackButtonExpertGfxRect = new Rectangle(2 ∗ 212, 480, 212, 352)
• static readonly Rectangle TrackButtonSelectionGfxRect = new Rectangle(3 ∗ 212, 480, 212, 352)
• static readonly Rectangle TrackTextBeginnerGfxRect = new Rectangle(0, 834, 212, 24)
• static readonly Rectangle TrackTextAdvancedGfxRect = new Rectangle(212, 834, 212, 24)
• static readonly Rectangle TrackTextExpertGfxRect = new Rectangle(2 ∗ 212, 834, 212, 24)
• static readonly Rectangle BottomButtonSelectionGfxRect = new Rectangle(212 ∗ 2, 240, 212, 92)
• static readonly Rectangle BottomButtonAButtonGfxRect = new Rectangle(0, 872, 212, 92)
• static readonly Rectangle BottomButtonBButtonGfxRect = new Rectangle(212, 872, 212, 92)
• static readonly Rectangle BottomButtonBackButtonGfxRect = new Rectangle(2 ∗ 212, 872, 212, 92)
• static readonly Rectangle BottomButtonStartButtonGfxRect = new Rectangle(3 ∗ 212, 872, 212, 92)
• static readonly Rectangle SelectionArrowGfxRect = new Rectangle(874, 426, 53, 39)
• static readonly Rectangle SelectionRadioButtonGfxRect = new Rectangle(935, 427, 39, 39)
• static readonly Rectangle LapsGfxRect = new Rectangle(381, 132, 222, 160)
In game gfx rects. Tacho is our speedometer we see on the screen.
• static readonly Rectangle TachoGfxRect = new Rectangle(0, 0, 343, 341)
• static readonly Rectangle TachoArrowGfxRect = new Rectangle(347, 0, 28, 186)
• static readonly Rectangle TachoMphGfxRect = new Rectangle(184, 256, 148, 72)
• static readonly Rectangle TachoGearGfxRect = new Rectangle(286, 149, 52, 72)
• static readonly Rectangle CurrentAndBestGfxRect = new Rectangle(381, 2, 342, 128)
• static readonly Rectangle CurrentTimePosGfxRect = new Rectangle(540, 8, 170, 52)
• static readonly Rectangle BestTimePosGfxRect = new Rectangle(540, 72, 170, 52)
• static readonly Rectangle TrackNameGfxRect = new Rectangle(726, 2, 282, 62)
• static readonly Rectangle Best5GfxRect = new Rectangle(726, 66, 282, 62)
Protected Member Functions
• virtual void Dispose (bool disposing)
Dispose.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
Properties
• Texture Buttons [get]
Buttons.
• Texture Headers [get]
Headers.
• Texture HelpScreen [get]
Help screen.
• Texture OptionsScreen [get]
Options screen.
• Texture Ingame [get]
Ingame.
• PostScreenMenu PostScreenMenuShader [get]
Post screen menu shader.
• PostScreenGlow PostScreenGlowShader [get]
• TextureCube SkyCubeMapTexture [get]
Sky cube map texture.
Private Attributes
• Texture background
Background.
• Texture buttons
Buttons.
• Texture headers
Headers.
• Texture helpScreen
Help screen texture.
• Texture optionsScreen
Options screen texture.
• Texture mouseCursor
Mouse cursor.
• TextureFont font
Font.
• PostScreenMenu postScreenMenuShader
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
395
396
Class Documentation
Post screen menu shader for cool screen effects like the TV effect, stripes, a flash effect and some color
correction.
• PostScreenGlow postScreenGameShader
Post screen game shader for glow, color correction and motion blur effects in the game.
• PreScreenSkyCubeMapping skyCube = null
Sky cube background rendering.
• LensFlare lensFlare = null
And finally the lens flare we render at the end.
• Texture ingame = null
Ingame texture for the speed, gear, time, rank, laps, etc.
• Texture[ ] trophies = new Texture[3]
Trophies.
•
•
•
•
•
•
•
•
List< TimeFadeupText > fadeupTexts = new List<TimeFadeupText>()
Vector3 oldCarForward = Vector3.Zero
Vector3 oldCarUp = Vector3.Zero
float carMenuTime = 0.0f
Vector3 carPos = GalaxyWarsManager.Player.ShipPosition
int randomCarNumber = RandomHelper.GetRandomInt(3)
Color randomCarColor = RandomHelper.RandomColor
bool showFps
Classes
• class TimeFadeupText
6.54.1
Detailed Description
Helper class to render all UI 2D stuff. Rendering textures is very easy with XNA using the Sprite class, but
we still have to create SpriteBatches. This class helps and handles everything for us.
Definition at line 22 of file UIRenderer.cs.
6.54.2
Member Enumeration Documentation
6.54.2.1
enum GalaxyWars::Graphics::UIRenderer::TrophyType
Trophy types we can get at the end of each game. Gold means new record. Silver means place 2 and Bronse
is used for everything below (since we won ∧∧ ).
Enumerator:
Gold
Silver
Bronze
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
Definition at line 213 of file UIRenderer.cs.
214
215
216
217
218
{
Gold,
Silver,
Bronze,
}
6.54.2.2
enum GalaxyWars::Graphics::UIRenderer::TimeFadeupMode
Time fadeup modes.
Enumerator:
Plus
Minus
Normal
Definition at line 339 of file UIRenderer.cs.
340
341
342
343
344
{
Plus,
Minus,
Normal,
}
6.54.3
Constructor & Destructor Documentation
6.54.3.1
GalaxyWars.Graphics.UIRenderer.UIRenderer ()
Create user interface renderer.
Definition at line 267 of file UIRenderer.cs.
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
{
background = new Texture("background.png");
buttons = new Texture("buttons.png");
headers = new Texture("headers.png");
helpScreen = new Texture("HelpScreenWindows.png");
optionsScreen = new Texture("OptionsScreenWindows.png");
mouseCursor = new Texture("MouseCursor.png");
ingame = new Texture("Ingame.png");
trophies[0] = new Texture("pokal1");
trophies[1] = new Texture("pokal2");
trophies[2] = new Texture("pokal3");
font = new TextureFont();
postScreenMenuShader = new PostScreenMenu();
postScreenGameShader = new PostScreenGlow();
skyCube = new PreScreenSkyCubeMapping();
lensFlare = new LensFlare(LensFlare.DefaultSunPos);
BaseGame.LightDirection = LensFlare.DefaultLightPos;
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
397
398
Class Documentation
6.54.4
Member Function Documentation
6.54.4.1
Texture GalaxyWars.Graphics.UIRenderer.GetTrophyTexture (TrophyType trophyType)
Get trophy texture.
Parameters:
trophyType Trophy type
Returns:
Texture
Definition at line 225 of file UIRenderer.cs.
226
227
228
{
return trophies[(int)trophyType];
}
6.54.4.2
void GalaxyWars.Graphics.UIRenderer.Dispose ()
Dispose.
Definition at line 293 of file UIRenderer.cs.
294
295
296
297
{
Dispose(true);
GC.SuppressFinalize(this);
}
6.54.4.3
virtual void GalaxyWars.Graphics.UIRenderer.Dispose (bool disposing) [protected,
virtual]
Dispose.
Parameters:
disposing Disposing
Definition at line 303 of file UIRenderer.cs.
304
305
306
307
308
309
310
311
312
313
314
315
316
{
if (disposing)
{
if (background != null)
background.Dispose();
if (buttons != null)
buttons.Dispose();
if (headers != null)
headers.Dispose();
if (helpScreen != null)
helpScreen.Dispose();
if (optionsScreen != null)
optionsScreen.Dispose();
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
399
if (mouseCursor != null)
mouseCursor.Dispose();
if (font != null)
font.Dispose();
if (postScreenMenuShader != null)
postScreenMenuShader.Dispose();
if (postScreenGameShader != null)
postScreenGameShader.Dispose();
if (skyCube != null)
skyCube.Dispose();
if (lensFlare != null)
lensFlare.Dispose();
if (ingame != null)
ingame.Dispose();
}
}
6.54.4.4
void GalaxyWars.Graphics.UIRenderer.AddTimeFadeupEffect (int timeMilliseconds,
TimeFadeupMode mode)
Add time fadeup effect. Used in the game to show times, plus (green) means we took longer for this
checkpoint, minus (green) means we did good.
Parameters:
timeMilisec Time
mode Mode
Definition at line 369 of file UIRenderer.cs.
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
6.54.4.5
{
string text =
//min
((timeMilliseconds / 1000) / 60) + ":" +
//sec
((timeMilliseconds / 1000) % 60).ToString("00") + "." +
//ms
((timeMilliseconds / 10) % 100).ToString("00");
Color col = Color.White;
if (mode == TimeFadeupMode.Plus)
{
text = "+ " + text;
col = Color.Red;
}
else if (mode == TimeFadeupMode.Minus)
{
text = "- " + text;
col = Color.Green;
}
fadeupTexts.Add(new TimeFadeupText(text, col));
}
void GalaxyWars.Graphics.UIRenderer.RenderTimeFadeupEffects ()
Render all time fadeup effects, move them up and fade them out.
Definition at line 396 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
400
Class Documentation
References
GalaxyWars.Graphics.UIRenderer.TimeFadeupText.color,
Wars.Graphics.UIRenderer.TimeFadeupText.showTimeMs,
and
Wars.Graphics.UIRenderer.TimeFadeupText.text.
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
6.54.4.6
GalaxyGalaxy-
{
for (int num = 0; num < fadeupTexts.Count; num++)
{
TimeFadeupText fadeupText = fadeupTexts[num];
fadeupText.showTimeMs -= BaseGame.ElapsedTimeThisFrameInMilliseconds;
if (fadeupText.showTimeMs < 0)
{
fadeupTexts.Remove(fadeupText);
num--;
}
else
{
// Fade out
float alpha = 1.0f;
if (fadeupText.showTimeMs < 1500)
alpha = fadeupText.showTimeMs / 1500.0f;
// Move up
float moveUpAmount =
(TimeFadeupText.MaxShowTimeMs - fadeupText.showTimeMs) /
TimeFadeupText.MaxShowTimeMs;
// Calculate screen position
TextureFont.WriteTextCentered(BaseGame.Width / 2,
BaseGame.Height / 3 - (int)(moveUpAmount * BaseGame.Height / 3),
fadeupText.text,
ColorHelper.ApplyAlphaToColor(fadeupText.color, alpha),
2.25f);
}
}
}
void GalaxyWars.Graphics.UIRenderer.RenderGameBackground ()
Render game background.
Definition at line 436 of file UIRenderer.cs.
437
438
439
440
6.54.4.7
{
// Show game background (sky and lensflare)
skyCube.RenderSky();
}
void GalaxyWars.Graphics.UIRenderer.RenderMenuTrackBackground ()
Render menu track background.
Definition at line 455 of file UIRenderer.cs.
456
457
6.54.4.8
{
}
void GalaxyWars.Graphics.UIRenderer.UpdateCarInMenu ()
Definition at line 462 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
463
464
465
{
GalaxyWarsManager.Player.Update();
}
6.54.4.9
void GalaxyWars.Graphics.UIRenderer.RenderMenuBackground ()
Render menu background.
Definition at line 470 of file UIRenderer.cs.
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
{
BaseGame.UI.UpdateCarInMenu();
// Render game background
RenderGameBackground();
// And show track
RenderMenuTrackBackground();
// Render background with transparency
// The background itself should be rendered before this ^^
background.RenderOnScreen(
BaseGame.ResolutionRect, BackgroundGfxRect,
ColorHelper.ApplyAlphaToColor(Color.White, 0.85f));
// Show GalaxyWars logo bouncing with the music
float bounceSize = 1.005f +
(float)Math.Sin(BaseGame.TotalTime / 0.46f) * 0.045f *
(float)Math.Cos(BaseGame.TotalTime / 0.285f);
background.RenderOnScreen(
BaseGame.CalcRectangleWithBounce(362, 36, 601, 218, bounceSize),
GalaxyWarsLogoGfxRect);
}
6.54.4.10
void GalaxyWars.Graphics.UIRenderer.RenderBlackBar (int yPos, int height)
Render black bar.
Parameters:
yPos Y position
height Height
Definition at line 502 of file UIRenderer.cs.
503
504
505
506
507
508
6.54.4.11
{
buttons.RenderOnScreen(
BaseGame.CalcRectangle(0, yPos, 1024, height),
BlackBarGfxRect,
ColorHelper.ApplyAlphaToColor(Color.White, 0.85f));
}
bool GalaxyWars.Graphics.UIRenderer.RenderBottomButtons (bool onlyBack)
Render bottom buttons (select, back, etc.).
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
401
402
Class Documentation
Parameters:
onlyBack Only back
Definition at line 517 of file UIRenderer.cs.
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
{
Rectangle bButtonRect = BaseGame.CalcRectangleCenteredWithGivenHeight(
0, 587, 48, BottomButtonBButtonGfxRect);
bButtonRect.X = BaseGame.Width - bButtonRect.Width - BaseGame.XToRes(25 + 25);
bool overBButton = Input.MouseInBox(bButtonRect);
int xAdd = BaseGame.XToRes(16);
int yAdd = BaseGame.YToRes(9);
if (overBButton)
bButtonRect = new Rectangle(
bButtonRect.X - xAdd / 2, bButtonRect.Y - yAdd / 2,
bButtonRect.Width + xAdd, bButtonRect.Height + yAdd);
buttons.RenderOnScreen(bButtonRect, BottomButtonBButtonGfxRect);
// Is mouse over button?
if (overBButton)
buttons.RenderOnScreen(bButtonRect, BottomButtonSelectionGfxRect);
// Store value if back button was pressed;
backButtonPressed = overBButton && Input.MouseLeftButtonJustPressed;
// Don’t show button a if there is nothing to select here
if (onlyBack)
return false;
Rectangle aButtonRect = BaseGame.CalcRectangleCenteredWithGivenHeight(
0, 587, 48, BottomButtonAButtonGfxRect);
aButtonRect.X = BaseGame.Width aButtonRect.Width * 2 - BaseGame.XToRes(55 + 25);
bool overAButton = Input.MouseInBox(aButtonRect);
if (overAButton)
aButtonRect = new Rectangle(
aButtonRect.X - xAdd / 2, aButtonRect.Y - yAdd / 2,
aButtonRect.Width + xAdd, aButtonRect.Height + yAdd);
buttons.RenderOnScreen(aButtonRect, BottomButtonAButtonGfxRect);
// Is mouse over button?
if (overAButton)
{
buttons.RenderOnScreen(aButtonRect, BottomButtonSelectionGfxRect);
if (Input.MouseLeftButtonJustPressed)
return true;
}
return false;
}
6.54.4.12
void GalaxyWars.Graphics.UIRenderer.RenderGameUI (int currentGameTime, int
bestLapTime, int lapNumber, float speed, int gear, float acceleration, string trackName)
Render game user interface.
Parameters:
currentGameTime Current game time
bestLapTime Best lap time
lapNumber Lap number
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
403
speed Speed
gear Gear
trackName Track name
Definition at line 575 of file UIRenderer.cs.
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
{
Color baseUIColor = ColorHelper.HalfAlpha;
// If game is over, set speed, gear and acceleration to 0
if (GalaxyWarsManager.Player.GameOver)
{
speed = 0;
gear = 1;
acceleration = 0;
}
// More distance to the screen borders on the Xbox 360 to fit better into
// the save region. Calculate all rectangles for each platform,
// then they will be used the same way on both platforms.
// Draw all boxes and background stuff
//Rectangle lapsRect = BaseGame.CalcRectangle1600(
//
10, 10, LapsGfxRect.Width, LapsGfxRect.Height);
//ingame.RenderOnScreen(lapsRect, LapsGfxRect, baseUIColor);
Rectangle timesRect =
BaseGame.CalcRectangle1600(10, 10, CurrentAndBestGfxRect.Width, CurrentAndBestGfxRect.
timesRect.Y = BaseGame.Height - timesRect.Bottom;
ingame.RenderOnScreen(timesRect, CurrentAndBestGfxRect, baseUIColor);
Rectangle trackNameRect =
BaseGame.CalcRectangle1600(10, 10, TrackNameGfxRect.Width, TrackNameGfxRect.Height);
trackNameRect.X = BaseGame.Width - trackNameRect.Right;
ingame.RenderOnScreen(trackNameRect, TrackNameGfxRect, baseUIColor);
Rectangle tachoRect = BaseGame.CalcRectangle1600(
10, 10, TachoGfxRect.Width , TachoGfxRect.Height);
tachoRect.X = BaseGame.Width - tachoRect.Right;
tachoRect.Y = BaseGame.Height - tachoRect.Bottom;
// Rest can stay the same because we use the rectangles from now on
ingame.RenderOnScreen(tachoRect, TachoGfxRect, baseUIColor);
// Ok, now add the numbers, text and speed values
//TextureFontBigNumbers.WriteNumber(
//
lapsRect.X + BaseGame.XToRes1600(15),
//
lapsRect.Y + BaseGame.YToRes1200(12),
//
lapNumber);
// Current and best game times
Color highlightColor = new Color(255, 185, 80);
int blockHeight = BaseGame.YToRes1200(74);
TextureFont.WriteGameTime(
timesRect.X + BaseGame.XToRes1600(154),
timesRect.Y + blockHeight / 2 - TextureFont.Height / 2,
currentGameTime,
highlightColor);
//TextureFont.WriteGameTime(
//
timesRect.X + BaseGame.XToRes1600(154),
//
timesRect.Y + timesRect.Height / 2 + blockHeight / 2 //
TextureFont.Height / 2,
//
bestLapTime,
//
Color.White);
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
404
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
6.54.4.13
Class Documentation
// Track name
TextureFont.WriteTextCentered(
trackNameRect.X + trackNameRect.Width / 2,
trackNameRect.Y + blockHeight / 2,
trackName);
// Acceleration
//Point tachoPoint = new Point(
//
tachoRect.X +
//
BaseGame.XToRes1600(194),
//
tachoRect.Y +
//
BaseGame.YToRes1200(194));
//ingame.RenderOnScreenWithRotation(
//
tachoPoint, TachoArrowGfxRect, -acceleration*2);
//if (acceleration < 0)
//
acceleration = 0;
//if (acceleration > 1)
//
acceleration = 1;
//float rotation = -2.33f + acceleration * 2.5f;
//int tachoArrowWidth = BaseGame.XToRes1600(TachoArrowGfxRect.Width);
//int tachoArrowHeight = BaseGame.YToRes1200(TachoArrowGfxRect.Height);
//Vector2 rotationPoint = new Vector2(
//
TachoArrowGfxRect.Width / 2,
//
TachoArrowGfxRect.Height - 13);
//ingame.RenderOnScreenWithRotation(
//
new Rectangle(tachoPoint.X, tachoPoint.Y,
//
tachoArrowWidth, tachoArrowHeight),
//
TachoArrowGfxRect,
//
rotation, rotationPoint);
// Speed in mph
TextureFontBigNumbers.WriteNumber(
tachoRect.X + BaseGame.XToRes1600(TachoMphGfxRect.X),
tachoRect.Y + BaseGame.YToRes1200(TachoMphGfxRect.Y),
TachoMphGfxRect.Height,
(int)Math.Round(speed));
}
static void GalaxyWars.Graphics.UIRenderer.Render (LineManager2D lineManager2D)
[static]
Render all UI elements at the end of the frame, will also render the mouse cursor if we got a mouse attached.
Render all ui elements that we collected this frame. Flush user interface graphics, this are mainly all Texture.RenderOnScreen calls we made this frame so far. Used in UIRenderer.RenderTextsAndMouseCursor,
but can also be called to force rendering UI at a specific point in the code.
Definition at line 695 of file UIRenderer.cs.
References GalaxyWars.Graphics.LineManager2D.Render().
696
697
698
699
700
701
702
703
704
705
706
707
708
{
if (lineManager2D == null)
throw new ArgumentNullException("lineManager2D");
// Disable depth buffer for UI
BaseGame.Device.RenderState.DepthBufferEnable = false;
// Overwrite the vertex declaration to make sure we don’t use
// the old format anymore.
BaseGame.Device.VertexDeclaration = TangentVertex.VertexDeclaration;
// Draw all sprites
Texture.AdditiveSprite.End();
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
709
710
711
712
713
714
Texture.AlphaSprite.End();
//SpriteHelper.DrawAllSprites();
// Render all 2d lines
lineManager2D.Render();
}
Here is the call graph for this function:
GalaxyWars.Graphics.UIRenderer.Render
6.54.4.14
GalaxyWars.Graphics.LineManager2D.Render
void GalaxyWars.Graphics.UIRenderer.RenderTextsAndMouseCursor ()
Render texts and mouse cursor, which is done at the very end of our render loop.
Definition at line 720 of file UIRenderer.cs.
721
{
722 #if DEBUG
723
724
725
726
727
728
729 #endif
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
}
// Show fps
if (Input.KeyboardF1JustPressed ||
// Also allow toggeling with gamepad
(Input.GamePad.Buttons.LeftShoulder == ButtonState.Pressed &&
Input.GamePadYJustPressed))
showFps = !showFps;
if (showFps)
TextureFont.WriteText(
BaseGame.XToRes(200), BaseGame.YToRes(26),
"Fps: " + BaseGame.Fps + " " +
BaseGame.Width + "x" + BaseGame.Height);
// Render font texts
RenderTimeFadeupEffects();
font.WriteAll();
// Render mouse
// For the xbox, there is no mouse support, don’t show cursor!
if (Input.MouseDetected &&
// Also don’t show cursor in game!
GalaxyWarsManager.ShowCursor)
{
Texture.AlphaSprite.Begin(SpriteBlendMode.Additive);
Texture.AdditiveSprite.Begin(SpriteBlendMode.AlphaBlend);
// Use our SpriteHelper logic to render the mouse cursor now!
mouseCursor.RenderOnScreen(Input.MousePos);
Texture.AdditiveSprite.End();
Texture.AlphaSprite.End();
//SpriteHelper.DrawAllSprites();
}
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
405
406
Class Documentation
6.54.5
Member Data Documentation
6.54.5.1
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BackgroundGfxRect = new
Rectangle(0, 0, 1024, 640) [static]
Graphic rectangles for displaying UI stuff.
Definition at line 29 of file UIRenderer.cs.
6.54.5.2
readonly Rectangle GalaxyWars.Graphics.UIRenderer.GalaxyWarsLogoGfxRect = new
Rectangle(0, 1024 - 375, 1024, 374) [static]
Definition at line 30 of file UIRenderer.cs.
6.54.5.3
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BottomLeftBorderGfxRect = new
Rectangle(2, 984, 38, 37) [static]
Definition at line 31 of file UIRenderer.cs.
6.54.5.4
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BottomRightBorderGfxRect =
new Rectangle(42, 984, 38, 37) [static]
Definition at line 32 of file UIRenderer.cs.
6.54.5.5
readonly Rectangle GalaxyWars.Graphics.UIRenderer.PressStartGfxRect = new
Rectangle(2, 1, 631, 45) [static]
Definition at line 33 of file UIRenderer.cs.
6.54.5.6
readonly Rectangle GalaxyWars.Graphics.UIRenderer.HeaderChooseCarGfxRect = new
Rectangle(0, 212, 512, 100) [static]
Definition at line 34 of file UIRenderer.cs.
6.54.5.7
readonly Rectangle GalaxyWars.Graphics.UIRenderer.HeaderOptionsGfxRect = new
Rectangle(512, 212, 512, 100) [static]
Definition at line 35 of file UIRenderer.cs.
6.54.5.8
readonly Rectangle GalaxyWars.Graphics.UIRenderer.HeaderSelectTrackGfxRect = new
Rectangle(0, 312, 512, 100) [static]
Definition at line 36 of file UIRenderer.cs.
6.54.5.9
readonly Rectangle GalaxyWars.Graphics.UIRenderer.HeaderHelpGfxRect = new
Rectangle(512, 312, 512, 100) [static]
Definition at line 37 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
6.54.5.10
407
readonly Rectangle GalaxyWars.Graphics.UIRenderer.HeaderHighscoresGfxRect =
new Rectangle(0, 412, 512, 100) [static]
Definition at line 38 of file UIRenderer.cs.
6.54.5.11
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BlackBarGfxRect = new
Rectangle(99, 999, 1, 1) [static]
Definition at line 39 of file UIRenderer.cs.
6.54.5.12
readonly Rectangle GalaxyWars.Graphics.UIRenderer.OptionsRadioButtonGfxRect =
new Rectangle(128, 980, 25, 25) [static]
Definition at line 40 of file UIRenderer.cs.
6.54.5.13
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuButtonPlayGfxRect = new
Rectangle(0, 0, 212, 212) [static]
Definition at line 41 of file UIRenderer.cs.
6.54.5.14
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuButtonHighscoresGfxRect
= new Rectangle(212, 0, 212, 212) [static]
Definition at line 42 of file UIRenderer.cs.
6.54.5.15
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuButtonOptionsGfxRect =
new Rectangle(2 ∗ 212, 0, 212, 212) [static]
Definition at line 43 of file UIRenderer.cs.
6.54.5.16
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuButtonHelpGfxRect = new
Rectangle(3 ∗ 212, 0, 212, 212) [static]
Definition at line 44 of file UIRenderer.cs.
6.54.5.17
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuButtonQuitGfxRect = new
Rectangle(212, 240, 212, 212) [static]
Definition at line 45 of file UIRenderer.cs.
6.54.5.18
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuButtonSelectionGfxRect =
new Rectangle(3 ∗ 212, 240, 212, 212) [static]
Definition at line 46 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
408
6.54.5.19
Class Documentation
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuTextPlayGfxRect = new
Rectangle(0, 214, 212, 24) [static]
Definition at line 47 of file UIRenderer.cs.
6.54.5.20
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuTextHighscoresGfxRect =
new Rectangle(212, 214, 212, 24) [static]
Definition at line 48 of file UIRenderer.cs.
6.54.5.21
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuTextOptionsGfxRect = new
Rectangle(2 ∗ 212, 214, 212, 24) [static]
Definition at line 49 of file UIRenderer.cs.
6.54.5.22
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuTextHelpGfxRect = new
Rectangle(3 ∗ 212, 214, 212, 24) [static]
Definition at line 50 of file UIRenderer.cs.
6.54.5.23
readonly Rectangle GalaxyWars.Graphics.UIRenderer.MenuTextQuitGfxRect = new
Rectangle(212, 240 + 214, 212, 24) [static]
Definition at line 51 of file UIRenderer.cs.
6.54.5.24
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BigArrowGfxRect = new
Rectangle(867, 242, 127, 178) [static]
Definition at line 52 of file UIRenderer.cs.
6.54.5.25
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TrackButtonBeginnerGfxRect =
new Rectangle(0, 480, 212, 352) [static]
Definition at line 53 of file UIRenderer.cs.
6.54.5.26
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TrackButtonAdvancedGfxRect =
new Rectangle(212, 480, 212, 352) [static]
Definition at line 54 of file UIRenderer.cs.
6.54.5.27
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TrackButtonExpertGfxRect =
new Rectangle(2 ∗ 212, 480, 212, 352) [static]
Definition at line 55 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
6.54.5.28
409
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TrackButtonSelectionGfxRect =
new Rectangle(3 ∗ 212, 480, 212, 352) [static]
Definition at line 56 of file UIRenderer.cs.
6.54.5.29
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TrackTextBeginnerGfxRect =
new Rectangle(0, 834, 212, 24) [static]
Definition at line 57 of file UIRenderer.cs.
6.54.5.30
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TrackTextAdvancedGfxRect =
new Rectangle(212, 834, 212, 24) [static]
Definition at line 58 of file UIRenderer.cs.
6.54.5.31
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TrackTextExpertGfxRect = new
Rectangle(2 ∗ 212, 834, 212, 24) [static]
Definition at line 59 of file UIRenderer.cs.
6.54.5.32
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BottomButtonSelectionGfxRect
= new Rectangle(212 ∗ 2, 240, 212, 92) [static]
Definition at line 60 of file UIRenderer.cs.
6.54.5.33
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BottomButtonAButtonGfxRect =
new Rectangle(0, 872, 212, 92) [static]
Definition at line 61 of file UIRenderer.cs.
6.54.5.34
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BottomButtonBButtonGfxRect =
new Rectangle(212, 872, 212, 92) [static]
Definition at line 62 of file UIRenderer.cs.
6.54.5.35
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BottomButtonBackButtonGfxRect = new
Rectangle(2 ∗ 212, 872, 212, 92) [static]
Definition at line 63 of file UIRenderer.cs.
6.54.5.36
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BottomButtonStartButtonGfxRect = new
Rectangle(3 ∗ 212, 872, 212, 92) [static]
Definition at line 64 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
410
6.54.5.37
Class Documentation
readonly Rectangle GalaxyWars.Graphics.UIRenderer.SelectionArrowGfxRect = new
Rectangle(874, 426, 53, 39) [static]
Definition at line 65 of file UIRenderer.cs.
6.54.5.38
readonly Rectangle GalaxyWars.Graphics.UIRenderer.SelectionRadioButtonGfxRect =
new Rectangle(935, 427, 39, 39) [static]
Definition at line 66 of file UIRenderer.cs.
6.54.5.39
readonly Rectangle GalaxyWars.Graphics.UIRenderer.LapsGfxRect = new
Rectangle(381, 132, 222, 160) [static]
In game gfx rects. Tacho is our speedometer we see on the screen.
Definition at line 72 of file UIRenderer.cs.
6.54.5.40
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TachoGfxRect = new
Rectangle(0, 0, 343, 341) [static]
Definition at line 73 of file UIRenderer.cs.
6.54.5.41
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TachoArrowGfxRect = new
Rectangle(347, 0, 28, 186) [static]
Definition at line 74 of file UIRenderer.cs.
6.54.5.42
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TachoMphGfxRect = new
Rectangle(184, 256, 148, 72) [static]
Definition at line 75 of file UIRenderer.cs.
6.54.5.43
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TachoGearGfxRect = new
Rectangle(286, 149, 52, 72) [static]
Definition at line 76 of file UIRenderer.cs.
6.54.5.44
readonly Rectangle GalaxyWars.Graphics.UIRenderer.CurrentAndBestGfxRect = new
Rectangle(381, 2, 342, 128) [static]
Definition at line 77 of file UIRenderer.cs.
6.54.5.45
readonly Rectangle GalaxyWars.Graphics.UIRenderer.CurrentTimePosGfxRect = new
Rectangle(540, 8, 170, 52) [static]
Definition at line 78 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
6.54.5.46
readonly Rectangle GalaxyWars.Graphics.UIRenderer.BestTimePosGfxRect = new
Rectangle(540, 72, 170, 52) [static]
Definition at line 79 of file UIRenderer.cs.
6.54.5.47
readonly Rectangle GalaxyWars.Graphics.UIRenderer.TrackNameGfxRect = new
Rectangle(726, 2, 282, 62) [static]
Definition at line 80 of file UIRenderer.cs.
6.54.5.48
readonly Rectangle GalaxyWars.Graphics.UIRenderer.Best5GfxRect = new
Rectangle(726, 66, 282, 62) [static]
Definition at line 81 of file UIRenderer.cs.
6.54.5.49
Texture GalaxyWars.Graphics.UIRenderer.background [private]
Background.
Definition at line 88 of file UIRenderer.cs.
6.54.5.50
Texture GalaxyWars.Graphics.UIRenderer.buttons [private]
Buttons.
Definition at line 92 of file UIRenderer.cs.
6.54.5.51
Texture GalaxyWars.Graphics.UIRenderer.headers [private]
Headers.
Definition at line 96 of file UIRenderer.cs.
6.54.5.52
Texture GalaxyWars.Graphics.UIRenderer.helpScreen [private]
Help screen texture.
Definition at line 100 of file UIRenderer.cs.
6.54.5.53
Texture GalaxyWars.Graphics.UIRenderer.optionsScreen [private]
Options screen texture.
Definition at line 104 of file UIRenderer.cs.
6.54.5.54
Texture GalaxyWars.Graphics.UIRenderer.mouseCursor [private]
Mouse cursor.
Definition at line 108 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
411
412
6.54.5.55
Class Documentation
TextureFont GalaxyWars.Graphics.UIRenderer.font [private]
Font.
Definition at line 112 of file UIRenderer.cs.
6.54.5.56
PostScreenMenu GalaxyWars.Graphics.UIRenderer.postScreenMenuShader
[private]
Post screen menu shader for cool screen effects like the TV effect, stripes, a flash effect and some color
correction.
Definition at line 118 of file UIRenderer.cs.
6.54.5.57
PostScreenGlow GalaxyWars.Graphics.UIRenderer.postScreenGameShader
[private]
Post screen game shader for glow, color correction and motion blur effects in the game.
Definition at line 124 of file UIRenderer.cs.
6.54.5.58
PreScreenSkyCubeMapping GalaxyWars.Graphics.UIRenderer.skyCube = null
[private]
Sky cube background rendering.
Definition at line 129 of file UIRenderer.cs.
6.54.5.59
LensFlare GalaxyWars.Graphics.UIRenderer.lensFlare = null [private]
And finally the lens flare we render at the end.
Definition at line 134 of file UIRenderer.cs.
6.54.5.60
Texture GalaxyWars.Graphics.UIRenderer.ingame = null [private]
Ingame texture for the speed, gear, time, rank, laps, etc.
Definition at line 139 of file UIRenderer.cs.
6.54.5.61
Texture [ ] GalaxyWars.Graphics.UIRenderer.trophies = new Texture[3] [private]
Trophies.
Definition at line 144 of file UIRenderer.cs.
6.54.5.62
List<TimeFadeupText> GalaxyWars.Graphics.UIRenderer.fadeupTexts = new
List<TimeFadeupText>() [private]
Definition at line 360 of file UIRenderer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
6.54.5.63
Vector3 GalaxyWars.Graphics.UIRenderer.oldCarForward = Vector3.Zero
[private]
Definition at line 445 of file UIRenderer.cs.
6.54.5.64
Vector3 GalaxyWars.Graphics.UIRenderer.oldCarUp = Vector3.Zero [private]
Definition at line 446 of file UIRenderer.cs.
6.54.5.65
float GalaxyWars.Graphics.UIRenderer.carMenuTime = 0.0f [private]
Definition at line 447 of file UIRenderer.cs.
6.54.5.66
Vector3 GalaxyWars.Graphics.UIRenderer.carPos = GalaxyWarsManager.Player.ShipPosition [private]
Definition at line 448 of file UIRenderer.cs.
6.54.5.67
int GalaxyWars.Graphics.UIRenderer.randomCarNumber =
RandomHelper.GetRandomInt(3) [private]
Definition at line 449 of file UIRenderer.cs.
6.54.5.68
Color GalaxyWars.Graphics.UIRenderer.randomCarColor =
RandomHelper.RandomColor [private]
Definition at line 450 of file UIRenderer.cs.
6.54.5.69
bool GalaxyWars.Graphics.UIRenderer.backButtonPressed = false
Definition at line 512 of file UIRenderer.cs.
6.54.5.70
bool GalaxyWars.Graphics.UIRenderer.showFps [private]
Initial value:
false
Definition at line 678 of file UIRenderer.cs.
6.54.6
Property Documentation
6.54.6.1
Texture GalaxyWars.Graphics.UIRenderer.Buttons [get]
Buttons.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
413
414
Class Documentation
Returns:
Texture
Definition at line 153 of file UIRenderer.cs.
6.54.6.2
Texture GalaxyWars.Graphics.UIRenderer.Headers [get]
Headers.
Returns:
Texture
Definition at line 165 of file UIRenderer.cs.
6.54.6.3
Texture GalaxyWars.Graphics.UIRenderer.HelpScreen [get]
Help screen.
Returns:
Texture
Definition at line 177 of file UIRenderer.cs.
6.54.6.4
Texture GalaxyWars.Graphics.UIRenderer.OptionsScreen [get]
Options screen.
Returns:
Texture
Definition at line 189 of file UIRenderer.cs.
6.54.6.5
Texture GalaxyWars.Graphics.UIRenderer.Ingame [get]
Ingame.
Returns:
Texture
Definition at line 201 of file UIRenderer.cs.
6.54.6.6
PostScreenMenu GalaxyWars.Graphics.UIRenderer.PostScreenMenuShader [get]
Post screen menu shader.
Returns:
Post screen menu
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.54 GalaxyWars.Graphics.UIRenderer Class Reference
Definition at line 235 of file UIRenderer.cs.
Referenced by GalaxyWars.GalaxyWarsManager.PostUIRender().
6.54.6.7
PostScreenGlow GalaxyWars.Graphics.UIRenderer.PostScreenGlowShader [get]
Definition at line 243 of file UIRenderer.cs.
6.54.6.8
TextureCube GalaxyWars.Graphics.UIRenderer.SkyCubeMapTexture [get]
Sky cube map texture.
Returns:
Texture cube
Definition at line 255 of file UIRenderer.cs.
The documentation for this class was generated from the following file:
• UIRenderer.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
415
416
Class Documentation
6.55
GalaxyWars.Graphics.UIRenderer.TimeFadeupText
Reference
Class
Collaboration diagram for GalaxyWars.Graphics.UIRenderer.TimeFadeupText:
Color
color
GalaxyWars.Graphics.UIRenderer.TimeFadeupText
Public Member Functions
• TimeFadeupText (string setText, Color setColor)
Public Attributes
•
•
•
•
string text
Color color
float showTimeMs
const float MaxShowTimeMs = 2250
6.55.1
Detailed Description
Definition at line 346 of file UIRenderer.cs.
6.55.2
Constructor & Destructor Documentation
6.55.2.1
GalaxyWars.Graphics.UIRenderer.TimeFadeupText.TimeFadeupText (string setText,
Color setColor)
Definition at line 353 of file UIRenderer.cs.
354
355
356
357
358
{
text = setText;
color = setColor;
showTimeMs = MaxShowTimeMs;
}
6.55.3
Member Data Documentation
6.55.3.1
string GalaxyWars.Graphics.UIRenderer.TimeFadeupText.text
Definition at line 348 of file UIRenderer.cs.
Referenced by GalaxyWars.Graphics.UIRenderer.RenderTimeFadeupEffects().
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.55 GalaxyWars.Graphics.UIRenderer.TimeFadeupText Class Reference
6.55.3.2
417
Color GalaxyWars.Graphics.UIRenderer.TimeFadeupText.color
Definition at line 349 of file UIRenderer.cs.
Referenced by GalaxyWars.Graphics.UIRenderer.RenderTimeFadeupEffects().
6.55.3.3
float GalaxyWars.Graphics.UIRenderer.TimeFadeupText.showTimeMs
Definition at line 350 of file UIRenderer.cs.
Referenced by GalaxyWars.Graphics.UIRenderer.RenderTimeFadeupEffects().
6.55.3.4
const float GalaxyWars.Graphics.UIRenderer.TimeFadeupText.MaxShowTimeMs = 2250
Definition at line 351 of file UIRenderer.cs.
The documentation for this class was generated from the following file:
• UIRenderer.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
418
Class Documentation
6.56
GalaxyWars.Shaders.VBScreenHelper Class Reference
The VBScreenHelper class helps you to create and use vertex buffers for on screen rendering used in
PreScreen and PostScreen shaders. You don’t have to create a VB for every shader anymore, just call VBScreenHelper.Render() and everything will be created for you and reused if same parameters are requested
again! Supports also Grid screen rendering required for radial motion blur.
Collaboration diagram for GalaxyWars.Shaders.VBScreenHelper:
GalaxyWars.Shaders.VBScreenHelper.GridScreen
gridScreen10x10Instance
vbScreenInstance
GalaxyWars.Shaders.VBScreenHelper
GalaxyWars.Shaders.VBScreenHelper.VBScreen
Static Public Member Functions
• static void Render ()
Just render a vertex buffer with the screen coordinates. No subTexelSize stuff is performed, do that in the fx
file.
• static void Render10x10Grid ()
Just render a 10x10 grid with help of GridScreen on the screen. No subTexelSize stuff is performed, do that
in the fx file.
Static Private Attributes
• static VBScreen vbScreenInstance = null
Vb screen instance.
• static GridScreen gridScreen10x10Instance = null
Grid screen 1 0x 10 instance.
Classes
• class GridScreen
Another vertex and index buffer for a screen grid, basically used for the same purpose as VBScreen, but
allows us to create a grid (e.g. 10x10), very useful for advanced post screen shaders.
• class VBScreen
VBScreen holds all data for the vbScreens list to reuse existing VBScreens. Handles also the VB, creation
and rendering.
6.56.1
Detailed Description
The VBScreenHelper class helps you to create and use vertex buffers for on screen rendering used in
PreScreen and PostScreen shaders. You don’t have to create a VB for every shader anymore, just call VBGenerated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.56 GalaxyWars.Shaders.VBScreenHelper Class Reference
419
ScreenHelper.Render() and everything will be created for you and reused if same parameters are requested
again! Supports also Grid screen rendering required for radial motion blur.
Definition at line 20 of file VBScreenHelper.cs.
6.56.2
Member Function Documentation
6.56.2.1
static void GalaxyWars.Shaders.VBScreenHelper.Render () [static]
Just render a vertex buffer with the screen coordinates. No subTexelSize stuff is performed, do that in the
fx file.
Definition at line 223 of file VBScreenHelper.cs.
224
225
226
227
228
229
{
if (vbScreenInstance == null)
vbScreenInstance = new VBScreen();
vbScreenInstance.Render();
}
6.56.2.2
static void GalaxyWars.Shaders.VBScreenHelper.Render10x10Grid () [static]
Just render a 10x10 grid with help of GridScreen on the screen. No subTexelSize stuff is performed, do
that in the fx file.
Definition at line 241 of file VBScreenHelper.cs.
242
243
244
245
246
247
{
if (gridScreen10x10Instance == null)
gridScreen10x10Instance = new GridScreen(10, 10);
gridScreen10x10Instance.Render();
}
6.56.3
Member Data Documentation
6.56.3.1
VBScreen GalaxyWars.Shaders.VBScreenHelper.vbScreenInstance = null [static,
private]
Vb screen instance.
Definition at line 218 of file VBScreenHelper.cs.
6.56.3.2
GridScreen GalaxyWars.Shaders.VBScreenHelper.gridScreen10x10Instance = null
[static, private]
Grid screen 1 0x 10 instance.
Definition at line 236 of file VBScreenHelper.cs.
The documentation for this class was generated from the following file:
• VBScreenHelper.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
420
Class Documentation
6.57
GalaxyWars.Shaders.VBScreenHelper.GridScreen Class Reference
Another vertex and index buffer for a screen grid, basically used for the same purpose as VBScreen, but
allows us to create a grid (e.g. 10x10), very useful for advanced post screen shaders.
Public Member Functions
• GridScreen (int setGridWidth, int setGridHeight)
Create grid screen.
• void Render ()
Render.
Private Attributes
• int gridWidth
Grid dimension.
• int gridHeight
• IndexBuffer indexBuffer = null
Index buffer.
• VertexBuffer vertexBuffer = null
Vertex buffer.
• VertexDeclaration decl
Vertex declaration.
6.57.1
Detailed Description
Another vertex and index buffer for a screen grid, basically used for the same purpose as VBScreen, but
allows us to create a grid (e.g. 10x10), very useful for advanced post screen shaders.
Definition at line 98 of file VBScreenHelper.cs.
6.57.2
Constructor & Destructor Documentation
6.57.2.1
GalaxyWars.Shaders.VBScreenHelper.GridScreen.GridScreen (int setGridWidth, int
setGridHeight)
Create grid screen.
Parameters:
setGridDimension Set grid dimension
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.57 GalaxyWars.Shaders.VBScreenHelper.GridScreen Class Reference
421
Definition at line 125 of file VBScreenHelper.cs.
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
{
if (setGridWidth < 2 ||
setGridHeight < 2)
throw new ArgumentException(
"setGridWidth=" + setGridWidth + ", setGridHeight=" + setGridHeight,
"Grid size must be at least (2, 2).");
gridWidth = setGridWidth;
gridHeight = setGridHeight;
// Create vertex buffer
vertexBuffer = new VertexBuffer(
BaseGame.Device,
typeof(VertexPositionTexture),
gridWidth * gridHeight,
BufferUsage.WriteOnly);
// Create all vertices
VertexPositionTexture[] vertices =
new VertexPositionTexture[gridWidth * gridHeight];
// Just simply create all vertices of the grid
for (int x = 0; x < gridWidth; x++)
for (int y = 0; y < gridHeight; y++)
{
vertices[x + y * gridWidth] =
new VertexPositionTexture(new Vector3(
-1.0f + 2.0f * (float)x / (float)(gridWidth - 1),
-1.0f + 2.0f * (float)y / (float)(gridHeight - 1),
0.5f),
new Vector2((float)x / (float)(gridWidth - 1),
// XNA expect bottom up for the screen rendering.
1.0f - ((float)y / (float)(gridHeight - 1))));
}
vertexBuffer.SetData(vertices);
// Index buffer
indexBuffer = new IndexBuffer(
BaseGame.Device,
typeof(ushort),
(gridWidth - 1) * (gridHeight - 1) * 2 * 3,
BufferUsage.WriteOnly);
ushort[] indices = new ushort[
(gridWidth - 1) * (gridHeight - 1) * 3 * 2];
// Just simply create all indices of the grid
int num = 0;
for (int x = 0; x < gridWidth - 1; x++)
for (int y = 0; y < gridHeight - 1; y++)
{
ushort index1 = (ushort)(x + y * gridWidth);
ushort index2 = (ushort)((x + 1) + y * gridWidth);
ushort index3 = (ushort)((x + 1) + (y + 1) * gridWidth);
ushort index4 = (ushort)(x + (y + 1) * gridWidth);
indices[num] = index1;
indices[num + 1] = index3;
indices[num + 2] = index2;
indices[num + 3] = index1;
indices[num + 4] = index4;
indices[num + 5] = index3;
num += 6;
}
indexBuffer.SetData(indices);
decl = new VertexDeclaration(
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
422
Class Documentation
191
192
BaseGame.Device, VertexPositionTexture.VertexElements);
}
6.57.3
Member Function Documentation
6.57.3.1
void GalaxyWars.Shaders.VBScreenHelper.GridScreen.Render ()
Render.
Definition at line 199 of file VBScreenHelper.cs.
200
201
202
203
204
205
206
207
208
209
{
// Rendering is pretty straight forward (if you know how anyway).
BaseGame.Device.VertexDeclaration = decl;
BaseGame.Device.Vertices[0].SetSource(vertexBuffer, 0,
VertexPositionTexture.SizeInBytes);
BaseGame.Device.Indices = indexBuffer;
BaseGame.Device.DrawIndexedPrimitives(PrimitiveType.TriangleList,
0, 0, gridWidth * gridHeight,
0, (gridWidth - 1) * (gridHeight - 1) * 2);
}
6.57.4
Member Data Documentation
6.57.4.1
int GalaxyWars.Shaders.VBScreenHelper.GridScreen.gridWidth [private]
Grid dimension.
Definition at line 104 of file VBScreenHelper.cs.
6.57.4.2
int GalaxyWars.Shaders.VBScreenHelper.GridScreen.gridHeight [private]
Definition at line 104 of file VBScreenHelper.cs.
6.57.4.3
IndexBuffer GalaxyWars.Shaders.VBScreenHelper.GridScreen.indexBuffer = null
[private]
Index buffer.
Definition at line 108 of file VBScreenHelper.cs.
6.57.4.4
VertexBuffer GalaxyWars.Shaders.VBScreenHelper.GridScreen.vertexBuffer = null
[private]
Vertex buffer.
Definition at line 112 of file VBScreenHelper.cs.
6.57.4.5
VertexDeclaration GalaxyWars.Shaders.VBScreenHelper.GridScreen.decl [private]
Vertex declaration.
Definition at line 117 of file VBScreenHelper.cs.
The documentation for this class was generated from the following file:
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.57 GalaxyWars.Shaders.VBScreenHelper.GridScreen Class Reference
• VBScreenHelper.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
423
424
Class Documentation
6.58
GalaxyWars.Shaders.VBScreenHelper.VBScreen Class Reference
VBScreen holds all data for the vbScreens list to reuse existing VBScreens. Handles also the VB, creation
and rendering.
Public Member Functions
• VBScreen ()
Create VB screen.
• void Render ()
Render.
Private Attributes
• VertexBuffer vbScreen
Vertex buffer to render stuff on screen.
• VertexDeclaration decl
6.58.1
Detailed Description
VBScreen holds all data for the vbScreens list to reuse existing VBScreens. Handles also the VB, creation
and rendering.
Definition at line 27 of file VBScreenHelper.cs.
6.58.2
Constructor & Destructor Documentation
6.58.2.1
GalaxyWars.Shaders.VBScreenHelper.VBScreen.VBScreen ()
Create VB screen.
Definition at line 41 of file VBScreenHelper.cs.
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
VertexPositionTexture[] vertices = new VertexPositionTexture[]
{
new VertexPositionTexture(
new Vector3(-1.0f, -1.0f, 0.5f),
new Vector2(0, 1)),
new VertexPositionTexture(
new Vector3(-1.0f, 1.0f, 0.5f),
new Vector2(0, 0)),
new VertexPositionTexture(
new Vector3(1.0f, -1.0f, 0.5f),
new Vector2(1, 1)),
new VertexPositionTexture(
new Vector3(1.0f, 1.0f, 0.5f),
new Vector2(1, 0)),
};
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.58 GalaxyWars.Shaders.VBScreenHelper.VBScreen Class Reference
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
425
vbScreen = new VertexBuffer(
BaseGame.Device,
typeof(VertexPositionTexture),
vertices.Length,
BufferUsage.WriteOnly);
vbScreen.SetData(vertices);
decl = new VertexDeclaration(
BaseGame.Device, VertexPositionTexture.VertexElements);
/*do we still have to do this?
// Recreate vb if device was lost and is reseted again
BaseGame.Device.DeviceReset +=
new System.EventHandler(OnCreateVBScreen);
*/
}
6.58.3
Member Function Documentation
6.58.3.1
void GalaxyWars.Shaders.VBScreenHelper.VBScreen.Render ()
Render.
Definition at line 80 of file VBScreenHelper.cs.
81
82
83
84
85
86
87
{
// Rendering is pretty straight forward (if you know how anyway).
BaseGame.Device.VertexDeclaration = decl;
BaseGame.Device.Vertices[0].SetSource(vbScreen, 0,
VertexPositionTexture.SizeInBytes);
BaseGame.Device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
}
6.58.4
Member Data Documentation
6.58.4.1
VertexBuffer GalaxyWars.Shaders.VBScreenHelper.VBScreen.vbScreen [private]
Vertex buffer to render stuff on screen.
Definition at line 33 of file VBScreenHelper.cs.
6.58.4.2
VertexDeclaration GalaxyWars.Shaders.VBScreenHelper.VBScreen.decl [private]
Definition at line 34 of file VBScreenHelper.cs.
The documentation for this class was generated from the following file:
• VBScreenHelper.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
426
Class Documentation
6.59
GalaxyWars.Helpers.Vector3Helper Class Reference
Vector 3 helper.
Static Public Member Functions
• static float GetAngleBetweenVectors (Vector3 vec1, Vector3 vec2)
Return angle between two vectors. Used for visbility testing and for checking angles between vectors for
the road sign generation.
• static float DistanceToLine (Vector3 point, Vector3 linePos1, Vector3 linePos2)
Distance from our point to the line described by linePos1 and linePos2.
• static float SignedDistanceToPlane (Vector3 point, Vector3 planePosition, Vector3 planeNormal)
Signed distance to plane.
Private Member Functions
• Vector3Helper ()
Private constructor to prevent instantiation.
6.59.1
Detailed Description
Vector 3 helper.
Definition at line 14 of file Vector3Helper.cs.
6.59.2
Constructor & Destructor Documentation
6.59.2.1
GalaxyWars.Helpers.Vector3Helper.Vector3Helper () [private]
Private constructor to prevent instantiation.
Definition at line 20 of file Vector3Helper.cs.
21
22
{
}
6.59.3
Member Function Documentation
6.59.3.1
static float GalaxyWars.Helpers.Vector3Helper.GetAngleBetweenVectors (Vector3 vec1,
Vector3 vec2) [static]
Return angle between two vectors. Used for visbility testing and for checking angles between vectors for
the road sign generation.
Parameters:
vec1 Vector 1
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
6.59 GalaxyWars.Helpers.Vector3Helper Class Reference
427
vec2 Vector 2
Returns:
Float
Definition at line 33 of file Vector3Helper.cs.
34
35
36
37
38
39
40
{
// See http://en.wikipedia.org/wiki/Vector_(spatial)
// for help and check out the Dot Product section ^^
// Both vectors are normalized so we can save deviding through the
// lengths.
return (float)Math.Acos(Vector3.Dot(vec1, vec2));
}
6.59.3.2
static float GalaxyWars.Helpers.Vector3Helper.DistanceToLine (Vector3 point, Vector3
linePos1, Vector3 linePos2) [static]
Distance from our point to the line described by linePos1 and linePos2.
Parameters:
point Point
linePos1 Line position 1
linePos2 Line position 2
Returns:
Float
Definition at line 51 of file Vector3Helper.cs.
53
54
55
56
57
58
59
{
// For help check out this article:
// http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html
Vector3 lineVec = linePos2 - linePos1;
Vector3 pointVec = linePos1 - point;
return Vector3.Cross(lineVec, pointVec).Length() / lineVec.Length();
}
6.59.3.3
static float GalaxyWars.Helpers.Vector3Helper.SignedDistanceToPlane (Vector3 point,
Vector3 planePosition, Vector3 planeNormal) [static]
Signed distance to plane.
Parameters:
point Point
planePosition Plane position
planeNormal Plane normal
Returns:
Float
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
428
Class Documentation
Definition at line 70 of file Vector3Helper.cs.
72
73
74
75
{
Vector3 pointVec = planePosition - point;
return Vector3.Dot(planeNormal, pointVec);
}
The documentation for this class was generated from the following file:
• Vector3Helper.cs
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Chapter 7
File Documentation
7.1
AssemblyInfo.cs File Reference
430
File Documentation
7.2
Asteroid.cs File Reference
Namespaces
• namespace GalaxyWars.Scenes
Classes
• class GalaxyWars.Scenes.Asteroid
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.3 Asteroids.cs File Reference
7.3
Asteroids.cs File Reference
Namespaces
• namespace GalaxyWars.Scenes
Classes
• class GalaxyWars.Scenes.Asteroids
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
431
432
File Documentation
7.4
BaseGame.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.BaseGame
Base game class for all the basic game support. Connects all our helper classes together and makes our
life easier! Note: This game was designed for 16:9 (e.g. 1920x1200), but it also works just fine for
4:3 (1024x768, 800x600, etc.). This is the reason you might see 1024x640 instead of 1024x768 in some
width/height calculations and the UI textures. The game looks best at 1920x1080 (HDTV 1080p resolution).
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.5 BasePlayer.cs File Reference
7.5
433
BasePlayer.cs File Reference
Namespaces
• namespace GalaxyWars.GameLogic
Classes
• class GalaxyWars.GameLogic.BasePlayer
Base player helper class, holds all the current game values: Game time, game over, level number, victory.
More stuff that has impact to the ShipController or ChaseCamera classes should be included here, else add
them directly to the Player class, which handles all the game logic. For example adding items or powerups
should be done in this class if they affect the speed or physics of our ship.
7.5.1
Detailed Description
Author:
Petr Broz ([email protected])
Date:
31/12/2007
Version:
1.1
Implementation of BasePlayer class that maintains all the values related to the player (game time, successes,
losses etc.).
Definition in file BasePlayer.cs.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
434
File Documentation
7.6
ChaseCamera.cs File Reference
Namespaces
• namespace GalaxyWars.GameLogic
Classes
• class GalaxyWars.GameLogic.ChaseCamera
Chase camera for our car. We are always close behind it. The camera rotation is not the same as the
current car rotation, we interpolate the values a bit, allowing the user to do small changes without rotating
the camera frantically. Also feels more realistic in curves. Derived from the CarController class, which
controls the car by the user input. This camera class is not controlled by the user, its all automatic!
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.7 ColorHelper.cs File Reference
7.7
435
ColorHelper.cs File Reference
Namespaces
• namespace GalaxyWars.Helpers
Classes
• class GalaxyWars.Helpers.ColorHelper
Color helper, just to convert colors to different formats and providing more helper methods missing in the
Color class.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
436
File Documentation
7.8
Directories.cs File Reference
Namespaces
• namespace GalaxyWars.Helpers
Classes
• class GalaxyWars.Helpers.Directories
Helper class which stores all used directories.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.9 FileHelper.cs File Reference
7.9
437
FileHelper.cs File Reference
Namespaces
• namespace GalaxyWars.Helpers
Classes
• class GalaxyWars.Helpers.FileHelper
File helper class to get text lines, number of text lines, etc. Update: Now also supports the XNA Storage
classes :).
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
438
File Documentation
7.10
FireParticleSystem.cs File Reference
Namespaces
• namespace GalaxyWars.Particles
Classes
• class GalaxyWars.Particles.FireParticleSystem
Custom particle system for creating a flame effect.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.11 GalaxyWarsManager.cs File Reference
7.11
GalaxyWarsManager.cs File Reference
Namespaces
• namespace GalaxyWars
Classes
• class GalaxyWars.GalaxyWarsManager
Manager class of the game. Handles all game screens, which themself handle all the game logic.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
439
440
File Documentation
7.12
GameScreen.cs File Reference
Namespaces
• namespace GalaxyWars.GameScreens
Classes
• class GalaxyWars.GameScreens.GameScreen
GameScreen, just manages the on screen display for the game.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.13 GameSettings.cs File Reference
7.13
441
GameSettings.cs File Reference
Namespaces
• namespace GalaxyWars.Properties
Classes
• class GalaxyWars.Properties.GameSettings
Game settings, stored in a custom XML file. The reason for this is we want to be able to store our game data
on the Xbox360 too. On the PC we could just use a Settings/config file and have all the code autogenerated
for us, but this way it works both on PC and Xbox. Note: The default instance for the game settings is in
this class, this way we get the same behaviour as for normal Settings files!
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
442
File Documentation
7.14
Help.cs File Reference
Namespaces
• namespace GalaxyWars.GameScreens
Classes
• class GalaxyWars.GameScreens.Help
Help.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.15 IGameScreen.cs File Reference
7.15
443
IGameScreen.cs File Reference
Namespaces
• namespace GalaxyWars.GameScreens
Classes
• interface GalaxyWars.GameScreens.IGameScreen
Game screen helper interface for all game screens of our game. Helps us to put them all into one list and
manage them in our RaceGame.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
444
File Documentation
7.16
Input.cs File Reference
Namespaces
• namespace GalaxyWars.GameLogic
Classes
• class GalaxyWars.GameLogic.Input
Input helper class, captures all the mouse, keyboard and XBox 360 controller input and provides some nice
helper methods and properties. Will also keep track of the last frame states for comparison if a button was
just pressed this frame, but not already in the last frame.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.17 LensFlare.cs File Reference
7.17
LensFlare.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.LensFlare
Lens flare class for simple 2d lens flare rendering.
• struct GalaxyWars.Graphics.LensFlare.FlareData
Flare data struct for the quick and easy flare type list below.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
445
446
File Documentation
7.18
LineManager2D.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.LineManager2D
LineManager class, used for drawing lines. We can’t simply draw lines like in OpenGL (glLine) because
we need to do everything with vertex buffers, which is a bit more work (and using DrawPrimitives directly
produces way worse code).
• struct GalaxyWars.Graphics.LineManager2D.Line
Struct for a line, instances of this struct will be added to lines.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.19 LineManager3D.cs File Reference
7.19
447
LineManager3D.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.LineManager3D
Helper class for game for rendering lines. This class will collect all line calls, then build a new vertex buffer
if any line has changed or the line number changed and finally will render all lines in the vertex buffer at
the end of the frame (so this class is obviously only for 2D lines directly on screen, no z buffer and no stuff
will be in front of the lines, because everything is rendered at the end of the frame).
• struct GalaxyWars.Graphics.LineManager3D.Line
Struct for a line, instances of this class will be added to lines.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
448
File Documentation
7.20
Log.cs File Reference
Namespaces
• namespace GalaxyWars.Helpers
Classes
• class GalaxyWars.Helpers.Log
Log will create automatically a log file and write log/error/debug info for simple runtime error checking,
very useful for minor errors, such as finding not files. The application can still continue working, but this
log provides an easy support to find out what files are missing (in this example).
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.21 MainMenu.cs File Reference
7.21
MainMenu.cs File Reference
Namespaces
• namespace GalaxyWars.GameScreens
Classes
• class GalaxyWars.GameScreens.MainMenu
Main menu.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
449
450
File Documentation
7.22
Material.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.Material
Material class for DirectX materials used for Models. Consists of normal DirectX material settings (ambient, diffuse, specular), the diffuse texture and optionally of normal map, height map and shader parameters.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.23 MeshRenderManager.cs File Reference
7.23
451
MeshRenderManager.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.MeshRenderManager
Mesh render manager, a little helper class which allows us to render all our models with much faster
performance through sorting by material and shader techniques.
• class GalaxyWars.Graphics.MeshRenderManager.RenderableMesh
Renderable mesh, created in the Model constructor and is rendered when we render all the models at once
at the end of each frame!
• class GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterial
Meshes per material.
• class GalaxyWars.Graphics.MeshRenderManager.MeshesPerMaterialPerTechniques
Meshes per material per techniques.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
452
File Documentation
7.24
Model.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.Model
Model class for loading and displaying x files including all materials and textures. Provides load and
render functions to render static non animated models (mostly 1 mesh), for animated models we need a
more advanced class, which is not required for this game yet.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.25 Music.cs File Reference
7.25
Music.cs File Reference
Namespaces
• namespace GalaxyWars.Sounds
Classes
• class GalaxyWars.Sounds.Music
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
453
454
File Documentation
7.26
Options.cs File Reference
Namespaces
• namespace GalaxyWars.GameScreens
Classes
• class GalaxyWars.GameScreens.Options
Options.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.27 ParticleEmitter.cs File Reference
7.27
455
ParticleEmitter.cs File Reference
Namespaces
• namespace GalaxyWars.Particles
Classes
• class GalaxyWars.Particles.ParticleEmitter
Helper for objects that want to leave particles behind them as they move around the world. This emitter
implementation solves two related problems:.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
456
File Documentation
7.28
ParticleSettings.cs File Reference
Namespaces
• namespace GalaxyWars.Particles
Classes
• class GalaxyWars.Particles.ParticleSettings
Settings class describes all the tweakable options used to control the appearance of a particle system.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.29 ParticleSystem.cs File Reference
7.29
ParticleSystem.cs File Reference
Namespaces
• namespace GalaxyWars.Particles
Classes
• class GalaxyWars.Particles.ParticleSystem
The main component in charge of displaying particles.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
457
458
File Documentation
7.30
ParticleVertex.cs File Reference
Namespaces
• namespace GalaxyWars.Particles
Classes
• struct GalaxyWars.Particles.ParticleVertex
Custom vertex structure for drawing point sprite particles.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.31 Player.cs File Reference
7.31
459
Player.cs File Reference
Namespaces
• namespace GalaxyWars.GameLogic
Classes
• class GalaxyWars.GameLogic.Player
Player helper class, holds all the current game properties: Fuel, Health, Speed, Lifes and Score. Note: This
class is just used in GalaxyWars and we only have 1 instance of it for the current player for the current
game. If we want to have more than 1 player (e.g. in multiplayer mode) you should add a multiplayer class
and have all player instances there.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
460
File Documentation
7.32
PostScreenGlow.cs File Reference
Namespaces
• namespace GalaxyWars.Shaders
Classes
• class GalaxyWars.Shaders.PostScreenGlow
Post screen glow shader based on PostScreenGlow.fx. Derive from PostScreenMenu, this way we can save
duplicating the effect parameters and use the same RenderToTextures.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.33 PostScreenMenu.cs File Reference
7.33
PostScreenMenu.cs File Reference
Namespaces
• namespace GalaxyWars.Shaders
Classes
• class GalaxyWars.Shaders.PostScreenMenu
Post screen glow shader based on PostScreenMenu.fx.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
461
462
File Documentation
7.34
PreScreenSkyCubeMapping.cs File Reference
Namespaces
• namespace GalaxyWars.Shaders
Classes
• class GalaxyWars.Shaders.PreScreenSkyCubeMapping
Pre screen sky cube mapping.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.35 PrimitivesRenderer.cs File Reference
7.35
PrimitivesRenderer.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.PrimitivesRenderer
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
463
464
File Documentation
7.36
Program.cs File Reference
Namespaces
• namespace GalaxyWars
Classes
• class GalaxyWars.Program
Main class of the Galaxy Wars game.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.37 RandomHelper.cs File Reference
7.37
RandomHelper.cs File Reference
Namespaces
• namespace GalaxyWars.Helpers
Classes
• class GalaxyWars.Helpers.RandomHelper
Random helper.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
465
466
File Documentation
7.38
RenderToTexture.cs File Reference
Namespaces
• namespace GalaxyWars.Shaders
Classes
• class GalaxyWars.Shaders.RenderToTexture
Render to texture helper class based on the Texture class. This class allows to render stuff onto textures, if
thats not supported, it will just not work and report an engine log message. This class is required for most
PostScreenShaders.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.39 ScreenshotCapturer.cs File Reference
7.39
ScreenshotCapturer.cs File Reference
Namespaces
• namespace GalaxyWars.GameLogic
Classes
• class GalaxyWars.GameLogic.ScreenshotCapturer
This is a game component that implements IUpdateable.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
467
468
File Documentation
7.40
ShaderEffect.cs File Reference
Namespaces
• namespace GalaxyWars.Shaders
Classes
• class GalaxyWars.Shaders.ShaderEffect
Shader effect class. You can either directly use this class by providing a fx filename in the constructor or
derive from this class for special shader functionality (see post screen shaders for a more complex example).
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.41 Sound.cs File Reference
7.41
Sound.cs File Reference
Namespaces
• namespace GalaxyWars.Sounds
Classes
• class GalaxyWars.Sounds.Sound
Sound.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
469
470
File Documentation
7.42
SpaceshipPhysics.cs File Reference
Namespaces
• namespace GalaxyWars.GameLogic
Classes
• class GalaxyWars.GameLogic.SpaceshipPhysics
Spaceship controller class for controlling the ship we control. This class is derived from the BasePlayer
class, which stores all important game values for us (game time, game over, etc.). The ChaseCamera is then
derived from this class and finally we got the Player class itself at the top, which is deriven from all these
classes. This way we can easily access everything from the Player class.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.43 SplashScreen.cs File Reference
7.43
SplashScreen.cs File Reference
Namespaces
• namespace GalaxyWars.GameScreens
Classes
• class GalaxyWars.GameScreens.SplashScreen
Splash screen.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
471
472
File Documentation
7.44
TangentVertex.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• struct GalaxyWars.Graphics.TangentVertex
Tangent vertex format for shader vertex format used all over the place. It contains: Position, Normal vector,
texture coords, tangent vector.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.45 Texture.cs File Reference
7.45
473
Texture.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.Texture
Texture class helping you with using DirectX Textures and handling possible errors that can happen while
loading (stupid DirectX error messages telling you absolutly nothing, so a lot of pre-checks help you determinate the error before even calling DirectX methods).
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
474
File Documentation
7.46
TextureFont.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.TextureFont
Texture font for our game, uses GameFont.png. If you want to know more details about creating bitmap
fonts in XNA, how to generate the bitmaps and more details about using it, please check out the following links:
http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx
http://blogs.msdn.com/garykac/articles/732007.aspx
http://www.angelcode.com/products/bmfont/.
• class GalaxyWars.Graphics.TextureFont.FontToRender
TextureFont to render.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.47 TextureFontBigNumbers.cs File Reference
7.47
TextureFontBigNumbers.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.TextureFontBigNumbers
TextureFontBigNumbers.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
475
476
File Documentation
7.48
UIRenderer.cs File Reference
Namespaces
• namespace GalaxyWars.Graphics
Classes
• class GalaxyWars.Graphics.UIRenderer
Helper class to render all UI 2D stuff. Rendering textures is very easy with XNA using the Sprite class, but
we still have to create SpriteBatches. This class helps and handles everything for us.
• class GalaxyWars.Graphics.UIRenderer.TimeFadeupText
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
7.49 VBScreenHelper.cs File Reference
7.49
477
VBScreenHelper.cs File Reference
Namespaces
• namespace GalaxyWars.Shaders
Classes
• class GalaxyWars.Shaders.VBScreenHelper
The VBScreenHelper class helps you to create and use vertex buffers for on screen rendering used in PreScreen and PostScreen shaders. You don’t have to create a VB for every shader anymore, just call VBScreenHelper.Render() and everything will be created for you and reused if same parameters are requested
again! Supports also Grid screen rendering required for radial motion blur.
• class GalaxyWars.Shaders.VBScreenHelper.VBScreen
VBScreen holds all data for the vbScreens list to reuse existing VBScreens. Handles also the VB, creation
and rendering.
• class GalaxyWars.Shaders.VBScreenHelper.GridScreen
Another vertex and index buffer for a screen grid, basically used for the same purpose as VBScreen, but
allows us to create a grid (e.g. 10x10), very useful for advanced post screen shaders.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
478
File Documentation
7.50
Vector3Helper.cs File Reference
Namespaces
• namespace GalaxyWars.Helpers
Classes
• class GalaxyWars.Helpers.Vector3Helper
Vector 3 helper.
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
Index
Acceleration
AlphaSprite
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Graphics::Texture, 133
364
alreadyCheckedGraphicsOptions
ActiveAsteroids
GalaxyWars::Graphics::BaseGame, 64
GalaxyWars::Scenes::Asteroids, 30
alreadyResolved
ActiveButtonWidth
GalaxyWars::Shaders::RenderToTexture, 313
GalaxyWars::GameScreens::MainMenu, 219
AmbientColor
Add
GalaxyWars::Shaders::ShaderEffect, 338
GalaxyWars::Graphics::MeshRenderManager, ambientColor
223
GalaxyWars::Graphics::Material, 112
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterial,
GalaxyWars::Shaders::ShaderEffect, 333
228
animatedMesh
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterialPerTechniques,
GalaxyWars::Graphics::Model, 121
232
ApplyAlphaToColor
AddGameScreen
GalaxyWars::Helpers::ColorHelper, 92
GalaxyWars::GalaxyWarsManager, 139
ApplyResolutionChange
AdditiveSprite
GalaxyWars::Graphics::BaseGame, 42
GalaxyWars::Graphics::Texture, 133
areaOrigin
AddLine
GalaxyWars::Scenes::Asteroids, 30
GalaxyWars::Graphics::LineManager2D, 195 areaSize
GalaxyWars::Graphics::LineManager3D, 204,
GalaxyWars::Scenes::Asteroids, 30
205
AspectRatio
AddLineWithShadow
GalaxyWars::Graphics::BaseGame, 68
GalaxyWars::Graphics::LineManager2D, 196 aspectRatio
AddNewParticlesToVertexBuffer
GalaxyWars::Graphics::BaseGame, 62
GalaxyWars::Particles::ParticleSystem, 268
AssemblyInfo.cs, 429
AddParticle
Asteroid
GalaxyWars::Particles::ParticleSystem, 270
GalaxyWars::Scenes::Asteroid, 24
AddRemRenderToTexture
Asteroid.cs, 430
GalaxyWars::Graphics::BaseGame, 59
asteroidModels
AddTimeFadeupEffect
GalaxyWars::Scenes::Asteroids, 30
GalaxyWars::Graphics::UIRenderer, 399
Asteroids
AirFrictionPerSpeed
GalaxyWars::GalaxyWarsManager, 143
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Scenes::Asteroids, 28
360
asteroids
AllowShadowMapping
GalaxyWars::GalaxyWarsManager, 142
GalaxyWars::Graphics::BaseGame, 67
GalaxyWars::Scenes::Asteroids, 30
allowShadowMapping
Asteroids.cs, 431
GalaxyWars::Graphics::BaseGame, 64
AsteroidsAmount
AlphaFactor
GalaxyWars::Scenes::Asteroids, 30
GalaxyWars::Shaders::ShaderEffect, 338
audioEngine
alphaFactor
GalaxyWars::Sounds::Sound, 346
GalaxyWars::Shaders::ShaderEffect, 333
BackBufferDepthFormat
AlphaMode
GalaxyWars::Graphics::BaseGame, 40
GalaxyWars::Graphics::BaseGame, 66
480
INDEX
backBufferDepthFormat
BrakeCurveMajor
GalaxyWars::Graphics::BaseGame, 63
GalaxyWars::Sounds::Sound, 341
backButtonPressed
BrakeCurveMinor
GalaxyWars::Graphics::UIRenderer, 413
GalaxyWars::Sounds::Sound, 341
background
BrakeMajor
GalaxyWars::Graphics::UIRenderer, 411
GalaxyWars::Sounds::Sound, 342
BackgroundColor
BrakeMinor
GalaxyWars::Graphics::BaseGame, 60
GalaxyWars::Sounds::Sound, 342
BackgroundGfxRect
BrakeSlowdown
GalaxyWars::Graphics::UIRenderer, 406
GalaxyWars::GameLogic::SpaceshipPhysics,
BaseGame
361
GalaxyWars::Graphics::BaseGame, 41
brakeSoundStillPlayingMs
BaseGame.cs, 432
GalaxyWars::Sounds::Sound, 347
BasePlayer.cs, 433
Bronze
baseVertex
GalaxyWars::Graphics::UIRenderer, 396
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
buildVertexBuffer
239
GalaxyWars::Graphics::LineManager2D, 197
Beep
GalaxyWars::Graphics::LineManager3D, 206
GalaxyWars::Sounds::Sound, 341
ButtonClick
Best5GfxRect
GalaxyWars::Sounds::Sound, 341
GalaxyWars::Graphics::UIRenderer, 411
ButtonRects
BestTimePosGfxRect
GalaxyWars::GameScreens::MainMenu, 219
GalaxyWars::Graphics::UIRenderer, 410
Buttons
BigArrowGfxRect
GalaxyWars::Graphics::UIRenderer, 413
GalaxyWars::Graphics::UIRenderer, 408
buttons
BigNumberRects
GalaxyWars::Graphics::UIRenderer, 411
GalaxyWars::Graphics::TextureFontBigNumbers,
cachedEffectParameters
391
GalaxyWars::Graphics::Model, 121
BlackBarGfxRect
cachedIsReflectionSpecularTechnique
GalaxyWars::Graphics::UIRenderer, 407
GalaxyWars::Graphics::Model, 121
Bleep
CalcHalfPixelSize
GalaxyWars::Sounds::Sound, 341
GalaxyWars::Graphics::Texture, 128
blurMap1
CalcRectangle
GalaxyWars::Shaders::PostScreenMenu, 289
GalaxyWars::Graphics::BaseGame, 45
blurMap1Texture
CalcRectangle1600
GalaxyWars::Shaders::PostScreenMenu, 290
GalaxyWars::Graphics::BaseGame, 47
blurMap2
CalcRectangle2000
GalaxyWars::Shaders::PostScreenMenu, 289
GalaxyWars::Graphics::BaseGame, 48
blurMap2Texture
CalcRectangleCenteredWithGivenHeight
GalaxyWars::Shaders::PostScreenMenu, 290
GalaxyWars::Graphics::BaseGame, 49
BottomButtonAButtonGfxRect
CalcRectangleKeep4To3
GalaxyWars::Graphics::UIRenderer, 409
GalaxyWars::Graphics::BaseGame, 46, 47
BottomButtonBackButtonGfxRect
CalcRectangleKeep4To3AlignBottom
GalaxyWars::Graphics::UIRenderer, 409
GalaxyWars::Graphics::BaseGame, 48
BottomButtonBButtonGfxRect
CalcRectangleKeep4To3AlignBottomRight
GalaxyWars::Graphics::UIRenderer, 409
GalaxyWars::Graphics::BaseGame, 49
BottomButtonSelectionGfxRect
CalcRectangleWithBounce
GalaxyWars::Graphics::UIRenderer, 409
GalaxyWars::Graphics::BaseGame, 46
BottomButtonStartButtonGfxRect
CalcSize
GalaxyWars::Graphics::UIRenderer, 409
GalaxyWars::Shaders::RenderToTexture, 309
BottomLeftBorderGfxRect
cameraDistance
GalaxyWars::Graphics::UIRenderer, 406
GalaxyWars::GameLogic::ChaseCamera, 86
BottomRightBorderGfxRect
GalaxyWars::Graphics::UIRenderer, 406
cameraLookVector
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
GalaxyWars::GameLogic::ChaseCamera, 86
CameraMode
GalaxyWars::GameLogic::ChaseCamera, 80
cameraMode
GalaxyWars::GameLogic::ChaseCamera, 86
CameraPos
GalaxyWars::Graphics::BaseGame, 70
cameraPos
GalaxyWars::GameLogic::ChaseCamera, 86
CameraPosition
GalaxyWars::GameLogic::ChaseCamera, 88
CameraRotation
GalaxyWars::Graphics::BaseGame, 70
cameraRotation
GalaxyWars::Graphics::BaseGame, 64
cameraWobbelFactor
GalaxyWars::GameLogic::ChaseCamera, 87
cameraWobbelTimeoutMs
GalaxyWars::GameLogic::ChaseCamera, 87
camPosition
GalaxyWars::Graphics::BaseGame, 64
CanControlShip
GalaxyWars::GameLogic::BasePlayer, 76
CarCrashMinor
GalaxyWars::Sounds::Sound, 342
CarCrashTotal
GalaxyWars::Sounds::Sound, 342
CarHueColorChange
GalaxyWars::Shaders::ShaderEffect, 339
carHueColorChange
GalaxyWars::Shaders::ShaderEffect, 334
CarLose
GalaxyWars::Sounds::Sound, 342
carMenuTime
GalaxyWars::Graphics::UIRenderer, 413
carPos
GalaxyWars::Graphics::UIRenderer, 413
CharRects
GalaxyWars::Graphics::TextureFont, 381
ChaseCamera
GalaxyWars::GameLogic::ChaseCamera, 80,
81
ChaseCamera.cs, 434
CheckOptionsAndShaderVersion
GalaxyWars::Graphics::BaseGame, 42
CheckpointBetter
GalaxyWars::Sounds::Sound, 342
CheckpointWorse
GalaxyWars::Sounds::Sound, 342
CheckRenderTargetFormat
GalaxyWars::Shaders::RenderToTexture, 310
CircleType
GalaxyWars::Graphics::LensFlare, 189
Clear
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
481
GalaxyWars::Shaders::RenderToTexture, 311
ClearBackground
GalaxyWars::Graphics::BaseGame, 59
ClearVariablesForGameOver
GalaxyWars::GameLogic::BasePlayer, 74
GalaxyWars::GameLogic::ChaseCamera, 85
GalaxyWars::GameLogic::SpaceshipPhysics,
353
color
GalaxyWars::Graphics::LensFlare::FlareData,
192
GalaxyWars::Graphics::LineManager2D::Line,
201
GalaxyWars::Graphics::TextureFont::FontToRender,
385
GalaxyWars::Graphics::UIRenderer::TimeFadeupText,
416
ColorHelper.cs, 435
Content
GalaxyWars::Graphics::BaseGame, 67
content
GalaxyWars::Particles::ParticleSystem, 271
ContentDirectory
GalaxyWars::Helpers::Directories, 96
contentManager
GalaxyWars::Graphics::BaseGame, 61
ControllerSensitivity
GalaxyWars::Properties::GameSettings, 158
controllerSensitivity
GalaxyWars::Properties::GameSettings, 156
Convert3DPointTo2D
GalaxyWars::Graphics::BaseGame, 53
crashSoundStillPlayingMs
GalaxyWars::Sounds::Sound, 347
Create
GalaxyWars::Shaders::RenderToTexture, 310
CreateGameContentFile
GalaxyWars::Helpers::FileHelper, 98
cube
GalaxyWars::Shaders::PreScreenSkyCubeMapping,
294
cubeIndices
GalaxyWars::Graphics::PrimitivesRenderer,
298
cubeVertices
GalaxyWars::Graphics::PrimitivesRenderer,
298
CurrentAndBestGfxRect
GalaxyWars::Graphics::UIRenderer, 410
currentButtonSizes
GalaxyWars::GameScreens::MainMenu, 220
currentGameTimeMilliseconds
GalaxyWars::GameLogic::BasePlayer, 75
currentMusicPath
482
INDEX
GalaxyWars::Shaders::PreScreenSkyCubeMapping,
294
DefaultSpecularColor
GalaxyWars::Graphics::Material, 111
DefaultSpecularPower
GalaxyWars::Graphics::Material, 111
DefaultSunPos
GalaxyWars::Graphics::LensFlare, 188
DestinationBlend
GalaxyWars::Particles::ParticleSettings, 261
DetailTexture
GalaxyWars::Shaders::ShaderEffect, 339
detailTexture
GalaxyWars::Graphics::Material, 113
GalaxyWars::Shaders::ShaderEffect, 334
Device
GalaxyWars::Graphics::BaseGame, 66
DiffuseColor
GalaxyWars::Shaders::ShaderEffect, 338
diffuseColor
GalaxyWars::Graphics::Material, 112
GalaxyWars::Shaders::ShaderEffect, 333
DangerColor
DiffuseTexture
GalaxyWars::GameScreens::GameScreen, 146
GalaxyWars::Shaders::ShaderEffect, 338
decl
diffuseTexture
GalaxyWars::Graphics::LineManager2D, 198
GalaxyWars::Graphics::Material, 112
GalaxyWars::Graphics::LineManager3D, 207
GalaxyWars::Shaders::ShaderEffect, 334
GalaxyWars::Shaders::VBScreenHelper::GridScreen,
Directories
422
GalaxyWars::Helpers::Directories, 95
GalaxyWars::Shaders::VBScreenHelper::VBScreen,
Directories.cs, 436
425
DisableAlpha
Default
GalaxyWars::Graphics::BaseGame, 40
GalaxyWars::GameLogic::ChaseCamera, 80
Dispose
GalaxyWars::Graphics::BaseGame, 40
GalaxyWars::Graphics::LensFlare, 186
GalaxyWars::Properties::GameSettings, 156
GalaxyWars::Graphics::LineManager2D, 194
DefaultAmbientColor
GalaxyWars::Graphics::LineManager3D, 203,
GalaxyWars::Graphics::Material, 111
204
defaultCategory
GalaxyWars::Graphics::Material, 110, 111
GalaxyWars::Sounds::Sound, 346
GalaxyWars::Graphics::Model, 118
DefaultDiffuseColor
GalaxyWars::Graphics::Texture, 128
GalaxyWars::Graphics::Material, 111
GalaxyWars::Graphics::TextureFont, 377
defaultInstance
GalaxyWars::Graphics::UIRenderer, 398
GalaxyWars::Properties::GameSettings, 154
GalaxyWars::Shaders::ShaderEffect, 326
DefaultLightPos
DistanceBetweenButtons
GalaxyWars::Graphics::LensFlare, 188
GalaxyWars::GameScreens::MainMenu, 220
DefaultMaxAccelerationPerSec
DistanceToLine
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Helpers::Vector3Helper, 427
360
downsampleMap
DefaultMaxSpeed
GalaxyWars::Shaders::PostScreenMenu, 289
GalaxyWars::GameLogic::SpaceshipPhysics,
downsampleMapTexture
360
GalaxyWars::Shaders::PostScreenMenu, 289
DefaultParallaxAmount
Draw
GalaxyWars::Graphics::Material, 111
GalaxyWars::Graphics::BaseGame, 58
DefaultSkyColor
GalaxyWars::Particles::ParticleSystem, 267
GalaxyWars::Sounds::Music, 242
currentMusicVolume
GalaxyWars::GameScreens::Options, 254
currentOptionsNumber
GalaxyWars::GameScreens::Options, 253
CurrentPlatform
GalaxyWars::Graphics::BaseGame, 61
currentPlayerName
GalaxyWars::GameScreens::Options, 253
CurrentRenderTarget
GalaxyWars::Graphics::BaseGame, 71
currentResolution
GalaxyWars::GameScreens::Options, 254
currentSensitivity
GalaxyWars::GameScreens::Options, 254
currentSoundVolume
GalaxyWars::GameScreens::Options, 254
currentTime
GalaxyWars::Particles::ParticleSystem, 272
CurrentTimePosGfxRect
GalaxyWars::Graphics::UIRenderer, 410
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
drawCounter
GalaxyWars::Particles::ParticleSystem, 272
DrawLine
GalaxyWars::Graphics::BaseGame, 54, 55
Duration
GalaxyWars::Particles::ParticleSettings, 259
DurationRandomness
GalaxyWars::Particles::ParticleSettings, 259
Effect
GalaxyWars::Shaders::ShaderEffect, 336
effect
GalaxyWars::Shaders::ShaderEffect, 332
effectProjectionParameter
GalaxyWars::Particles::ParticleSystem, 271
effectTimeParameter
GalaxyWars::Particles::ParticleSystem, 271
effectViewParameter
GalaxyWars::Particles::ParticleSystem, 271
effectViewportHeightParameter
GalaxyWars::Particles::ParticleSystem, 271
ElapsedTimeThisFrameInMilliseconds
GalaxyWars::Graphics::BaseGame, 69
elapsedTimeThisFrameInMs
GalaxyWars::Graphics::BaseGame, 63
EmitterVelocitySensitivity
GalaxyWars::Particles::ParticleSettings, 259
Empty
GalaxyWars::Helpers::ColorHelper, 93
endColor
GalaxyWars::Graphics::LineManager3D::Line,
210
endPoint
GalaxyWars::Graphics::LineManager2D::Line,
201
GalaxyWars::Graphics::LineManager3D::Line,
210
EndVelocity
GalaxyWars::Particles::ParticleSettings, 259
Epsilon
GalaxyWars::Graphics::BaseGame, 65
Equals
GalaxyWars::Graphics::LineManager2D::Line,
200
GalaxyWars::Graphics::LineManager3D::Line,
209
error
GalaxyWars::Graphics::Texture, 134
ErrorCheck
GalaxyWars::Sounds::Music, 242
EveryMillisecond
GalaxyWars::Graphics::BaseGame, 42
fadeupTexts
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
483
GalaxyWars::Graphics::UIRenderer, 412
FarPlane
GalaxyWars::Graphics::BaseGame, 61
FieldOfView
GalaxyWars::Graphics::BaseGame, 60
FileHelper.cs, 437
Filename
GalaxyWars::Graphics::Texture, 134
GalaxyWars::Shaders::PostScreenGlow, 282
GalaxyWars::Shaders::PostScreenMenu, 289
GalaxyWars::Shaders::PreScreenSkyCubeMapping,
294
FireParticleSystem
GalaxyWars::Particles::FireParticleSystem,
105
FireParticleSystem.cs, 438
firstActiveParticle
GalaxyWars::Particles::ParticleSystem, 271
firstFrame
GalaxyWars::GameLogic::BasePlayer, 75
firstFreeParticle
GalaxyWars::Particles::ParticleSystem, 272
firstNewParticle
GalaxyWars::Particles::ParticleSystem, 272
firstRetiredParticle
GalaxyWars::Particles::ParticleSystem, 272
FlareData
GalaxyWars::Graphics::LensFlare::FlareData,
191
flareTextureNames
GalaxyWars::Graphics::LensFlare, 189
flareTextures
GalaxyWars::Graphics::LensFlare, 189
flareTypes
GalaxyWars::Graphics::LensFlare, 190
followPath
GalaxyWars::GameLogic::SpaceshipPhysics,
363
font
GalaxyWars::Graphics::UIRenderer, 411
FontHeight
GalaxyWars::Graphics::TextureFont, 381
fontSprite
GalaxyWars::Graphics::TextureFont, 382
fontTexture
GalaxyWars::Graphics::TextureFont, 382
FontToRender
GalaxyWars::Graphics::TextureFont::FontToRender,
383, 384
Fps
GalaxyWars::Graphics::BaseGame, 68
fpsInterpolated
GalaxyWars::Graphics::BaseGame, 64
fpsLastSecond
484
GalaxyWars::Graphics::BaseGame, 63
frameCountThisSecond
GalaxyWars::Graphics::BaseGame, 63
FreeCamera
GalaxyWars::GameLogic::ChaseCamera, 80,
89
freeCameraRot
GalaxyWars::GameLogic::ChaseCamera, 87
FreeRetiredParticles
GalaxyWars::Particles::ParticleSystem, 267
FullScreen
GalaxyWars::Shaders::RenderToTexture, 308
Fullscreen
GalaxyWars::Graphics::BaseGame, 66
GalaxyWars::Properties::GameSettings, 157
fullscreen
GalaxyWars::GameScreens::Options, 254
GalaxyWars::Properties::GameSettings, 155
FullscreenGfxRect
GalaxyWars::GameScreens::Options, 253
GalaxyWars, 11
GalaxyWars.GameLogic, 12
GalaxyWars.GameScreens, 13
GalaxyWars.Graphics, 14
GalaxyWars.Helpers, 16
GalaxyWars.Particles, 17
GalaxyWars.Properties, 18
GalaxyWars.Scenes, 19
GalaxyWars.Shaders, 20
GalaxyWars.Sounds, 21
GalaxyWars::GalaxyWarsManager, 136
AddGameScreen, 139
Asteroids, 143
asteroids, 142
GalaxyWarsManager, 138
GameActive, 143
gameScreens, 141
Initialize, 139
LensFlare, 143
lensFlare, 142
MenuActive, 142
ParticleSystem, 144
particleSystem, 142
Player, 143
player, 141
PostUIRender, 140
PrimitivesRenderer, 142
primitivesRenderer, 141
Render, 140
shipModel, 142
shipTextures, 142
ShowCursor, 143
SpaceshipModel, 143
INDEX
TrippSys, 143
trippSystem, 141
Update, 139
GalaxyWars::GameLogic::BasePlayer, 72
CanControlShip, 76
ClearVariablesForGameOver, 74
currentGameTimeMilliseconds, 75
firstFrame, 75
GameOver, 76
GameTimeMilliseconds, 75
isGameOver, 75
Reset, 73
StartGameZoomedInTime, 75
StartGameZoomTimeMilliseconds, 75
Update, 74
ZoomInTime, 75
zoomInTime, 75
GalaxyWars::GameLogic::ChaseCamera, 77
cameraDistance, 86
cameraLookVector, 86
CameraMode, 80
cameraMode, 86
cameraPos, 86
CameraPosition, 88
cameraWobbelFactor, 87
cameraWobbelTimeoutMs, 87
ChaseCamera, 80, 81
ClearVariablesForGameOver, 85
Default, 80
FreeCamera, 80, 89
freeCameraRot, 87
HandleFreeCamera, 82
InterpolateCameraPosition, 82
lastCameraWobble, 87
MaxCameraWobbelTimeoutMs, 87
Reset, 85
RotationMatrix, 88
rotMatrix, 86
SetCameraPosition, 81
Update, 86
UpdateViewMatrix, 84
wannaCameraDistance, 87
wannaCameraLookVector, 87
wannaHaveCameraRotation, 87
WobbelCamera, 81
XAxis, 88
YAxis, 88
ZAxis, 88
GalaxyWars::GameLogic::Input, 163
GamePad, 178
GamePadAJustPressed, 181
GamePadAPressed, 179
GamePadBackJustPressed, 182
GamePadBJustPressed, 182
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
GamePadBPressed, 179
GamePadDownJustPressed, 181
GamePadDownPressed, 181
GamePadLeftJustPressed, 180
GamePadLeftPressed, 180
GamePadRightJustPressed, 180
GamePadRightPressed, 180
GamePadStartPressed, 179
gamePadState, 173
gamePadStateLastFrame, 173
GamePadUpJustPressed, 181
GamePadUpPressed, 181
GamePadXJustPressed, 182
GamePadXPressed, 179
GamePadYJustPressed, 182
GamePadYPressed, 180
HandleKeyboardInput, 170
HasMouseMoved, 174
IsGamePadConnected, 179
IsSpecialKey, 168
Keyboard, 176
KeyboardDownJustPressed, 177
KeyboardDownPressed, 178
KeyboardEscapeJustPressed, 177
KeyboardF1JustPressed, 176
KeyboardKeyJustPressed, 171
KeyboardLeftJustPressed, 177
KeyboardLeftPressed, 178
KeyboardRightJustPressed, 177
KeyboardRightPressed, 178
KeyboardSpaceJustPressed, 176
keyboardState, 172
KeyboardUpJustPressed, 177
KeyboardUpPressed, 178
keysPressedLastFrame, 172
KeyToChar, 169
lastMouseXMovement, 173
lastMouseYMovement, 173
MouseDetected, 174
mouseDetected, 172
MouseDraggingAmount, 176
MouseInBox, 167
MouseInBoxRelative, 168
MouseLeftButtonJustPressed, 175
MouseLeftButtonPressed, 175
MouseMiddleButtonPressed, 175
MousePos, 174
MouseRightButtonJustPressed, 175
MouseRightButtonPressed, 175
mouseState, 172
mouseStateLastFrame, 172
MouseWheelDelta, 176
mouseWheelDelta, 173
mouseWheelValue, 173
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
485
MouseXMovement, 174
mouseXMovement, 173
MouseYMovement, 174
mouseYMovement, 173
ResetMouseDraggingAmount, 167
startDraggingPos, 173
Update, 171
GalaxyWars::GameLogic::Player, 275
Player, 276
Reset, 276
Update, 276
GalaxyWars::GameLogic::ScreenshotCapturer, 315
game, 318
GetCurrentScreenshotNum, 316
MakeScreenshot, 317
ScreenshotCapturer, 316
ScreenshotNameBuilder, 316
screenshotNum, 318
Update, 318
GalaxyWars::GameLogic::SpaceshipPhysics, 348
Acceleration, 364
AirFrictionPerSpeed, 360
BrakeSlowdown, 361
ClearVariablesForGameOver, 353
DefaultMaxAccelerationPerSec, 360
DefaultMaxSpeed, 360
followPath, 363
GetPosition, 358
lastAccelerationResult, 363
LookAtPos, 365
MaxAcceleration, 360
maxAccelerationPerSec, 362
MaxAirFriction, 361
MaxPossibleSpeed, 360
MaxRotationPerSec, 361
maxSpeed, 362
MaxViewDistance, 361
MinAcceleration, 360
MinSensitivity, 361
MinViewDistance, 361
Path, 365
PathTime, 365
Reset, 353
rotateShipAfterCollision, 363
rotationChange, 364
SetShipPosition, 352
ShipDirection, 365
shipDirection, 362
shipForce, 362
shipMass, 362
ShipPosition, 364
shipPosition, 362
ShipRenderMatrix, 365
shipRenderMatrix, 363
486
ShipRight, 365
shipSpeed, 363
shipUp, 362
SpaceshipHeight, 361
SpaceshipMass, 360
SpaceshipPhysics, 352
SpaceshipUpVector, 364
Speed, 364
t, 363
Update, 353
UpdateCarMatrixAndCamera, 359
verticalRotationAmount, 364
verticalRotationChange, 364
viewDistance, 363
virtualRotationAmount, 363
GalaxyWars::GameScreens::GameScreen, 145
DangerColor, 146
GameScreen, 145
maxDanger, 148
path, 148
Render, 146
GalaxyWars::GameScreens::Help, 160
Render, 160
GalaxyWars::GameScreens::IGameScreen, 162
Render, 162
GalaxyWars::GameScreens::MainMenu, 215
ActiveButtonWidth, 219
ButtonRects, 219
currentButtonSizes, 220
DistanceBetweenButtons, 220
idleTime, 220
ignoreMouse, 220
InactiveButtonWidth, 220
InterpolateRect, 216
NumberOfButtons, 219
pressedLeftMs, 220
pressedRightMs, 220
Render, 216
SelectedButton, 221
selectedButton, 220
TextRects, 219
TimeOutMenu, 220
GalaxyWars::GameScreens::Options, 244
currentMusicVolume, 254
currentOptionsNumber, 253
currentPlayerName, 253
currentResolution, 254
currentSensitivity, 254
currentSoundVolume, 254
fullscreen, 254
FullscreenGfxRect, 253
HighDetailGfxRect, 253
Line4ArrowGfxRect, 252
Line5ArrowGfxRect, 252
INDEX
Line6ArrowGfxRect, 252
MusicGfxRect, 253
Options, 245
PostScreenEffectsGfxRect, 253
Render, 246
Resolution1024x768GfxRect, 252
Resolution1280x1024GfxRect, 252
Resolution640x480GfxRect, 252
Resolution800x600GfxRect, 252
ResolutionAutoGfxRect, 252
SensitivityGfxRect, 253
ShadowsGfxRect, 253
SoundGfxRect, 253
useHighDetail, 254
usePostScreenShaders, 254
useShadowMapping, 254
GalaxyWars::GameScreens::SplashScreen, 367
Render, 367
SplashScreen, 367
GalaxyWars::Graphics::BaseGame, 32
AddRemRenderToTexture, 59
AllowShadowMapping, 67
allowShadowMapping, 64
AlphaMode, 40
alreadyCheckedGraphicsOptions, 64
ApplyResolutionChange, 42
AspectRatio, 68
aspectRatio, 62
BackBufferDepthFormat, 66
backBufferDepthFormat, 63
BackgroundColor, 60
BaseGame, 41
CalcRectangle, 45
CalcRectangle1600, 47
CalcRectangle2000, 48
CalcRectangleCenteredWithGivenHeight, 49
CalcRectangleKeep4To3, 46, 47
CalcRectangleKeep4To3AlignBottom, 48
CalcRectangleKeep4To3AlignBottomRight,
49
CalcRectangleWithBounce, 46
CameraPos, 70
CameraRotation, 70
cameraRotation, 64
camPosition, 64
CheckOptionsAndShaderVersion, 42
ClearBackground, 59
Content, 67
contentManager, 61
Convert3DPointTo2D, 53
CurrentPlatform, 61
CurrentRenderTarget, 71
Default, 40
Device, 66
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
DisableAlpha, 40
Draw, 58
DrawLine, 54, 55
ElapsedTimeThisFrameInMilliseconds, 69
elapsedTimeThisFrameInMs, 63
Epsilon, 65
EveryMillisecond, 42
FarPlane, 61
FieldOfView, 60
Fps, 68
fpsInterpolated, 64
fpsLastSecond, 63
frameCountThisSecond, 63
Fullscreen, 66
graphics_DeviceReset, 52
graphics_PrepareDevice, 51
graphicsManager, 61
Height, 68
HighDetail, 66
highDetail, 64
Initialize, 51
InverseViewMatrix, 70
invViewMatrix, 64
IsAppActive, 71
isAppActive, 65
lastFrameTotalTimeMs, 63
lastSetRenderTarget, 65
LightDirection, 66
lightDirection, 63
LineManager, 66
lineManager2D, 62
lineManager3D, 62
MeshRenderManager, 67
meshRenderManager, 62
MoveFactorPerSecond, 69
mustApplyDeviceChanges, 64
NearPlane, 61
OnActivated, 57
OnDeactivated, 57
OneOne, 40
PointInFront, 53
PointVisible, 53
PostUIRender, 59
ProjectionMatrix, 70
projectionMatrix, 62
remRenderToTextures, 65
remSceneRenderTarget, 65
remWindowsTitle, 62
Render, 59
RenderHandler, 59
RenderLines2D, 56
RenderLines3D, 56
renderLoopErrorCount, 65
ResetRenderTarget, 60
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
487
ResolutionRect, 68
screenHeight, 61
screenWidth, 61
SetAlphaBlendingEnabled, 50
SetCurrentAlphaMode, 50
SetRenderTarget, 60
SourceAlphaOne, 40
startTimeThisSecond, 63
totalFrameCount, 63
TotalFrames, 69
TotalTime, 69
TotalTimeMilliseconds, 69
totalTimeMs, 63
UI, 67
ui, 61
Update, 56
UsePostScreenShaders, 67
usePostScreenShaders, 64
ViewableFieldOfView, 61
ViewMatrix, 70
viewMatrix, 62
ViewProjectionMatrix, 71
Width, 68
WindowsTitle, 66
WorldMatrix, 70
worldMatrix, 62
WorldViewProjectionMatrix, 71
XToRes, 43
XToRes1400, 44
XToRes1600, 44
YToRes, 43
YToRes1050, 45
YToRes1200, 44
YToRes768, 43
GalaxyWars::Graphics::LensFlare, 183
CircleType, 189
DefaultLightPos, 188
DefaultSunPos, 188
Dispose, 186
flareTextureNames, 189
flareTextures, 189
flareTypes, 190
GlowFlareType, 189
HaloType, 189
LensFlare, 185
LensFlareType, 189
lensOrigin3D, 188
LoadTextures, 186
NumberOfFlareTypes, 189
Origin3D, 190
Render, 187
RingType, 189
RotateSun, 185
ScreenFlareSize, 188
488
StreaksType, 189
SunFlareType, 188
sunIntensity, 190
GalaxyWars::Graphics::LensFlare::FlareData, 191
color, 192
FlareData, 191
position, 192
scale, 192
type, 192
GalaxyWars::Graphics::LineManager2D, 193
AddLine, 195
AddLineWithShadow, 196
buildVertexBuffer, 197
decl, 198
Dispose, 194
LineManager2D, 194
lines, 197
lineVertices, 197
MaxNumOfLines, 198
numOfLines, 197
numOfPrimitives, 198
Render, 196
UpdateVertexBuffer, 195
GalaxyWars::Graphics::LineManager2D::Line, 199
color, 201
endPoint, 201
Equals, 200
GetHashCode, 201
Line, 200
operator!=, 200
operator==, 200
startPoint, 201
GalaxyWars::Graphics::LineManager3D, 202
AddLine, 204, 205
buildVertexBuffer, 206
decl, 207
Dispose, 203, 204
LineManager3D, 203
lines, 206
lineVertices, 206
MaxNumOfLines, 207
numOfLines, 206
numOfPrimitives, 207
Render, 205
UpdateVertexBuffer, 205
GalaxyWars::Graphics::LineManager3D::Line, 208
endColor, 210
endPoint, 210
Equals, 209
GetHashCode, 210
Line, 209
operator!=, 209
operator==, 209
startColor, 210
INDEX
startPoint, 210
GalaxyWars::Graphics::Material, 106
ambientColor, 112
DefaultAmbientColor, 111
DefaultDiffuseColor, 111
DefaultParallaxAmount, 111
DefaultSpecularColor, 111
DefaultSpecularPower, 111
detailTexture, 113
diffuseColor, 112
diffuseTexture, 112
Dispose, 110, 111
HasAlpha, 113
heightTexture, 112
Material, 108–110
normalTexture, 112
parallaxAmount, 113
specularColor, 112
specularPower, 112
GalaxyWars::Graphics::MeshRenderManager, 222
Add, 223
lastIndexBufferSet, 225
lastVertexBufferSet, 225
Render, 224
sortedMeshes, 225
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterial,
227
Add, 228
material, 229
meshes, 229
MeshesPerMaterial, 228
NumberOfRenderMatrices, 230
Render, 228
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterialPerTec
231
Add, 232
MeshesPerMaterialPerTechniques, 231
meshesPerMaterials, 233
NumberOfRenderMatrices, 234
Render, 232
technique, 233
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
235
baseVertex, 239
indexBuffer, 238
material, 238
numVertices, 239
primitiveCount, 239
Render, 237
RenderableMesh, 236
renderMatrices, 239
RenderMesh, 237
startIndex, 239
streamOffset, 239
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
usedTechnique, 238
vertexBuffer, 238
vertexDeclaration, 238
vertexStride, 239
worldParameter, 238
GalaxyWars::Graphics::Model, 114
animatedMesh, 121
cachedEffectParameters, 121
cachedIsReflectionSpecularTechnique, 121
Dispose, 118
GetIndexBuffer, 120
GetVertexBuffer, 119
hasAlpha, 121
isShip, 121
MaxViewDistance, 122
maxViewDistance, 122
Model, 116
Name, 122
name, 120
NumOfMeshParts, 122
ObjectMatrix, 122
objectMatrix, 120
Positions, 123
realScaling, 120
Render, 118, 119
renderableMeshes, 121
scaling, 121
Size, 122
transforms, 120
xnaModel, 120
GalaxyWars::Graphics::PrimitivesRenderer, 295
cubeIndices, 298
cubeVertices, 298
PrimitivesRenderer, 295
RenderCross, 296
RenderCube, 297
RenderSphere, 297, 298
RenderTriangle, 296, 297
sphereIndices, 299
SphereQuality, 298
sphereVertices, 298
triangleVertices, 298
vertexDecl, 298
GalaxyWars::Graphics::TangentVertex, 369
GenerateVertexElements, 371
IsTangentVertexDeclaration, 372
normal, 372
pos, 372
SizeInBytes, 373
tangent, 372
TangentVertex, 370, 371
ToString, 371
U, 373
uv, 372
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
489
V, 373
VertexDeclaration, 373
VertexElements, 373
GalaxyWars::Graphics::Texture, 124
AdditiveSprite, 133
AlphaSprite, 133
CalcHalfPixelSize, 128
Dispose, 128
error, 134
Filename, 134
GfxRectangle, 134
HalfPixelSize, 134
hasAlpha, 134
HasAlphaPixels, 135
Height, 134
internalXnaTexture, 133
loaded, 134
precaledHalfPixelSize, 133
RenderOnScreen, 129–132
RenderOnScreenRelative1600, 131
RenderOnScreenRelative16To9, 130
RenderOnScreenRelative4To3, 131
RenderOnScreenWithRotation, 132
texFilename, 133
texHeight, 133
Texture, 127
texWidth, 133
ToString, 133
Valid, 135
Width, 134
XnaTexture, 135
GalaxyWars::Graphics::TextureFont, 375
CharRects, 381
Dispose, 377
FontHeight, 381
fontSprite, 382
fontTexture, 382
GameFontFilename, 381
GetTextWidth, 377
Height, 382
remTexts, 382
SubRenderHeight, 381
TextureFont, 377
WriteAll, 380
WriteGameTime, 379
WriteText, 378
WriteTextCentered, 379
GalaxyWars::Graphics::TextureFont::FontToRender,
383
color, 385
FontToRender, 383, 384
scale, 385
text, 384
x, 384
490
y, 384
GalaxyWars::Graphics::TextureFontBigNumbers,
386
BigNumberRects, 391
WriteDigit, 387, 388
WriteNumber, 388, 389
WriteNumberCentered, 390
GalaxyWars::Graphics::UIRenderer, 392
AddTimeFadeupEffect, 399
backButtonPressed, 413
background, 411
BackgroundGfxRect, 406
Best5GfxRect, 411
BestTimePosGfxRect, 410
BigArrowGfxRect, 408
BlackBarGfxRect, 407
BottomButtonAButtonGfxRect, 409
BottomButtonBackButtonGfxRect, 409
BottomButtonBButtonGfxRect, 409
BottomButtonSelectionGfxRect, 409
BottomButtonStartButtonGfxRect, 409
BottomLeftBorderGfxRect, 406
BottomRightBorderGfxRect, 406
Bronze, 396
Buttons, 413
buttons, 411
carMenuTime, 413
carPos, 413
CurrentAndBestGfxRect, 410
CurrentTimePosGfxRect, 410
Dispose, 398
fadeupTexts, 412
font, 411
GalaxyWarsLogoGfxRect, 406
GetTrophyTexture, 398
Gold, 396
HeaderChooseCarGfxRect, 406
HeaderHelpGfxRect, 406
HeaderHighscoresGfxRect, 406
HeaderOptionsGfxRect, 406
Headers, 414
headers, 411
HeaderSelectTrackGfxRect, 406
HelpScreen, 414
helpScreen, 411
Ingame, 414
ingame, 412
LapsGfxRect, 410
lensFlare, 412
MenuButtonHelpGfxRect, 407
MenuButtonHighscoresGfxRect, 407
MenuButtonOptionsGfxRect, 407
MenuButtonPlayGfxRect, 407
MenuButtonQuitGfxRect, 407
INDEX
MenuButtonSelectionGfxRect, 407
MenuTextHelpGfxRect, 408
MenuTextHighscoresGfxRect, 408
MenuTextOptionsGfxRect, 408
MenuTextPlayGfxRect, 407
MenuTextQuitGfxRect, 408
Minus, 397
mouseCursor, 411
Normal, 397
oldCarForward, 412
oldCarUp, 413
OptionsRadioButtonGfxRect, 407
OptionsScreen, 414
optionsScreen, 411
Plus, 397
postScreenGameShader, 412
PostScreenGlowShader, 415
PostScreenMenuShader, 414
postScreenMenuShader, 412
PressStartGfxRect, 406
randomCarColor, 413
randomCarNumber, 413
Render, 404
RenderBlackBar, 401
RenderBottomButtons, 401
RenderGameBackground, 400
RenderGameUI, 402
RenderMenuBackground, 401
RenderMenuTrackBackground, 400
RenderTextsAndMouseCursor, 405
RenderTimeFadeupEffects, 399
SelectionArrowGfxRect, 409
SelectionRadioButtonGfxRect, 410
showFps, 413
Silver, 396
skyCube, 412
SkyCubeMapTexture, 415
TachoArrowGfxRect, 410
TachoGearGfxRect, 410
TachoGfxRect, 410
TachoMphGfxRect, 410
TimeFadeupMode, 397
TrackButtonAdvancedGfxRect, 408
TrackButtonBeginnerGfxRect, 408
TrackButtonExpertGfxRect, 408
TrackButtonSelectionGfxRect, 408
TrackNameGfxRect, 411
TrackTextAdvancedGfxRect, 409
TrackTextBeginnerGfxRect, 409
TrackTextExpertGfxRect, 409
trophies, 412
TrophyType, 396
UIRenderer, 397
UpdateCarInMenu, 400
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
GalaxyWars::Graphics::UIRenderer::TimeFadeupText,
SignedDistanceToPlane, 427
416
Vector3Helper, 426
color, 416
GalaxyWars::Particles::FireParticleSystem, 104
MaxShowTimeMs, 417
FireParticleSystem, 105
showTimeMs, 417
InitializeSettings, 105
text, 416
GalaxyWars::Particles::ParticleEmitter, 255
TimeFadeupText, 416
ParticleEmitter, 256
GalaxyWars::Helpers::ColorHelper, 90
particleSystem, 257
ApplyAlphaToColor, 92
previousPosition, 257
Empty, 93
timeBetweenParticles, 257
HalfAlpha, 93
timeLeftOver, 257
InterpolateColor, 92
Update, 256
MixAlphaToColor, 93
GalaxyWars::Particles::ParticleSettings, 258
MultiplyColors, 91
DestinationBlend, 261
SameColor, 92
Duration, 259
StayInRange, 91
DurationRandomness, 259
GalaxyWars::Helpers::Directories, 95
EmitterVelocitySensitivity, 259
ContentDirectory, 96
EndVelocity, 259
Directories, 95
Gravity, 259
GameBaseDirectory, 96
MaxColor, 260
ScreenshotsDirectory, 96
MaxEndSize, 260
SoundsDirectory, 96
MaxHorizontalVelocity, 259
GalaxyWars::Helpers::FileHelper, 97
MaxParticles, 258
CreateGameContentFile, 98
MaxRotateSpeed, 260
GetLines, 99
MaxStartSize, 260
LoadGameContentFile, 98
MaxVerticalVelocity, 259
OpenFileForCurrentPlayer, 99
MinColor, 260
ReadMatrix, 102
MinEndSize, 260
ReadVector3, 101
MinHorizontalVelocity, 259
ReadVector4, 102
MinRotateSpeed, 260
SaveGameContentFile, 99
MinStartSize, 260
WriteMatrix, 101
MinVerticalVelocity, 259
WriteVector3, 100
SourceBlend, 260
WriteVector4, 100
TextureName, 258
XnaUserDevice, 103
GalaxyWars::Particles::ParticleSystem, 262
xnaUserDevice, 103
AddNewParticlesToVertexBuffer, 268
GalaxyWars::Helpers::Log, 212
AddParticle, 270
Initialize, 212
content, 271
LogFilename, 214
currentTime, 272
Write, 213
Draw, 267
writer, 214
drawCounter, 272
GalaxyWars::Helpers::RandomHelper, 302
effectProjectionParameter, 271
GenerateNewRandomGenerator, 303
effectTimeParameter, 271
GetRandomByte, 303
effectViewParameter, 271
GetRandomFloat, 303
effectViewportHeightParameter, 271
GetRandomInt, 303
firstActiveParticle, 271
GetRandomVector2, 304
firstFreeParticle, 272
GetRandomVector3, 304
firstNewParticle, 272
globalRandomGenerator, 305
firstRetiredParticle, 272
RandomColor, 305
FreeRetiredParticles, 267
RandomNormalVector3, 305
Initialize, 264
GalaxyWars::Helpers::Vector3Helper, 426
InitializeSettings, 264
DistanceToLine, 427
LoadGraphicsContent, 264
GetAngleBetweenVectors, 426
LoadParticleEffect, 265
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
491
492
particleEffect, 271
particles, 271
ParticleSystem, 264
random, 272
RetireActiveParticles, 266
SetCamera, 269
SetParticleRenderStates, 269
settings, 271
Update, 266
vertexBuffer, 271
vertexDeclaration, 271
GalaxyWars::Particles::ParticleVertex, 273
Position, 273
Random, 273
SizeInBytes, 274
Time, 273
Velocity, 273
VertexElements, 273
GalaxyWars::Program, 300
Main, 300
StartGame, 300
GalaxyWars::Properties::GameSettings, 149
ControllerSensitivity, 158
controllerSensitivity, 156
Default, 156
defaultInstance, 154
Fullscreen, 157
fullscreen, 155
GameSettings, 152
HighDetail, 158
highDetail, 155
Highscores, 157
highscores, 154
Initialize, 152
Load, 152
MinimumResolutionHeight, 155
MinimumResolutionWidth, 155
MusicVolume, 158
musicVolume, 156
needSave, 154
PlayerName, 157
playerName, 155
PostScreenEffects, 158
postScreenEffects, 155
ResolutionHeight, 157
resolutionHeight, 155
ResolutionWidth, 157
resolutionWidth, 155
Save, 153
SetMinimumGraphics, 153
SettingsFilename, 154
ShadowMapping, 158
shadowMapping, 155
ShowBackground, 156
INDEX
showBackground, 154
ShowDiagram, 156
showDiagram, 154
ShowPath, 156
showPath, 154
ShowVertices, 156
showVertices, 154
SoundVolume, 158
soundVolume, 155
GalaxyWars::Scenes::Asteroid, 23
Asteroid, 24
GetPosition, 25
GetRotation, 25
GetScale, 25
mesh, 26
Model, 26
Position, 26
position, 26
Render, 24
Rotation, 26
rotation, 26
Scale, 26
scale, 26
Set, 24
transformation, 26
UpdateMatrix, 25
Vertices, 24
GalaxyWars::Scenes::Asteroids, 28
ActiveAsteroids, 30
areaOrigin, 30
areaSize, 30
asteroidModels, 30
Asteroids, 28
asteroids, 30
AsteroidsAmount, 30
MaximalSize, 30
MinimalSize, 30
Render, 29
Update, 29
Vertices, 29
GalaxyWars::Shaders::PostScreenGlow, 278
Filename, 282
GetParameters, 279
lastUsedRadialBlurScaleFactor, 282
PostScreenGlow, 279
RadialBlurScaleFactor, 283
radialBlurScaleFactor, 282
radialSceneMap, 282
radialSceneMapTexture, 282
screenBorderFadeoutMap, 282
screenBorderFadeoutMapTexture, 282
Show, 280
GalaxyWars::Shaders::PostScreenMenu, 284
blurMap1, 289
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
blurMap1Texture, 290
blurMap2, 289
blurMap2Texture, 290
downsampleMap, 289
downsampleMapTexture, 289
Filename, 289
GetParameters, 286
noiseMap, 289
noiseMapTexture, 290
PostScreenMenu, 286
sceneMap, 289
sceneMapTexture, 289
Show, 287
Start, 287
Started, 290
started, 290
timer, 289
windowSize, 289
GalaxyWars::Shaders::PreScreenSkyCubeMapping,
291
cube, 294
DefaultSkyColor, 294
Filename, 294
GetParameters, 292
PreScreenSkyCubeMapping, 292
RenderSky, 293
SkyCubeMapFilename, 294
SkyCubeMapTexture, 294
skyCubeMapTexture, 294
GalaxyWars::Shaders::RenderToTexture, 306
alreadyResolved, 313
CalcSize, 309
CheckRenderTargetFormat, 310
Clear, 311
Create, 310
FullScreen, 308
HalfScreen, 308
HandleDeviceReset, 309
QuarterScreen, 308
RenderTarget, 313
renderTarget, 312
RenderToTexture, 308
RenderToTextureGlobalInstanceId, 313
Resolve, 312
SetRenderTarget, 311
ShadowMap, 308
SizeType, 308
sizeType, 312
UsesHighPercisionFormat, 313
usesHighPercisionFormat, 312
XnaTexture, 313
ZBufferSurface, 313
zBufferSurface, 312
GalaxyWars::Shaders::ShaderEffect, 319
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
493
AlphaFactor, 338
alphaFactor, 333
AmbientColor, 338
ambientColor, 333
CarHueColorChange, 339
carHueColorChange, 334
DetailTexture, 339
detailTexture, 334
DiffuseColor, 338
diffuseColor, 333
DiffuseTexture, 338
diffuseTexture, 334
Dispose, 326
Effect, 336
effect, 332
GetParameters, 327
GetTechnique, 324
HeightTexture, 338
heightTexture, 334
InverseViewMatrix, 337
landscapeNormalMapping, 332
lastUsedAlphaFactor, 335
lastUsedAmbientColor, 335
lastUsedCarHueColorChange, 336
lastUsedDetailTexture, 336
lastUsedDiffuseColor, 335
lastUsedDiffuseTexture, 335
lastUsedHeightTexture, 335
lastUsedInverseViewMatrix, 334
lastUsedLightDir, 335
lastUsedNormalTexture, 335
lastUsedParallaxAmount, 336
lastUsedProjectionMatrix, 335
lastUsedReflectionCubeTexture, 336
lastUsedSpecularColor, 335
lastUsedSpecularPower, 335
lastUsedViewProjMatrix, 334
lastUsedWorldViewProjMatrix, 334
LightDir, 337
lightDir, 333
lighting, 332
lineRendering, 332
normalMapping, 332
NormalTexture, 338
normalTexture, 334
NumberOfTechniques, 336
ParallaxAmount, 339
parallaxAmount, 334
projection, 333
ProjectionMatrix, 337
ReflectionCubeTexture, 339
reflectionCubeTexture, 334
Reload, 327
Render, 330, 331
494
RenderSinglePassShader, 331
ResetParameters, 327
scale, 334
SetParameters, 328
SetParametersOptimized, 329
SetParametersOptimizedGeneral, 329
SetValue, 324–326
shaderContentName, 332
ShaderEffect, 324
SpecularColor, 338
specularColor, 333
SpecularPower, 338
specularPower, 333
Update, 330
Valid, 336
viewInverse, 333
viewProj, 333
ViewProjMatrix, 337
world, 333
WorldMatrix, 337
WorldParameter, 337
worldViewProj, 333
WorldViewProjMatrix, 337
GalaxyWars::Shaders::VBScreenHelper, 418
gridScreen10x10Instance, 419
Render, 419
Render10x10Grid, 419
vbScreenInstance, 419
GalaxyWars::Shaders::VBScreenHelper::GridScreen,
420
decl, 422
gridHeight, 422
GridScreen, 420
gridWidth, 422
indexBuffer, 422
Render, 422
vertexBuffer, 422
GalaxyWars::Shaders::VBScreenHelper::VBScreen,
424
decl, 425
Render, 425
VBScreen, 424
vbScreen, 425
GalaxyWars::Sounds::Music, 240
currentMusicPath, 242
ErrorCheck, 242
GameMusic, 243
Initialize, 240
MenuMusic, 242
music, 242
musicChannel, 242
PlayMusic, 241
soundDictionary, 242
StopMusic, 241
INDEX
system, 242
GalaxyWars::Sounds::Sound, 340
audioEngine, 346
Beep, 341
Bleep, 341
BrakeCurveMajor, 341
BrakeCurveMinor, 341
BrakeMajor, 342
BrakeMinor, 342
brakeSoundStillPlayingMs, 347
ButtonClick, 341
CarCrashMinor, 342
CarCrashTotal, 342
CarLose, 342
CheckpointBetter, 342
CheckpointWorse, 342
crashSoundStillPlayingMs, 347
defaultCategory, 346
GameMusic, 342
GetBreakSoundType, 344
Highlight, 341
Initialize, 342
MenuMusic, 342
musicCategory, 346
Play, 343
PlayBrakeSound, 344
PlayCrashSound, 345
ScreenBack, 341
ScreenClick, 341
SetVolumes, 346
Sound, 342
soundBank, 346
Sounds, 341
StopMusic, 343
Update, 345
Victory, 342
waveBank, 346
GalaxyWarsLogoGfxRect
GalaxyWars::Graphics::UIRenderer, 406
GalaxyWarsManager
GalaxyWars::GalaxyWarsManager, 138
GalaxyWarsManager.cs, 439
game
GalaxyWars::GameLogic::ScreenshotCapturer,
318
GameActive
GalaxyWars::GalaxyWarsManager, 143
GameBaseDirectory
GalaxyWars::Helpers::Directories, 96
GameFontFilename
GalaxyWars::Graphics::TextureFont, 381
GameMusic
GalaxyWars::Sounds::Music, 243
GalaxyWars::Sounds::Sound, 342
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
GameOver
GalaxyWars::GameLogic::BasePlayer, 76
GamePad
GalaxyWars::GameLogic::Input, 178
GamePadAJustPressed
GalaxyWars::GameLogic::Input, 181
GamePadAPressed
GalaxyWars::GameLogic::Input, 179
GamePadBackJustPressed
GalaxyWars::GameLogic::Input, 182
GamePadBJustPressed
GalaxyWars::GameLogic::Input, 182
GamePadBPressed
GalaxyWars::GameLogic::Input, 179
GamePadDownJustPressed
GalaxyWars::GameLogic::Input, 181
GamePadDownPressed
GalaxyWars::GameLogic::Input, 181
GamePadLeftJustPressed
GalaxyWars::GameLogic::Input, 180
GamePadLeftPressed
GalaxyWars::GameLogic::Input, 180
GamePadRightJustPressed
GalaxyWars::GameLogic::Input, 180
GamePadRightPressed
GalaxyWars::GameLogic::Input, 180
GamePadStartPressed
GalaxyWars::GameLogic::Input, 179
gamePadState
GalaxyWars::GameLogic::Input, 173
gamePadStateLastFrame
GalaxyWars::GameLogic::Input, 173
GamePadUpJustPressed
GalaxyWars::GameLogic::Input, 181
GamePadUpPressed
GalaxyWars::GameLogic::Input, 181
GamePadXJustPressed
GalaxyWars::GameLogic::Input, 182
GamePadXPressed
GalaxyWars::GameLogic::Input, 179
GamePadYJustPressed
GalaxyWars::GameLogic::Input, 182
GamePadYPressed
GalaxyWars::GameLogic::Input, 180
GameScreen
GalaxyWars::GameScreens::GameScreen, 145
GameScreen.cs, 440
gameScreens
GalaxyWars::GalaxyWarsManager, 141
GameSettings
GalaxyWars::Properties::GameSettings, 152
GameSettings.cs, 441
GameTimeMilliseconds
GalaxyWars::GameLogic::BasePlayer, 75
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
495
GenerateNewRandomGenerator
GalaxyWars::Helpers::RandomHelper, 303
GenerateVertexElements
GalaxyWars::Graphics::TangentVertex, 371
GetAngleBetweenVectors
GalaxyWars::Helpers::Vector3Helper, 426
GetBreakSoundType
GalaxyWars::Sounds::Sound, 344
GetCurrentScreenshotNum
GalaxyWars::GameLogic::ScreenshotCapturer,
316
GetHashCode
GalaxyWars::Graphics::LineManager2D::Line,
201
GalaxyWars::Graphics::LineManager3D::Line,
210
GetIndexBuffer
GalaxyWars::Graphics::Model, 120
GetLines
GalaxyWars::Helpers::FileHelper, 99
GetParameters
GalaxyWars::Shaders::PostScreenGlow, 279
GalaxyWars::Shaders::PostScreenMenu, 286
GalaxyWars::Shaders::PreScreenSkyCubeMapping,
292
GalaxyWars::Shaders::ShaderEffect, 327
GetPosition
GalaxyWars::GameLogic::SpaceshipPhysics,
358
GalaxyWars::Scenes::Asteroid, 25
GetRandomByte
GalaxyWars::Helpers::RandomHelper, 303
GetRandomFloat
GalaxyWars::Helpers::RandomHelper, 303
GetRandomInt
GalaxyWars::Helpers::RandomHelper, 303
GetRandomVector2
GalaxyWars::Helpers::RandomHelper, 304
GetRandomVector3
GalaxyWars::Helpers::RandomHelper, 304
GetRotation
GalaxyWars::Scenes::Asteroid, 25
GetScale
GalaxyWars::Scenes::Asteroid, 25
GetTechnique
GalaxyWars::Shaders::ShaderEffect, 324
GetTextWidth
GalaxyWars::Graphics::TextureFont, 377
GetTrophyTexture
GalaxyWars::Graphics::UIRenderer, 398
GetVertexBuffer
GalaxyWars::Graphics::Model, 119
GfxRectangle
GalaxyWars::Graphics::Texture, 134
496
INDEX
globalRandomGenerator
GalaxyWars::Graphics::UIRenderer, 406
HeaderOptionsGfxRect
GalaxyWars::Helpers::RandomHelper, 305
GalaxyWars::Graphics::UIRenderer, 406
GlowFlareType
Headers
GalaxyWars::Graphics::LensFlare, 189
GalaxyWars::Graphics::UIRenderer, 414
Gold
headers
GalaxyWars::Graphics::UIRenderer, 396
GalaxyWars::Graphics::UIRenderer, 411
graphics_DeviceReset
HeaderSelectTrackGfxRect
GalaxyWars::Graphics::BaseGame, 52
GalaxyWars::Graphics::UIRenderer, 406
graphics_PrepareDevice
Height
GalaxyWars::Graphics::BaseGame, 51
GalaxyWars::Graphics::BaseGame, 68
graphicsManager
GalaxyWars::Graphics::Texture, 134
GalaxyWars::Graphics::BaseGame, 61
GalaxyWars::Graphics::TextureFont, 382
Gravity
HeightTexture
GalaxyWars::Particles::ParticleSettings, 259
GalaxyWars::Shaders::ShaderEffect, 338
gridHeight
heightTexture
GalaxyWars::Shaders::VBScreenHelper::GridScreen,
422
GalaxyWars::Graphics::Material, 112
GridScreen
GalaxyWars::Shaders::ShaderEffect, 334
GalaxyWars::Shaders::VBScreenHelper::GridScreen,
Help.cs, 442
420
HelpScreen
gridScreen10x10Instance
GalaxyWars::Graphics::UIRenderer, 414
GalaxyWars::Shaders::VBScreenHelper, 419
helpScreen
gridWidth
GalaxyWars::Graphics::UIRenderer, 411
GalaxyWars::Shaders::VBScreenHelper::GridScreen,
HighDetail
422
GalaxyWars::Graphics::BaseGame, 66
GalaxyWars::Properties::GameSettings, 158
HalfAlpha
highDetail
GalaxyWars::Helpers::ColorHelper, 93
GalaxyWars::Graphics::BaseGame, 64
HalfPixelSize
GalaxyWars::Properties::GameSettings, 155
GalaxyWars::Graphics::Texture, 134
HighDetailGfxRect
HalfScreen
GalaxyWars::GameScreens::Options, 253
GalaxyWars::Shaders::RenderToTexture, 308
Highlight
HaloType
GalaxyWars::Sounds::Sound, 341
GalaxyWars::Graphics::LensFlare, 189
Highscores
HandleDeviceReset
GalaxyWars::Properties::GameSettings, 157
GalaxyWars::Shaders::RenderToTexture, 309
highscores
HandleFreeCamera
GalaxyWars::Properties::GameSettings, 154
GalaxyWars::GameLogic::ChaseCamera, 82
HandleKeyboardInput
idleTime
GalaxyWars::GameLogic::Input, 170
GalaxyWars::GameScreens::MainMenu, 220
HasAlpha
IGameScreen.cs, 443
GalaxyWars::Graphics::Material, 113
ignoreMouse
hasAlpha
GalaxyWars::GameScreens::MainMenu, 220
GalaxyWars::Graphics::Model, 121
InactiveButtonWidth
GalaxyWars::Graphics::Texture, 134
GalaxyWars::GameScreens::MainMenu, 220
HasAlphaPixels
indexBuffer
GalaxyWars::Graphics::Texture, 135
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
HasMouseMoved
238
GalaxyWars::GameLogic::Input, 174
GalaxyWars::Shaders::VBScreenHelper::GridScreen,
HeaderChooseCarGfxRect
422
GalaxyWars::Graphics::UIRenderer, 406
Ingame
HeaderHelpGfxRect
GalaxyWars::Graphics::UIRenderer, 414
GalaxyWars::Graphics::UIRenderer, 406
ingame
HeaderHighscoresGfxRect
GalaxyWars::Graphics::UIRenderer, 412
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
Initialize
GalaxyWars::GalaxyWarsManager, 139
GalaxyWars::Graphics::BaseGame, 51
GalaxyWars::Helpers::Log, 212
GalaxyWars::Particles::ParticleSystem, 264
GalaxyWars::Properties::GameSettings, 152
GalaxyWars::Sounds::Music, 240
GalaxyWars::Sounds::Sound, 342
InitializeSettings
GalaxyWars::Particles::FireParticleSystem,
105
GalaxyWars::Particles::ParticleSystem, 264
Input.cs, 444
internalXnaTexture
GalaxyWars::Graphics::Texture, 133
InterpolateCameraPosition
GalaxyWars::GameLogic::ChaseCamera, 82
InterpolateColor
GalaxyWars::Helpers::ColorHelper, 92
InterpolateRect
GalaxyWars::GameScreens::MainMenu, 216
InverseViewMatrix
GalaxyWars::Graphics::BaseGame, 70
GalaxyWars::Shaders::ShaderEffect, 337
invViewMatrix
GalaxyWars::Graphics::BaseGame, 64
IsAppActive
GalaxyWars::Graphics::BaseGame, 71
isAppActive
GalaxyWars::Graphics::BaseGame, 65
isGameOver
GalaxyWars::GameLogic::BasePlayer, 75
IsGamePadConnected
GalaxyWars::GameLogic::Input, 179
isShip
GalaxyWars::Graphics::Model, 121
IsSpecialKey
GalaxyWars::GameLogic::Input, 168
IsTangentVertexDeclaration
GalaxyWars::Graphics::TangentVertex, 372
Keyboard
GalaxyWars::GameLogic::Input, 176
KeyboardDownJustPressed
GalaxyWars::GameLogic::Input, 177
KeyboardDownPressed
GalaxyWars::GameLogic::Input, 178
KeyboardEscapeJustPressed
GalaxyWars::GameLogic::Input, 177
KeyboardF1JustPressed
GalaxyWars::GameLogic::Input, 176
KeyboardKeyJustPressed
GalaxyWars::GameLogic::Input, 171
KeyboardLeftJustPressed
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
497
GalaxyWars::GameLogic::Input, 177
KeyboardLeftPressed
GalaxyWars::GameLogic::Input, 178
KeyboardRightJustPressed
GalaxyWars::GameLogic::Input, 177
KeyboardRightPressed
GalaxyWars::GameLogic::Input, 178
KeyboardSpaceJustPressed
GalaxyWars::GameLogic::Input, 176
keyboardState
GalaxyWars::GameLogic::Input, 172
KeyboardUpJustPressed
GalaxyWars::GameLogic::Input, 177
KeyboardUpPressed
GalaxyWars::GameLogic::Input, 178
keysPressedLastFrame
GalaxyWars::GameLogic::Input, 172
KeyToChar
GalaxyWars::GameLogic::Input, 169
landscapeNormalMapping
GalaxyWars::Shaders::ShaderEffect, 332
LapsGfxRect
GalaxyWars::Graphics::UIRenderer, 410
lastAccelerationResult
GalaxyWars::GameLogic::SpaceshipPhysics,
363
lastCameraWobble
GalaxyWars::GameLogic::ChaseCamera, 87
lastFrameTotalTimeMs
GalaxyWars::Graphics::BaseGame, 63
lastIndexBufferSet
GalaxyWars::Graphics::MeshRenderManager,
225
lastMouseXMovement
GalaxyWars::GameLogic::Input, 173
lastMouseYMovement
GalaxyWars::GameLogic::Input, 173
lastSetRenderTarget
GalaxyWars::Graphics::BaseGame, 65
lastUsedAlphaFactor
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedAmbientColor
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedCarHueColorChange
GalaxyWars::Shaders::ShaderEffect, 336
lastUsedDetailTexture
GalaxyWars::Shaders::ShaderEffect, 336
lastUsedDiffuseColor
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedDiffuseTexture
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedHeightTexture
GalaxyWars::Shaders::ShaderEffect, 335
498
lastUsedInverseViewMatrix
GalaxyWars::Shaders::ShaderEffect, 334
lastUsedLightDir
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedNormalTexture
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedParallaxAmount
GalaxyWars::Shaders::ShaderEffect, 336
lastUsedProjectionMatrix
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedRadialBlurScaleFactor
GalaxyWars::Shaders::PostScreenGlow, 282
lastUsedReflectionCubeTexture
GalaxyWars::Shaders::ShaderEffect, 336
lastUsedSpecularColor
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedSpecularPower
GalaxyWars::Shaders::ShaderEffect, 335
lastUsedViewProjMatrix
GalaxyWars::Shaders::ShaderEffect, 334
lastUsedWorldViewProjMatrix
GalaxyWars::Shaders::ShaderEffect, 334
lastVertexBufferSet
GalaxyWars::Graphics::MeshRenderManager,
225
LensFlare
GalaxyWars::GalaxyWarsManager, 143
GalaxyWars::Graphics::LensFlare, 185
lensFlare
GalaxyWars::GalaxyWarsManager, 142
GalaxyWars::Graphics::UIRenderer, 412
LensFlare.cs, 445
LensFlareType
GalaxyWars::Graphics::LensFlare, 189
lensOrigin3D
GalaxyWars::Graphics::LensFlare, 188
LightDir
GalaxyWars::Shaders::ShaderEffect, 337
lightDir
GalaxyWars::Shaders::ShaderEffect, 333
LightDirection
GalaxyWars::Graphics::BaseGame, 66
lightDirection
GalaxyWars::Graphics::BaseGame, 63
lighting
GalaxyWars::Shaders::ShaderEffect, 332
Line
GalaxyWars::Graphics::LineManager2D::Line,
200
GalaxyWars::Graphics::LineManager3D::Line,
209
Line4ArrowGfxRect
GalaxyWars::GameScreens::Options, 252
Line5ArrowGfxRect
INDEX
GalaxyWars::GameScreens::Options, 252
Line6ArrowGfxRect
GalaxyWars::GameScreens::Options, 252
LineManager
GalaxyWars::Graphics::BaseGame, 66
LineManager2D
GalaxyWars::Graphics::LineManager2D, 194
lineManager2D
GalaxyWars::Graphics::BaseGame, 62
LineManager2D.cs, 446
LineManager3D
GalaxyWars::Graphics::LineManager3D, 203
lineManager3D
GalaxyWars::Graphics::BaseGame, 62
LineManager3D.cs, 447
lineRendering
GalaxyWars::Shaders::ShaderEffect, 332
lines
GalaxyWars::Graphics::LineManager2D, 197
GalaxyWars::Graphics::LineManager3D, 206
lineVertices
GalaxyWars::Graphics::LineManager2D, 197
GalaxyWars::Graphics::LineManager3D, 206
Load
GalaxyWars::Properties::GameSettings, 152
loaded
GalaxyWars::Graphics::Texture, 134
LoadGameContentFile
GalaxyWars::Helpers::FileHelper, 98
LoadGraphicsContent
GalaxyWars::Particles::ParticleSystem, 264
LoadParticleEffect
GalaxyWars::Particles::ParticleSystem, 265
LoadTextures
GalaxyWars::Graphics::LensFlare, 186
Log.cs, 448
LogFilename
GalaxyWars::Helpers::Log, 214
LookAtPos
GalaxyWars::GameLogic::SpaceshipPhysics,
365
Main
GalaxyWars::Program, 300
MainMenu.cs, 449
MakeScreenshot
GalaxyWars::GameLogic::ScreenshotCapturer,
317
Material
GalaxyWars::Graphics::Material, 108–110
material
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterial,
229
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
499
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
GalaxyWars::GalaxyWarsManager, 142
238
MenuButtonHelpGfxRect
Material.cs, 450
GalaxyWars::Graphics::UIRenderer, 407
MaxAcceleration
MenuButtonHighscoresGfxRect
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Graphics::UIRenderer, 407
360
MenuButtonOptionsGfxRect
maxAccelerationPerSec
GalaxyWars::Graphics::UIRenderer, 407
GalaxyWars::GameLogic::SpaceshipPhysics,
MenuButtonPlayGfxRect
362
GalaxyWars::Graphics::UIRenderer, 407
MaxAirFriction
MenuButtonQuitGfxRect
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Graphics::UIRenderer, 407
361
MenuButtonSelectionGfxRect
MaxCameraWobbelTimeoutMs
GalaxyWars::Graphics::UIRenderer, 407
GalaxyWars::GameLogic::ChaseCamera, 87
MenuMusic
MaxColor
GalaxyWars::Sounds::Music, 242
GalaxyWars::Particles::ParticleSettings, 260
GalaxyWars::Sounds::Sound, 342
maxDanger
MenuTextHelpGfxRect
GalaxyWars::GameScreens::GameScreen, 148
GalaxyWars::Graphics::UIRenderer, 408
MaxEndSize
MenuTextHighscoresGfxRect
GalaxyWars::Particles::ParticleSettings, 260
GalaxyWars::Graphics::UIRenderer, 408
MaxHorizontalVelocity
MenuTextOptionsGfxRect
GalaxyWars::Particles::ParticleSettings, 259
GalaxyWars::Graphics::UIRenderer, 408
MaximalSize
MenuTextPlayGfxRect
GalaxyWars::Scenes::Asteroids, 30
GalaxyWars::Graphics::UIRenderer, 407
MaxNumOfLines
MenuTextQuitGfxRect
GalaxyWars::Graphics::LineManager2D, 198
GalaxyWars::Graphics::UIRenderer, 408
GalaxyWars::Graphics::LineManager3D, 207 mesh
MaxParticles
GalaxyWars::Scenes::Asteroid, 26
GalaxyWars::Particles::ParticleSettings, 258
meshes
MaxPossibleSpeed
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterial,
GalaxyWars::GameLogic::SpaceshipPhysics,
229
360
MeshesPerMaterial
MaxRotateSpeed
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterial,
GalaxyWars::Particles::ParticleSettings, 260
228
MaxRotationPerSec
MeshesPerMaterialPerTechniques
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterialP
361
231
MaxShowTimeMs
meshesPerMaterials
GalaxyWars::Graphics::UIRenderer::TimeFadeupText,GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterialP
417
233
maxSpeed
MeshRenderManager
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Graphics::BaseGame, 67
362
meshRenderManager
MaxStartSize
GalaxyWars::Graphics::BaseGame, 62
GalaxyWars::Particles::ParticleSettings, 260
MeshRenderManager.cs, 451
MaxVerticalVelocity
MinAcceleration
GalaxyWars::Particles::ParticleSettings, 259
GalaxyWars::GameLogic::SpaceshipPhysics,
MaxViewDistance
360
GalaxyWars::GameLogic::SpaceshipPhysics,
MinColor
361
GalaxyWars::Particles::ParticleSettings, 260
GalaxyWars::Graphics::Model, 122
MinEndSize
maxViewDistance
GalaxyWars::Particles::ParticleSettings, 260
GalaxyWars::Graphics::Model, 122
MinHorizontalVelocity
MenuActive
GalaxyWars::Particles::ParticleSettings, 259
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
500
MinimalSize
GalaxyWars::Scenes::Asteroids, 30
MinimumResolutionHeight
GalaxyWars::Properties::GameSettings, 155
MinimumResolutionWidth
GalaxyWars::Properties::GameSettings, 155
MinRotateSpeed
GalaxyWars::Particles::ParticleSettings, 260
MinSensitivity
GalaxyWars::GameLogic::SpaceshipPhysics,
361
MinStartSize
GalaxyWars::Particles::ParticleSettings, 260
Minus
GalaxyWars::Graphics::UIRenderer, 397
MinVerticalVelocity
GalaxyWars::Particles::ParticleSettings, 259
MinViewDistance
GalaxyWars::GameLogic::SpaceshipPhysics,
361
MixAlphaToColor
GalaxyWars::Helpers::ColorHelper, 93
Model
GalaxyWars::Graphics::Model, 116
GalaxyWars::Scenes::Asteroid, 26
Model.cs, 452
mouseCursor
GalaxyWars::Graphics::UIRenderer, 411
MouseDetected
GalaxyWars::GameLogic::Input, 174
mouseDetected
GalaxyWars::GameLogic::Input, 172
MouseDraggingAmount
GalaxyWars::GameLogic::Input, 176
MouseInBox
GalaxyWars::GameLogic::Input, 167
MouseInBoxRelative
GalaxyWars::GameLogic::Input, 168
MouseLeftButtonJustPressed
GalaxyWars::GameLogic::Input, 175
MouseLeftButtonPressed
GalaxyWars::GameLogic::Input, 175
MouseMiddleButtonPressed
GalaxyWars::GameLogic::Input, 175
MousePos
GalaxyWars::GameLogic::Input, 174
MouseRightButtonJustPressed
GalaxyWars::GameLogic::Input, 175
MouseRightButtonPressed
GalaxyWars::GameLogic::Input, 175
mouseState
GalaxyWars::GameLogic::Input, 172
mouseStateLastFrame
GalaxyWars::GameLogic::Input, 172
INDEX
MouseWheelDelta
GalaxyWars::GameLogic::Input, 176
mouseWheelDelta
GalaxyWars::GameLogic::Input, 173
mouseWheelValue
GalaxyWars::GameLogic::Input, 173
MouseXMovement
GalaxyWars::GameLogic::Input, 174
mouseXMovement
GalaxyWars::GameLogic::Input, 173
MouseYMovement
GalaxyWars::GameLogic::Input, 174
mouseYMovement
GalaxyWars::GameLogic::Input, 173
MoveFactorPerSecond
GalaxyWars::Graphics::BaseGame, 69
MultiplyColors
GalaxyWars::Helpers::ColorHelper, 91
music
GalaxyWars::Sounds::Music, 242
Music.cs, 453
musicCategory
GalaxyWars::Sounds::Sound, 346
musicChannel
GalaxyWars::Sounds::Music, 242
MusicGfxRect
GalaxyWars::GameScreens::Options, 253
MusicVolume
GalaxyWars::Properties::GameSettings, 158
musicVolume
GalaxyWars::Properties::GameSettings, 156
mustApplyDeviceChanges
GalaxyWars::Graphics::BaseGame, 64
Name
GalaxyWars::Graphics::Model, 122
name
GalaxyWars::Graphics::Model, 120
NearPlane
GalaxyWars::Graphics::BaseGame, 61
needSave
GalaxyWars::Properties::GameSettings, 154
noiseMap
GalaxyWars::Shaders::PostScreenMenu, 289
noiseMapTexture
GalaxyWars::Shaders::PostScreenMenu, 290
Normal
GalaxyWars::Graphics::UIRenderer, 397
normal
GalaxyWars::Graphics::TangentVertex, 372
normalMapping
GalaxyWars::Shaders::ShaderEffect, 332
NormalTexture
GalaxyWars::Shaders::ShaderEffect, 338
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
501
Options.cs, 454
normalTexture
OptionsRadioButtonGfxRect
GalaxyWars::Graphics::Material, 112
GalaxyWars::Graphics::UIRenderer, 407
GalaxyWars::Shaders::ShaderEffect, 334
OptionsScreen
NumberOfButtons
GalaxyWars::Graphics::UIRenderer, 414
GalaxyWars::GameScreens::MainMenu, 219
optionsScreen
NumberOfFlareTypes
GalaxyWars::Graphics::UIRenderer, 411
GalaxyWars::Graphics::LensFlare, 189
Origin3D
NumberOfRenderMatrices
GalaxyWars::Graphics::LensFlare, 190
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterial,
230
ParallaxAmount
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterialPerTechniques,
GalaxyWars::Shaders::ShaderEffect, 339
234
parallaxAmount
NumberOfTechniques
GalaxyWars::Graphics::Material, 113
GalaxyWars::Shaders::ShaderEffect, 336
GalaxyWars::Shaders::ShaderEffect, 334
numOfLines
GalaxyWars::Graphics::LineManager2D, 197 particleEffect
GalaxyWars::Particles::ParticleSystem, 271
GalaxyWars::Graphics::LineManager3D, 206
ParticleEmitter
NumOfMeshParts
GalaxyWars::Particles::ParticleEmitter, 256
GalaxyWars::Graphics::Model, 122
ParticleEmitter.cs, 455
numOfPrimitives
GalaxyWars::Graphics::LineManager2D, 198 particles
GalaxyWars::Particles::ParticleSystem, 271
GalaxyWars::Graphics::LineManager3D, 207
ParticleSettings.cs, 456
numVertices
ParticleSystem
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
GalaxyWars::GalaxyWarsManager, 144
239
GalaxyWars::Particles::ParticleSystem, 264
particleSystem
ObjectMatrix
GalaxyWars::GalaxyWarsManager, 142
GalaxyWars::Graphics::Model, 122
GalaxyWars::Particles::ParticleEmitter, 257
objectMatrix
ParticleSystem.cs, 457
GalaxyWars::Graphics::Model, 120
ParticleVertex.cs, 458
oldCarForward
Path
GalaxyWars::Graphics::UIRenderer, 412
GalaxyWars::GameLogic::SpaceshipPhysics,
oldCarUp
365
GalaxyWars::Graphics::UIRenderer, 413
path
OnActivated
GalaxyWars::GameScreens::GameScreen, 148
GalaxyWars::Graphics::BaseGame, 57
PathTime
OnDeactivated
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Graphics::BaseGame, 57
365
OneOne
Play
GalaxyWars::Graphics::BaseGame, 40
GalaxyWars::Sounds::Sound, 343
OpenFileForCurrentPlayer
PlayBrakeSound
GalaxyWars::Helpers::FileHelper, 99
GalaxyWars::Sounds::Sound, 344
operator!=
GalaxyWars::Graphics::LineManager2D::Line, PlayCrashSound
GalaxyWars::Sounds::Sound, 345
200
GalaxyWars::Graphics::LineManager3D::Line, Player
GalaxyWars::GalaxyWarsManager, 143
209
GalaxyWars::GameLogic::Player, 276
operator==
GalaxyWars::Graphics::LineManager2D::Line, player
GalaxyWars::GalaxyWarsManager, 141
200
GalaxyWars::Graphics::LineManager3D::Line, Player.cs, 459
209
PlayerName
Options
GalaxyWars::Properties::GameSettings, 157
GalaxyWars::GameScreens::Options, 245
playerName
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
502
INDEX
GalaxyWars::Properties::GameSettings, 155
GalaxyWars::Graphics::UIRenderer, 406
PlayMusic
previousPosition
GalaxyWars::Sounds::Music, 241
GalaxyWars::Particles::ParticleEmitter, 257
Plus
primitiveCount
GalaxyWars::Graphics::UIRenderer, 397
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
PointInFront
239
GalaxyWars::Graphics::BaseGame, 53
PrimitivesRenderer
PointVisible
GalaxyWars::GalaxyWarsManager, 142
GalaxyWars::Graphics::BaseGame, 53
GalaxyWars::Graphics::PrimitivesRenderer,
pos
295
GalaxyWars::Graphics::TangentVertex, 372
primitivesRenderer
Position
GalaxyWars::GalaxyWarsManager, 141
GalaxyWars::Particles::ParticleVertex, 273
PrimitivesRenderer.cs, 463
GalaxyWars::Scenes::Asteroid, 26
Program.cs, 464
position
projection
GalaxyWars::Graphics::LensFlare::FlareData,
GalaxyWars::Shaders::ShaderEffect, 333
192
ProjectionMatrix
GalaxyWars::Scenes::Asteroid, 26
GalaxyWars::Graphics::BaseGame, 70
Positions
GalaxyWars::Shaders::ShaderEffect, 337
GalaxyWars::Graphics::Model, 123
projectionMatrix
PostScreenEffects
GalaxyWars::Graphics::BaseGame, 62
GalaxyWars::Properties::GameSettings, 158
QuarterScreen
postScreenEffects
GalaxyWars::Shaders::RenderToTexture, 308
GalaxyWars::Properties::GameSettings, 155
PostScreenEffectsGfxRect
RadialBlurScaleFactor
GalaxyWars::GameScreens::Options, 253
GalaxyWars::Shaders::PostScreenGlow, 283
postScreenGameShader
radialBlurScaleFactor
GalaxyWars::Graphics::UIRenderer, 412
GalaxyWars::Shaders::PostScreenGlow, 282
PostScreenGlow
radialSceneMap
GalaxyWars::Shaders::PostScreenGlow, 279
GalaxyWars::Shaders::PostScreenGlow, 282
PostScreenGlow.cs, 460
radialSceneMapTexture
PostScreenGlowShader
GalaxyWars::Shaders::PostScreenGlow, 282
GalaxyWars::Graphics::UIRenderer, 415
Random
PostScreenMenu
GalaxyWars::Particles::ParticleVertex, 273
GalaxyWars::Shaders::PostScreenMenu, 286
random
PostScreenMenu.cs, 461
GalaxyWars::Particles::ParticleSystem, 272
PostScreenMenuShader
randomCarColor
GalaxyWars::Graphics::UIRenderer, 414
GalaxyWars::Graphics::UIRenderer, 413
postScreenMenuShader
randomCarNumber
GalaxyWars::Graphics::UIRenderer, 412
GalaxyWars::Graphics::UIRenderer, 413
PostUIRender
RandomColor
GalaxyWars::GalaxyWarsManager, 140
GalaxyWars::Helpers::RandomHelper, 305
GalaxyWars::Graphics::BaseGame, 59
RandomHelper.cs, 465
precaledHalfPixelSize
RandomNormalVector3
GalaxyWars::Graphics::Texture, 133
GalaxyWars::Helpers::RandomHelper, 305
PreScreenSkyCubeMapping
ReadMatrix
GalaxyWars::Shaders::PreScreenSkyCubeMapping,
GalaxyWars::Helpers::FileHelper, 102
292
ReadVector3
PreScreenSkyCubeMapping.cs, 462
GalaxyWars::Helpers::FileHelper, 101
pressedLeftMs
ReadVector4
GalaxyWars::GameScreens::MainMenu, 220
GalaxyWars::Helpers::FileHelper, 102
pressedRightMs
realScaling
GalaxyWars::GameScreens::MainMenu, 220
PressStartGfxRect
GalaxyWars::Graphics::Model, 120
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
503
ReflectionCubeTexture
GalaxyWars::Graphics::UIRenderer, 401
GalaxyWars::Shaders::ShaderEffect, 339
RenderBottomButtons
reflectionCubeTexture
GalaxyWars::Graphics::UIRenderer, 401
GalaxyWars::Shaders::ShaderEffect, 334
RenderCross
Reload
GalaxyWars::Graphics::PrimitivesRenderer,
GalaxyWars::Shaders::ShaderEffect, 327
296
remRenderToTextures
RenderCube
GalaxyWars::Graphics::BaseGame, 65
GalaxyWars::Graphics::PrimitivesRenderer,
remSceneRenderTarget
297
GalaxyWars::Graphics::BaseGame, 65
RenderGameBackground
remTexts
GalaxyWars::Graphics::UIRenderer, 400
GalaxyWars::Graphics::TextureFont, 382
RenderGameUI
remWindowsTitle
GalaxyWars::Graphics::UIRenderer, 402
GalaxyWars::Graphics::BaseGame, 62
RenderHandler
Render
GalaxyWars::Graphics::BaseGame, 59
GalaxyWars::GalaxyWarsManager, 140
RenderLines2D
GalaxyWars::GameScreens::GameScreen, 146
GalaxyWars::Graphics::BaseGame, 56
GalaxyWars::GameScreens::Help, 160
RenderLines3D
GalaxyWars::GameScreens::IGameScreen,
GalaxyWars::Graphics::BaseGame, 56
162
renderLoopErrorCount
GalaxyWars::GameScreens::MainMenu, 216
GalaxyWars::Graphics::BaseGame, 65
GalaxyWars::GameScreens::Options, 246
renderMatrices
GalaxyWars::GameScreens::SplashScreen,
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
367
239
GalaxyWars::Graphics::BaseGame, 59
RenderMenuBackground
GalaxyWars::Graphics::LensFlare, 187
GalaxyWars::Graphics::UIRenderer, 401
GalaxyWars::Graphics::LineManager2D, 196 RenderMenuTrackBackground
GalaxyWars::Graphics::LineManager3D, 205
GalaxyWars::Graphics::UIRenderer, 400
GalaxyWars::Graphics::MeshRenderManager, RenderMesh
224
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterial,
237
228
RenderOnScreen
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterialPerTechniques,
GalaxyWars::Graphics::Texture, 129–132
232
RenderOnScreenRelative1600
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
GalaxyWars::Graphics::Texture, 131
237
RenderOnScreenRelative16To9
GalaxyWars::Graphics::Model, 118, 119
GalaxyWars::Graphics::Texture, 130
GalaxyWars::Graphics::UIRenderer, 404
RenderOnScreenRelative4To3
GalaxyWars::Scenes::Asteroid, 24
GalaxyWars::Graphics::Texture, 131
GalaxyWars::Scenes::Asteroids, 29
RenderOnScreenWithRotation
GalaxyWars::Shaders::ShaderEffect, 330, 331
GalaxyWars::Graphics::Texture, 132
GalaxyWars::Shaders::VBScreenHelper, 419
RenderSinglePassShader
GalaxyWars::Shaders::VBScreenHelper::GridScreen, GalaxyWars::Shaders::ShaderEffect, 331
422
RenderSky
GalaxyWars::Shaders::VBScreenHelper::VBScreen, GalaxyWars::Shaders::PreScreenSkyCubeMapping,
425
293
Render10x10Grid
RenderSphere
GalaxyWars::Shaders::VBScreenHelper, 419
GalaxyWars::Graphics::PrimitivesRenderer,
RenderableMesh
297, 298
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
RenderTarget
236
GalaxyWars::Shaders::RenderToTexture, 313
renderableMeshes
renderTarget
GalaxyWars::Graphics::Model, 121
GalaxyWars::Shaders::RenderToTexture, 312
RenderBlackBar
RenderTextsAndMouseCursor
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
504
GalaxyWars::Graphics::UIRenderer, 405
RenderTimeFadeupEffects
GalaxyWars::Graphics::UIRenderer, 399
RenderToTexture
GalaxyWars::Shaders::RenderToTexture, 308
RenderToTexture.cs, 466
RenderToTextureGlobalInstanceId
GalaxyWars::Shaders::RenderToTexture, 313
RenderTriangle
GalaxyWars::Graphics::PrimitivesRenderer,
296, 297
Reset
GalaxyWars::GameLogic::BasePlayer, 73
GalaxyWars::GameLogic::ChaseCamera, 85
GalaxyWars::GameLogic::Player, 276
GalaxyWars::GameLogic::SpaceshipPhysics,
353
ResetMouseDraggingAmount
GalaxyWars::GameLogic::Input, 167
ResetParameters
GalaxyWars::Shaders::ShaderEffect, 327
ResetRenderTarget
GalaxyWars::Graphics::BaseGame, 60
Resolution1024x768GfxRect
GalaxyWars::GameScreens::Options, 252
Resolution1280x1024GfxRect
GalaxyWars::GameScreens::Options, 252
Resolution640x480GfxRect
GalaxyWars::GameScreens::Options, 252
Resolution800x600GfxRect
GalaxyWars::GameScreens::Options, 252
ResolutionAutoGfxRect
GalaxyWars::GameScreens::Options, 252
ResolutionHeight
GalaxyWars::Properties::GameSettings, 157
resolutionHeight
GalaxyWars::Properties::GameSettings, 155
ResolutionRect
GalaxyWars::Graphics::BaseGame, 68
ResolutionWidth
GalaxyWars::Properties::GameSettings, 157
resolutionWidth
GalaxyWars::Properties::GameSettings, 155
Resolve
GalaxyWars::Shaders::RenderToTexture, 312
RetireActiveParticles
GalaxyWars::Particles::ParticleSystem, 266
RingType
GalaxyWars::Graphics::LensFlare, 189
rotateShipAfterCollision
GalaxyWars::GameLogic::SpaceshipPhysics,
363
RotateSun
GalaxyWars::Graphics::LensFlare, 185
INDEX
Rotation
GalaxyWars::Scenes::Asteroid, 26
rotation
GalaxyWars::Scenes::Asteroid, 26
rotationChange
GalaxyWars::GameLogic::SpaceshipPhysics,
364
RotationMatrix
GalaxyWars::GameLogic::ChaseCamera, 88
rotMatrix
GalaxyWars::GameLogic::ChaseCamera, 86
SameColor
GalaxyWars::Helpers::ColorHelper, 92
Save
GalaxyWars::Properties::GameSettings, 153
SaveGameContentFile
GalaxyWars::Helpers::FileHelper, 99
Scale
GalaxyWars::Scenes::Asteroid, 26
scale
GalaxyWars::Graphics::LensFlare::FlareData,
192
GalaxyWars::Graphics::TextureFont::FontToRender,
385
GalaxyWars::Scenes::Asteroid, 26
GalaxyWars::Shaders::ShaderEffect, 334
scaling
GalaxyWars::Graphics::Model, 121
sceneMap
GalaxyWars::Shaders::PostScreenMenu, 289
sceneMapTexture
GalaxyWars::Shaders::PostScreenMenu, 289
ScreenBack
GalaxyWars::Sounds::Sound, 341
screenBorderFadeoutMap
GalaxyWars::Shaders::PostScreenGlow, 282
screenBorderFadeoutMapTexture
GalaxyWars::Shaders::PostScreenGlow, 282
ScreenClick
GalaxyWars::Sounds::Sound, 341
ScreenFlareSize
GalaxyWars::Graphics::LensFlare, 188
screenHeight
GalaxyWars::Graphics::BaseGame, 61
ScreenshotCapturer
GalaxyWars::GameLogic::ScreenshotCapturer,
316
ScreenshotCapturer.cs, 467
ScreenshotNameBuilder
GalaxyWars::GameLogic::ScreenshotCapturer,
316
screenshotNum
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
GalaxyWars::GameLogic::ScreenshotCapturer,
318
ScreenshotsDirectory
GalaxyWars::Helpers::Directories, 96
screenWidth
GalaxyWars::Graphics::BaseGame, 61
SelectedButton
GalaxyWars::GameScreens::MainMenu, 221
selectedButton
GalaxyWars::GameScreens::MainMenu, 220
SelectionArrowGfxRect
GalaxyWars::Graphics::UIRenderer, 409
SelectionRadioButtonGfxRect
GalaxyWars::Graphics::UIRenderer, 410
SensitivityGfxRect
GalaxyWars::GameScreens::Options, 253
Set
GalaxyWars::Scenes::Asteroid, 24
SetAlphaBlendingEnabled
GalaxyWars::Graphics::BaseGame, 50
SetCamera
GalaxyWars::Particles::ParticleSystem, 269
SetCameraPosition
GalaxyWars::GameLogic::ChaseCamera, 81
SetCurrentAlphaMode
GalaxyWars::Graphics::BaseGame, 50
SetMinimumGraphics
GalaxyWars::Properties::GameSettings, 153
SetParameters
GalaxyWars::Shaders::ShaderEffect, 328
SetParametersOptimized
GalaxyWars::Shaders::ShaderEffect, 329
SetParametersOptimizedGeneral
GalaxyWars::Shaders::ShaderEffect, 329
SetParticleRenderStates
GalaxyWars::Particles::ParticleSystem, 269
SetRenderTarget
GalaxyWars::Graphics::BaseGame, 60
GalaxyWars::Shaders::RenderToTexture, 311
SetShipPosition
GalaxyWars::GameLogic::SpaceshipPhysics,
352
settings
GalaxyWars::Particles::ParticleSystem, 271
SettingsFilename
GalaxyWars::Properties::GameSettings, 154
SetValue
GalaxyWars::Shaders::ShaderEffect, 324–326
SetVolumes
GalaxyWars::Sounds::Sound, 346
shaderContentName
GalaxyWars::Shaders::ShaderEffect, 332
ShaderEffect
GalaxyWars::Shaders::ShaderEffect, 324
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
505
ShaderEffect.cs, 468
ShadowMap
GalaxyWars::Shaders::RenderToTexture, 308
ShadowMapping
GalaxyWars::Properties::GameSettings, 158
shadowMapping
GalaxyWars::Properties::GameSettings, 155
ShadowsGfxRect
GalaxyWars::GameScreens::Options, 253
ShipDirection
GalaxyWars::GameLogic::SpaceshipPhysics,
365
shipDirection
GalaxyWars::GameLogic::SpaceshipPhysics,
362
shipForce
GalaxyWars::GameLogic::SpaceshipPhysics,
362
shipMass
GalaxyWars::GameLogic::SpaceshipPhysics,
362
shipModel
GalaxyWars::GalaxyWarsManager, 142
ShipPosition
GalaxyWars::GameLogic::SpaceshipPhysics,
364
shipPosition
GalaxyWars::GameLogic::SpaceshipPhysics,
362
ShipRenderMatrix
GalaxyWars::GameLogic::SpaceshipPhysics,
365
shipRenderMatrix
GalaxyWars::GameLogic::SpaceshipPhysics,
363
ShipRight
GalaxyWars::GameLogic::SpaceshipPhysics,
365
shipSpeed
GalaxyWars::GameLogic::SpaceshipPhysics,
363
shipTextures
GalaxyWars::GalaxyWarsManager, 142
shipUp
GalaxyWars::GameLogic::SpaceshipPhysics,
362
Show
GalaxyWars::Shaders::PostScreenGlow, 280
GalaxyWars::Shaders::PostScreenMenu, 287
ShowBackground
GalaxyWars::Properties::GameSettings, 156
showBackground
GalaxyWars::Properties::GameSettings, 154
ShowCursor
506
INDEX
GalaxyWars::GalaxyWarsManager, 143
GalaxyWars::GameScreens::Options, 253
ShowDiagram
Sounds
GalaxyWars::Properties::GameSettings, 156
GalaxyWars::Sounds::Sound, 341
showDiagram
SoundsDirectory
GalaxyWars::Properties::GameSettings, 154
GalaxyWars::Helpers::Directories, 96
showFps
SoundVolume
GalaxyWars::Graphics::UIRenderer, 413
GalaxyWars::Properties::GameSettings, 158
ShowPath
soundVolume
GalaxyWars::Properties::GameSettings, 156
GalaxyWars::Properties::GameSettings, 155
showPath
SourceAlphaOne
GalaxyWars::Properties::GameSettings, 154
GalaxyWars::Graphics::BaseGame, 40
showTimeMs
SourceBlend
GalaxyWars::Graphics::UIRenderer::TimeFadeupText,GalaxyWars::Particles::ParticleSettings, 260
417
SpaceshipHeight
ShowVertices
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Properties::GameSettings, 156
361
showVertices
SpaceshipMass
GalaxyWars::Properties::GameSettings, 154
GalaxyWars::GameLogic::SpaceshipPhysics,
SignedDistanceToPlane
360
GalaxyWars::Helpers::Vector3Helper, 427
SpaceshipModel
Silver
GalaxyWars::GalaxyWarsManager, 143
GalaxyWars::Graphics::UIRenderer, 396
SpaceshipPhysics
Size
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Graphics::Model, 122
352
SizeInBytes
SpaceshipPhysics.cs, 470
GalaxyWars::Graphics::TangentVertex, 373
SpaceshipUpVector
GalaxyWars::Particles::ParticleVertex, 274
GalaxyWars::GameLogic::SpaceshipPhysics,
SizeType
364
GalaxyWars::Shaders::RenderToTexture, 308
SpecularColor
sizeType
GalaxyWars::Shaders::ShaderEffect, 338
GalaxyWars::Shaders::RenderToTexture, 312
specularColor
skyCube
GalaxyWars::Graphics::Material, 112
GalaxyWars::Graphics::UIRenderer, 412
GalaxyWars::Shaders::ShaderEffect, 333
SkyCubeMapFilename
SpecularPower
GalaxyWars::Shaders::PreScreenSkyCubeMapping, GalaxyWars::Shaders::ShaderEffect, 338
294
specularPower
SkyCubeMapTexture
GalaxyWars::Graphics::Material, 112
GalaxyWars::Graphics::UIRenderer, 415
GalaxyWars::Shaders::ShaderEffect, 333
GalaxyWars::Shaders::PreScreenSkyCubeMapping,
Speed
294
GalaxyWars::GameLogic::SpaceshipPhysics,
skyCubeMapTexture
364
GalaxyWars::Shaders::PreScreenSkyCubeMapping,
sphereIndices
294
GalaxyWars::Graphics::PrimitivesRenderer,
sortedMeshes
299
GalaxyWars::Graphics::MeshRenderManager, SphereQuality
225
GalaxyWars::Graphics::PrimitivesRenderer,
Sound
298
GalaxyWars::Sounds::Sound, 342
sphereVertices
Sound.cs, 469
GalaxyWars::Graphics::PrimitivesRenderer,
soundBank
298
GalaxyWars::Sounds::Sound, 346
SplashScreen
soundDictionary
GalaxyWars::GameScreens::SplashScreen,
GalaxyWars::Sounds::Music, 242
367
SoundGfxRect
SplashScreen.cs, 471
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
507
GalaxyWars::Graphics::UIRenderer, 410
TachoMphGfxRect
GalaxyWars::Shaders::PostScreenMenu, 287
GalaxyWars::Graphics::UIRenderer, 410
startColor
GalaxyWars::Graphics::LineManager3D::Line, tangent
GalaxyWars::Graphics::TangentVertex, 372
210
TangentVertex
startDraggingPos
GalaxyWars::Graphics::TangentVertex, 370,
GalaxyWars::GameLogic::Input, 173
371
Started
TangentVertex.cs, 472
GalaxyWars::Shaders::PostScreenMenu, 290
technique
started
GalaxyWars::Graphics::MeshRenderManager::MeshesPerMaterialP
GalaxyWars::Shaders::PostScreenMenu, 290
233
StartGame
texFilename
GalaxyWars::Program, 300
GalaxyWars::Graphics::Texture, 133
StartGameZoomedInTime
texHeight
GalaxyWars::GameLogic::BasePlayer, 75
GalaxyWars::Graphics::Texture, 133
StartGameZoomTimeMilliseconds
text
GalaxyWars::GameLogic::BasePlayer, 75
GalaxyWars::Graphics::TextureFont::FontToRender,
startIndex
384
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
GalaxyWars::Graphics::UIRenderer::TimeFadeupText,
239
416
startPoint
GalaxyWars::Graphics::LineManager2D::Line, TextRects
GalaxyWars::GameScreens::MainMenu, 219
201
GalaxyWars::Graphics::LineManager3D::Line, Texture
GalaxyWars::Graphics::Texture, 127
210
Texture.cs, 473
startTimeThisSecond
TextureFont
GalaxyWars::Graphics::BaseGame, 63
GalaxyWars::Graphics::TextureFont, 377
StayInRange
TextureFont.cs, 474
GalaxyWars::Helpers::ColorHelper, 91
TextureFontBigNumbers.cs, 475
StopMusic
TextureName
GalaxyWars::Sounds::Music, 241
GalaxyWars::Particles::ParticleSettings, 258
GalaxyWars::Sounds::Sound, 343
texWidth
StreaksType
GalaxyWars::Graphics::Texture, 133
GalaxyWars::Graphics::LensFlare, 189
Time
streamOffset
GalaxyWars::Particles::ParticleVertex, 273
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
timeBetweenParticles
239
GalaxyWars::Particles::ParticleEmitter, 257
SubRenderHeight
TimeFadeupMode
GalaxyWars::Graphics::TextureFont, 381
GalaxyWars::Graphics::UIRenderer, 397
SunFlareType
TimeFadeupText
GalaxyWars::Graphics::LensFlare, 188
GalaxyWars::Graphics::UIRenderer::TimeFadeupText,
sunIntensity
416
GalaxyWars::Graphics::LensFlare, 190
timeLeftOver
system
GalaxyWars::Particles::ParticleEmitter, 257
GalaxyWars::Sounds::Music, 242
TimeOutMenu
t
GalaxyWars::GameScreens::MainMenu, 220
GalaxyWars::GameLogic::SpaceshipPhysics,
timer
363
GalaxyWars::Shaders::PostScreenMenu, 289
TachoArrowGfxRect
ToString
GalaxyWars::Graphics::UIRenderer, 410
GalaxyWars::Graphics::TangentVertex, 371
TachoGearGfxRect
GalaxyWars::Graphics::Texture, 133
GalaxyWars::Graphics::UIRenderer, 410
totalFrameCount
TachoGfxRect
GalaxyWars::Graphics::BaseGame, 63
Start
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
508
INDEX
TotalFrames
GalaxyWars::Graphics::BaseGame, 69
TotalTime
GalaxyWars::Graphics::BaseGame, 69
TotalTimeMilliseconds
GalaxyWars::Graphics::BaseGame, 69
totalTimeMs
GalaxyWars::Graphics::BaseGame, 63
TrackButtonAdvancedGfxRect
GalaxyWars::Graphics::UIRenderer, 408
TrackButtonBeginnerGfxRect
GalaxyWars::Graphics::UIRenderer, 408
TrackButtonExpertGfxRect
GalaxyWars::Graphics::UIRenderer, 408
TrackButtonSelectionGfxRect
GalaxyWars::Graphics::UIRenderer, 408
TrackNameGfxRect
GalaxyWars::Graphics::UIRenderer, 411
TrackTextAdvancedGfxRect
GalaxyWars::Graphics::UIRenderer, 409
TrackTextBeginnerGfxRect
GalaxyWars::Graphics::UIRenderer, 409
TrackTextExpertGfxRect
GalaxyWars::Graphics::UIRenderer, 409
transformation
GalaxyWars::Scenes::Asteroid, 26
transforms
GalaxyWars::Graphics::Model, 120
triangleVertices
GalaxyWars::Graphics::PrimitivesRenderer,
298
TrippSys
GalaxyWars::GalaxyWarsManager, 143
trippSystem
GalaxyWars::GalaxyWarsManager, 141
trophies
GalaxyWars::Graphics::UIRenderer, 412
TrophyType
GalaxyWars::Graphics::UIRenderer, 396
type
GalaxyWars::Graphics::LensFlare::FlareData,
192
U
GalaxyWars::GameLogic::BasePlayer, 74
GalaxyWars::GameLogic::ChaseCamera, 86
GalaxyWars::GameLogic::Input, 171
GalaxyWars::GameLogic::Player, 276
GalaxyWars::GameLogic::ScreenshotCapturer,
318
GalaxyWars::GameLogic::SpaceshipPhysics,
353
GalaxyWars::Graphics::BaseGame, 56
GalaxyWars::Particles::ParticleEmitter, 256
GalaxyWars::Particles::ParticleSystem, 266
GalaxyWars::Scenes::Asteroids, 29
GalaxyWars::Shaders::ShaderEffect, 330
GalaxyWars::Sounds::Sound, 345
UpdateCarInMenu
GalaxyWars::Graphics::UIRenderer, 400
UpdateCarMatrixAndCamera
GalaxyWars::GameLogic::SpaceshipPhysics,
359
UpdateMatrix
GalaxyWars::Scenes::Asteroid, 25
UpdateVertexBuffer
GalaxyWars::Graphics::LineManager2D, 195
GalaxyWars::Graphics::LineManager3D, 205
UpdateViewMatrix
GalaxyWars::GameLogic::ChaseCamera, 84
usedTechnique
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
238
useHighDetail
GalaxyWars::GameScreens::Options, 254
UsePostScreenShaders
GalaxyWars::Graphics::BaseGame, 67
usePostScreenShaders
GalaxyWars::GameScreens::Options, 254
GalaxyWars::Graphics::BaseGame, 64
useShadowMapping
GalaxyWars::GameScreens::Options, 254
UsesHighPercisionFormat
GalaxyWars::Shaders::RenderToTexture, 313
usesHighPercisionFormat
GalaxyWars::Shaders::RenderToTexture, 312
uv
GalaxyWars::Graphics::TangentVertex, 372
GalaxyWars::Graphics::TangentVertex, 373
UI
V
GalaxyWars::Graphics::BaseGame, 67
ui
GalaxyWars::Graphics::BaseGame, 61
UIRenderer
GalaxyWars::Graphics::UIRenderer, 397
UIRenderer.cs, 476
Update
GalaxyWars::GalaxyWarsManager, 139
GalaxyWars::Graphics::TangentVertex, 373
Valid
GalaxyWars::Graphics::Texture, 135
GalaxyWars::Shaders::ShaderEffect, 336
VBScreen
GalaxyWars::Shaders::VBScreenHelper::VBScreen,
424
vbScreen
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
INDEX
509
GalaxyWars::Shaders::VBScreenHelper::VBScreen, GalaxyWars::Shaders::ShaderEffect, 333
425
ViewProjectionMatrix
VBScreenHelper.cs, 477
GalaxyWars::Graphics::BaseGame, 71
vbScreenInstance
ViewProjMatrix
GalaxyWars::Shaders::VBScreenHelper, 419
GalaxyWars::Shaders::ShaderEffect, 337
Vector3Helper
virtualRotationAmount
GalaxyWars::Helpers::Vector3Helper, 426
GalaxyWars::GameLogic::SpaceshipPhysics,
Vector3Helper.cs, 478
363
Velocity
wannaCameraDistance
GalaxyWars::Particles::ParticleVertex, 273
GalaxyWars::GameLogic::ChaseCamera, 87
vertexBuffer
wannaCameraLookVector
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
GalaxyWars::GameLogic::ChaseCamera, 87
238
wannaHaveCameraRotation
GalaxyWars::Particles::ParticleSystem, 271
GalaxyWars::Shaders::VBScreenHelper::GridScreen, GalaxyWars::GameLogic::ChaseCamera, 87
waveBank
422
GalaxyWars::Sounds::Sound, 346
vertexDecl
Width
GalaxyWars::Graphics::PrimitivesRenderer,
GalaxyWars::Graphics::BaseGame, 68
298
GalaxyWars::Graphics::Texture, 134
VertexDeclaration
windowSize
GalaxyWars::Graphics::TangentVertex, 373
GalaxyWars::Shaders::PostScreenMenu, 289
vertexDeclaration
WindowsTitle
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
GalaxyWars::Graphics::BaseGame, 66
238
WobbelCamera
GalaxyWars::Particles::ParticleSystem, 271
GalaxyWars::GameLogic::ChaseCamera, 81
VertexElements
world
GalaxyWars::Graphics::TangentVertex, 373
GalaxyWars::Shaders::ShaderEffect, 333
GalaxyWars::Particles::ParticleVertex, 273
WorldMatrix
vertexStride
GalaxyWars::Graphics::BaseGame, 70
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
GalaxyWars::Shaders::ShaderEffect, 337
239
worldMatrix
verticalRotationAmount
GalaxyWars::Graphics::BaseGame, 62
GalaxyWars::GameLogic::SpaceshipPhysics,
WorldParameter
364
GalaxyWars::Shaders::ShaderEffect, 337
verticalRotationChange
worldParameter
GalaxyWars::GameLogic::SpaceshipPhysics,
GalaxyWars::Graphics::MeshRenderManager::RenderableMesh,
364
238
Vertices
worldViewProj
GalaxyWars::Scenes::Asteroid, 24
GalaxyWars::Shaders::ShaderEffect, 333
GalaxyWars::Scenes::Asteroids, 29
WorldViewProjectionMatrix
Victory
GalaxyWars::Graphics::BaseGame, 71
GalaxyWars::Sounds::Sound, 342
WorldViewProjMatrix
ViewableFieldOfView
GalaxyWars::Shaders::ShaderEffect, 337
GalaxyWars::Graphics::BaseGame, 61
Write
viewDistance
GalaxyWars::Helpers::Log, 213
GalaxyWars::GameLogic::SpaceshipPhysics,
WriteAll
363
GalaxyWars::Graphics::TextureFont, 380
viewInverse
WriteDigit
GalaxyWars::Shaders::ShaderEffect, 333
GalaxyWars::Graphics::TextureFontBigNumbers,
ViewMatrix
387, 388
GalaxyWars::Graphics::BaseGame, 70
WriteGameTime
viewMatrix
GalaxyWars::Graphics::TextureFont, 379
GalaxyWars::Graphics::BaseGame, 62
viewProj
WriteMatrix
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen
510
INDEX
GalaxyWars::Helpers::FileHelper, 101
GalaxyWars::GameLogic::ChaseCamera, 88
ZBufferSurface
WriteNumber
GalaxyWars::Shaders::RenderToTexture, 313
GalaxyWars::Graphics::TextureFontBigNumbers,
zBufferSurface
388, 389
GalaxyWars::Shaders::RenderToTexture, 312
WriteNumberCentered
GalaxyWars::Graphics::TextureFontBigNumbers,ZoomInTime
GalaxyWars::GameLogic::BasePlayer, 75
390
zoomInTime
writer
GalaxyWars::GameLogic::BasePlayer, 75
GalaxyWars::Helpers::Log, 214
WriteText
GalaxyWars::Graphics::TextureFont, 378
WriteTextCentered
GalaxyWars::Graphics::TextureFont, 379
WriteVector3
GalaxyWars::Helpers::FileHelper, 100
WriteVector4
GalaxyWars::Helpers::FileHelper, 100
x
GalaxyWars::Graphics::TextureFont::FontToRender,
384
XAxis
GalaxyWars::GameLogic::ChaseCamera, 88
xnaModel
GalaxyWars::Graphics::Model, 120
XnaTexture
GalaxyWars::Graphics::Texture, 135
GalaxyWars::Shaders::RenderToTexture, 313
XnaUserDevice
GalaxyWars::Helpers::FileHelper, 103
xnaUserDevice
GalaxyWars::Helpers::FileHelper, 103
XToRes
GalaxyWars::Graphics::BaseGame, 43
XToRes1400
GalaxyWars::Graphics::BaseGame, 44
XToRes1600
GalaxyWars::Graphics::BaseGame, 44
y
GalaxyWars::Graphics::TextureFont::FontToRender,
384
YAxis
GalaxyWars::GameLogic::ChaseCamera, 88
YToRes
GalaxyWars::Graphics::BaseGame, 43
YToRes1050
GalaxyWars::Graphics::BaseGame, 45
YToRes1200
GalaxyWars::Graphics::BaseGame, 44
YToRes768
GalaxyWars::Graphics::BaseGame, 43
ZAxis
Generated on Tue May 13 00:00:38 2008 for Galaxy Wars by Doxygen