37 #ifndef __GFX_DRAW_H__
38 #define __GFX_DRAW_H__
58 #define WINDOW_TITLE "FreeRTOS Emulator"
65 #define SCREEN_WIDTH 640
72 #define SCREEN_HEIGHT 480
83 #define TUMBlue (unsigned int)(0x0065bd)
84 #define Red (unsigned int)(0xFF0000)
85 #define Green (unsigned int)(0x00FF00)
86 #define Blue (unsigned int)(0x0000FF)
87 #define Yellow (unsigned int)(0xFFFF00)
88 #define Aqua (unsigned int)(0x00FFFF)
89 #define Fuchsia (unsigned int)(0xFF00FF)
90 #define White (unsigned int)(0xFFFFFF)
91 #define Black (unsigned int)(0x000000)
92 #define Gray (unsigned int)(0x808080)
94 #define Magenta Fuchsia
96 #define Lime (unsigned int)(0x00FF00)
97 #define Maroon (unsigned int)(0x800000)
98 #define Navy (unsigned int)(0x000080)
99 #define Olive (unsigned int)(0x808000)
100 #define Purple (unsigned int)(0x800080)
101 #define Silver (unsigned int)(0xC0C0C0)
102 #define Teal (unsigned int)(0x008080)
103 #define Orange (unsigned int)(0xFFA500)
104 #define Pink (unsigned int)(0xFFC0CB)
105 #define Skyblue (unsigned int)(0x87CEEB)
234 int gfxDrawEllipse(
signed short x,
signed short y,
signed short rx,
235 signed short ry,
unsigned int colour);
251 int gfxDrawArc(
signed short x,
signed short y,
signed short radius,
252 signed short start,
signed short end,
unsigned int colour);
266 int gfxDrawText(
char *str,
signed short x,
signed short y,
unsigned int colour);
291 unsigned int colour);
303 int gfxDrawBox(
signed short x,
signed short y,
signed short w,
signed short h,
304 unsigned int colour);
317 signed short h,
unsigned int colour);
328 int gfxDrawCircle(
signed short x,
signed short y,
signed short radius,
329 unsigned int colour);
342 int gfxDrawLine(
signed short x1,
signed short y1,
signed short x2,
343 signed short y2,
unsigned char thickness,
unsigned int colour);
468 int gfxDrawImage(
char *filename,
signed short x,
signed short y);
518 unsigned sprite_padding_x,
unsigned sprite_padding_y);
544 unsigned sprite_spacing_x,
unsigned sprite_spacing_y);
571 unsigned sprite_width,
unsigned sprite_height,
572 unsigned bounding_box_left_x_pixel,
unsigned bounding_box_top_y_pixel);
603 unsigned sprite_width,
unsigned sprite_height,
604 unsigned sprite_padding_x,
unsigned sprite_padding_y,
605 unsigned bounding_box_left_x_pixel,
unsigned bounding_box_top_y_pixel);
638 unsigned sprite_width,
unsigned sprite_height,
639 unsigned sprite_spacing_x,
unsigned sprite_spacing_y,
640 unsigned bounding_box_left_x_pixel,
unsigned bounding_box_top_y_pixel);
653 signed short x,
signed short y);
689 int gfxDrawArrow(
signed short x1,
signed short y1,
signed short x2,
690 signed short y2,
signed short head_length,
691 unsigned char thickness,
unsigned int colour);
741 unsigned frame_period_ms);
770 unsigned ms_timestep,
int x,
int y);
Config file for the FreeRTOS Emulator.
gfx_animation_handle_t gfxDrawAnimationCreate(gfx_spritesheet_handle_t spritesheet)
Creates an animation object with an attached spritesheet that must be loaded prior as an image.
Definition: gfx_draw.c:504
gfx_image_handle_t gfxDrawLoadImage(char *filename)
Loads an image file from disk, loaded image file can be closed using gfxDrawFreeLoadedImage()
Definition: gfx_draw.c:1457
struct coord coord_t
Holds a pixel co-ordinate.
int gfxDrawGetLoadedImageHeight(gfx_image_handle_t img)
Retrieves the image's height when drawn to screen, ie. after scaling.
Definition: gfx_draw.c:1522
int gfxDrawText(char *str, signed short x, signed short y, unsigned int colour)
Prints a string to the screen.
Definition: gfx_draw.c:1195
int gfxDrawGetLoadedImageSize(gfx_image_handle_t img, int *w, int *h)
Retrieves bother the image's width and height when drawn to screen, ie. after scaling.
Definition: gfx_draw.c:1531
void * gfx_sequence_handle_t
Returns an instance of an animation.
Definition: gfx_draw.h:150
gfx_spritesheet_handle_t gfxDrawLoadSpritesheetFromPortionOfImagePaddedSpacing(gfx_image_handle_t img, unsigned sprite_cols, unsigned sprite_rows, unsigned sprite_width, unsigned sprite_height, unsigned sprite_spacing_x, unsigned sprite_spacing_y, unsigned bounding_box_left_x_pixel, unsigned bounding_box_top_y_pixel)
Creates a spritesheet object from a portion of loaded image where sprites are padded.
Definition: gfx_draw.c:1717
int gfxDrawFreeLoadedImage(gfx_image_handle_t *img)
Closes a loaded image and frees all memory used by the image structure.
Definition: gfx_draw.c:1462
int gfxDrawLine(signed short x1, signed short y1, signed short x2, signed short y2, unsigned char thickness, unsigned int colour)
Draws a line on the screen.
Definition: gfx_draw.c:1332
int gfxDrawGetGlobalYOffset(int *offset)
Retrieves a copy of the current global X axis drawing offset.
Definition: gfx_draw.c:1994
int gfxDrawCircle(signed short x, signed short y, signed short radius, unsigned int colour)
Draws a filled circle on the screen.
Definition: gfx_draw.c:1319
int gfxDrawSetLoadedImageScale(gfx_image_handle_t img, float scale)
Scales a loaded image, the scale is a value where, for example, 1.0 represents the original image's s...
Definition: gfx_draw.c:1493
void * gfx_image_handle_t
Handle used to reference loaded images, an invalid image will have a NULL handle.
Definition: gfx_draw.h:130
gfx_spritesheet_handle_t gfxDrawLoadSpritesheetFromEntireImageUnpadded(gfx_image_handle_t img, unsigned sprite_cols, unsigned sprite_rows)
Creates a spritesheet object from a loaded image where each sprite is not padded and the sprite sheet...
Definition: gfx_draw.c:1628
int gfxDrawPoly(coord_t *points, int n, unsigned int colour)
Draws a polygon on the screen.
Definition: gfx_draw.c:1347
int gfxDrawAnimationAddSequence(gfx_animation_handle_t animation, char *name, unsigned start_row, unsigned start_col, enum sprite_sequence_direction sprite_step_direction, unsigned frames)
Adds an animation sequence to a previously created animation.
Definition: gfx_draw.c:526
void * gfx_animation_handle_t
Handle used to reference a loaded animation spritesheet, an invalid spritesheet will have a NULL hand...
Definition: gfx_draw.h:141
int gfxDrawBox(signed short x, signed short y, signed short w, signed short h, unsigned int colour)
Draws a filled box on the screen.
Definition: gfx_draw.c:1281
gfx_spritesheet_handle_t gfxDrawLoadSpritesheetFromPortionOfImagePadded(gfx_image_handle_t img, unsigned sprite_cols, unsigned sprite_rows, unsigned sprite_width, unsigned sprite_height, unsigned sprite_padding_x, unsigned sprite_padding_y, unsigned bounding_box_left_x_pixel, unsigned bounding_box_top_y_pixel)
Creates a spritesheet object from a portion of loaded image where sprites are padded.
Definition: gfx_draw.c:1691
int gfxDrawUpdateScreen(void)
Executes the queued draw jobs.
Definition: gfx_draw.c:981
gfx_spritesheet_handle_t gfxDrawLoadSpritesheetFromEntireImagePadded(gfx_image_handle_t img, unsigned sprite_cols, unsigned sprite_rows, unsigned sprite_padding_x, unsigned sprite_padding_y)
Creates a spritesheet object from a loaded image where sprites are padded.
Definition: gfx_draw.c:1641
gfx_sequence_handle_t gfxDrawAnimationSequenceInstantiate(gfx_animation_handle_t animation, char *sequence_name, unsigned frame_period_ms)
Creates an instance of an animation from a loaded animation object and a sequence name of a sequence ...
Definition: gfx_draw.c:580
int gfxDrawTriangle(coord_t *points, unsigned int colour)
Draws a triangle on the screen.
Definition: gfx_draw.c:1365
gfx_image_handle_t gfxDrawLoadScaledImage(char *filename, float scale)
Loads an image from disk and scales the image, loaded image file can be closed using gfxDrawFreeLoade...
Definition: gfx_draw.c:1382
int gfxDrawSetGlobalXOffset(int offset)
Sets the global draw position offset's X axis value.
Definition: gfx_draw.c:1949
int gfxDrawArc(signed short x, signed short y, signed short radius, signed short start, signed short end, unsigned int colour)
Draws an arc on the screen.
Definition: gfx_draw.c:1252
void gfxDrawExit(void)
Exits the GFX Draw backend.
Definition: gfx_draw.c:1179
int gfxDrawEllipse(signed short x, signed short y, signed short rx, signed short ry, unsigned int colour)
Draws an ellipse on the screen.
Definition: gfx_draw.c:1238
gfx_spritesheet_handle_t gfxDrawLoadSpritesheetFromEntireImagePaddedSpacing(gfx_image_handle_t img, unsigned sprite_cols, unsigned sprite_rows, unsigned sprite_spacing_x, unsigned sprite_spacing_y)
Creates a spritesheet object from a loaded image where sprites are padded.
Definition: gfx_draw.c:1656
int gfxDrawImage(char *filename, signed short x, signed short y)
Draws an image on the screen.
Definition: gfx_draw.c:1547
int gfxDrawGetLoadedImageWidth(gfx_image_handle_t img)
Retrieves the image's width when drawn to screen, ie. after scaling.
Definition: gfx_draw.c:1513
int gfxDrawAnimationDrawFrame(gfx_sequence_handle_t sequence, unsigned ms_timestep, int x, int y)
Draws the target intantiated animation sequence at a given location.
Definition: gfx_draw.c:1854
float gfxDrawGetLoadedImageScale(gfx_image_handle_t img)
Retrieves the current scaling factor of an image.
Definition: gfx_draw.c:1504
int gfxGetTextSize(char *str, int *width, int *height)
Finds the width and height of a strings bounding box.
Definition: gfx_draw.c:1219
sprite_sequence_direction
Defines the direction that the animation appears on the spritesheet.
Definition: gfx_draw.h:111
int gfxDrawClear(unsigned int colour)
Sets the screen to a solid colour.
Definition: gfx_draw.c:1310
int gfxDrawSprite(gfx_spritesheet_handle_t spritesheet, char column, char row, signed short x, signed short y)
Draws a sprite from a spritesheet.
Definition: gfx_draw.c:1741
int gfxDrawBindThread(void)
Transfers the drawing ability to the calling thread/taskd.
Definition: gfx_draw.c:1124
int gfxDrawSetGlobalYOffset(int offset)
Sets the global draw position offset's Y axis value.
Definition: gfx_draw.c:1964
int gfxDrawFilledBox(signed short x, signed short y, signed short w, signed short h, unsigned int colour)
Draws an unfilled box on the screen.
Definition: gfx_draw.c:1267
char * gfxGetErrorMessage(void)
Returns a string error message from the gfx_draw back end.
Definition: gfx_draw.c:1039
int gfxDrawInit(char *path)
Initializes the gfx_draw backend.
Definition: gfx_draw.c:1044
int gfxDrawArrow(signed short x1, signed short y1, signed short x2, signed short y2, signed short head_length, unsigned char thickness, unsigned int colour)
Draws an arrow on the screen.
Definition: gfx_draw.c:1817
void gfxDrawDuplicateBuffer(void)
Definition: gfx_draw.c:1295
int gfxDrawGetGlobalXOffset(int *offset)
Retrieves a copy of the current global X axis drawing offset.
Definition: gfx_draw.c:1979
int gfxGetImageSize(char *filename, int *w, int *h)
Gets the width and height of an image.
Definition: gfx_draw.c:1789
void * gfx_spritesheet_handle_t
Returns an instance of a spritesheet.
Definition: gfx_draw.h:158
int gfxDrawLoadedImage(gfx_image_handle_t img, signed short x, signed short y)
Draws a loaded image to the screen.
Definition: gfx_draw.c:1477
void gfxDrawAnimationReset(gfx_sequence_handle_t sequence)
Resets the time and frame of an animation back to its initial configuration.
Definition: gfx_draw.c:1834
int gfxDrawScaledImage(char *filename, signed short x, signed short y, float scale)
Draws a scaled image on the screen.
Definition: gfx_draw.c:1796
gfx_spritesheet_handle_t gfxDrawLoadSpritesheetFromPortionOfImageUnpadded(gfx_image_handle_t img, unsigned sprite_cols, unsigned sprite_rows, unsigned sprite_width, unsigned sprite_height, unsigned bounding_box_left_x_pixel, unsigned bounding_box_top_y_pixel)
Creates a spritesheet object from a portion of a loaded image where sprites are unpadded.
Definition: gfx_draw.c:1672
int gfxDrawCenteredText(char *str, signed short x, signed short y, unsigned int colour)
Prints a string to the screen.
Definition: gfx_draw.c:1227
@ SPRITE_SEQUENCE_HORIZONTAL_NEG
Definition: gfx_draw.h:113
@ SPRITE_SEQUENCE_VERTICAL_NEG
Definition: gfx_draw.h:115
@ SPRITE_SEQUENCE_HORIZONTAL_POS
Definition: gfx_draw.h:112
@ SPRITE_SEQUENCE_VERTICAL_POS
Definition: gfx_draw.h:114
Holds a pixel co-ordinate.
Definition: gfx_draw.h:121
signed short x
Definition: gfx_draw.h:122
signed short y
Definition: gfx_draw.h:123
Definition: gfx_draw.c:108