refactor: separate window from opengl::context

Extract GLFW window management into a dedicated cbt::window
class (new files in cbt/). The opengl::context now only
handles GLAD setup and context activation (no more window
creation or GLFW init/terminate).

Updated main loop in cuber.cpp, CMakeLists.txt (to build
the new source), and AGENTS.md (docs + source layout).

Addresses the design note in context.cpp about mixing
concerns.
This commit is contained in:
2026-05-05 23:37:19 +02:00
parent 7a81b30d32
commit 22d2bb1c40
7 changed files with 140 additions and 93 deletions
+4 -2
View File
@@ -34,7 +34,7 @@ To add a new dependency:
The project is split into static libraries:
- **`cbt_opengl`** — OpenGL abstraction (context, buffer, texture, vao, shader, descriptor)
- **`cbt_opengl`** — OpenGL abstraction and window management (window, context, buffer, texture, vao, shader, descriptor)
- **`cbt_scene`** — Base scene class
- **`scenes_cube`** — Cube scene implementation
@@ -102,8 +102,10 @@ cuber/
cbt/ # Project namespace (utilities)
scene.hpp # Base scene class
scene.cpp # Scene implementation
window.hpp # GLFW window RAII wrapper
window.cpp # Window implementation
opengl/ # OpenGL abstraction layer
context.hpp # OpenGL context RAII wrapper
context.hpp # OpenGL context RAII wrapper (GLAD setup)
context.cpp # Context implementation
buffer.hpp # Buffer resource (VBO, EBO, UBO, SSBO)
buffer.cpp # Buffer implementation