A modern C++20 application framework for OpenGL applications, providing essential infrastructure for window management, rendering, logging, and event handling.
- Application Framework - Complete application lifecycle management with layer-based architecture
- Window Management - GLFW-based window wrapper with framebuffer callbacks and OpenGL context
- Texture System - RAII-based OpenGL texture management
- Logging - Powerful spdlog-based logging system with source location tracking
- Event System - Type-safe event bus for decoupled communication
- Layer Architecture - Composable layer system for organizing rendering and update logic
Application- Main application class managing window, layers, and render loopWindow- GLFW window wrapper with OpenGL context managementLayer- Abstract base class for application layers (UI, rendering, etc.)EventBus- Type-safe publish-subscribe event systemLogger- Singleton logging system with multiple log levelsTexture- RAII OpenGL texture wrapper
- GLFW 3 - Window and input management
- glad - OpenGL loader
- glm - OpenGL Mathematics library
- spdlog - Fast C++ logging library
All dependencies are managed via vcpkg.
- C++20 compatible compiler
- CMake 3.26+
- vcpkg (for dependency management)
cd your-project
git submodule add https://github.com/yourusername/kappa-core.git external/kappa-core
git submodule update --init --recursive# Add kappa-core subdirectory
add_subdirectory(external/kappa-core)
# Link against Core library
target_link_libraries(YourApp PRIVATE Core)#include "Application.h"
#include "Layer.h"
class MyLayer : public Kappa::Layer
{
public:
void OnUpdate(float deltaTime) override
{
// Update logic here
}
void OnRender() override
{
// Rendering logic here
}
};
int main()
{
Kappa::ApplicationSpecification spec;
spec.name = "My Application";
spec.width = 1280;
spec.height = 720;
Kappa::Application app(spec);
app.PushLayer(std::make_shared<MyLayer>());
app.Run();
return 0;
}#include "Logger.h"
// Simple logging
LOG_INFO("Application started");
LOG_WARN("Warning message");
LOG_ERROR("Error occurred: {}", errorCode);
// Logging with source location
LOG_DEBUG("Debug info at {}:{}", __FILE__, __LINE__);#include "EventBus.h"
#include "Event.h"
// Define custom event
struct MyEvent : public Kappa::Event
{
int data;
};
// Subscribe to events
auto& eventBus = app.GetEventBus();
eventBus.Subscribe<MyEvent>([](const MyEvent& event) {
LOG_INFO("Received event with data: {}", event.data);
});
// Publish events
eventBus.Publish(MyEvent{42});#include "Texture.h"
// Load texture from file (requires image loading library)
Kappa::Texture texture;
// ... load image data ...
texture.Create(width, height, imageData);
// Use texture
glBindTexture(GL_TEXTURE_2D, texture.GetID());Application::Run()
├── Initialize Window
├── Load Resources
└── Main Loop
├── Process Events
├── Update Layers (OnUpdate)
├── Render Layers (OnRender)
└── Swap Buffers
Layers are processed in the order they're added:
- Update Phase - Each layer's
OnUpdate()is called - Render Phase - Each layer's
OnRender()is called
Layers can be used for:
- UI rendering (ImGui, etc.)
- Game world rendering
- Debug overlays
- Post-processing effects
See the examples/ directory for complete sample applications:
minimal- Bare minimum applicationlogging- Logging system demonstrationlayers- Multi-layer renderingevents- Event bus usage
# Configure
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]/scripts/buildsystems/vcpkg.cmake
# Build
cmake --build build
# Run tests
ctest --test-dir buildKappa-core includes comprehensive unit tests using Google Test framework.
# Using CMake presets
cmake --preset Debug-vcpkg
cmake --build --preset Debug-vcpkg
ctest --preset Debug-vcpkg
# Or manually
cd build
ctest --output-on-failureCode coverage analysis is available using LLVM tools (requires llvm-profdata and llvm-cov).
# Enable coverage in CMake
cmake --preset Debug-coverage -DENABLE_COVERAGE=ON
# Run coverage analysis (automated)
python scripts/run-coverage.py
# Or manually using CMake targets
cmake --build build --target kappa-coverage-html
cmake --build build --target kappa-coverage-open # Opens HTML reportCurrent Coverage: ~39% (73/81 tests passing)
- Function Coverage: 39.29% (22/56)
- Line Coverage: 38.92% (151/388)
- Branch Coverage: 35.37% (29/82)
- TestSimple.cpp - Basic sanity tests (4 tests)
- TestEventBus.cpp - Event system tests (15 tests)
- TestLayer.cpp - Layer lifecycle tests (15 tests)
- TestWindow.cpp - Window specification tests (12 tests)
- TestWindowStatePersistence.cpp - JSON persistence tests (15 tests)
- TestApplication.cpp - Application framework tests (20 tests, 8 disabled due to MSVC allocator issues)
Total: 81 tests (73 passing, 8 disabled)
kappa-core/
├── include/ # Public headers
│ ├── Application.h # Main application framework
│ ├── Window.h # GLFW window wrapper
│ ├── Layer.h # Layer base class
│ ├── EventBus.h # Event system
│ ├── Logger.h # Logging system
│ ├── Texture.h # OpenGL texture wrapper
│ └── Event.h # Event base class
├── src/ # Implementation files
│ ├── Application.cpp
│ ├── Window.cpp
│ ├── WindowStatePersistence.cpp
│ └── Texture.cpp
├── tests/ # Unit tests (Google Test)
│ ├── TestSimple.cpp
│ ├── TestEventBus.cpp
│ ├── TestLayer.cpp
│ ├── TestWindow.cpp
│ ├── TestWindowStatePersistence.cpp
│ ├── TestApplication.cpp
│ └── README.md
├── cmake/ # CMake modules
│ └── CodeQuality.cmake # Coverage & quality targets
├── scripts/ # Utility scripts
│ └── run-coverage.py # Automated coverage analysis
├── examples/ # Example applications
├── CMakeLists.txt # Build configuration
├── vcpkg.json # Dependency manifest
├── README.md # This file
└── TESTING.md # Testing documentation
- Modern C++ - Leverages C++20 features for clean, expressive code
- RAII - Resource management through constructors/destructors
- Minimal Dependencies - Only essential libraries, all via vcpkg
- Type Safety - Strong typing, compile-time checks where possible
- Composability - Layer system allows mixing different concerns
- Zero-Cost Abstractions - Thin wrappers with minimal overhead
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - see LICENSE file for details
Built with:
- Application framework with layer system
- Window management with GLFW
- Logging system with spdlog
- Event bus for type-safe events
- OpenGL texture wrapper
Made with ❤️ for building modern C++ applications