![]() |
mgsLib
1.3
Mermaja's Graphic Screen. A simple C library to build Windows graphic applications from console programs.
|
Header file for the MGS Library. More...
Macros | |
#define | mgsRGBColor(r, g, b) ((((b)&0xFF)<<16)|(((g)&0xFF)<<8)|((r)&0xFF)) |
Creates a RGB color from its R, G and B components. More... | |
#define | mgsGetScreenInfo(s, p) mgsGetScreenInfoAdvanced((s), (p), NULL); |
Gets position and size information for an screen or the desktop. More... | |
Macros to draw non bordered figures. | |
Non bordered versions of the functions to draw figures. | |
#define | mgsRectangle(s, l, t, r, b, c) mgsBorderedRectangle((s), (l), (t), (r), (b), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsEllipse(s, x, y, h, v, c) mgsBorderedEllipse((s), (x), (y), (h), (v), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRegPolygonCR(s, n, x, y, r, c) mgsBorderedRegPolygonCR((s), (n), (x), (y), (r), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRegPolygonVC(s, n, x, y, a, b, c) mgsBorderedRegPolygonVC((s), (n), (x), (y), (a), (b), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsPolygon(s, n, v, c) mgsBorderedPolygon((s), (n), (v), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsStarCR(s, n, x, y, e, i, c) mgsBorderedStarCR((s), (n), (x), (y), (e), (i), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsStarVC(s, n, x, y, a, b, i, c) mgsBorderedStarVC((s), (n), (x), (y), (a), (b), (i), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsESector(s, x, y, h, v, i, e, c) mgsBorderedESector((s), (x), (y), (h), (v), (i), (e), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsESegment(s, x, y, h, v, i, e, c) mgsBorderedESegment((s), (x), (y), (h), (v), (i), (e), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRotatedRectangle(s, l, t, r, b, a, c) mgsRotatedBorderedRectangle((s), (l), (t), (r), (b), (a), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRotatedEllipse(s, x, y, h, v, a, c) mgsRotatedBorderedEllipse((s), (x), (y), (h), (v), (a), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRotatedRegPolygonCR(s, n, x, y, r, a, c) mgsRotatedBorderedRegPolygonCR((s), (n), (x), (y), (r), (a), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRotatedPolygon(s, n, v, x, y, a, c) mgsRotatedBorderedPolygon((s), (n), (v), (x), (y), (a), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRotatedStarCR(s, n, x, y, e, i, a, c) mgsRotatedBorderedStarCR((s), (n), (x), (y), (e), (i), (a), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRotatedESector(s, x, y, h, v, i, e, a, c) mgsRotatedBorderedESector((s), (x), (y), (h), (v), (i), (e), (a), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsRotatedESegment(s, x, y, h, v, i, e, a, c) mgsRotatedBorderedESegment((s), (x), (y), (h), (v), (i), (e), (a), (c), 0, -1) |
Non bordered version of the corresponding function. | |
#define | mgsLeftMouseClk(s, x, y, a, b) mgsMouseClicked(s, _MLEFT, x, y, a, b) |
Individual macros to select only one mouse button on the advanced mouse functions. | |
#define | mgsCenterMouseClk(s, x, y, a, b) mgsMouseClicked(s, _MCENTER, x, y, a, b) |
Individual macros to select only one mouse button on the advanced mouse functions. | |
#define | mgsRightMouseClk(s, x, y, a, b) mgsMouseClicked(s, _MRIGHT, x, y, a, b) |
Individual macros to select only one mouse button on the advanced mouse functions. | |
#define | mgsLeftMousePress(s, x, y, a, b) mgsMousePressed(s, _MLEFT, x, y, a, b) |
Individual macros to select only one mouse button on the advanced mouse functions. | |
#define | mgsCenterMousePress(s, x, y, a, b) mgsMousePressed(s, _MCENTER, x, y, a, b) |
Individual macros to select only one mouse button on the advanced mouse functions. | |
#define | mgsRightMousePress(s, x, y, a, b) mgsMousePressed(s, _MRIGHT, x, y, a, b) |
Individual macros to select only one mouse button on the advanced mouse functions. | |
Functions | |
int | mgsCreateScreen (int width, int height, char *title, int bckColor, char *bckFile) |
Creates a new graphic screen with the given width, height and background. More... | |
int | mgsFullScreen (int bckColor, char *bckFile) |
Creates a borderless, full desktop graphic screen with the given background. More... | |
int | mgsDeleteScreen (int scrNumber) |
Delete the screen window whose reference number is given. More... | |
int | mgsMoveScreen (int scr, int x, int y) |
Moves a screen to a new position. More... | |
int | mgsActivateScreen (int scr) |
Shows at front the screen window whose reference number is given. More... | |
int | mgsUpdateScreen (int scrNumber) |
Update the screen window whose reference number is given. More... | |
int | mgsClearScreen (int scrNumber) |
Clear the screen whose reference number is given. More... | |
int | mgsSetBackground (int scrNumber) |
Freeze as background the current state of the screen whose reference number is given. More... | |
int | mgsGetScreenInfoAdvanced (int scrNumber, int *posAndSize, char *handle) |
Gets information about position, size and handle of a screen or the display. More... | |
int | mgsPoint (int scrNumber, int x, int y, int color) |
Plots a pixel with the given color at the given screen coordinates. More... | |
int | mgsGetColor (int scr, int x, int y) |
Returns the color of the pixel at the given screen coordinates. More... | |
int | mgsLine (int scrNumber, int xStart, int yStart, int xEnd, int yEnd, int width, int color) |
Draws a line with the given color and width from the given start to the given end point. More... | |
int | mgsEArc (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startingAngle, int endingAngle, int width, int color) |
Draws an elliptic arc with the given color and dimensions. More... | |
int | mgsRotatedEArc (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startingAngle, int endingAngle, int rotationAngle, int width, int color) |
Draws a rotated elliptic arc with the given color and dimensions. More... | |
int | mgsDrawRectangle (int scrNumer, int left, int top, int right, int bottom, int width, int color) |
Draws a non filled rectangle with the given color and dimensions. More... | |
int | mgsDrawEllipse (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int width, int color) |
Draws a non filled ellipse with the given color and dimensions. More... | |
int | mgsDrawRegPolygonCR (int scrNumber, int sides, int centerX, int centerY, int radius, int width, int color) |
Draws a regular polygon given the number of vertex, radius and center, and its color. More... | |
int | mgsDrawRegPolygonVC (int scrNumber, int sides, int vertexX, int vertexY, int centerX, int centerY, int width, int color) |
Draws a regular polygon given the number of vertex, center, one vertice and its color. More... | |
int | mgsDrawPolygon (int scrNumber, int sides, int *vertices, int width, int color) |
Draws a generic polygon given its number and list of vertex and its color. More... | |
int | mgsDrawStarCR (int scrNumber, int nsides, int centerX, int centerY, int externalRadius, int internalRadius, int width, int color) |
Draws a star given the number of points, inner and outer radius and center, and its color. More... | |
int | mgsDrawStarVC (int scrNumber, int sides, int vertexX, int vertexY, int centerX, int centerY, int internalRadius, int width, int color) |
Draws a star given the number of points, center, inner radius, one point and its color. More... | |
int | mgsDrawESector (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startingAngle, int endingAngle, int width, int color) |
Draws an elliptic sector with the given color and dimensions. More... | |
int | mgsDrawESegment (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startingAngle, int endingAngle, int width, int color) |
Draws an elliptic segment with the given color and dimensions. More... | |
int | mgsDrawRotatedRectangle (int scrNumer, int left, int top, int right, int bottom, int angle, int width, int color) |
Draws a non filled rotated rectangle with the given color and dimensions. More... | |
int | mgsDrawRotatedEllipse (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int angle, int width, int color) |
Draws a non filled rotated ellipse with the given color and dimensions. More... | |
int | mgsDrawRotatedRegPolygonCR (int scrNumber, int sides, int centerX, int centerY, int radius, int angle, int width, int color) |
Draws a rotated regular polygon given the number of vertex, radius and center, and its color. More... | |
int | mgsDrawRotatedPolygon (int scrNumber, int sides, int *vertices, int centerX, int centerY, int angle, int width, int color) |
Draws a rotated generic polygon given its number and list of vertex and its color. More... | |
int | mgsDrawRotatedStarCR (int scrNumber, int nsides, int centerX, int centerY, int externalRadius, int internalRadius, int angle, int width, int color) |
Draws a rotated star given the number of points, inner and outer radius and center, and its color. More... | |
int | mgsDrawRotatedESector (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startingAngle, int endingAngle, int rotationAngle, int width, int color) |
Draws a rotated elliptic sector with the given color and dimensions. More... | |
int | mgsDrawRotatedESegment (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startingAngle, int endingAngle, int rotationAngle, int width, int color) |
Draws a rotated elliptic segment with the given color and dimensions. More... | |
int | mgsBorderedRectangle (int scrNumber, int left, int top, int right, int bottom, int color, int borderWidth, int borderColor) |
Draws a bordered rectangle with the given colors and dimensions. A macro is provided to draw uniform non bordered rectangles. More... | |
int | mgsBorderedEllipse (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int color, int borderWidth, int borderColor) |
Draws a bordered ellipse with the given colors and dimensions. A macro is provided to draw uniform non bordered ellipses. More... | |
int | mgsBorderedRegPolygonCR (int scrNumber, int sides, int centerX, int centerY, int radius, int color, int borderWidth, int borderColor) |
Draws a regular polygon given the number of vertex, radius and center, and its colors. A macro is provided to draw uniform non bordered regular polygons this way. More... | |
int | mgsBorderedRegPolygonVC (int scrNumber, int sides, int vertexX, int vertexY, int centerX, int centerY, int color, int borderWidth, int borderColor) |
Draws a regular polygon given the number of vertex, center, one vertice and its colors. A macro is provided to draw uniform non bordered regular polygons this way. More... | |
int | mgsBorderedPolygon (int scrNumber, int sides, int *vertices, int color, int borderWidth, int borderColor) |
Draws a generic polygon given its number and list of vertex and its colors. A macro is provided to draw uniform non bordered generic polygons. More... | |
int | mgsBorderedStarCR (int scrNumber, int sides, int centerX, int centerY, int externalRadius, int internalRadius, int color, int borderWidth, int borderColor) |
Draws a star given the number of points, inner and outer radius and center, and its colors. A macro is provided to draw uniform non bordered regular stars this way. More... | |
int | mgsBorderedStarVC (int scrNumber, int sides, int vertexX, int vertexY, int centerX, int centerY, int internalRadius, int color, int borderWidth, int borderColor) |
Draws a star given the number of points, center, inner radius, one point and its colors. A macro is provided to draw uniform non bordered stars this way. More... | |
int | mgsBorderedESector (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startAngle, int endAngle, int color, int borderWidth, int borderColor) |
Draws a bordered elliptic sector with the given colors and dimensions. A macro is provided to draw uniform non bordered sectors this way. More... | |
int | mgsBorderedESegment (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startAngle, int endAngle, int color, int borderWidth, int borderColor) |
Draws an elliptic segment with the given color and dimensions. A macro is provided to draw uniform non bordered segments this way. More... | |
int | mgsRotatedBorderedRectangle (int scrNumber, int left, int top, int right, int bottom, int angle, int color, int borderWidth, int borderColor) |
Draws a rotated bordered rectangle with the given colors and dimensions. A macro is provided to draw rotated uniform non bordered rectangles. More... | |
int | mgsRotatedBorderedEllipse (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int angle, int color, int borderWidth, int borderColor) |
Draws a rotated bordered ellipse with the given colors and dimensions. A macro is provided to draw rotated uniform non bordered ellipses. More... | |
int | mgsRotatedBorderedRegPolygonCR (int scrNumber, int sides, int centerX, int centerY, int radius, int angle, int color, int borderWidth, int borderColor) |
Draws a rotated regular polygon given the number of vertex, radius and center, and its colors. A macro is provided to draw uniform non bordered rotated regular polygons. More... | |
int | mgsRotatedBorderedPolygon (int scrNumber, int sides, int *vertices, int centerX, int centerY, int angle, int color, int borderWidth, int borderColor) |
Draws a rotated generic polygon given its number and list of vertex and its colors. A macro is provided to draw rotated uniform non bordered generic polygons. More... | |
int | mgsRotatedBorderedStarCR (int scrNumber, int sides, int centerX, int centerY, int externalRadius, int internalRadius, int angle, int color, int borderWidth, int borderColor) |
Draws a rotated star given the number of points, inner and outer radius and center, and its colors. A macro is provided to draw uniform non bordered rotated regular stars this way. More... | |
int | mgsRotatedBorderedESector (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startAngle, int endAngle, int rotationAngle, int color, int borderWidth, int borderColor) |
Draws a rotated bordered elliptic sector with the given colors and dimensions. A macro is provided to draw uniform non bordered sectors this way. More... | |
int | mgsRotatedBorderedESegment (int scrNumber, int centerX, int centerY, int radiusH, int radiusV, int startAngle, int endAngle, int rotationAngle, int color, int borderWidth, int borderColor) |
Draws an elliptic segment with the given color and dimensions. A macro is provided to draw uniform non bordered segments this way. More... | |
int | mgsLoadImage (char *name) |
Loads an image and creates a new image object. More... | |
int | mgsSetImportTColor (unsigned int c) |
Sets the color to use for transparent pixels. More... | |
int | mgsMakeImage (int scrNumber, int originX, int originY, int width, int height) |
Creates a new image object from a rectangular region of a screen. More... | |
int | mgsImageWidth (int imgNumber) |
Returns the width of a image. More... | |
int | mgsImageHeight (int imgNumber) |
Returns the height of a image. More... | |
int | mgsDeleteImage (int imgNumber) |
Delete the image whose reference number is given. More... | |
int | mgsDisplayImage (int scrNumber, int imgNumber, int dx, int dy, int transparent) |
Displays an image on screen at the given position. More... | |
int | mgsDisplayRotatedImage (int scrNumber, int imgNumber, int dx, int dy, double scaleX, double scaleY, int angle, int transparent) |
Displays a rotated and scaled image on screen at the given position. More... | |
int | mgsSetFont (int scrNumber, int size, int textColor, int backColor) |
Sets font size and colors (text and background). More... | |
int | mgsSetFontType (int scrNumber, int size, int angle, char *fontName, int style) |
Sets font type and size. More... | |
int | mgsSetFontColor (int scrNumber, int textColor, int backColor) |
Sets font size and colors (text and background). More... | |
int | mgsPuts (int scrNumber, int x, int y, char *str) |
Outputs a text string at the given position. More... | |
int | mgsPutsAligned (int scrNumber, int mode, int left, int top, int right, int bottom, char *str) |
Outputs a text string aligned at the given position. More... | |
int | mgsTextSize (int scrNumber, char *str, int *y) |
Returns the width and height in pixels of the given string on the screen. More... | |
int | mgsMouseButtons (int scrNumber) |
Gets the state of the mouse buttons when activated over the given screen. More... | |
int | mgsMouseX (int scrNumber) |
Gets the x coordinate of the cusor over the screen. More... | |
int | mgsMouseY (int scrNumber) |
Gets the y coordinate of the cusor over the screen. More... | |
int | mgsMouseGlobal (int *y) |
Gets the x and y coordinates of the cusor over the desktop. More... | |
int | mgsMouseIn (int scrNumber) |
Determines if the cursor is over the screen. More... | |
int | mgsMouseWheel (int scrNumber, unsigned char reset) |
Gets the last mouse wheel movement when the screen has the focus. More... | |
void | mgsHandleMouse (int scr) |
Advanced mouse handling coordination function. More... | |
unsigned char | mgsMouseClicked (int scr, unsigned char b, int x0, int y0, int x1, int y1) |
Detects user clicks on the given rectangular region of the screen. More... | |
unsigned char | mgsMousePressed (int scr, unsigned char b, int x0, int y0, int x1, int y1) |
Returns the pressing state of the given button on the given rectangular region of the screen. More... | |
unsigned char | mgsMouseOver (int scr, int x0, int y0, int x1, int y1) |
Retruns true if the cursor is over the given rectangular region of the screen. More... | |
unsigned char | mgsKeyPressed (int keyCode) |
Checks if a given key is pressed. More... | |
int | mgsPlaySoundFile (char *filename, int mode) |
Plays the given .WAV sound file. More... | |
void | mgsSetFrameTime (int milliSeconds) |
Sets the new frame duration in ms. More... | |
void | mgsWaitFrame (void) |
Stops the main thread until the given frame time expires. More... | |
double | mgsPerformanceMeasure (int mode) |
Returns different measures of the inter frame time. More... | |
void | mgsShowError (int errNum, char *msg, int flags) |
Displays a console message or a windows message box about the error. More... | |
struct mgsInfo | mgsVersionData (void) |
Returns the main MGS System information. More... | |
#define mgsRGBColor | ( | r, | |
g, | |||
b | |||
) | ((((b)&0xFF)<<16)|(((g)&0xFF)<<8)|((r)&0xFF)) |
This macro creates an int with the appropriate color by combining the R, G, and B components passed individually. Each of them should be a value between 0 and 255
#define mgsGetScreenInfo | ( | s, | |
p | |||
) | mgsGetScreenInfoAdvanced((s), (p), NULL); |
This macro calls the advanced get screen information but discarding information about the handle
int mgsCreateScreen | ( | int | sx, |
int | sy, | ||
char * | t, | ||
int | bckColor, | ||
char * | file | ||
) |
This function is used to create a graphic screen of the given width and height. If a title is specified it will be used as window title, else the system provides a generic one. Also a color and an optional image for the background are given. If the image exists, it is adjusted to the screen size; if no image is specified or the file does not exist or it is not a valid BMP file, the background is set to the given color. The graphic screen window is created to the right of the main application window, at the same vertical position. This function is previous to the use of any other of the library functions (with exceptions that include keyboard input and sound), so any application should start by creating at least one graphic screen.
[in] | sx | Width in pixels of the client area of the created screen. |
[in] | sy | Height in pixels of the client area of the created screen. |
[in] | t | Title of the window. The system provides a generic one if it is NULL. |
[in] | bckColor | Background color for the screen. It will be used if a background image does not exist. |
[in] | file | Background image. It will be used unless it is NULL or it is not a valid bmp file. |
int mgsFullScreen | ( | int | bckColor, |
char * | file | ||
) |
This function is used to create a full screen borderless graphic screen. Also a color and an optional image for the background are given. If the image exists, it is adjusted to the screen size; if no image is specified or the file does not exist or it is not a valid BMP file, the background is set to the given color. This function is previous to the use of any other of the library functions (with exceptions that include keyboard input and sound), so any application should start by creating at least one graphic screen.
[in] | bckColor | Background color for the screen. It will be used if a background image does not exist. |
[in] | file | Background image. It will be used unless it is NULL or it is not a valid bmp file. |
int mgsDeleteScreen | ( | int | scr | ) |
This functions deletes from the system the graphic screen whose reference number is given, releasing all associated resources including its window. The reference number and screen slot are released for further use.
[in] | scr | Graphic screen reference number. |
int mgsMoveScreen | ( | int | scr, |
int | x, | ||
int | y | ||
) |
This functions places the given screen -top left corner- to the indicated position, without altering proportion nor contents. No bounding checks are performed.
[in] | scr | Graphic screen reference number. |
[in] | x | Coordinate of the leftmost position. |
[in] | y | Coordinate of the top position. |
int mgsActivateScreen | ( | int | scr | ) |
The screen whose number is given is placed at the topmost Z position which results in this screen being displayed at the front of the display.
[in] | scr | Graphic screen reference number. |
int mgsUpdateScreen | ( | int | scr | ) |
The drawing functions of the library do not affect the window client area but an in memory image of it. When mgsUpdateScreen is called the window is updated and all the modifications actually displayed. The applications has thus control of the updating of the real window, allowing to perform timed updates and animations. Note that this control is not total, as the system will update the window if it is required to redraw it (if it has been totally or partially covered and returns to be completely visible).
[in] | scr | Graphic screen reference number. |
int mgsClearScreen | ( | int | scr | ) |
The screen is cleared by displaying only the background color or image.
[in] | scr | Graphic screen reference number. |
int mgsSetBackground | ( | int | scr | ) |
The current contents of the screen are freezed as its background to be used in future calls to mgsClearScreen. This allows to programmatically create backgrounds or to change it as required on runtime.
[in] | scr | Graphic screen reference number. |
int mgsGetScreenInfoAdvanced | ( | int | scr, |
int * | ps, | ||
char * | h | ||
) |
Returns postion and size information about the selected window or the desktop. It can also return a handle to the screen.
[in] | scr | Graphic screen reference number. If it is < 0 the desktop size (resolution) is returned. |
[out] | ps | A vector of six integers to return screen left position, top position, width and height including border and width and height of the drawing area, in this order. If the desktop is selected, the two first values will be 0, third and fifth will be equal, as well as fourth and sixth. |
[in,out] | h | If this parameter is not null, a handle to the window is returned (so the type of h has to be adequate to hold it). If the desktop is selected this parameter is ignored. |
int mgsPoint | ( | int | scr, |
int | x, | ||
int | y, | ||
int | c | ||
) |
A single pixel of the given color is drawn af the given coordinates if these are inside the screen. Nothing happens otherwise.
[in] | scr | Graphic screen reference number. |
[in] | x | Horizonal coordinate of the pixel. |
[in] | y | Vertical coordinate of the pixel. |
[in] | c | Color of the pixel. |
int mgsGetColor | ( | int | scr, |
int | x, | ||
int | y | ||
) |
A single pixel of the given color is drawn af the given coordinates if these are inside the screen. Nothing happens otherwise.
[in] | scr | Graphic screen reference number. |
[in] | x | Horizonal coordinate of the pixel. |
[in] | y | Vertical coordinate of the pixel. |
int mgsLine | ( | int | scr, |
int | sx, | ||
int | sy, | ||
int | ex, | ||
int | ey, | ||
int | w, | ||
int | c | ||
) |
A straight line of the given width and color is drawn from the start to the end point (this one always excluded). If either the origin or the end are out of the screen, the visible part of the line is drawn.
[in] | scr | Graphic screen reference number. |
[in] | sx | Horizonal coordinate of the start point. |
[in] | sy | Vertical coordinate of the start point. |
[in] | ex | Horizonal coordinate of the end point. |
[in] | ey | Vertical coordinate of the end point. |
[in] | w | Width in pixels of the line. |
[in] | c | Color of the line. |
int mgsEArc | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | w, | ||
int | c | ||
) |
This functions draws the arc of an ellipse defined by its center and horizonal and vertical radius. If both are equal a circular arc is drawn. The starting and ending counterclockwise angles of the arch are also given. Only the on screen part of the ellipse is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the ellipse. |
int mgsRotatedEArc | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | a, | ||
int | w, | ||
int | c | ||
) |
This functions draws the arc of an ellipse defined by its center and horizonal and vertical radius, rotated counterclockwise the given angle. If both are equal a circular arc is drawn. The starting and ending counterclockwise angles of the arc are also given. Only the on screen part of the ellipse is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | a | Sexagesimal rotation angle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the ellipse. |
int mgsDrawRectangle | ( | int | scr, |
int | l, | ||
int | t, | ||
int | r, | ||
int | b, | ||
int | w, | ||
int | c | ||
) |
This functions draws a rectangle defined by (l,t) and (r,b) as the coordinates of the top left and bottom right corner respectively. The function suceeds and draws the corresponding rectangle although the corners are not well defined (that is, bottom higher than top, left righter than right) or out of screen. A color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | l | Leftmost horizontal coordinate of the rectangle. |
[in] | t | Top vertical coordinate of the rectangle. |
[in] | r | Rightmost horizontal coordinate of the rectangle. |
[in] | b | Bottom vertical coordinate of the rectangle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the rectangle. |
int mgsDrawEllipse | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | w, | ||
int | c | ||
) |
This functions draws an ellipse defined by its center and horizonal and vertical radius. If both are equal a circle is drawn. Only the on screen part of the ellipse is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the ellipse. |
int mgsDrawRegPolygonCR | ( | int | scr, |
int | ns, | ||
int | cx, | ||
int | cy, | ||
int | r, | ||
int | w, | ||
int | c | ||
) |
This functions draws a regular polygon defined by its center, radius of the circumscribed circumference and number of vertex. The polygon is drawn so that one vertex is placed at the vertical coordinate of the center and to its right. Only the on screen part of the polygon is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | cx | Horizontal coordinate of the center of the polygon. |
[in] | cy | Vertical coordinate of the center of the polygon. |
[in] | r | Radius of the polygon. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the polygon. |
int mgsDrawRegPolygonVC | ( | int | scr, |
int | ns, | ||
int | vx, | ||
int | vy, | ||
int | cx, | ||
int | cy, | ||
int | w, | ||
int | c | ||
) |
This functions draws a regular polygon defined by its center, coordinates of one vertice and number of vertex. Only the on screen part of the polygon is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | vx | Horizontal coordinate of the given vertice. |
[in] | vy | Vertical coordinate of the given vertice. |
[in] | cx | Horizontal coordinate of the center of the polygon. |
[in] | cy | Vertical coordinate of the center of the polygon. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the polygon. |
int mgsDrawPolygon | ( | int | scr, |
int | ns, | ||
int * | vx, | ||
int | w, | ||
int | c | ||
) |
This functions draws a polygon defined by its number of vertex and the coordinates of all of them. These are placed on a vector of integers, holding on its even elements (0, 2, ...) the x coordinates and on its odd ones (1, 3, ...) the y coordinates. Only the on screen part of the polygon is drawn. A border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | vx | Vector of 2 * ns integers. Each pair of integers hold the x and y coordinates of a vertice. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the polygon. |
int mgsDrawStarCR | ( | int | scr, |
int | ns, | ||
int | cx, | ||
int | cy, | ||
int | er, | ||
int | ir, | ||
int | w, | ||
int | c | ||
) |
This functions draws a star defined by its center, inner and outer radius and number of points. The outer radius is the distance from the center to the points, while the inner is the distance from the center to the nodes. The star is drawn so that one point is placed at the vertical coordinate of the center and to its right. It is not required that the inner radius be less than the outer, but none of them can be 0. Only the on screen part of the star is drawn. A border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of points of the star. |
[in] | cx | Horizontal coordinate of the center of the star. |
[in] | cy | Vertical coordinate of the center of the star. |
[in] | er | Outer radius of the star. |
[in] | ir | Inner radius of the star. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the polygon. |
int mgsDrawStarVC | ( | int | scr, |
int | ns, | ||
int | vx, | ||
int | vy, | ||
int | cx, | ||
int | cy, | ||
int | ir, | ||
int | w, | ||
int | c | ||
) |
This functions draws a star defined by its center, coordinates of one point, inner radius and number of points. The inner radius can be longer than the distance from the center to the point, but none of them can be 0. Only the on screen part of the star is drawn. A border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of points of the star. |
[in] | vx | Horizontal coordinate of the given point. |
[in] | vy | Vertical coordinate of the given point. |
[in] | cx | Horizontal coordinate of the center of the star. |
[in] | cy | Vertical coordinate of the center of the star. |
[in] | ir | Inner radius of the star. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the polygon. |
int mgsDrawESector | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | w, | ||
int | c | ||
) |
This functions draws a sector of ellipse defined by its center and horizonal and vertical radius. If both are equal a circular sector is drawn. The starting and ending counterclockwise angles of the arch are also given. Only the on screen part of the sector is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the ellipse. |
int mgsDrawESegment | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | w, | ||
int | c | ||
) |
This functions draws a sement of ellipse defined by its center and horizonal and vertical radius. If both are equal a circular segment is drawn. The starting and ending counterclockwise angles of the arch are also given. Only the on screen part of the sement is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the ellipse. |
int mgsDrawRotatedRectangle | ( | int | scr, |
int | l, | ||
int | t, | ||
int | r, | ||
int | b, | ||
int | a, | ||
int | w, | ||
int | c | ||
) |
This functions draws a rectangle defined by (l,t) and (r,b) as the coordinates of the top left and bottom right corner respectively, rotated counterclockwise the given angle. The rotation point is the calculated center of the rectangle, so the l and t coordinates do not determine in general any point on the rotated figure. The function suceeds and draws the corresponding rectangle although the corners are not well defined (that is, bottom higher than top, left righter than right) or out of screen. A color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | l | Leftmost horizontal coordinate of the rectangle. |
[in] | t | Top vertical coordinate of the rectangle. |
[in] | r | Rightmost horizontal coordinate of the rectangle. |
[in] | b | Bottom vertical coordinate of the rectangle. |
[in] | a | Sexagesimal rotation angle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the rectangle. |
int mgsDrawRotatedEllipse | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | a, | ||
int | w, | ||
int | c | ||
) |
This functions draws an ellipse defined by its center and horizonal and vertical radius, rotated counterclockwise the given angle. If both are equal a circle is drawn. Only the on screen part of the ellipse is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | a | Sexagesimal rotation angle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the ellipse. |
int mgsDrawRotatedRegPolygonCR | ( | int | scr, |
int | ns, | ||
int | cx, | ||
int | cy, | ||
int | r, | ||
int | a, | ||
int | w, | ||
int | c | ||
) |
This functions draws a regular polygon defined by its center, radius of the circumscribed circumference and number of vertex, rotated counterclockwise the given angle. The polygon is calculated so that one vertex is placed at the vertical coordinate of the center and to its right, then rotated counterclockwise the given angle. Only the on screen part of the polygon is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | cx | Horizontal coordinate of the center of the polygon. |
[in] | cy | Vertical coordinate of the center of the polygon. |
[in] | r | Radius of the polygon. |
[in] | a | Sexagesimal rotation angle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the polygon. |
int mgsDrawRotatedPolygon | ( | int | scr, |
int | ns, | ||
int * | vx, | ||
int | cx, | ||
int | cy, | ||
int | a, | ||
int | w, | ||
int | c | ||
) |
This functions draws a polygon defined by its number of vertex and the coordinates of all of them. These are placed on a vector of integers, holding on its even elements (0, 2, ...) the x coordinates and on its odd ones (1, 3, ...) the y coordinates. The polygon is rotated counterclockwise the given angle around the given arbitrary point. Only the on screen part of the polygon is drawn. A border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | vx | Vector of 2 * ns integers. Each pair of integers hold the x and y coordinates of a vertice. |
[in] | cx | Horizontal coordinate of the rotation point. |
[in] | cy | Vertical coordinate of the rotation point. |
[in] | a | Sexagesimal rotation angle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the polygon. |
int mgsDrawRotatedStarCR | ( | int | scr, |
int | ns, | ||
int | cx, | ||
int | cy, | ||
int | er, | ||
int | ir, | ||
int | a, | ||
int | w, | ||
int | c | ||
) |
This functions draws a star defined by its center, inner and outer radius and number of points. The outer radius is the distance from the center to the points, while the inner is the distance from the center to the nodes. The star is drawn so that one point is placed at the vertical coordinate of the center and to its right. It is not required that the inner radius be less than the outer, but none of them can be 0. Only the on screen part of the star is drawn. A border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of points of the star. |
[in] | cx | Horizontal coordinate of the center of the star. |
[in] | cy | Vertical coordinate of the center of the star. |
[in] | er | Outer radius of the star. |
[in] | ir | Inner radius of the star. |
[in] | a | Sexagesimal rotation angle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the polygon. |
int mgsDrawRotatedESector | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | a, | ||
int | w, | ||
int | c | ||
) |
This functions draws a sector of ellipse defined by its center and horizonal and vertical radius, rotated counterclockwise the given angle. If both are equal a circular sector is drawn. The starting and ending counterclockwise angles of the arch are also given. Only the on screen part of the sector is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | a | Sexagesimal rotation angle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the ellipse. |
int mgsDrawRotatedESegment | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | a, | ||
int | w, | ||
int | c | ||
) |
This functions draws a segment of ellipse defined by its center and horizonal and vertical radius, rotated counterclockwise the given angle. If both radius are equal a circular segment is drawn. The starting and ending counterclockwise angles of the arch are also given. Only the on screen part of the sement is drawn. The border color and width are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | a | Sexagesimal rotation angle. |
[in] | w | Width in pixels of the border. |
[in] | c | Color of the ellipse. |
int mgsBorderedRectangle | ( | int | scr, |
int | l, | ||
int | t, | ||
int | r, | ||
int | b, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a rectangle defined by (l,t) and (r,b) as the coordinates of the top left and bottom right corner respectively. The function suceeds and draws the corresponding rectangle although the corners are not well defined (that is, bottom higher than top, left righter than right) or out of screen. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | l | Leftmost horizontal coordinate of the rectangle. |
[in] | t | Top vertical coordinate of the rectangle. |
[in] | r | Rightmost horizontal coordinate of the rectangle. |
[in] | b | Bottom vertical coordinate of the rectangle. |
[in] | fc | Fill color of the rectangle. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsBorderedEllipse | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws an ellipse defined by its center and horizonal and vertical radius. If both are equal a circle is drawn. Only the on screen part of the ellipse is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | fc | Fill color of the ellipse. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsBorderedRegPolygonCR | ( | int | scr, |
int | ns, | ||
int | cx, | ||
int | cy, | ||
int | r, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a regular polygon defined by its center, radius of the circumscribed circumference and number of vertex. The polygon is drawn so that one vertex is placed at the vertical coordinate of the center and to its right. Only the on screen part of the polygon is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | cx | Horizontal coordinate of the center of the polygon. |
[in] | cy | Vertical coordinate of the center of the polygon. |
[in] | r | Radius of the polygon. |
[in] | fc | Fill color of the polygon. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsBorderedRegPolygonVC | ( | int | scr, |
int | ns, | ||
int | vx, | ||
int | vy, | ||
int | cx, | ||
int | cy, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a regular polygon defined by its center, coordinates of one vertice and number of vertex. Only the on screen part of the polygon is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | vx | Horizontal coordinate of the given vertice. |
[in] | vy | Vertical coordinate of the given vertice. |
[in] | cx | Horizontal coordinate of the center of the polygon. |
[in] | cy | Vertical coordinate of the center of the polygon. |
[in] | fc | Fill color of the polygon. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsBorderedPolygon | ( | int | scr, |
int | ns, | ||
int * | vx, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a polygon defined by its number of vertex and the coordinates of all of them. These are placed on a vector of integers, holding on its even elements (0, 2, ...) the x coordinates and on its odd ones (1, 3, ...) the y coordinates. Only the on screen part of the polygon is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | vx | Vector of 2 * ns integers. Each pair of integers hold the x and y coordinates of a vertice. |
[in] | fc | Fill color of the polygon. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsBorderedStarCR | ( | int | scr, |
int | ns, | ||
int | cx, | ||
int | cy, | ||
int | er, | ||
int | ir, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a star defined by its center, inner and outer radius and number of points. The outer radius is the distance from the center to the points, while the inner is the distance from the center to the nodes. The star is drawn so that one point is placed at the vertical coordinate of the center and to its right. It is not required that the inner radius be less than the outer, but none of them can be 0. Only the on screen part of the star is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of points of the star. |
[in] | cx | Horizontal coordinate of the center of the star. |
[in] | cy | Vertical coordinate of the center of the star. |
[in] | er | Outer radius of the star. |
[in] | ir | Inner radius of the star. |
[in] | fc | Fill color of the star. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsBorderedStarVC | ( | int | scr, |
int | ns, | ||
int | vx, | ||
int | vy, | ||
int | cx, | ||
int | cy, | ||
int | ir, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a star defined by its center, coordinates of one point, inner radius and number of points. The inner radius can be longer than the distance from the center to the point, but none of them can be 0. Only the on screen part of the star is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of points of the star. |
[in] | vx | Horizontal coordinate of the given point. |
[in] | vy | Vertical coordinate of the given point. |
[in] | cx | Horizontal coordinate of the center of the star. |
[in] | cy | Vertical coordinate of the center of the star. |
[in] | ir | Inner radius of the star. |
[in] | fc | Fill color of the star. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsBorderedESector | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a sector of ellipse defined by its center and horizonal and vertical radius. If both are equal a circular sector is drawn. The starting and ending counterclockwise angles of the arch are also given. Only the on screen part of the sector is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | fc | Fill color of the sector. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsBorderedESegment | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a segment of ellipse defined by its center and horizonal and vertical radius. If both are equal a circular segment is drawn. The starting and ending counterclockwise angles of the arch are also given. Only the on screen part of the sement is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | fc | Fill color of the segment. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsRotatedBorderedRectangle | ( | int | scr, |
int | l, | ||
int | t, | ||
int | r, | ||
int | b, | ||
int | a, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a rectangle defined by (l,t) and (r,b) as the coordinates of the top left and bottom right corner respectively, rotated counterclockwise the given angle. The rotation point is the calculated center of the rectangle, so the l and t coordinates do not determine in general any point on the rotated figure. The function suceeds and draws the corresponding rectangle although the corners are not well defined (that is, bottom higher than top, left righter than right) or out of screen. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | l | Leftmost horizontal coordinate of the rectangle. |
[in] | t | Top vertical coordinate of the rectangle. |
[in] | r | Rightmost horizontal coordinate of the rectangle. |
[in] | b | Bottom vertical coordinate of the rectangle. |
[in] | a | Sexagesimal rotation angle. |
[in] | fc | Fill color of the rectangle. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsRotatedBorderedEllipse | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | a, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws an ellipse defined by its center and horizonal and vertical radius, rotated counterclockwise the given angle. If both radius are equal a circle is drawn. Only the on screen part of the ellipse is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | a | Sexagesimal rotation angle. |
[in] | fc | Fill color of the ellipse. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsRotatedBorderedRegPolygonCR | ( | int | scr, |
int | ns, | ||
int | cx, | ||
int | cy, | ||
int | r, | ||
int | a, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a regular polygon defined by its center, radius of the circumscribed circumference and number of vertex. The polygon is calculated so that one vertex is placed at the vertical coordinate of the center and to its right, then rotated counterclockwise the given angle. Only the on screen part of the polygon is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | cx | Horizontal coordinate of the center of the polygon. |
[in] | cy | Vertical coordinate of the center of the polygon. |
[in] | r | Radius of the polygon. |
[in] | a | Sexagesimal rotation angle. |
[in] | fc | Fill color of the polygon. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsRotatedBorderedPolygon | ( | int | scr, |
int | ns, | ||
int * | vx, | ||
int | cx, | ||
int | cy, | ||
int | a, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a polygon defined by its number of vertex and the coordinates of all of them. These are placed on a vector of integers, holding on its even elements (0, 2, ...) the x coordinates and on its odd ones (1, 3, ...) the y coordinates. The polygon is rotated counterclockwise the given angle around the given arbitrary point. Only the on screen part of the polygon is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of sides (and vertex) of the polygon. |
[in] | vx | Vector of 2 * ns integers. Each pair of integers hold the x and y coordinates of a vertice. |
[in] | cx | Horizontal coordinate of the rotation point. |
[in] | cy | Vertical coordinate of the rotation point. |
[in] | a | Sexagesimal rotation angle. |
[in] | fc | Fill color of the polygon. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsRotatedBorderedStarCR | ( | int | scr, |
int | ns, | ||
int | cx, | ||
int | cy, | ||
int | er, | ||
int | ir, | ||
int | a, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a star defined by its center, inner and outer radius and number of points. The outer radius is the distance from the center to the points, while the inner is the distance from the center to the nodes. The star is calculated so that one point is placed at the vertical coordinate of the center and to its right. Then it is rotated counterclockwise the given angle. It is not required that the inner radius be less than the outer, but none of them can be 0. Only the on screen part of the star is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | ns | Number of points of the star. |
[in] | cx | Horizontal coordinate of the center of the star. |
[in] | cy | Vertical coordinate of the center of the star. |
[in] | er | Outer radius of the star. |
[in] | ir | Inner radius of the star. |
[in] | a | Sexagesimal rotation angle. |
[in] | fc | Fill color of the star. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsRotatedBorderedESector | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | a, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a sector of ellipse defined by its center and horizonal and vertical radius. If both are equal a circular sector is drawn. The starting and ending counterclockwise angles of the arch are also given. The sector is then rotated counterclockwise the given angle. Only the on screen part of the sector is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | a | Sexagesimal rotation angle. |
[in] | fc | Fill color of the sector. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsRotatedBorderedESegment | ( | int | scr, |
int | cx, | ||
int | cy, | ||
int | rh, | ||
int | rv, | ||
int | sa, | ||
int | ea, | ||
int | a, | ||
int | fc, | ||
int | bw, | ||
int | bc | ||
) |
This functions draws a segment of ellipse defined by its center and horizonal and vertical radius. If both are equal a circular segment is drawn. The starting and ending counterclockwise angles of the arch are also given. The segment is then rotated counterclockwise the given angle. Only the on screen part of the sement is drawn. A border color and width and a fill color are also provided and applied.
[in] | scr | Graphic screen reference number. |
[in] | cx | Horizontal coordinate of the center of the ellipse. |
[in] | cy | Vertical coordinate of the center of the ellipse. |
[in] | rh | Horizontal radius of the ellipse. |
[in] | rv | Vertical radius of the ellipse. |
[in] | sa | Starting angle, counted counterclocwise from the horizontal. |
[in] | ea | Ending angle, counted counterclocwise from the horizontal. The drawn angle is the difference of both. |
[in] | a | Sexagesimal rotation angle. |
[in] | fc | Fill color of the segment. |
[in] | bw | Width in pixels of the border. |
[in] | bc | Color of the border. |
int mgsLoadImage | ( | char * | name | ) |
Loads an image from the given file and stores in one of the image slots of the system. The image can then be displayed on the screen in the different modes the image handling functions provide. The functions assumes the color of the upper left corner of the image to be transparent.
[in] | name | The file containing the image. |
int mgsSetImportTColor | ( | unsigned int | c | ) |
Currently MGS lib does not support alpha channel nor real transparent pixels in images. When loading an image file that supports transparent pixels, these are converted to the importTColor. This function sets the value for this color.
[in] | c | The substitution color. |
int mgsMakeImage | ( | int | scr, |
int | ox, | ||
int | oy, | ||
int | w, | ||
int | h | ||
) |
Copies the contents of a rectangular region of a screen in one of the image slots of the system. The image can then be displayed on the screen in the different modes the image handling functions provide. The functions assumes the color of the upper left corner of the image to be transparent.
[in] | scr | Source graphic screen reference number. |
[in] | ox | Horizontal coordinate on screen of the origin left top corner. |
[in] | oy | Vertical coordinate on screen of the origin left top corner. |
[in] | w | Width of the rectangular region. Cannot go out of the original screen. |
[in] | h | Height of the rectangular region. Cannot go out of the original screen. |
int mgsImageWidth | ( | int | img | ) |
Returns the width in pixels of a previously loaded .BMP image
[in] | img | Image reference number. |
int mgsImageHeight | ( | int | img | ) |
Returns the height in pixels of a previously loaded .BMP image
[in] | img | Image reference number. |
int mgsDeleteImage | ( | int | img | ) |
This functions deletes from the system the image whose reference number is given, releasing all associated resources. The reference number and image slot are released for further use.
[in] | img | Image reference number. |
int mgsDisplayImage | ( | int | scr, |
int | img, | ||
int | dx, | ||
int | dy, | ||
int | t | ||
) |
Displays an existing image at the given position of the screen, keeping its width and height. If the transparent flag is set (noncero value) pixels having the color used as transparent (that of the upper left corner) are not displayed preserving the screen color under them
[in] | scr | Graphic screen reference number. |
[in] | img | Image reference number. |
[in] | dx | Horizontal coordinate on screen of the destination left top corner |
[in] | dy | Vertical coordinate on screen of the destination left top corner |
[in] | t | Transparent flag. When noncero the image has transparent pixels |
int mgsDisplayRotatedImage | ( | int | scr, |
int | img, | ||
int | dx, | ||
int | dy, | ||
double | sx, | ||
double | sy, | ||
int | a, | ||
int | t | ||
) |
Displays an existing image at the given position of the screen, scaled on x and y and rotated. If the transparent flag is set (noncero value) pixels having the color used as transparent (that of the upper left corner) are not displayed preserving the screen color under them
[in] | scr | Graphic screen reference number. |
[in] | img | Image reference number. |
[in] | dx | Horizontal coordinate on screen of the destination left top corner |
[in] | dy | Vertical coordinate on screen of the destination left top corner |
[in] | sx | Horizontal scale factor |
[in] | sy | Vertical scale factor |
[in] | a | Rotation angle |
[in] | t | Transparent flag. When noncero the image has transparent pixels |
int mgsSetFont | ( | int | scr, |
int | sz, | ||
int | tc, | ||
int | bc | ||
) |
Sets the size and color of the text and the color of the background to be used in later calls to display text. The background can be made transparent setting it to MGS_TRANSPARENT.
[in] | scr | Graphic screen reference number. |
[in] | sz | Size of the font. |
[in] | tc | Text color. |
[in] | bc | Background color; transparent if using MGS_TRANSPARENT. |
int mgsSetFontType | ( | int | scr, |
int | sz, | ||
int | a, | ||
char * | fn, | ||
int | s | ||
) |
Sets the size and type of the text to be used in later calls to display text. The font is one of windows fonts, and can be set to be italic, underscored and striked out. Its weight -normal, bold, heavy...- can also be set.
[in] | scr | Graphic screen reference number. |
[in] | sz | Size of the font. |
[in] | a | Rotation angle in degrees. |
[in] | fn | Pointer to a string containing the font name. If it is NULL the standard font is used. |
[in] | s | Style of the font. The three lower bits mean from 0 to 2 italic, underline and strikeout. The higher bits a weight ranging from 0 to 1000. The constants MGS_ITALIC, MGS_UNDERLINE and MGS_STRIKEOUT can be ored to form the lower three bits. MGS_LIGHT, MGS_BOLD and MGS_HEAVY are three predefined values for the weight that can also be ored. |
int mgsSetFontColor | ( | int | scr, |
int | tc, | ||
int | bc | ||
) |
Sets the color of the text and the background to be used in later calls to display text. The background can be made transparent setting it to MGS_TRANSPARENT.
[in] | scr | Graphic screen reference number. |
[in] | tc | Text color. |
[in] | bc | Background color; transparent if using MGS_TRANSPARENT. |
int mgsPuts | ( | int | scr, |
int | x, | ||
int | y, | ||
char * | str | ||
) |
Prints the given screen at the given coordinates, that reference the top left corner of the text. Only the visible part of the text is shown.
[in] | scr | Graphic screen reference number. |
[in] | x | Horizontal coordinate of the left top point of the text. |
[in] | y | Vertical coordinate of the left top point of the text. |
[in] | str | String to be displayed. |
int mgsPutsAligned | ( | int | scr, |
int | mode, | ||
int | l, | ||
int | t, | ||
int | r, | ||
int | b, | ||
char * | str | ||
) |
Prints the given text according to the alignment mode and coordinates. If the flag MGS_TSCREEN is ored in mode, the coordinates are the whole screen, otherwise the rectangle formed by (l, t) and (r, b). Mode is formed oring three mutually exclusive modes per dimension to specify the alignment. MGS_TLEFT, MGS_TRIGHT and MGS_THCENTER for the horizontal and MGS_TTOP, MGS_TBOTTOM and MGS_TVCENTER for the vertical. The text is displayed outside the given rectangle unless the MGS_TCUT flag is ored in mode. In this case, the text is cut to fit in the rectangle. No boundary checks are perfored on the size of the text against the coordinates.
[in] | scr | Graphic screen reference number. |
[in] | mode | Alignment mode. See the description. |
[in] | l | Horizontal coordinate of the top left point of the bounding rectangle. |
[in] | t | Vertical coordinate of the top left top point of the bounding rectangle. |
[in] | r | Horizontal coordinate of the bottom right point of the bounding rectangle. |
[in] | b | Vertical coordinate of the bottom right top point of the bounding rectangle. |
[in] | str | String to be displayed. |
int mgsTextSize | ( | int | scr, |
char * | str, | ||
int * | y | ||
) |
Measures the width and height in pixels of a given string, according to the current font selected for the screen. The angle is considered to be horizontal, if the selected font is rotated, the correction has to be done outside this function.
[in] | scr | Graphic screen reference number. |
[in] | str | String to be measured. |
[out] | y | Pointer to the height in pixels of the text. This value is discarded if the pointer is NULL. |
int mgsMouseButtons | ( | int | scr | ) |
Each time a button is pressed or released when the cursor is over the given screen its state is recorded. When we call this function we get its current state, formed oring MGS_MOUSELEFT, MGS_MOUSERIGHT and MGS_MOUSECENTER if the corresponding button is pressed
[in] | scr | Graphic screen reference number. |
int mgsMouseX | ( | int | scr | ) |
Each time the cursor moves over the screen its position is tracked. This function returns its x coordinate if over the screen or the last it took before leaving
[in] | scr | Graphic screen reference number. |
int mgsMouseY | ( | int | scr | ) |
Each time the cursor moves over the screen its position is tracked. This function returns its y coordinate if over the screen or the last it took before leaving
[in] | scr | Graphic screen reference number. |
int mgsMouseGlobal | ( | int * | y | ) |
This function returns the horizontal and vertical coordinates of the cursor over the full desktop. 0,0 is the upper left corner. If y is null only the horizontal is returned
[out] | y | The y coordinate of the cursor over the screen. |
int mgsMouseIn | ( | int | scr | ) |
This function returns 1 if the cursor is over the screen or 0 otherwise. Negative value in case of error
[in] | scr | Graphic screen reference number. |
int mgsMouseWheel | ( | int | scr, |
unsigned char | res | ||
) |
Returns the last ammount rotated using the central wheel of the mouse if the screen is selected . Positive means forward, and negative backwards -towards the user-. This value is not acumulative, but remains unchanged unless it is forced to be reset.
[in] | scr | Graphic screen reference number. |
[in] | res | A value other than 0 resets the stored value to 0. |
void mgsHandleMouse | ( | int | scr | ) |
This function fills all the required data structures needed for the advanced mouse handling functions, according to the activity of the mouse on the screen. Has to be called once per frame or iteration if other advanced functions are to be used.
[in] | scr | Graphic screen reference number. |
unsigned char mgsMouseClicked | ( | int | scr, |
unsigned char | b, | ||
int | x0, | ||
int | y0, | ||
int | x1, | ||
int | y1 | ||
) |
This function returns true if the user has clicked -pressed and released- the given mouse button on the rectangular region specified. The if the cursor moves out of the rectanble between press and release but both occur when it is over it, true is returned. If either press or release occur with the cursor out of the region, the return value is false. Specific macros exist to check only one of the mouse buttons.
[in] | scr | Graphic screen reference number. |
[in] | b | Mouse button, one of _MLEFT, _MCENTER o _MRIGHT. |
[in] | x0 | Leftmost horizontal coordinate of the rectangular region. |
[in] | y0 | Top vertical coordinate of the rectangular region. |
[in] | x1 | Rightmost horizontal coordinate of the rectangular region. |
[in] | y1 | Bottom vertical coordinate of the rectangular region. |
unsigned char mgsMousePressed | ( | int | scr, |
unsigned char | b, | ||
int | x0, | ||
int | y0, | ||
int | x1, | ||
int | y1 | ||
) |
This function returns the pressed state of the button with regard to the rectangular region specified. It can be no pressed at all MGS_MNO, pressed and on the region MGS_MIN or pressed and out of the region MGS_MOUT. When pressed, the flag MGS_MNEW indicates that it has been recently pressed -according to the calls to mgsHandleMouse(). Specific macros exist to check only one of the mouse buttons.
[in] | scr | Graphic screen reference number. |
[in] | b | Mouse button, one of _MLEFT, _MCENTER o _MRIGHT. |
[in] | x0 | Leftmost horizontal coordinate of the rectangular region. |
[in] | y0 | Top vertical coordinate of the rectangular region. |
[in] | x1 | Rightmost horizontal coordinate of the rectangular region. |
[in] | y1 | Bottom vertical coordinate of the rectangular region. |
unsigned char mgsMouseOver | ( | int | scr, |
int | x0, | ||
int | y0, | ||
int | x1, | ||
int | y1 | ||
) |
This function returns true if the cursor is on the screen and over the given rectangle
[in] | scr | Graphic screen reference number. |
[in] | x0 | Leftmost horizontal coordinate of the rectangular region. |
[in] | y0 | Top vertical coordinate of the rectangular region. |
[in] | x1 | Rightmost horizontal coordinate of the rectangular region. |
[in] | y1 | Bottom vertical coordinate of the rectangular region. |
unsigned char mgsKeyPressed | ( | int | keyCode | ) |
Retruns 1 if the given key is pressed, 0 otherwise. While the mouse input functions are per screen, this one is system wise as the keyboard is not related to any specific window. When the key represents a printable character as its main function, its ASCII code is used as parameters, in capital form in case of letters. Else a predefinde constant is used, as MGS_KALT for the ALT key or MGS_KF5 for the F5 function key.
[in] | keyCode | The code of the key to be checked. |
int mgsPlaySoundFile | ( | char * | fs, |
int | mode | ||
) |
This function plays a sound read from the given .wav file. If a previos sound is being it is cancelled, no mixing is performed. If the flag MGS_LOOP is used, the sound is played in a loop, else it is played to its end.
[in] | fs | The name of the sound file. |
[in] | mode | MGS_LOOP to play the sound in a loop or 0 to play it once. |
void mgsSetFrameTime | ( | int | ms | ) |
This functions sets the current frame duration for synchronized animations.
[in] | ms | The new frame duration in ms (> 4). The default frame time is 20ms (50 FPS). |
void mgsWaitFrame | ( | void | ) |
This is the main synchronization function for animations. Whenever it is called it calculated the time lapse since it was previously called. If it is less than the frame time (as it should be) it sleeps the remaining frame time. This function also calculates some values to perform performance measurement using mgsPerformanceMeasure()
double mgsPerformanceMeasure | ( | int | m | ) |
This is an utility function to calculate the relation between the frame time and the processing time in the main loop. It can give mean absoulte milliseconds or relative % (when MGS_PMRELATIVE is ored) measure of the remaining or used (when MGS_PMUSED is ored) time always against the current frame duration. If the MGS_PMRESET flag is ored the accumulated values to calculate the mean are reset to 0.
[in] | m | The measure mode, ored of the flags above. |
void mgsShowError | ( | int | err, |
char * | msg, | ||
int | flags | ||
) |
This functions displays information about the error whose code is passed as parameter. If it is a system error, also the Windows error number obtained with GetLsstError() is shown. Oring the MGS_EFWIN flag a windows message box is used, else a console message is displayed. In this last case, oring MGS_EFWAIT causes the system to wait for pressing the 'C' key.
[in] | err | The error code returned by the last call. |
[in] | msg | An additional user string to be displayed. |
[in] | flags | The display mode, ored of the flags above. |
struct mgsInfo mgsVersionData | ( | void | ) |
Retruns a mgsInfo structure holding the major and minor version numbers, the maximum and free number of screens, the maximun and free number of images, and the frame time. The mgsInfo strucuture is formed by 7 integers: