Skip to content

1716285375/ZGhostEscape

Repository files navigation

GhostEscape

A C++ game project built with SDL3, GLM, and other libraries.

Project Structure

GhostEscape/
├── GhostEscape/           # Main project directory
│   ├── src/              # Source code
│   │   ├── Core/         # Core game classes (Game, Scene, Object)
│   │   ├── Common/       # Utility functions
│   │   ├── main.cpp      # Entry point
│   │   ├── SceneMain.cpp # Main scene implementation
│   │   └── SceneMain.h   # Main scene header
│   └── vendor/           # Third-party libraries
│       ├── SDL3-devel-3.2.24/    # SDL3 core library
│       ├── SDL3_image-3.2.4/     # SDL3 image loading
│       ├── SDL3_mixer/           # SDL3 audio mixing
│       ├── SDL3_ttf-3.2.2/       # SDL3 font rendering
│       ├── glm/                  # OpenGL Mathematics library
│       ├── imgui-docking/        # Dear ImGui (UI library)
│       └── box2d-main/           # Box2D physics engine
├── premake5.lua          # Premake build configuration
├── generate_project.bat  # Script to generate Visual Studio project
└── README.md             # This file

Dependencies

  • SDL3: Window management, rendering, input handling
  • SDL3_image: Image loading (PNG, JPG, etc.)
  • SDL3_mixer: Audio mixing and playback
  • SDL3_ttf: Font rendering
  • GLM: Mathematics library for vectors and matrices
  • Box2D: Physics engine (available but not currently used)
  • Dear ImGui: Immediate mode GUI (available but not currently used)

Building with Premake

Prerequisites

  1. Premake5: Download from https://premake.github.io/download.html

    • Place premake5.exe in the project root directory
  2. Visual Studio 2022: With C++ development tools installed

Build Steps

  1. Generate Project Files:

    generate_project.bat

    Or manually:

    premake5.exe vs2022
  2. Open in Visual Studio:

    • Open GhostEscape.sln in Visual Studio 2022
    • Select Debug or Release configuration
    • Build the solution (Ctrl+Shift+B)
  3. Run the Game:

    • The executable will be in bin/Debug-windows-x64/GhostEscape/ or bin/Release-windows-x64/GhostEscape/
    • All required DLLs are automatically copied to the output directory

Project Architecture

Core Classes

  • Game: Singleton class managing the main game loop, SDL initialization, and scene management
  • Scene: Base class for game scenes with camera support
  • SceneMain: Main game scene implementation
  • Object: Base class for all game objects
  • Utils: Static utility functions for rendering

Key Features

  • Scene-based architecture
  • Camera system with world coordinates
  • Grid rendering system
  • Boundary drawing utilities
  • Singleton game instance pattern
  • SDL3-based rendering pipeline

Development Notes

  • The project uses C++17 standard
  • All paths in premake5.lua are relative to the project root
  • DLLs are automatically copied to the output directory during build
  • The project is configured for x64 architecture only

Troubleshooting

Common Issues

  1. "premake5.exe not found":

    • Download premake5 from the official website
    • Place the executable in the project root directory
  2. Missing DLLs:

    • Ensure all vendor libraries are properly extracted
    • Check that the premake5.lua paths are correct
  3. Build Errors:

    • Verify Visual Studio 2022 is installed with C++ tools
    • Check that all include directories in premake5.lua are valid

Adding New Files

When adding new source files:

  1. Add them to the files section in premake5.lua
  2. Regenerate the project files with generate_project.bat
  3. Rebuild the solution in Visual Studio

About

ZGhostEscape 是一个 2D 动作游戏。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published