View XNA Framework Notes
I'm going through the WROX press book "Professional XNA Game Programming for XBox 360 and Windows", written by Benjamin Nitschke. Now that I have some perspective on how non-ideal Managed Direct X was, I am finding this pass through the book to be more enlightening. I'm taking notes on things I am discovering as I read through the book.
On a side note, there's an Application Model Overview in the XNA Game Studio 2.0 docs (available after you install XNA Game Studio 2.0).
Game class
This is the top-level class provided by the XNA Framework. Provides basic graphics device initialization, game logic, rendering code, and a game loop. It has basic game time also, supporting fixed or variable time steps.
Important Internal Objects
- Components - collection of GameComponent, which are code module class for Update, Draw, and Dispose interfaces
- Content - instance to ContentManager, which loads assets processed by the Content Pipeline. Only has Load<T>() and Unload() method handling: Model, Effect, SpriteFont, Texture, Texture2D, Texture3D and TextureCube.
- GraphicsDevice - Primitive-based rendering, shader creation, related resource management
- Services
- Window
Important Methods
The main public methods below form the basic game logic:
- Focus Events: OnActivated(), OnDeactivated()
- Rendering: BeginDraw(), EndDraw()
- GameLoop: Tick(), Update()
- Initialization: Initialize(), BeginRun(), EndRun(), Finalize()
- Content Management: LoadContent(), LoadGraphicsContent(), UnloadContent(), UnloadGraphicsContent()
GraphicsDevice
Important Properties
- 3D Env: ClipPlanes, DepthStencilBuffer
- Current Render States: PixelShader, RenderState, VertexShader
- Vertex Processing: VertexDeclaration, Indices,
- Device Processing State: SoftwareVertexProcessing
- Resources: Textures, Vertices, VertexTextures
- Device Capabilities: DriverLevel, GraphicsDeviceCapabilities, GraphicsDeviceStatus
- Display Setting: DisplayMode, RasterStatus, CreationParameters
- Device Readiness: IsDisposed
Important Methods
- Buffer Management: Clear(), GetRenderTarget(), SetRenderTarget()
- Presentation: GetGammaRamp(), SetGammaRamp(), Present(), Reset()
- Resource Management: Dispose(), EvictManagedResources(), ResolveBackBuffer()
- Drawing: DrawIndexedPrimitive(), DrawPrimitives(), DrawUserIndexedPrimitives(), DrawUserPrimitives()
- PixelShader: SetPixelShaderConstant(), many GetPixelShader...() calls to access registers (?)
- VertexShader: SetVertexShaderConstant(), many GetVertexShader...() calls to access register (?)
