1#ifndef YAZE_APP_CORE_PLATFORM_RENDERER_H
2#define YAZE_APP_CORE_PLATFORM_RENDERER_H
8#include "absl/status/status.h"
9#include "absl/strings/str_format.h"
33 renderer_ = std::unique_ptr<SDL_Renderer, SDL_Deleter>(SDL_CreateRenderer(
34 window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED));
36 return absl::InternalError(
37 absl::StrFormat(
"SDL_CreateRenderer: %s\n", SDL_GetError()));
39 SDL_SetRenderDrawBlendMode(
renderer_.get(), SDL_BLENDMODE_BLEND);
40 SDL_SetRenderDrawColor(
renderer_.get(), 0x00, 0x00, 0x00, 0x00);
41 return absl::OkStatus();
61 const std::vector<uint8_t> &data,
64 bitmap.
Create(width, height, depth, data);
67 return absl::OkStatus();
73 std::unique_ptr<SDL_Renderer, SDL_Deleter>
renderer_;
The Renderer class represents the renderer for the Yaze application.
absl::Status CreateRenderer(SDL_Window *window)
auto renderer() -> SDL_Renderer *
absl::Status CreateAndRenderBitmap(int width, int height, int depth, const std::vector< uint8_t > &data, gfx::Bitmap &bitmap, gfx::SnesPalette &palette)
std::unique_ptr< SDL_Renderer, SDL_Deleter > renderer_
void UpdateBitmap(gfx::Bitmap *bitmap)
Used to update a bitmap on the screen.
Renderer(const Renderer &)=delete
static Renderer & GetInstance()
void RenderBitmap(gfx::Bitmap *bitmap)
Used to render a bitmap to the screen.
Renderer & operator=(const Renderer &)=delete
Represents a bitmap image.
absl::Status ApplyPalette(const SnesPalette &palette)
Copy color data from the SnesPalette into the SDL_Palette.
void Create(int width, int height, int depth, const std::vector< uint8_t > &data)
Creates a bitmap object with the provided graphical data.
void UpdateTexture(SDL_Renderer *renderer)
Updates the underlying SDL_Texture when it already exists.
void CreateTexture(SDL_Renderer *renderer)
Creates the underlying SDL_Texture to be displayed.
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
#define RETURN_IF_ERROR(expression)