Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
World2DRenderer.hpp
Go to the documentation of this file.
1#pragma once
4#include <map>
5
6namespace monopoly::engine
7{
9 {
10 public:
14 [[nodiscard]] static std::expected<std::unique_ptr<World2DRenderer>, std::string>
15 load(SDL_GPUDevice* device, const std::filesystem::path& shaders,
17 [[nodiscard]] std::expected<std::size_t, std::string> render(
19 std::uint32_t width, std::uint32_t height, const SequenceWorld2DSlot& slot);
20 [[nodiscard]] std::size_t textureCount() const noexcept { return textures_.size(); }
21 // Presentation only: the retail pointer sequence remains live in its slot.
23 { standardPointerPresentation_ = enabled; }
24 private:
25 World2DRenderer() = default;
26 [[nodiscard]] std::expected<SDL_GPUTexture*, std::string> resolveTexture(
27 const std::shared_ptr<const data::BitmapRuntimeAsset>& asset);
28 struct Texture
29 {
30 SDL_GPUTexture* gpu{};
31 std::shared_ptr<const data::BitmapRuntimeAsset> source;
32 };
33 SDL_GPUDevice* device_{};
34 World3DShaderSet shaders_;
35 SDL_GPUGraphicsPipeline* pipeline_{};
36 SDL_GPUBuffer* quad_{};
37 SDL_GPUSampler* sampler_{};
38 SDL_GPUSampler* linearSampler_{};
39 bool standardPointerPresentation_{};
40 std::map<const data::BitmapRuntimeAsset*, Texture> textures_;
41 };
42}
bool enabled
Definition Engine.cpp:170
PlayerNumber slot
std::shared_ptr< const data::HmdTextureImage > source
std::uint32_t height
std::uint32_t width
unsigned index
void configureStandardPointerPresentation(bool enabled) noexcept
World2DRenderer(const World2DRenderer &)=delete
World2DRenderer & operator=(const World2DRenderer &)=delete
static std::expected< std::unique_ptr< World2DRenderer >, std::string > load(SDL_GPUDevice *device, const std::filesystem::path &shaders, SDL_GPUTextureFormat colorFormat)
std::expected< std::size_t, std::string > render(SDL_GPUCommandBuffer *command, SDL_GPUTexture *target, std::uint32_t width, std::uint32_t height, const SequenceWorld2DSlot &slot)
std::size_t textureCount() const noexcept