FreeRTOS Emulator with SDL2 Based Graphics and Input Library
1.0
A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler.
|
Example draw functions for drawing user objects. More...
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semaphore.h"
#include "gfx_ball.h"
#include "gfx_font.h"
#include "gfx_event.h"
#include "gfx_utils.h"
#include "gfx_print.h"
#include "gfx_draw.h"
#include "buttons.h"
#include "draw.h"
Classes | |
struct | images |
struct | animations |
Macros | |
#define | FPS_AVERAGE_COUNT 50 |
#define | LOGO_FILENAME "freertos.jpg" |
#define | CAVE_SIZE_X SCREEN_WIDTH / 2 |
#define | CAVE_SIZE_Y SCREEN_HEIGHT / 2 |
#define | CAVE_X CAVE_SIZE_X / 2 |
#define | CAVE_Y CAVE_SIZE_Y / 2 |
#define | CAVE_THICKNESS 25 |
#define | TOTAL_NUMBER_OF_BALL_SPRITES 25 |
#define | NUMBER_OF_BALL_FRAMES 24 |
#define | BALL_FRAME_PERIOD_MS 40 |
#define | MARIO_SEQUENCE_IMAGES 3 |
#define | MARIO_START_IMAGE_X 12 |
#define | MARIO_START_IMAGE_Y 204 |
#define | MARIO_X_SPACING 4 |
#define | MARIO_Y_SPACING 0 |
#define | MARIO_WIDTH 15 |
#define | MARIO_HEIGHT 16 |
#define | MARIO_RUN_FRAME_PERIOD 200 |
#define | BARREL_SEQUENCE_IMAGES 4 |
#define | BARREL_START_IMAGE_X 245 |
#define | BARREL_START_IMAGE_Y 76 |
#define | BARREL_X_PADDING 2 |
#define | BARREL_Y_PADDING 0 |
#define | BARREL_WIDTH 12 |
#define | BARREL_HEIGHT 12 |
#define | BARREL_FRAME_PERIOD 100 |
Functions | |
void | vCheckDraw (unsigned char status, const char *msg) |
void | vDrawClearScreen (void) |
Clears the screen to be white. More... | |
void | vDrawCaveBoundingBox (void) |
void | vCreateWalls (wall_t **left_wall, wall_t **right_wall, wall_t **top_wall, wall_t **bottom_wall) |
Creates the four demo walls used. More... | |
void | vDrawWalls (wall_t *left_wall, wall_t *right_wall, wall_t *top_wall, wall_t *bottom_wall) |
Draws the demo walls. More... | |
void | vDrawBall (ball_t *ball) |
Draws a ball. More... | |
void | vDrawMouseBallAndBoundingBox (unsigned char ball_color_inverted) |
Draws the ball moved by the mouse and its bounding box. More... | |
void | vDrawHelpText (void) |
void | vDrawFPS (void) |
Draws the FPS value on the screen. More... | |
void | vDrawLogo (void) |
void | vDrawStaticItems (void) |
Draws the help text and FreeRTOS logo on the screen. More... | |
void | vDrawButtonText (void) |
Draws the status information of the button presses on the screen. More... | |
void | vDrawInitImages (void) |
void | vDrawInitBallHorizontalAnimations (void) |
void | vDrawInitBallVerticalAnimations (void) |
void | vDrawInitMarioRunAnimation (gfx_image_handle_t donkey_kong_image) |
void | vDrawInitBarrelAnimation (gfx_image_handle_t donkey_kong_image) |
void | vDrawInitDonkeyKongAnimations (void) |
void | vDrawInitAnnimations (void) |
void | vDrawInitResources (void) |
Loads images, sprite sheets and creates the annimation sequences needed. More... | |
void | vDrawSpriteStatic () |
Draws the static sprite to the bottom right corner of the screen. More... | |
void | vDrawSpriteResetDownwardSequence () |
Resets the downward animation sequence for example purposes. More... | |
void | vDrawSpriteAnimations (TickType_t xLastFrameTime) |
Draws the sprite annimation to the bottom right corner of the screen. More... | |
Variables | |
struct images | my_images = { 0 } |
struct animations | my_animations = { 0 } |
Example draw functions for drawing user objects.
---------------------------------------------------------------------- Copyright (C) Alexander Hoffman, 2023 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ----------------------------------------------------------------------
#define BALL_FRAME_PERIOD_MS 40 |
#define BARREL_FRAME_PERIOD 100 |
#define BARREL_HEIGHT 12 |
#define BARREL_SEQUENCE_IMAGES 4 |
#define BARREL_START_IMAGE_X 245 |
#define BARREL_START_IMAGE_Y 76 |
#define BARREL_WIDTH 12 |
#define BARREL_X_PADDING 2 |
#define BARREL_Y_PADDING 0 |
#define CAVE_SIZE_X SCREEN_WIDTH / 2 |
#define CAVE_SIZE_Y SCREEN_HEIGHT / 2 |
#define CAVE_THICKNESS 25 |
#define CAVE_X CAVE_SIZE_X / 2 |
#define CAVE_Y CAVE_SIZE_Y / 2 |
#define FPS_AVERAGE_COUNT 50 |
#define LOGO_FILENAME "freertos.jpg" |
#define MARIO_HEIGHT 16 |
#define MARIO_RUN_FRAME_PERIOD 200 |
#define MARIO_SEQUENCE_IMAGES 3 |
#define MARIO_START_IMAGE_X 12 |
#define MARIO_START_IMAGE_Y 204 |
#define MARIO_WIDTH 15 |
#define MARIO_X_SPACING 4 |
#define MARIO_Y_SPACING 0 |
#define NUMBER_OF_BALL_FRAMES 24 |
#define TOTAL_NUMBER_OF_BALL_SPRITES 25 |
void vCheckDraw | ( | unsigned char | status, |
const char * | msg | ||
) |
void vCreateWalls | ( | wall_t ** | left_wall, |
wall_t ** | right_wall, | ||
wall_t ** | top_wall, | ||
wall_t ** | bottom_wall | ||
) |
Creates the four demo walls used.
left_wall | Double pointer to the wall handle for the left wall |
right_wall | Double pointer to the wall handle for the right wall |
top_wall | Double pointer to the wall handle for the top wall |
bottom_wall | Double pointer to the wall handle for the bottom wall |
void vDrawBall | ( | ball_t * | ball | ) |
Draws a ball.
ball | Pointer to ball handle to be drawn |
void vDrawButtonText | ( | void | ) |
Draws the status information of the button presses on the screen.
void vDrawCaveBoundingBox | ( | void | ) |
void vDrawClearScreen | ( | void | ) |
Clears the screen to be white.
void vDrawFPS | ( | void | ) |
Draws the FPS value on the screen.
void vDrawHelpText | ( | void | ) |
void vDrawInitAnnimations | ( | void | ) |
void vDrawInitBallHorizontalAnimations | ( | void | ) |
void vDrawInitBallVerticalAnimations | ( | void | ) |
void vDrawInitBarrelAnimation | ( | gfx_image_handle_t | donkey_kong_image | ) |
void vDrawInitDonkeyKongAnimations | ( | void | ) |
void vDrawInitImages | ( | void | ) |
void vDrawInitMarioRunAnimation | ( | gfx_image_handle_t | donkey_kong_image | ) |
void vDrawInitResources | ( | void | ) |
Loads images, sprite sheets and creates the annimation sequences needed.
void vDrawLogo | ( | void | ) |
void vDrawMouseBallAndBoundingBox | ( | unsigned char | ball_color_inverted | ) |
Draws the ball moved by the mouse and its bounding box.
ball_color_inverted |
void vDrawSpriteAnimations | ( | TickType_t | xLastFrameTime | ) |
Draws the sprite annimation to the bottom right corner of the screen.
xLastFrameTime | Ticks since last frame |
void vDrawSpriteResetDownwardSequence | ( | ) |
Resets the downward animation sequence for example purposes.
void vDrawSpriteStatic | ( | ) |
Draws the static sprite to the bottom right corner of the screen.
void vDrawStaticItems | ( | void | ) |
Draws the help text and FreeRTOS logo on the screen.
void vDrawWalls | ( | wall_t * | left_wall, |
wall_t * | right_wall, | ||
wall_t * | top_wall, | ||
wall_t * | bottom_wall | ||
) |
Draws the demo walls.
left_wall | Pointer to the wall handle for the left wall |
right_wall | Pointer to the wall handle for the right wall |
top_wall | Pointer to the wall handle for the top wall |
bottom_wall | Pointer to the wall handle for the bottom wall |
struct animations my_animations = { 0 } |
struct images my_images = { 0 } |