gwindow.h
GWindow
class which supports
drawing graphical objects on the screen.
Class | |
This class represents a graphics window that supports simple graphics. | |
Functions | |
Converts a hexadecimal "#rrggbb" color name into an integer that encodes the red, green, and blue components of the color. | |
Converts an rgb value into a hexadecimal color name in the form "#rrggbb" . | |
Closes all graphics windows and exits from the application without waiting for any additional user interaction. | |
Returns the height of the entire display screen. | |
Returns the width/height of the entire display screen. | |
Returns the width of the entire display screen. | |
Pauses for the indicated number of milliseconds. | |
Issues a request to update all graphics windows. | |
Waits for a mouse click to occur anywhere in any window. |
void repaint();
Usage:
repaint();
void pause(double milliseconds);
Usage:
pause(milliseconds);
double getScreenWidth();
Usage:
width = getScreenWidth();
double getScreenHeight();
Usage:
height = getScreenHeight();
GDimension getScreenSize();
Usage:
GDimension size = getScreenSize();
int convertColorToRGB(string colorName);
value & 0xff000000
) are unused;
value & 0x00ff0000
) represent the redness of the color, from 0 (none) through 255 (full);
value & 0x0000ff00
) represent the greenness of the color, from 0 (none) through 255 (full);
value & 0x000000ff
) represent the blueness of the color, from 0 (none) through 255 (full).
For example, the call of convertColorToRGB("#ff00ff")
would return the integer value 0xff00ff
, which is 16711935
in base-10.
Usage:
int rgb = convertColorToRGB(colorName);
string convertRGBToColor(int rgb);
rgb
value into a color name in the
form "#rrggbb"
. Each of the rr
,
gg
, and bb
values are two-digit
hexadecimal numbers indicating the intensity of that component, from 00
(the least amount of that color) to ff
, the hexadecimal representation of the number 255, indicating the largest amount of that color.
Colors are usually written as hexadecimal (base-16) integer literal values.
For example, the color black is represented as 0x000000
, white is 0xffffff
, red is 0xff0000
, green is 0x00ff00
, blue is 0x0000ff
, purple is 0xff00ff
, yellow is 0xffff00
, and so on.
For example, the call of convertRGBToColor(0xff00cc)
would return the string "#ff00ff"
.
Usage:
string colorName = convertRGBToColor(rgb);
void waitForClick();
Usage:
waitForClick();
void exitGraphics();
Usage:
exitGraphics();