The SimpleCxxLib package


#include "gwindow.h"

This file defines the GWindow class which supports drawing graphical objects on the screen.
Class
GWindow This class represents a graphics window that supports simple graphics.
Functions
convertColorToRGB(colorName) Converts a color name into an integer that encodes the red, green, and blue components of the color.
convertRGBToColor(rgb) Converts an rgb value into a color name in the form "#rrggbb".
exitGraphics() Closes all graphics windows and exits from the application without waiting for any additional user interaction.
getScreenHeight() Returns the height of the entire display screen.
getScreenWidth() Returns the width of the entire display screen.
pause(milliseconds) Pauses for the indicated number of milliseconds.
repaint() Issues a request to update all graphics windows.
waitForClick() Waits for a mouse click to occur anywhere in any window.

Function detail


void repaint();
Issues a request to update all graphics windows. This function is called automatically when the program pauses, waits for an event, waits for user input on the console, or terminates. As a result, most clients never need to call repaint explicitly.

Usage:

repaint();

void pause(double milliseconds);
Pauses for the indicated number of milliseconds. This function is useful for animation where the motion would otherwise be too fast.

Usage:

pause(milliseconds);

double getScreenWidth();
Returns the width of the entire display screen.

Usage:

width = getScreenWidth();

double getScreenHeight();
Returns the height of the entire display screen.

Usage:

height = getScreenHeight();

int convertColorToRGB(string colorName);
Converts a color name into an integer that encodes the red, green, and blue components of the color.

Usage:

int rgb = convertColorToRGB(colorName);

string convertRGBToColor(int rgb);
Converts an 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.

Usage:

int colorName = convertRGBToColor(rgb);

void waitForClick();
Waits for a mouse click to occur anywhere in any window.

Usage:

waitForClick();

void exitGraphics();
Closes all graphics windows and exits from the application without waiting for any additional user interaction.

Usage:

exitGraphics();