#include <gui.h>
This class includes the ability to create a window in X, display an image stored in a buffer, and handle simple mouse and keyboard input.
Definition at line 40 of file gui.h.
Public Member Functions | |
| GUI () | |
| Constructor. | |
| ~GUI () | |
| Deconstructor. | |
| int | init () |
| Initializes SDL with given parameters. | |
| int | setDisplayMode (int mode) |
| Sets the display mode. | |
| void | drawPixel (int x, int y, int r, int g, int b) |
| Draws a pixel. | |
| int | drawFrame (struct Frame *frame, int x, int y) |
| Draws a frame object. | |
| int | drawImage (struct Image *pic, int x, int y) |
| Draws an Image object. | |
| void | drawLine (int x1, int y1, int x2, int y2, int r, int g, int b) |
| Draws a line on the screen. | |
| void | setTitle (char *title, char *icon) |
| Sets the title of a window. | |
| void | clearScreen (int r, int b, int g) |
| Fills the screen with a color. | |
| void | toggleFullScreen () |
| Toggles full screen mode. | |
| void | showScreen () |
| Shows the screen. | |
Public Attributes | |
| int | displayFlags |
| SDL flags to be passed to video mode. | |
| int | height |
| Height of screen. | |
| int | width |
| Width of screen. | |
| int | bpp |
| Bits per pixel of screen mode. | |
| SDL_Surface * | screen |
| SDL surface to hold the main display. | |
|
|
Constructor. Initializes SDL and sets up default variables. Definition at line 6 of file gui.cpp. References displayFlags. |
|
|
Deconstructor. Shuts down the SDL and makes sure all windows are closed and freed. |
|
||||||||||||||||
|
Fills the screen with a color. This method looks up the 32-bit color, given a set of red, green, and blue values. Then, it fills the screen with this color. Pass 0,0,0 as the red, green, and blue values to clear the screen with with black.
Definition at line 172 of file gui.cpp. References screen. |
|
||||||||||||||||
|
Draws a frame object. The frame class contains enough information about a captured image for it to be displayed on screen. The height and width of the frame are taken straight from the frame member varibles. It can be placed anywhere on screen.
Definition at line 139 of file gui.cpp. References Frame::blueMask, Frame::buffer, drawPixel(), Frame::greenMask, height, Frame::masked, Frame::redMask, Frame::width, and width. |
|
||||||||||||||||
|
Draws an Image object. This method extracts the SDL_Surface from the Image object and places it on the screen in a specified location.
Definition at line 158 of file gui.cpp. References screen, and Image::surf. |
|
||||||||||||||||||||||||||||||||
|
Draws a line on the screen. This method uses a fast, integer based line drawing algorithm to display lines on screen.
Definition at line 194 of file gui.cpp. References drawPixel(), Point2D::x, and Point2D::y. |
|
||||||||||||||||||||||||
|
Draws a pixel. This method calculates the proper offset in the video buffer, creates the specified color, and draws it to the screen. It also makes sure to lock and unlock the screen if necessary.
Definition at line 115 of file gui.cpp. References screen. Referenced by drawFrame(), and drawLine(). |
|
|
Initializes SDL with given parameters. This method read the private class variables that can either be set directly or ignored. If ignored, the method will use default values established in the constructor.
|
|
|
Sets the display mode. This method attempts to create an SDL surface of the specified type and change the display to that surface. The possible mode parameters are listed at the top of gui.h.
Definition at line 30 of file gui.cpp. References bpp, displayFlags, height, screen, and width. |
|
||||||||||||
|
Sets the title of a window. This method is used to set the value of the caption that appears at the top of a regular window. The string is passed to the window manager, which takes care of rendering the text.
|
|
|
Shows the screen. This method flips the display buffer and the screen buffer so changes can be seen by the user. This is usually called after the program finished drawing an entire frame. Definition at line 182 of file gui.cpp. References screen. |
|
|
Toggles full screen mode. This method attempts to switch the display from windowed mode to fullscreen mode. Definition at line 177 of file gui.cpp. References screen. |
1.4.2