context and frame buffer

main
Brett 2024-04-16 02:43:51 -04:00
parent cd7c34cb16
commit 722ae6fa6f
5 changed files with 56 additions and 6 deletions

View File

@ -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})

View File

@ -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);

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
#ifndef BLT_WITH_GRAPHICS_FRAMEBUFFER_H
#define BLT_WITH_GRAPHICS_FRAMEBUFFER_H
namespace blt::gfx
{
}
#endif //BLT_WITH_GRAPHICS_FRAMEBUFFER_H

View File

@ -31,13 +31,14 @@ namespace blt::gfx
std::string title;
std::int32_t width;
std::int32_t height;
std::function<void()> init;
std::function<void(std::int32_t, std::int32_t)> update;
std::function<void(window_context&)> init;
std::function<void(window_context&, std::int32_t, std::int32_t)> update;
window_context context{};
std::int32_t sync_interval = 0;
window_data(std::string title, std::function<void()> init, std::function<void(std::int32_t, std::int32_t)> update, std::int32_t width = 640,
window_data(std::string title, std::function<void(window_context&)> init,
std::function<void(window_context&, std::int32_t, std::int32_t)> 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))
{}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
#include <blt/gfx/framebuffer.h>
namespace blt::gfx
{
}