Wolf3D
Public Member Functions | List of all members
RenderWindow Class Reference

Public Member Functions

void create (const char *title, int width, int height)
 Create the window and the renderer. More...
 
void draw_buffer (Uint32 *buffer)
 Draws a buffer of pixel colours to the screen. More...
 
SDL_Texture * load_texture (const char *file_path)
 
void render (int x, int y, float scale_factor, SDL_Texture *texture)
 Render an SDL_Texture to the renderer. More...
 
void render (int x, int y, float scale_factor, std::string text, TTF_Font *font, SDL_Colour text_colour)
 Render string text to the renderer with an SDL_Colour for text colour. More...
 
void redraw ()
 Draws the renderer to the window.
 
bool done (bool quit_if_esc=true, bool delay=true)
 Used in while loops to tell if the window has been closed or not. More...
 
const Uint8 * readKeys ()
 Get the current held down keys. More...
 
bool keyDown (const Uint8 *inkeys, int key)
 If the key is held down. More...
 

Member Function Documentation

◆ create()

void RenderWindow::create ( const char *  title,
int  width,
int  height 
)

Create the window and the renderer.

Parameters
titleThe window title
widthThe window width
heightThe window height

◆ done()

bool RenderWindow::done ( bool  quit_if_esc = true,
bool  delay = true 
)

Used in while loops to tell if the window has been closed or not.

Parameters
quit_if_escQuit the program is the ESC key is pressed
delayDelay per frame to save computation power
Returns
true The window has been closed
false The window is still open

◆ draw_buffer()

void RenderWindow::draw_buffer ( Uint32 *  buffer)

Draws a buffer of pixel colours to the screen.

Parameters
bufferBuffer of pixel colours

◆ keyDown()

bool RenderWindow::keyDown ( const Uint8 *  inkeys,
int  key 
)

If the key is held down.

Parameters
inkeysUint8 of the keys on the keyboard which are held down
keyKey to test
Returns
true Key is held down
false Key is now held down

◆ load_texture()

SDL_Texture * RenderWindow::load_texture ( const char *  file_path)
Parameters
file_pathPath to the file
Returns
SDL_Texture*

◆ readKeys()

const Uint8 * RenderWindow::readKeys ( )

Get the current held down keys.

Returns
const Uint8*

◆ render() [1/2]

void RenderWindow::render ( int  x,
int  y,
float  scale_factor,
SDL_Texture *  texture 
)

Render an SDL_Texture to the renderer.

Parameters
xTop left coordinate
yTop left coordinate
scale_factorHow much to scale the image by, 1 is normal size
textureSDL_Texture to render

◆ render() [2/2]

void RenderWindow::render ( int  x,
int  y,
float  scale_factor,
std::string  text,
TTF_Font *  font,
SDL_Colour  text_colour 
)

Render string text to the renderer with an SDL_Colour for text colour.

Parameters
xTop left coordinate
yTop left coordinate
scale_factorHow much to scale the image by, 1 is normal size
textText to render
fontFont to render the text in
text_colourColour to render the text in

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