Initial commit. Not even a game yet :P
[cToan.git] / src / SDLWrap_Display.hpp
blobef5c3ba4b22f078d2502be3c44db8d8e4882adec
1 #ifndef _SDLWRAP_DISPLAY_H_
2 #define _SDLWRAP_DISPLAY_H_
4 #include "SDL/SDL.h"
6 #include "SDLWrap_Surface.hpp"
7 #include "ErrorHandler.hpp"
9 namespace SDLWrap {
11 /* This class is a speacil purpose surface, it represents the actual video frame buffer memory, so it must be created
12 * first.
15 class Display : public Surface {
16 public:
17 /* All flags that can be sent to SetVideoMode, or in this case, the Display constructor, are gathered and
18 * displayed here. To be fair, they can be used in plain Surfaces but that's limited to a few, the first
19 * three of them, or was it four? Anyways, it requires CreateRGBSurface() which I'm unlikely to use, so
20 * why put them there?
22 enum {
23 SWSURFACE = SDL_SWSURFACE,
24 HWSURFACE = SDL_HWSURFACE,
25 ASYNCBLIT = SDL_ASYNCBLIT,
26 ANYFORMAT = SDL_ANYFORMAT,
27 HWPALETTE = SDL_HWPALETTE,
28 DOUBLEBUF = SDL_DOUBLEBUF,
29 FULLSCREEN = SDL_FULLSCREEN,
30 OPENGL = SDL_OPENGL,
31 OPENGLBLIT = SDL_OPENGLBLIT,
32 RESIZABLE = SDL_RESIZABLE,
33 NOFRAME = SDL_NOFRAME
36 /* Really self explanatory constructor, c'mon ^^'
37 * All that's worth noting is that it throws a SurfaceCreationError if it can't create the Display surface.
39 Display(int Width, int Height, int BPP, Uint32 Flags);
41 /* Just frees the surface as usual. */
42 // ~Display(); // Might not need it as the Surface class has the exact same one...
44 /* If the hardware supports double buffering or if the Display was constructed with the HWSURFACE flag then
45 * this function sets up a flip and returns. The hardware will wait for vertical retrace, and swaps video
46 * buffers before the next video surface blit or lock will return. If SWSURFACE is set on the Display, then it
47 * simply calls SDL_UpdateRect(this->me, 0, 0, 0, 0).
49 * A software screen surface is also updated automatically when parts of a SDL window are redrawn, caused by
50 * overlapping windows or by restoring from an iconified state. As a result there is no proper double buffer
51 * behavior in windowed mode for a software screen, in contrast to a full screen software mode.
53 * You must pass the DOUBLEBUF flag to the Display constructor for the function to perform hardware flipping.
55 bool Flip();
60 #endif