FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
fge::vulkan::SurfaceSDLWindow Class Referencefinal

Vulkan OS window surface made with SDL. More...

#include <C_surface.hpp>

Inheritance diagram for fge::vulkan::SurfaceSDLWindow:
fge::vulkan::SurfaceWindow fge::vulkan::Surface

Public Types

enum class  Types { UNKNOWN , SDL }
 

Public Member Functions

 SurfaceSDLWindow (Instance &instance)
 
 SurfaceSDLWindow (Instance &instance, std::string_view title, fge::Vector2i const &position, fge::Vector2i const &size, uint32_t flags)
 
 SurfaceSDLWindow (Instance &instance, fge::Vector2i const &position, fge::Vector2i const &size, uint32_t flags)
 
 SurfaceSDLWindow (SurfaceSDLWindow &&r) noexcept
 
bool create (SDL_Window *window)
 Create a surface by taking an already created SDL_Window.
 
bool create (std::string_view title, fge::Vector2i const &position, fge::Vector2i const &size, uint32_t flags)
 Create a surface and the SDL_Window.
 
void destroy () override
 
Types getType () const override
 
fge::Vector2i getSize () const override
 
fge::Vector2i getPosition () const override
 
SDL_Window * getWindow () const
 
VkExtent2D getExtent () const override
 
VkSurfaceKHR get () const
 
bool isCreated () const
 
InstancegetInstance ()
 
Instance const & getInstance () const
 

Protected Attributes

VkSurfaceKHR _g_surface
 

Detailed Description

Vulkan OS window surface made with SDL.

This class is used to create a Vulkan surface on a SDL window.

Member Function Documentation

◆ create() [1/2]

bool fge::vulkan::SurfaceSDLWindow::create ( SDL_Window * window)

Create a surface by taking an already created SDL_Window.

The window must be created with no error and with the SDL_WINDOW_VULKAN flag. This method take the ownership of the SDL window, that means it will automatically destroy it.

Parameters
windowThe SDL window handle
Returns
true if created successfully, false otherwise

◆ create() [2/2]

bool fge::vulkan::SurfaceSDLWindow::create ( std::string_view title,
fge::Vector2i const & position,
fge::Vector2i const & size,
uint32_t flags )

Create a surface and the SDL_Window.

You can use FGE_WINDOWPOS_UNDEFINED or FGE_WINDOWPOS_CENTERED helpers for the position.

Parameters
titleA valid UTF8 string view
positionThe position of the window when created
sizeThe size of the window
flagsThe flag passed to SDL_CreateWindow

◆ destroy()

void fge::vulkan::SurfaceSDLWindow::destroy ( )
overridevirtual

Implements fge::vulkan::Surface.

◆ getExtent()

VkExtent2D fge::vulkan::SurfaceWindow::getExtent ( ) const
inlinenodiscardoverridevirtualinherited

Reimplemented from fge::vulkan::Surface.

◆ getPosition()

fge::Vector2i fge::vulkan::SurfaceSDLWindow::getPosition ( ) const
nodiscardoverridevirtual

◆ getSize()

fge::Vector2i fge::vulkan::SurfaceSDLWindow::getSize ( ) const
nodiscardoverridevirtual

◆ getType()

Types fge::vulkan::SurfaceSDLWindow::getType ( ) const
nodiscardoverridevirtual

The documentation for this class was generated from the following file: