CorsixTH engine (the C++ part)
Open source implementation of Theme Hospital
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
render_target Class Reference

#include <th_gfx_sdl.h>

Classes

class  scoped_buffer
 
class  scoped_clip
 
class  scoped_target_texture
 

Public Member Functions

 render_target (const render_target_creation_params &params)
 
 render_target (const render_target &other)=delete
 
render_targetoperator= (const render_target &other)=delete
 
 ~render_target ()
 
bool update (const render_target_creation_params &params)
 Update the parameters for the render target.
 
const charget_last_error ()
 Get the reason for the last operation failing.
 
bool start_frame ()
 Begin rendering a new frame.
 
bool end_frame ()
 Finish rendering the current frame and present it.
 
bool fill_black ()
 Paint the entire render target black.
 
bool fill_colour (uint32_t colour)
 Paint the entire render target with a solid colour.
 
void set_blue_filter_active (bool bActivate)
 Sets a blue filter on the current surface.
 
bool fill_rect (uint32_t iColour, int iX, int iY, int iW, int iH)
 Fill a rectangle of the render target with a solid colour.
 
int set_minimum_size (int width, int height)
 Sets a minimum size for the render target.
 
void push_clip_rect (const clip_rect *pRect)
 Push a new clip rectangle.
 
void pop_clip_rect ()
 Restore the previous clip rectangle.
 
int get_width () const
 Get the width of the render target (in pixels)
 
int get_height () const
 Get the height of the render target (in pixels)
 
void start_nonoverlapping_draws ()
 Enable optimisations for non-overlapping draws.
 
void finish_nonoverlapping_draws ()
 Disable optimisations for non-overlapping draws.
 
void set_cursor (cursor *pCursor)
 Set the cursor to be used.
 
void set_cursor_position (int iX, int iY)
 Update the cursor position (if the cursor is being simulated)
 
bool take_screenshot (const char *file_path) const
 Take a screenshot and save it as a PNG file.
 
bool set_scale_factor (double fScale, scaled_items eWhatToScale)
 Set the amount by which future draw operations are scaled.
 
void set_caption (const char *sCaption)
 Set the window caption.
 
void set_window_grab (bool bActivate)
 Toggle mouse capture on the window.
 
const charget_renderer_details () const
 Get any user-displayable information to describe the renderer path used.
 
SDL_Rendererget_renderer () const
 
bool should_scale_bitmaps (double *pFactor)
 Should bitmaps be scaled?
 
SDL_Texturecreate_palettized_texture (int iWidth, int iHeight, const uint8_t *pPixels, const ::palette *pPalette, uint32_t iSpriteFlags) const
 
SDL_Texturecreate_texture (int iWidth, int iHeight, const uint32_t *pPixels) const
 
void draw (SDL_Texture *pTexture, const SDL_Rect *prcSrcRect, const SDL_Rect *prcDstRect, int iFlags)
 
void draw_line (line_sequence *pLine, int iX, int iY)
 
std::unique_ptr< scoped_bufferbegin_intermediate_drawing (int iX, int iY, int iWidth, int iHeight)
 

Static Public Member Functions

static constexpr uint32_t map_colour (uint8_t iR, uint8_t iG, uint8_t iB)
 Encode an RGB triplet for fillRect()
 

Friends

class scoped_target_texture
 

Constructor & Destructor Documentation

◆ render_target() [1/2]

render_target::render_target ( const render_target_creation_params params)
explicit

◆ render_target() [2/2]

render_target::render_target ( const render_target other)
delete

◆ ~render_target()

render_target::~render_target ( )

Member Function Documentation

◆ begin_intermediate_drawing()

std::unique_ptr< render_target::scoped_buffer > render_target::begin_intermediate_drawing ( int  iX,
int  iY,
int  iWidth,
int  iHeight 
)

Begin drawing to an intermediate unscaled texture targeting the given location and size. The intermediate drawing will be committed once the returned scoped_buffer is destroyed.

Parameters
iXX-coordinate of left side of drawing rectangle.
iYY-coordinate of top side of drawing rectangle.
iWidthWidth of drawing rectangle.
iHeightHeight of drawing rectangle.

◆ create_palettized_texture()

