From 8dad985328e2183b224300aa992951131956fdb3 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 23 Jan 2024 13:12:11 +0100 Subject: core,codec-json,codec-minecraft,codec-netcdf,codec,io-tls,io,io_codec,window,window-opengl: Renamed file endings and changed includes --- modules/window-opengl/gl_backends.h | 10 ------ modules/window-opengl/gl_backends.hpp | 10 ++++++ modules/window-opengl/gl_context.h | 43 ---------------------- modules/window-opengl/gl_context.hpp | 43 ++++++++++++++++++++++ modules/window-opengl/gl_window.h | 8 ----- modules/window-opengl/gl_window.hpp | 8 +++++ modules/window-opengl/gl_xcb.h | 68 ----------------------------------- modules/window-opengl/gl_xcb.hpp | 68 +++++++++++++++++++++++++++++++++++ 8 files changed, 129 insertions(+), 129 deletions(-) delete mode 100644 modules/window-opengl/gl_backends.h create mode 100644 modules/window-opengl/gl_backends.hpp delete mode 100644 modules/window-opengl/gl_context.h create mode 100644 modules/window-opengl/gl_context.hpp delete mode 100644 modules/window-opengl/gl_window.h create mode 100644 modules/window-opengl/gl_window.hpp delete mode 100644 modules/window-opengl/gl_xcb.h create mode 100644 modules/window-opengl/gl_xcb.hpp (limited to 'modules/window-opengl') diff --git a/modules/window-opengl/gl_backends.h b/modules/window-opengl/gl_backends.h deleted file mode 100644 index 652954f..0000000 --- a/modules/window-opengl/gl_backends.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -namespace saw { -namespace gfx { -namespace backend { -struct gl_linux_xcb {}; -struct gl_wasm {}; -} -} -} diff --git a/modules/window-opengl/gl_backends.hpp b/modules/window-opengl/gl_backends.hpp new file mode 100644 index 0000000..652954f --- /dev/null +++ b/modules/window-opengl/gl_backends.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace saw { +namespace gfx { +namespace backend { +struct gl_linux_xcb {}; +struct gl_wasm {}; +} +} +} diff --git a/modules/window-opengl/gl_context.h b/modules/window-opengl/gl_context.h deleted file mode 100644 index 685e527..0000000 --- a/modules/window-opengl/gl_context.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -namespace saw { -namespace gfx { -class gl_settings { -public: - uint8_t gl_major = 3; - uint8_t gl_minor = 3; - - enum class render_type : int32_t { rgba }; - - render_type render_t = render_type::rgba; - - bool renderable = true; - - bool window_type = true; - - enum class drawable_type : int32_t { - window_bit = 0x01, - pixmap_bit = 0x02, - pbuffer_bit = 0x04 - }; - - drawable_type drawable_t = drawable_type::window_bit; - - bool double_buffer = true; - int red_bits = 8; - int green_bits = 8; - int blue_bits = 8; - int alpha_bits = 8; - - int depth_bits = 24; - int stencil_bits = 8; - - bool core_profile = true; -}; - -template -class gpu_context; - - -} -} diff --git a/modules/window-opengl/gl_context.hpp b/modules/window-opengl/gl_context.hpp new file mode 100644 index 0000000..685e527 --- /dev/null +++ b/modules/window-opengl/gl_context.hpp @@ -0,0 +1,43 @@ +#pragma once + +namespace saw { +namespace gfx { +class gl_settings { +public: + uint8_t gl_major = 3; + uint8_t gl_minor = 3; + + enum class render_type : int32_t { rgba }; + + render_type render_t = render_type::rgba; + + bool renderable = true; + + bool window_type = true; + + enum class drawable_type : int32_t { + window_bit = 0x01, + pixmap_bit = 0x02, + pbuffer_bit = 0x04 + }; + + drawable_type drawable_t = drawable_type::window_bit; + + bool double_buffer = true; + int red_bits = 8; + int green_bits = 8; + int blue_bits = 8; + int alpha_bits = 8; + + int depth_bits = 24; + int stencil_bits = 8; + + bool core_profile = true; +}; + +template +class gpu_context; + + +} +} diff --git a/modules/window-opengl/gl_window.h b/modules/window-opengl/gl_window.h deleted file mode 100644 index 3bb9f83..0000000 --- a/modules/window-opengl/gl_window.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -namespace saw { -namespace gfx { -template -class gpu_window; -} -} diff --git a/modules/window-opengl/gl_window.hpp b/modules/window-opengl/gl_window.hpp new file mode 100644 index 0000000..3bb9f83 --- /dev/null +++ b/modules/window-opengl/gl_window.hpp @@ -0,0 +1,8 @@ +#pragma once + +namespace saw { +namespace gfx { +template +class gpu_window; +} +} diff --git a/modules/window-opengl/gl_xcb.h b/modules/window-opengl/gl_xcb.h deleted file mode 100644 index 0d84662..0000000 --- a/modules/window-opengl/gl_xcb.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include - -#ifndef SAW_OGL -#error "OpenGL is not supported" -#endif - -#include "gl_backends.h" -#include "gl_context.h" -#include "gl_window.h" - -#include - -namespace saw { -namespace gfx { - -struct glx_library_extensions { -public: - std::string_view raw_extension_string; - GLXContext (*glXCreateContextAttribsARB)(Display*, GLXFBConfig, GLXContext, Bool, const int*) = nullptr; -}; - -template<> -class gpu_context final { -private: - glx_library_extensions ext_lib_; - own> device_; - int visual_id_; - GLXContext context_; - GLXFBConfig fb_config_; - - friend class gpu_window; -public: - gpu_context(const glx_library_extensions&, own>, int, GLXContext, GLXFBConfig); - ~gpu_context(); - - own> create_window(const video_mode&, std::string_view); - - void flush(); -}; - -template<> -class gpu_window final { -private: - own> window_; - gpu_context* context_; - - ::GLXWindow glx_window_handle_; -public: - gpu_window(own> window, gpu_context& ctx, - ::GLXWindow); - ~gpu_window(); - - void bind(); - void swap(); - void show(); - void hide(); - - const video_mode& get_video_mode() const; - const std::string_view get_title() const; - - void resize(size_t height, size_t width); - - conveyor> on_event(); -}; -} -} diff --git a/modules/window-opengl/gl_xcb.hpp b/modules/window-opengl/gl_xcb.hpp new file mode 100644 index 0000000..a737e41 --- /dev/null +++ b/modules/window-opengl/gl_xcb.hpp @@ -0,0 +1,68 @@ +#pragma once + +#include + +#ifndef SAW_OGL +#error "OpenGL is not supported" +#endif + +#include "gl_backends.hpp +#include "gl_context.hpp +#include "gl_window.hpp + +#include + +namespace saw { +namespace gfx { + +struct glx_library_extensions { +public: + std::string_view raw_extension_string; + GLXContext (*glXCreateContextAttribsARB)(Display*, GLXFBConfig, GLXContext, Bool, const int*) = nullptr; +}; + +template<> +class gpu_context final { +private: + glx_library_extensions ext_lib_; + own> device_; + int visual_id_; + GLXContext context_; + GLXFBConfig fb_config_; + + friend class gpu_window; +public: + gpu_context(const glx_library_extensions&, own>, int, GLXContext, GLXFBConfig); + ~gpu_context(); + + own> create_window(const video_mode&, std::string_view); + + void flush(); +}; + +template<> +class gpu_window final { +private: + own> window_; + gpu_context* context_; + + ::GLXWindow glx_window_handle_; +public: + gpu_window(own> window, gpu_context& ctx, + ::GLXWindow); + ~gpu_window(); + + void bind(); + void swap(); + void show(); + void hide(); + + const video_mode& get_video_mode() const; + const std::string_view get_title() const; + + void resize(size_t height, size_t width); + + conveyor> on_event(); +}; +} +} -- cgit v1.2.3