diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/luma/main.hh | 65 | ||||
-rw-r--r-- | include/luma/stdlibsock/gfx.hh | 2 |
2 files changed, 43 insertions, 24 deletions
diff --git a/include/luma/main.hh b/include/luma/main.hh index 12aaf1d..11df184 100644 --- a/include/luma/main.hh +++ b/include/luma/main.hh @@ -1,39 +1,58 @@ -# if defined(__cplusplus) # if __cplusplus < 202002L -# error The compiler seems to not have support for C++20 or newer½ (__cplusplus is less than 202002L), which is required to build Luma. -# endif -# else -# error The compiler appears to not support C++ at all (__cplusplus is not defined). +# error The compiler seems to not have support for C++20 or newer (__cplusplus is less than 202002L), which is required to build Luma. # endif # if !defined(LUMA__HEADER__MAIN) # define LUMA__HEADER__MAIN -//# if defined(__linux__) -# define LUMA__USE_X -//# endif +# if !defined(LUMA__) +# if (defined(__DragonFlyBSD__) || defined(__FreeBSD__) || defined(__linux__)) +# define LUMA__X false +# else +# define LUMA__X true +# endif +# endif # include <cstdint> +# include <iostream> # include <luma/stdlibsock.hh> # include <luma/stdlibsock/gfx.hh> # include <string> -# if defined(LUMA__USE_X) +# include <vector> +# include <vulkan/vulkan.h> # include <wayland-client.h> -# else # include <xcb/xcb.h> -# endif using namespace std::literals::string_literals; namespace luma { - class dat_t { - public: - char * dispsrv; -# if defined(LUMA__USE_X) - wl_display * wldisp; - wl_shell_surface * wlsurf; + bool constexpr debug = +# if defined(NDEBUG) + false; # else - xcb_connection_t * xconn; - xcb_screen_t * xscrn; - xcb_window_t xwin; + true; # endif - }; - luma::dat_t extern dat; - void initgfx(uint32_t * retval); + bool constexpr usex = LUMA__X; + void inline dbgmsg(char const * msg) { + if constexpr(debug) { + std::cerr << msg; + } + } + void initgfx(); + void termgfx(); + class dat_t { + private: + bool gfxisinit; + std::vector<VkExtensionProperties> vkexts; + std::vector<VkPhysicalDevice> vkphysdevs; + ::VkApplicationInfo vkappinf {}; + ::VkInstance vkinst; + ::VkInstanceCreateInfo vkinstcrtinf {}; + ::VkResult vkreslt; + ::wl_buffer * wlbuff = nullptr; + ::wl_display * wldisp = nullptr; + ::wl_shell_surface * wlsurf = nullptr; + ::xcb_connection_t * xconn = nullptr; + ::xcb_screen_t * xscrn = nullptr; + ::xcb_window_t xwin; + friend void luma::initgfx(); + friend std::uint8_t luma::stdlibsock::gfx::crtwin(std::basic_string<char> nm,std::uint16_t pos_x,std::uint16_t pos_y,std::uint16_t res_x,std::uint16_t res_y,bool flscrn); + friend void luma::termgfx(); + } extern dat; } # endif diff --git a/include/luma/stdlibsock/gfx.hh b/include/luma/stdlibsock/gfx.hh index a9d7805..f44ba34 100644 --- a/include/luma/stdlibsock/gfx.hh +++ b/include/luma/stdlibsock/gfx.hh @@ -5,7 +5,7 @@ namespace luma { namespace stdlibsock { namespace gfx { - uint8_t crtwin(std::basic_string<char> nm, uint16_t pos_x, uint16_t pos_y, uint16_t res_x, uint16_t res_y, bool flscrn); + std::uint8_t crtwin(std::basic_string<char> nm, std::uint16_t pos_x, std::uint16_t pos_y, std::uint16_t res_x, std::uint16_t res_y, bool flscrn); void destwin(); } } |