Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
Public Member Functions | List of all members
rt::screen Class Reference

Graphical window. More...

#include <screen.hpp>

Inheritance diagram for rt::screen:
rt::image

Public Member Functions

 screen (int width, int height)
 
virtual ~screen ()
 
virtual void update ()
 
bool wait_quit_event ()
 wait indefinitely for the next quit event More...
 
- Public Member Functions inherited from rt::image
 image (int width, int height)
 
 image (const image &img)
 
virtual ~image ()
 
virtual int width () const
 
virtual int height () const
 
virtual image copy () const
 
virtual color get_pixel (int x, int y) const
 
virtual void set_pixel (int x, int y, const color &c)
 
virtual void blit (image &dst, const rect &srcrect, int dstx, int dsty) const
 
virtual void blit (image &dst, int dstx, int dsty) const
 
virtual void draw_line (int x1, int y1, int x2, int y2, const color &c)
 
virtual void draw_rect (int x1, int y1, int x2, int y2, const color &c)
 
virtual void fill_rect (int x1, int y1, int x2, int y2, const color &c)
 

Additional Inherited Members

- Protected Member Functions inherited from rt::image
 image ()
 
- Protected Attributes inherited from rt::image
SDL_Surface * data
 

Detailed Description

Graphical window.

The screen class inherites from the image class in order to draw something on the screen. It also wraps the SDL initialization calls. Only one screen should be created. If a second screen instance is created, it gets attached to the first one and the width and height are ignored.

Constructor & Destructor Documentation

◆ screen()

rt::screen::screen ( int  width,
int  height 
)

Main constructor, uses width and height.

◆ ~screen()

rt::screen::~screen ( )
virtual

Destructor. Decrements the initialized counter and closes the screen only if it goes to 0.

Member Function Documentation

◆ update()

void rt::screen::update ( )
virtual

Flushes the buffer to the screen

◆ wait_quit_event()

bool rt::screen::wait_quit_event ( )

wait indefinitely for the next quit event

Returns
true if we get a quit event, or false if there was an error while waiting for the quit event

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