Skip to content

dvdphobia/Console

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Console Engine

A custom game engine built with bgfx, SDL3, and ImGui.

Project Structure

Console/
├── vendor/                 # Third-party libraries
│   ├── bgfx/              # bgfx rendering library (with bx and bimg)
│   ├── sdl/               # SDL3 for windowing and input
│   └── imgui/             # Dear ImGui for debug UI
├── src/
│   ├── engine/            # Core engine library
│   │   ├── core/          # Application, Window, Logger, Timer
│   │   ├── graphics/      # Renderer (bgfx wrapper)
│   │   ├── input/         # Input management
│   │   └── audio/         # Audio system (TODO)
│   ├── framework/         # Game framework
│   │   ├── Scene.h/cpp    # Scene management
│   │   ├── Entity.h/cpp   # Entity with components
│   │   ├── Component.h/cpp# Component base class
│   │   └── GameLoop.h/cpp # Scene stack management
│   ├── game/              # Example game
│   │   ├── main.cpp       # Entry point
│   │   └── Game.cpp       # Game implementation
│   └── Engine.h           # Main include header
├── assets/                # Game assets (textures, shaders, etc.)
├── build/                 # Build output
└── CMakeLists.txt         # CMake build configuration

Building

Prerequisites

  • CMake 3.20 or higher
  • Visual Studio 2022 (Windows) or GCC/Clang (Linux/macOS)
  • Git (for cloning dependencies)

Build Steps

# Configure
cmake -B build -S .

# Build
cmake --build build --config Release

# Run
./build/bin/Release/Game.exe  # Windows
./build/bin/Game              # Linux/macOS

Features

Engine

  • Application: Main application loop with initialization and shutdown
  • Window: SDL3-based window management
  • Renderer: bgfx-based rendering (supports DirectX, OpenGL, Vulkan, Metal)
  • Input: Keyboard and mouse input handling
  • Logger: Console and file logging with colored output
  • Timer: Delta time and FPS tracking

Framework

  • Scene: Container for entities with lifecycle callbacks
  • Entity: Game object with transform and components
  • Component: Attachable behavior/data for entities
  • GameLoop: Scene stack management

Third-Party Libraries

  • bgfx: Cross-platform rendering library
  • SDL3: Window creation, input, and platform abstraction
  • ImGui: Immediate mode GUI for debug tools

Usage Example

#include "Engine.h"

class MyGame : public Engine::Application {
public:
    MyGame() : Application({"My Game", 1920, 1080}) {}

protected:
    void OnInit() override {
        // Initialize your game
    }

    void OnUpdate(float deltaTime) override {
        // Update game logic
    }

    void OnRender() override {
        // Render your game
    }

    void OnImGui() override {
        // Debug UI
        ImGui::Begin("Debug");
        ImGui::Text("Hello, World!");
        ImGui::End();
    }
};

int main() {
    MyGame game;
    game.Run();
    return 0;
}

License

This project is for educational purposes.

About

A lightweight C++ game engine built with SDL3, bgfx, and ImGui

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published