A minimal DirectX 11-based game framework written in C++. Provides core subsystems for window and device management, rendering, input handling, camera control, model/textures loading, and basic lighting with HLSL shaders.
- Project Overview
- Features
- Prerequisites
- Building & Running
- Project Structure
- Subsystems & Classes
- Assets & Shaders
- Usage Example
- Contributing
- License
This framework encapsulates common boilerplate needed to start a DirectX 11-powered application on Windows:
- Creates and manages the application window and message loop
- Initializes the Direct3D 11 device, swap chain, render target, and depth/stencil buffers
- Loads and renders static meshes and textures
- Supports camera movement and basic keyboard input
- Implements simple directional lighting and texture shaders
It is intended as a foundation for learning, experimentation, or rapid prototyping of small DirectX demos and games.
- Window & System Management (
SystemClass) - Direct3D Initialization (
D3DClass) - Model Loading & Rendering (
ModelClass) - Texture Loading (
TextureClass) - Camera Control (
CameraClass) - Keyboard Input Handling (
InputClass) - Basic Lighting (
LightClass) - HLSL Shaders (
Engine/light.vs/.ps,Engine/texture.vs/.ps) - Configurable via C++ headers and HLSL files
- Windows 10 or later (x64)
- Visual Studio 2019 or 2022 (Desktop Development with C++ workload)
- Windows 10 SDK (DirectX headers included) or legacy DirectX SDK (June 2010)
- Git (to clone the repository)
- Clone the repository:
git clone https://github.com/quimmedes/DirectX-Game-Framework.git cd DirectX-Game-Framework - Open
DirectX.slnin Visual Studio. - Select x64 and Debug (or Release) configuration.
- Build the solution (Ctrl+Shift+B).
- Run the
DirectXproject (F5).
A window will open rendering a textured 3D object with simple lighting.
/ (root)
├─ applicationclass.{h,cpp} # Entry point, window & message loop
├─ systemclass.{h,cpp} # Wraps Win32 initialization & shutdown
├─ d3dclass.{h,cpp} # Direct3D 11 device, context, swap chain
├─ cameraclass.{h,cpp} # View/projection matrix setup & movement
├─ inputclass.{h,cpp} # Keyboard state tracking
├─ modelclass.{h,cpp} # Mesh data loading & drawing
├─ textureclass.{h,cpp} # Texture loading
├─ lightclass.{h,cpp} # Lighting parameters
├─ lightshaderclass.{h,cpp} # HLSL shader compilation & rendering
├─ main.cpp # Application entry
├─ Engine/
│ ├─ *.vs, *.ps # HLSL vertex/pixel shaders
│ └─ data/ # Texture and model assets
└─ x64/Debug/ # Build artifacts
-
ApplicationClass
Orchestrates initialization, the main loop, rendering, and cleanup. -
SystemClass
Manages Win32 window creation, resizing, and message pump. -
D3DClass
Wraps Direct3D 11 initialization: device, swap chain, render target, depth buffer, and viewport. -
ModelClass
Loads.txtmesh data (vertex positions, UVs, normals) into vertex/index buffers. -
TextureClass
Loads texture assets (.tga) into shader resource views. -
CameraClass
Generates view and projection matrices; offers position and rotation controls. -
InputClass
Tracks keyboard state for real-time input queries. -
LightClass & LightShaderClass
Encapsulate directional/point light properties and compile HLSL shaders for basic per-pixel lighting.
Located under Engine/:
-
Shaders (
*.vs,*.ps):texture.vs/.ps: Basic textured renderinglight.vs/.ps: Textured rendering with lighting
-
Data:
.tgatextures.txtmesh definitions (cube, sphere, brick, stone)
After starting the application:
- Use W/A/S/D or arrow keys to move the camera.
- Observe textured 3D geometry lit by a directional light source.
Extend or replace HLSL shaders in Engine/ to experiment with custom effects.
- Fork the repository.
- Create a feature branch.
- Commit your changes with clear messages.
- Open a pull request.
This project is released under the MIT License. See LICENSE for details.