SDL_Texture * render_target::create_palettized_texture ( int  iWidth,
int  iHeight,
const uint8_t *  pPixels,
const ::palette pPalette,
uint32_t  iSpriteFlags 
) const

◆ create_texture()

SDL_Texture * render_target::create_texture ( int  iWidth,
int  iHeight,
const uint32_t *  pPixels 
) const

◆ draw()

void render_target::draw ( SDL_Texture pTexture,
const SDL_Rect *  prcSrcRect,
const SDL_Rect *  prcDstRect,
int  iFlags 
)

◆ draw_line()

void render_target::draw_line ( line_sequence pLine,
int  iX,
int  iY 
)

◆ end_frame()

bool render_target::end_frame ( )

Finish rendering the current frame and present it.

◆ fill_black()

bool render_target::fill_black ( )

Paint the entire render target black.

◆ fill_colour()

bool render_target::fill_colour ( uint32_t  colour)

Paint the entire render target with a solid colour.

◆ fill_rect()

bool render_target::fill_rect ( uint32_t  iColour,
int  iX,
int  iY,
int  iW,
int  iH 
)

Fill a rectangle of the render target with a solid colour.

◆ finish_nonoverlapping_draws()

void render_target::finish_nonoverlapping_draws ( )

Disable optimisations for non-overlapping draws.

◆ get_height()

int render_target::get_height ( ) const

Get the height of the render target (in pixels)

◆ get_last_error()

const char * render_target::get_last_error ( )

Get the reason for the last operation failing.

◆ get_renderer()

SDL_Renderer * render_target::get_renderer ( ) const
inline

◆ get_renderer_details()

const char * render_target::get_renderer_details ( ) const

Get any user-displayable information to describe the renderer path used.

◆ get_width()

int render_target::get_width ( ) const

Get the width of the render target (in pixels)

◆ map_colour()

static constexpr uint32_t render_target::map_colour ( uint8_t  iR,
uint8_t  iG,
uint8_t  iB 
)
inlinestaticconstexpr

Encode an RGB triplet for fillRect()

◆ operator=()

render_target & render_target::operator= ( const render_target other)
delete

◆ pop_clip_rect()

void render_target::pop_clip_rect ( )

Restore the previous clip rectangle.

◆ push_clip_rect()

void render_target::push_clip_rect ( const clip_rect pRect)

Push a new clip rectangle.

◆ set_blue_filter_active()

void render_target::set_blue_filter_active ( bool  bActivate)

Sets a blue filter on the current surface.

◆ set_caption()

void render_target::set_caption ( const char sCaption)

Set the window caption.

◆ set_cursor()

void render_target::set_cursor ( cursor pCursor)

Set the cursor to be used.

◆ set_cursor_position()

void render_target::set_cursor_position ( int  iX,
int  iY 
)

Update the cursor position (if the cursor is being simulated)

◆ set_minimum_size()

int render_target::set_minimum_size ( int  width,
int  height 
)

Sets a minimum size for the render target.

◆ set_scale_factor()

bool render_target::set_scale_factor ( double  fScale,
scaled_items  eWhatToScale 
)

Set the amount by which future draw operations are scaled.

Parameters
fScaleNew scale to use.
eWhatToScaleTh kind of items to scale.
Returns
Whether the scale could be set.

◆ set_window_grab()

void render_target::set_window_grab ( bool  bActivate)

Toggle mouse capture on the window.

◆ should_scale_bitmaps()

bool render_target::should_scale_bitmaps ( double pFactor)

Should bitmaps be scaled?

Parameters
[out]pFactorIf the function returns true, the factor to use for scaling (can be nullptr if not interested in the value).
Returns
Whether bitmaps should be scaled.

◆ start_frame()

bool render_target::start_frame ( )

Begin rendering a new frame.

◆ start_nonoverlapping_draws()

void render_target::start_nonoverlapping_draws ( )

Enable optimisations for non-overlapping draws.

◆ take_screenshot()

bool render_target::take_screenshot ( const char file_path) const

Take a screenshot and save it as a PNG file.

◆ update()

bool render_target::update ( const render_target_creation_params params)

Update the parameters for the render target.

Friends And Related Symbol Documentation

◆ scoped_target_texture


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