Skip to content

Project Structure

CatIsNotFound edited this page Feb 20, 2026 · 2 revisions

Project Structure

The following is the directory structure of this project:

MyEngine
├── assets              # Original repository image resources
├── ChangeLog.md        # English change log
├── ChangeLog_zh.md     # Chinese change log
├── cmake               # CMake configuration files
├── CMakeLists.txt      # Main CMake configuration file
├── docs                # Documentation directory (incomplete)
│   ├── en
│   ├── zh_SC
│   └── zh_TC
├── libs                # Third-party dependency library directory
├── LICENSE             # Project license
├── README.md           # English project introduction
├── README_zh.md        # Chinese project introduction
├── src                 # Project source code directory
│   ├── Algorithm         # Algorithm-related source code directory
│   ├── Basic.h           # Basic header file
│   ├── Components.cpp/h  # Component-related source code
│   ├── Core.cpp/h        # Core source code
│   ├── Exception.h       # Exception header file
│   ├── Game              # Game-related source code directory (incomplete, only contains basic components)
│   ├── Libs.h            # Library header file directory (contains required libraries)
│   ├── MultiThread       # Multi-threading related (only contains related components and directly usable modules)
│   ├── MyEngine          # Total project import file (including this file equals including all)
│   ├── Renderer          # Renderer-related source code directory
│   ├── Template          # Template-related source code directory
│   ├── Utils             # Utility-related source code directory (contains many necessary utilities)
│   └── Widgets           # Widget-related source code directory (incomplete, only contains basic components)
|   └── ...        
├── templates           # Example templates, can be directly copied
└── test                # Test directory

Related Module Explanation

The MyEngine project uses modular design to separate components with different functions. Each component depends on each other, forming an extensible project. The code is organized according to different modules, each responsible for specific functions. Details are as follows:

Kernel Modules

  • Engine: Manages the operation of the entire application, including metadata management, event system, window management, text system, audio system, etc.; this is the foundation of everything.
  • Window: Used to manage windows, including basic operations such as creation, destruction, display, and hiding.
  • Renderer: Used to render graphics, text, and other content to the specified window.
  • EventSystem: Used to manage and handle all events being executed in the engine (including normal events and global events). Mainly uses a mapping table approach, using corresponding event IDs as keys to handle corresponding events.
  • TextSystem: Used to manage and render text to the specified window. Mainly implemented through the SDL_ttf library.
  • AudioSystem: Used to manage and play audio files. Mainly implemented through the SDL_mixer library.

Basic Components

  • Font: Used to manage font files, supporting basic functions such as setting font size, font style, and rendering fonts. Mainly implemented through the SDL_ttf library.
  • FontDatabase: Used to manage all fonts in the system, supporting obtaining corresponding font file paths based on font names. Usually uses FontMap to store the mapping relationship between font names and font file paths.
  • BGM: Used to manage and play background music, which can be used like a player. Mainly implemented through the SDL_mixer library.
  • SFX: Used to manage and play sound effect files, supporting managing and playing multiple sound effects simultaneously. Mainly implemented through the SDL_mixer library.
  • Texture: Used to manage and render textures to the specified window.
  • TextureProperty: Used to store texture properties. Used to manage individual textures in detail, such as setting texture position, size, rotation angle, scaling, cropping, color channels, etc. in the window.
  • TextureAtlas: Used to crop individual textures into multiple tiles to reduce texture loading times and improve rendering efficiency. Suitable for rendering static elements in games (such as characters, props, maps, etc.).
  • TextureAnimation: Used to manage and render texture animations. Mainly implemented through the SDL_image library, supporting loading GIF sequence animation files. Each animation frame is a separate texture, and animation effects are achieved by switching different textures.
  • Timer: Used to manage and trigger timed events. Implemented through multi-threading.
  • Trigger: Used to manage and trigger events through trigger conditions. Implemented through multi-threading.

Basic Abstractions

  • Vector2: Used to represent 2D vectors, containing x and y components.
  • Size: Used to represent 2D dimensions, containing width and height components.
  • GeometryF: Used to represent 2D geometric shapes, containing position and size properties. Implemented based on Vector2 and Size.
  • Geometry: Used to represent 2D geometric shapes, containing position and size properties. Uses int type.
  • Matrix2D: Used to represent 2D matrices. Supports storing any data type and implementing higher-order functions and operations.
  • Graphics: Graphics module, containing abstract classes for 2D graphics. Mainly includes classes such as Point, Line, Rectangle, Ellipse, etc.

Clone this wiki locally