Central API for most of the engine / framework. More...
#include <le2d/context.hpp>
Classes | |
class | Waiter |
Calls Context::wait_idle() in its destructor. More... | |
Public Types | |
using | SpirV = std::span< std::uint32_t const > |
using | CreateInfo = ContextCreateInfo |
Public Member Functions | |
virtual auto | get_window () const -> GLFWwindow *=0 |
virtual auto | get_render_device () const -> kvf::RenderDevice const &=0 |
virtual auto | get_resource_factory () const -> IResourceFactory const &=0 |
virtual auto | get_audio_mixer () const -> IAudioMixer &=0 |
virtual auto | get_default_shader () const -> IShader const &=0 |
virtual auto | get_renderer () const -> IRenderer const &=0 |
auto | window_size () const -> glm::ivec2 |
auto | framebuffer_size () const -> glm::ivec2 |
auto | swapchain_extent () const -> vk::Extent2D |
auto | main_pass_size () const -> glm::ivec2 |
auto | display_ratio () const -> glm::vec2 |
auto | unprojector (Viewport const &viewport, Transform const &view) const -> Unprojector |
auto | get_title () const -> klib::CString |
void | set_title (klib::CString title) |
auto | get_refresh_rate () const -> std::int32_t |
auto | is_fullscreen () const -> bool |
auto | set_fullscreen (GLFWmonitor *target=nullptr) -> bool |
Show window and set fullscreen. | |
void | set_windowed (glm::ivec2 size={1280, 720}) |
Show window and set windowed with given size. | |
void | set_visible (bool visible) |
Show/hide window. | |
auto | is_running () const -> bool |
Check if Window is (and should remain) open. | |
void | set_window_close () |
Set the Window close flag. | |
void | cancel_window_close () |
Reset the Window close flag. | |
void | wait_idle () |
Wait for the graphics and audio devices to become idle. | |
virtual auto | get_render_scale () const -> float=0 |
virtual auto | set_render_scale (float scale) -> bool=0 |
virtual auto | get_supported_vsync () const -> std::span< Vsync const >=0 |
virtual auto | get_vsync () const -> Vsync=0 |
virtual auto | set_vsync (Vsync vsync) -> bool=0 |
virtual auto | get_samples () const -> vk::SampleCountFlagBits=0 |
virtual auto | get_supported_samples () const -> vk::SampleCountFlags=0 |
virtual auto | set_samples (vk::SampleCountFlagBits samples) -> bool=0 |
Set desired MSAA samples. | |
virtual auto | next_frame () -> vk::CommandBuffer=0 |
Begin the next frame. | |
virtual auto | event_queue () const -> std::span< Event const >=0 |
virtual auto | begin_render (kvf::Color clear=kvf::black_v) -> IRenderer &=0 |
Begin rendering the primary RenderPass. | |
virtual void | present ()=0 |
Submit recorded commands and present RenderTarget of primary RenderPass. | |
virtual auto | get_frame_stats () const -> FrameStats const &=0 |
auto | create_waiter () -> Waiter |
virtual auto | create_render_pass (vk::SampleCountFlagBits samples) const -> std::unique_ptr< IRenderPass >=0 |
virtual auto | create_asset_loader (gsl::not_null< IDataLoader const * > data_loader) const -> AssetLoader=0 |
Static Public Member Functions | |
static auto | create (CreateInfo const &create_info={}) -> std::unique_ptr< Context > |
Static Public Attributes | |
static constexpr auto | min_render_scale_v {0.2f} |
static constexpr auto | max_render_scale_v {8.0f} |
Central API for most of the engine / framework.
using le::Context::SpirV = std::span<std::uint32_t const> |
|
pure virtual |
Begin rendering the primary RenderPass.
clear | Clear color. |
void le::Context::cancel_window_close | ( | ) |
Reset the Window close flag.
|
static |
|
pure virtual |
|
pure virtual |
auto le::Context::create_waiter | ( | ) | -> Waiter |
auto le::Context::display_ratio | ( | ) | const -> glm::vec2 |
|
pure virtual |
auto le::Context::framebuffer_size | ( | ) | const -> glm::ivec2 |
|
pure virtual |
|
pure virtual |
|
pure virtual |
auto le::Context::get_refresh_rate | ( | ) | const -> std::int32_t |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
auto le::Context::get_title | ( | ) | const -> klib::CString |
|
pure virtual |
|
pure virtual |
auto le::Context::is_fullscreen | ( | ) | const -> bool |
auto le::Context::is_running | ( | ) | const -> bool |
Check if Window is (and should remain) open.
auto le::Context::main_pass_size | ( | ) | const -> glm::ivec2 |
|
pure virtual |
Begin the next frame.
Resets render resources and polls events.
|
pure virtual |
Submit recorded commands and present RenderTarget of primary RenderPass.
auto le::Context::set_fullscreen | ( | GLFWmonitor * | target = nullptr | ) | -> bool |
Show window and set fullscreen.
target | Target monitor (optional). |
|
pure virtual |
scale | Desired render scale. |
|
pure virtual |
Set desired MSAA samples.
RenderPass will be recreated on the next frame, not immediately.
void le::Context::set_title | ( | klib::CString | title | ) |
void le::Context::set_visible | ( | bool | visible | ) |
Show/hide window.
|
pure virtual |
vsync | Desired Vsync mode. |
void le::Context::set_window_close | ( | ) |
Set the Window close flag.
Note: the window will remain visible until this object is destroyed by owning code.
void le::Context::set_windowed | ( | glm::ivec2 | size = {1280, 720} | ) |
Show window and set windowed with given size.
size | Window size. Must be positive. |
auto le::Context::swapchain_extent | ( | ) | const -> vk::Extent2D |
|
inline |
viewport | Render viewport to unproject. |
view | Render view to unproject. |
void le::Context::wait_idle | ( | ) |
Wait for the graphics and audio devices to become idle.
Does not account for user owned audio sources.
auto le::Context::window_size | ( | ) | const -> glm::ivec2 |
|
staticconstexpr |
|
staticconstexpr |