Robotcode
1.0
|
Window that is displayed to the Participant. More...
#include <Screen.h>
Public Member Functions | |
void | init (HINSTANCE hThisInst, int xPos, int yPos, int width, int height, void(*displayFcn)(int)) |
Initializes the window. | |
BOOL | createRenderContext (void) |
Rendering context is for openGL drawing commands. | |
void | deleteRenderContext (void) |
Deleted. | |
void | clear () |
void | lock () |
void | unlocked () |
void | getSizePixel (int &height, int &width) |
Return the size of the screen in pixel. | |
Vector2D | getCenter (void) |
Return workspace coordinate for center of screen. | |
void | setCenter (Vector2D size) |
Set center of screen in workspace coordinates. | |
Vector2D | getSize (void) |
Return the size (in workspace coordinates) | |
Vector2D | getScale (void) |
Scaling (size of one pixel in Workspace coordinates) | |
void | setScale (Vector2D scale) |
Scaling factor of pixel to coordinate system. | |
void | setColor (int theColor) |
Sets the current drawing color (from list of colors) | |
void | setColor (Color_t theColor) |
Sets the current drawing color (in RGB) | |
void | drawDisk (GLfloat xsize, GLfloat ysize, GLfloat x, GLfloat y) |
Draws a Rectangle. | |
void | drawDisk (Vector2D size, Vector2D pos) |
Draws a Circle. | |
void | drawCircle (GLfloat xsize, GLfloat ysize, GLfloat x, GLfloat y) |
void | drawCircle (GLfloat xsize, GLfloat ysize, GLfloat x, GLfloat y, int linewidth) |
void | drawCircle (Vector2D size, Vector2D pos) |
void | drawSegment (Vector2D size, Vector2D pos, float startang, float endang) |
Draws a circular segment. | |
void | drawRect (GLfloat xsize, GLfloat ysize, GLfloat xpos, GLfloat ypos) |
Draws a Rectangle. | |
void | drawRect (Vector2D size, Vector2D pos) |
Draws a Rectangle. | |
void | drawBox (GLfloat xsize, GLfloat ysize, GLfloat xpos, GLfloat ypos) |
Draws a Filled Rectangle. | |
void | drawBox (Vector2D size, Vector2D pos) |
Draws a Filled Rectangle. | |
void | drawLine (GLfloat xposStart, GLfloat yposStart, GLfloat xposEnd, GLfloat yposEnd, GLfloat width=1) |
Draws a Filled Rectangle. | |
void | drawLine (Vector2D start, Vector2D end) |
Draws a Filled Rectangle. | |
void | drawArrow (Vector2D start, Vector2D end, double headLength) |
Draws an Arrow. | |
void | drawPlus (Vector2D size, Vector2D pos) |
Draws an Plus sign. | |
void | drawHex (Vector2D size, Vector2D pos) |
Draws a regular hexagon. | |
void | drawHexF (Vector2D size, Vector2D pos) |
Draws a filled regular hexagon. | |
void | print (string s, double x, double y, GLfloat magnification) |
Prints a string on the screen. | |
void | print (string s, Vector2D pos, GLfloat magnification) |
void | printChar (char s, double x, double y, GLfloat magnification) |
Prints a var on the screen. | |
void | switchSetup () |
switches between setups (L/R reversal) | |
void | close () |
Closes the window. | |
Static Public Member Functions | |
static void | reshape (int w, int h) |
Static callback functions. | |
static void | display (HWND hwnd) |
Static callback functions: update Graphics. | |
static void | onKey (unsigned char k, int x, int y) |
Static callback function. | |
static void | setProjection () |
Sets the Projection matrix, depending on scale and center. | |
static LRESULT CALLBACK | messageCallback (HWND, UINT, WPARAM, LPARAM) |
Static Public Attributes | |
static HWND | windowHnd |
Window Handle. | |
static WNDCLASSEX | wcl |
static HDC | hDeviceContext |
static HGLRC | hRenderContext |
static void(* | updateGraphics )(int) |
static Color_t | black = {0,0,0} |
BLACK: 0. | |
static Color_t | white = {255,255,255} |
1 | |
static Color_t | red = {200,0,0} |
2 | |
static Color_t | green = {0,220,100} |
3 | |
static Color_t | blue = {20,20,255} |
4 | |
static Color_t | grey = {180,180,180} |
5 | |
static Color_t | salmon = {255,160,122} |
6 | |
static Color_t | yellow = {255,255,0} |
7 | |
static Color_t | pale = {80,60,0} |
8 | |
static Color_t | lightblue = {100,100,255} |
9 | |
static bool | keyPressed = 0 |
static char | key |
static double | lastTime |
static double | lastCycle |
static bool | isLocked |
static int | circlelist |
static int | rectlist |
static int | disklist |
static int | boxlist |
static int | hexlist |
static int | hexFlist |
static Vector2D | scale |
What is the size of a pixel in workspace coordinates? | |
static Vector2D | center |
What workspace coordinate is in the middle of the screen? | |
static int | windowWidth |
What is the width of the window in pixel? | |
static int | windowHeight |
What is the height of the window in pixel? |
Window that is displayed to the Participant.
Screen implements a Window without a frame. It has a scale parameter, that influences the projection, so that all drawing commands can be performed in the Workspace of the robot, i.e. in cm.
Draws a circular segment.
Draws a segement from startang to endang (in degrees, 0 is up) Does not use a precompiled display list
size | x and y size of the ellipse |
position | in workspace |
startang | angle to start at (goes clockwise) |
endend | angle to end with |
void Screen::drawRect | ( | GLfloat | xsize, |
GLfloat | ysize, | ||
GLfloat | xpos, | ||
GLfloat | ypos | ||
) |
Draws a Rectangle.
Draws a rectangle on the screen.
xsize | width of the rectangle |
ysize | height of the rectangle |
xpos | position of the center of the rectangle |
ypos | position of the center of the rectangle |
void Screen::print | ( | string | s, |
Vector2D | pos, | ||
GLfloat | magnification | ||
) | [inline] |
magnification | Prints a string on the screen |