Public Member Functions
|void||ClearScreen (Color *color=NULL, Rect *area=NULL)|
|Clears the framebuffer with the selected color. |
|Returns colordepth. |
|SDL_Surface *||GetFramebuffer (void)|
|Returns the framebuffer. |
|void||Init (int width, int height, int colordepth, unsigned int screen_mode, char *window_title="Easy2D - Object Oriented 2D Game Engine", char *icon_file=NULL)|
|Creates a surface for drawing, and also a window. |
|Destroys the surface allocated to main video buffer. |
|Flips the buffer (double buffering). |
Static Public Member Functions
|static Video *||GetInstance (void)|
|Gets an object for this class. |
|main drawing surface |
Static Public Attributes
|static const unsigned int||FULLSCREEN = SDL_FULLSCREEN|
|Fullscreen video mode. |
|static const unsigned int||WINDOWED = 0|
|Windowed video mode. |
|Video * e2d::graphics::Video::GetInstance||(||void||)||
This class is a Singleton. If you want an instance of this class to work with, get it via this method.
Fills part of the framebuffer with the color selected. If the color is NULL, it defaults to black. If area is NULL, the whole framebuffer is filled.
|color||The color you want to use to clear the screen|
|area||The area of the framebuffer to be cleared|
|SDL_Surface * e2d::graphics::Video::GetFramebuffer||(||void||)|
Even if the framebuffer is publicly accessible, this method is available just for convenience.
|char *|| window_title =
|char *|| icon_file = |
Initializes the framebuffer, and creates a window to contain it. This framebuffer is where you may want to draw your images, so they shall appear on-screen. If the call succeeds, the framebuffer will be allocated in the main video memory (hardware), and will be double-buffered.
|width||desired width of the window|
|height||desired height of the window|
|colordepth||desired colordepth (bits per pixel - bpp) of the drawing surface|
|screen_mode||one of Video::FULLSCREEN or Video::WINDOWED|
|window_title||string your OS shall write as the window title|
|icon_file||path to an image file your OS shall draw as the window icon|
|e2d::core::Exception||if SDL fails to create the framebuffer.|
Deallocates the framebuffer memory and quits the SDL video subsystem.
When drawing to the framebuffer, you are actually drawing to the backbuffer. So, when you want to make the backbuffer visible, swap it with the frontbuffer (Easy2D always works with double-buffering).