embedded-software
reusable software modules for embedded systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
game.c File Reference
#include <strings.h>
#include "project_settings.h"
#include "game.h"
#include "uart.h"
#include "subsystem.h"
#include "timing.h"
Include dependency graph for game.c:

Data Structures

struct  game_t
 game structure More...
 

Macros

#define PLAYER1_UART   SUBSYSTEM_UART
 
#define PLAYER2_UART   PLAYER1_UART
 
#define MAX_GAMES   30
 

Functions

void Game_Init (void)
 
uint8_t Game_Register (char *name, char *description, void(*play)(void), void(*help)(void))
 Game_Register registers a game by adding it to the games[] array. More...
 
void Game_RegisterCallback (uint8_t game_id, void(*callback)(int argc, char *argv[]))
 
void Game_RegisterHighscoreCallback (uint8_t game_id, void(*callback)(void))
 
void Game_Log (uint8_t id, char *str,...)
 
void Game_EnableMultiPlayer (uint8_t id, uint8_t num)
 
void Game_RegisterPlayer1Receiver (void(*rx)(uint8_t))
 
void Game_RegisterPlayer2Receiver (void(*rx)(uint8_t))
 Register Player 2 UART Channel. More...
 
void Game_UnregisterPlayer1Receiver (void(*rx)(uint8_t))
 Unregister Player 1 UART Channel receiver. More...
 
void Game_UnregisterPlayer2Receiver (void(*rx)(uint8_t))
 Unregister Player 2 UART Channel receiver. More...
 
void Game_CharXY (char c, char x, char y)
 Write a character to a coordinate of the terminal. More...
 
void Game_Player1CharXY (char c, char x, char y)
 Write a character to a coordinate of the first players terminal. More...
 
void Game_Player2CharXY (char c, char x, char y)
 Write a character to a coordinate of the second players terminal. More...
 
void Game_CursorXY (char x, char y)
 Cursor Position XY. More...
 
void Game_Player1CursorXY (char x, char y)
 Player 1 Cursor Position XY. More...
 
void Game_Player2CursorXY (char x, char y)
 Player 2 Cursor Position XY. More...
 
void Game_Printf (char *str,...)
 
void Game_PrintfXY (char x, char y, char *str,...)
 PrintfXY to screen. More...
 
void Game_Player1Printf (char *str,...)
 
void Game_Player2Printf (char *str,...)
 
void Game_HideCursor (void)
 Hide the cursor for player 1 (and player2 if a two player game) More...
 
void Game_ShowCursor (void)
 Show the cursor for player 1 (and player2 if a two player game) More...
 
void Game_SetColor (enum term_color color)
 
void Game_DrawTile (char *tile[], char x, char y)
 
void Game_ClearScreen (void)
 
void Game_DrawRect (char x_min, char y_min, char x_max, char y_max)
 
void Game_FillRect (char c, char x_min, char y_min, char x_max, char y_max)
 
void Game_LinkedChar (char c, char x_first, char y_first, int length, int direction, linked_char_object_t list[])
 
void Game_ScrollDown (void)
 
void Game_ScrollUp (void)
 
void Game_Bell (void)
 
uint8_t Game_IsTransmitting (void)
 
void Game_GameOver (void)
 let the game management module know that your game is over. More...
 

Variables

game_t games [MAX_GAMES]
 
uint8_t game_last_index = 0xFF
 
uint8_t game_id
 
uint8_t playing_id = 0
 

Macro Definition Documentation

#define MAX_GAMES   30
#define PLAYER1_UART   SUBSYSTEM_UART
#define PLAYER2_UART   PLAYER1_UART

Function Documentation

void Game_Init ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

uint8_t game_id
uint8_t game_last_index = 0xFF
game_t games[MAX_GAMES]
uint8_t playing_id = 0