CS488 PA6
Public Member Functions | Private Attributes | List of all members
SDLFrameBuffer Class Reference

#include <SDLFrameBuffer.h>

Inherits FrameBuffer.

Public Member Functions

 SDLFrameBuffer (int width, int height)
 
 ~SDLFrameBuffer ()
 
virtual void clear (const Color &color)
 
virtual int getHeight () const
 
virtual int getWidth () const
 
virtual void setKeyboardHandler (void(*handler)(const SDL_Event &event))
 
virtual void setPixel (int x, int y, const Color &color)
 
virtual void show ()
 

Private Attributes

bool keepRunning
 
SDL_Renderer * renderer
 
SDL_Window * window
 
void(* keyboardHandler )(const SDL_Event &event)
 

Additional Inherited Members

- Protected Attributes inherited from FrameBuffer
int height
 
int width
 
int xMax
 
int xMin
 
int yMax
 
int yMin
 

Detailed Description

This encapsulation of a FrameBuffer is built on SDL.

Constructor & Destructor Documentation

◆ SDLFrameBuffer()

SDLFrameBuffer::SDLFrameBuffer ( int  width,
int  height 
)

Explicit Value Constructor.

Parameters
widthThe width (in pixels) of the FrameBuffer
heightThe height (in pixels) of the FrameBuffer

◆ ~SDLFrameBuffer()

SDLFrameBuffer::~SDLFrameBuffer ( )

Destructor.

Member Function Documentation

◆ clear()

void SDLFrameBuffer::clear ( const Color color)
virtual

Clear the FrameBuffer (i.e., set each pixel to the given Color).

Parameters
colorThe color to clear to

Implements FrameBuffer.

◆ getHeight()

int SDLFrameBuffer::getHeight ( ) const
virtual

Get the height of this FrameBuffer in pixels.

Returns
The height

Implements FrameBuffer.

◆ getWidth()

int SDLFrameBuffer::getWidth ( ) const
virtual

Get the width of this FrameBuffer in pixels.

Returns
The width

Implements FrameBuffer.

◆ setKeyboardHandler()

void SDLFrameBuffer::setKeyboardHandler ( void(*)(const SDL_Event &event)  handler)
virtual

Set the keyboard handler to use.

NOTE: While this method must be public (because of the design of SDL) it is not part of the FrameBuffer API.

Parameters
handlerThe keyboard handler

◆ setPixel()

void SDLFrameBuffer::setPixel ( int  x,
int  y,
const Color color 
)
virtual

Set a particular pixel to a particular color.

Parameters
xThe horizontal coordinate of the pixel
yThe vertical coordinate of the pixel
colorThe Color

Implements FrameBuffer.

◆ show()

void SDLFrameBuffer::show ( )
virtual

Show this FrameBuffer in the window.

Implements FrameBuffer.

Member Data Documentation

◆ keepRunning

bool SDLFrameBuffer::keepRunning
private

Used to control a loop.

◆ keyboardHandler

void(* SDLFrameBuffer::keyboardHandler) (const SDL_Event &event)
private

The keyboard handler.

Parameters
eventThe event to handle.

◆ renderer

SDL_Renderer* SDLFrameBuffer::renderer
private

The SDL renderer to use.

◆ window

SDL_Window* SDLFrameBuffer::window
private

The SDL window associated with this GraphicsWindow.


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