From 722ae6fa6fb9a21f55e98a6dbfde68a5596b8e65 Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 16 Apr 2024 02:43:51 -0400 Subject: [PATCH] context and frame buffer --- CMakeLists.txt | 2 +- examples/basic/basic.cpp | 4 ++-- include/blt/gfx/framebuffer.h | 27 +++++++++++++++++++++++++++ include/blt/gfx/window.h | 7 ++++--- src/blt/gfx/framebuffer.cpp | 22 ++++++++++++++++++++++ 5 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 include/blt/gfx/framebuffer.h create mode 100644 src/blt/gfx/framebuffer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e65d7d..c6ad609 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.25) -set(BLT_GRAPHICS_VERSION 0.9.11) +set(BLT_GRAPHICS_VERSION 0.9.12) set(BLT_GRAPHICS_TEST_VERSION 0.0.1) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) diff --git a/examples/basic/basic.cpp b/examples/basic/basic.cpp index 735886a..9deb172 100644 --- a/examples/basic/basic.cpp +++ b/examples/basic/basic.cpp @@ -25,7 +25,7 @@ blt::gfx::resource_manager resources; blt::gfx::batch_renderer_2d renderer_2d(resources); blt::gfx::first_person_camera camera; -void init() +void init(blt::gfx::window_context& context) { using namespace blt::gfx; @@ -35,7 +35,7 @@ void init() renderer_2d.create(); } -void update(std::int32_t width, std::int32_t height) +void update(blt::gfx::window_context& context, std::int32_t width, std::int32_t height) { global_matrices.update_perspectives(width, height, 90, 0.1, 2000); diff --git a/include/blt/gfx/framebuffer.h b/include/blt/gfx/framebuffer.h new file mode 100644 index 0000000..adca019 --- /dev/null +++ b/include/blt/gfx/framebuffer.h @@ -0,0 +1,27 @@ +#pragma once +/* + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef BLT_WITH_GRAPHICS_FRAMEBUFFER_H +#define BLT_WITH_GRAPHICS_FRAMEBUFFER_H + +namespace blt::gfx +{ + +} + +#endif //BLT_WITH_GRAPHICS_FRAMEBUFFER_H diff --git a/include/blt/gfx/window.h b/include/blt/gfx/window.h index b544c9a..df2a758 100644 --- a/include/blt/gfx/window.h +++ b/include/blt/gfx/window.h @@ -31,13 +31,14 @@ namespace blt::gfx std::string title; std::int32_t width; std::int32_t height; - std::function init; - std::function update; + std::function init; + std::function update; window_context context{}; std::int32_t sync_interval = 0; - window_data(std::string title, std::function init, std::function update, std::int32_t width = 640, + window_data(std::string title, std::function init, + std::function update, std::int32_t width = 640, std::int32_t height = 480): title(std::move(title)), width(width), height(height), init(std::move(init)), update(std::move(update)) {} diff --git a/src/blt/gfx/framebuffer.cpp b/src/blt/gfx/framebuffer.cpp new file mode 100644 index 0000000..5e9a8f1 --- /dev/null +++ b/src/blt/gfx/framebuffer.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include + +namespace blt::gfx +{ + +} \ No newline at end of file