1#ifndef SDLOUTPUTSURFACE_HH
2#define SDLOUTPUTSURFACE_HH
18 template<std::
unsigned_
integral Pixel>
19 [[nodiscard]] std::span<Pixel>
getLine(
unsigned y) {
20 return {
reinterpret_cast<Pixel*
>(
static_cast<char*
>(surface->pixels) + y * surface->pitch),
75 SDL_Surface* surface =
nullptr;
76 SDL_Renderer* renderer =
nullptr;
A frame buffer where pixels can be written to.
std::span< Pixel > getLine(unsigned y)
SDLDirectPixelAccess(SDL_Surface *surface_)
A frame buffer where pixels can be written to.
void setSDLSurface(SDL_Surface *surface_)
SDLOutputSurface()=default
virtual void flushFrameBuffer()
Copy frame buffer to display buffer.
SDL_Renderer * getSDLRenderer() const
SDL_Surface * getSDLSurface() const
virtual void clearScreen()
Clear frame buffer (paint it black).
SDLDirectPixelAccess getDirectPixelAccess()
Return a SDLDirectPixelAccess object.
void setSDLPixelFormat(const SDL_PixelFormat &format)
SDLOutputSurface(const SDLOutputSurface &)=delete
SDLOutputSurface & operator=(const SDLOutputSurface &)=delete
void setSDLRenderer(SDL_Renderer *r)
This file implemented 3 utility functions: