Marty Laverick / main

Dependents:   DCGame el14m2l_Dungeon_Crawler_Game

Embed: (wiki syntax)

« Back to documentation index

main.h File Reference

main.h File Reference

Header file containing function prototypes, defines and global variables for the main.cpp file. More...

Go to the source code of this file.

Namespaces

namespace  r_led
 

GPIO output for the on-board red LED.


namespace  g_led
 

GPIO output for the on-board green LED.


namespace  b_led
 

GPIO output for the on-board blue LED.


namespace  sw2
 

GPIO input for the on-board switch.


namespace  sw3
 

GPIO input for the on-board switch.


namespace  js_pot_x
 

GPIO input for the x-axis potentiometer on the joystick.


namespace  js_pot_y
 

GPIO input for the y-axis potentiometer on the joystick.


namespace  js_button
 

GPIO input for the button on the joystick.


namespace  b_button
 

GPIO input for the button on the PCB.


namespace  lcd
 

GPIO inputs and outputs for the visual display.


namespace  sd
 

GPIO inputs and outputs for the SD card.


namespace  update_flag
 

Ticker to execute the flag update.


namespace  fp
 

FILE pointer to allow file access from the SD card.


namespace  buzzer
 

GPIO output for music.


namespace  screen
 

A three dimensional array for allowing seperate sections of the two dimensional lcd.


namespace  pointer_obj
 

Object for the pointer array.


namespace  player_still_obj
 

Object for the player_still array.


namespace  player_moving1_obj
 

Object for the player_moving1 array.


namespace  player_moving2_obj
 

Object for the player_moving2 array.


namespace  player_jumping_obj
 

Object for the player_jumping array.


namespace  spike_small_obj1
 

Object for the spike_small array.


namespace  spike_small_obj2
 

Object for the spike_small array.


namespace  spike_small_obj3
 

Object for the spike_small array.


namespace  spike_large_obj1
 

Object for the spike_large array.


namespace  spike_large_obj2
 

Object for the spike_large array.


namespace  player
 

Animation for the player_still array, player_moving1 array and player_moving2 array.


namespace  bat1
 

Animation for the bat_middle array, bat_open array and bat_close array.


namespace  bat2
 

Animation for the bat_middle array, bat_open array and bat_close array.


namespace  bat3
 

Animation for the bat_middle array, bat_open array and bat_close array.


namespace  bat4
 

Animation for the bat_middle array, bat_open array and bat_close array.


namespace  bat5
 

Animation for the bat_middle array, bat_open array and bat_close array.


namespace  background
 

Background to add scenery to the BG sub-array.


Functions

void calibrate_joystick ()
 Calibrates the joystick from it's initial position.
void update_flag_func ()
 Sets to up_flag to true.
void update_joystick ()
 Sets the new values for the joystick struct variables.
bool js_button_check ()
 Checks if the js_button has been held down.
bool b_button_check ()
 Checks if the b_button has been held down.
void init_K64F ()
 Initialises the settings of on-board components for the K64F.
void init_N5110 ()
 Initialises the settings of the N5110.
void init_obj ()
 Initialises the objects with bitmaps.
void menu ()
 Runs the menu screen and allows for progression to further game functions.
void menu_select ()
 Runs the function as declared by the variable option set in th menu.
void start_game ()
 Runs the game and calls all other functions relevant to the game.
void init_game ()
 Initialises all variables used in the game and sets the initial screen.
void init_player ()
 Initialises the players position and speed.
void draw_health ()
 Sets the health animations in the HEALTH sub-array.
void check_collisions ()
 Determines whether the player has collided with the spikes.
void update_physics_engine ()
 Updates the players position depending on the players current position, velocity and acceleration, all determined from SUVAT equations.
void redraw ()
 Updates the lcd to show the new game state.
void death ()
 Ends the game and shows the user their score when they run out of lives.
void highscores ()
 Displays the five highest scores and the name of the person who got the score.
void new_highscore ()
 Determines whether the latest score after death is higher than any current highscores and sets it accordingly.
void register_name ()
 Allows the user to resgister a name to accompany their new highscore.
void rules ()
 Displays an overview of the games concept.
void credits ()
 Displays the details of the games creator.

Variables

float refresh_rate
float g_dt
bool up_flag
bool js_button_previous
bool b_button_previous
bool menu_viewed
bool jumping
bool spike1_there
bool spike2_there
bool spike3_there
bool spike4_there
bool spike5_there
bool dead
int selector
int option
int health
int spike_x1
int spike_x2
int spike_x3
int spike_x4
int spike_x5
int spike1_counter
int spike2_counter
int spike3_counter
int spike4_counter
int spike5_counter
int jump_counter
int score_counter
int highscore1
int highscore2
int highscore3
int highscore4
int highscore5
int letter
int letter1
int letter2
int letter3
int letter_counter
char score [10]
char score1 [10]
char score2 [10]
char score3 [10]
char score4 [10]
char score5 [10]
char name [3]
char name1 [4]
char name2 [4]
char name3 [4]
char name4 [4]
char name5 [4]

Detailed Description

Header file containing function prototypes, defines and global variables for the main.cpp file.

Version 1.0.0

Author:
Marty Laverick
Date:
5th May 2016

Definition in file main.h.


Function Documentation

bool b_button_check (  )

Checks if the b_button has been held down.

Returns:
false if the button has already been registered as presed but is being held down else true

Definition at line 121 of file main.cpp.

void calibrate_joystick (  )

Calibrates the joystick from it's initial position.

Definition at line 60 of file main.cpp.

void check_collisions (  )

Determines whether the player has collided with the spikes.

Definition at line 572 of file main.cpp.

void credits (  )

Displays the details of the games creator.

Definition at line 2214 of file main.cpp.

void death (  )

Ends the game and shows the user their score when they run out of lives.

Definition at line 687 of file main.cpp.

void draw_health (  )

Sets the health animations in the HEALTH sub-array.

Definition at line 545 of file main.cpp.

void highscores (  )

Displays the five highest scores and the name of the person who got the score.

Definition at line 708 of file main.cpp.

void init_game (  )

Initialises all variables used in the game and sets the initial screen.

Definition at line 484 of file main.cpp.

void init_K64F (  )

Initialises the settings of on-board components for the K64F.

Definition at line 134 of file main.cpp.

void init_N5110 (  )

Initialises the settings of the N5110.

Definition at line 148 of file main.cpp.

void init_obj (  )

Initialises the objects with bitmaps.

Definition at line 155 of file main.cpp.

void init_player (  )

Initialises the players position and speed.

Definition at line 534 of file main.cpp.

bool js_button_check (  )

Checks if the js_button has been held down.

Returns:
false if the button has already been registered as presed but is being held down else true

Definition at line 108 of file main.cpp.

void menu (  )

Runs the menu screen and allows for progression to further game functions.

Definition at line 169 of file main.cpp.

void menu_select (  )

Runs the function as declared by the variable option set in th menu.

Definition at line 336 of file main.cpp.

void new_highscore (  )

Determines whether the latest score after death is higher than any current highscores and sets it accordingly.

Definition at line 739 of file main.cpp.

void redraw (  )

Updates the lcd to show the new game state.

Definition at line 651 of file main.cpp.

void register_name (  )

Allows the user to resgister a name to accompany their new highscore.

Definition at line 889 of file main.cpp.

void rules (  )

Displays an overview of the games concept.

Definition at line 2188 of file main.cpp.

void start_game (  )

Runs the game and calls all other functions relevant to the game.

Definition at line 351 of file main.cpp.

void update_flag_func (  )

Sets to up_flag to true.

Definition at line 69 of file main.cpp.

void update_joystick (  )

Sets the new values for the joystick struct variables.

Definition at line 74 of file main.cpp.

void update_physics_engine (  )

Updates the players position depending on the players current position, velocity and acceleration, all determined from SUVAT equations.

Definition at line 617 of file main.cpp.


Variable Documentation

b_button_previous set and flipped in update_joystick

Definition at line 92 of file main.h.

bool dead

dead set in init_game and flipped in start_game

Definition at line 100 of file main.h.

float g_dt

g_dt set in main from refresh_rate

Definition at line 89 of file main.h.

int health

health set in init_game and start_game

Definition at line 103 of file main.h.

highscore1 set in menu and new_highscore

Definition at line 116 of file main.h.

highscore2 set in menu and new_highscore

Definition at line 117 of file main.h.

highscore3 set in menu and new_highscore

Definition at line 118 of file main.h.

highscore4 set in menu and new_highscore

Definition at line 119 of file main.h.

highscore5 set in menu and new_highscore

Definition at line 120 of file main.h.

js_button_previous set and flipped in update_joystick

Definition at line 91 of file main.h.

jump_counter set in init_game and start_game

Definition at line 114 of file main.h.

bool jumping

jumping set in init_game and flipped in start_game

Definition at line 94 of file main.h.

int letter

letter set in register_name

Definition at line 121 of file main.h.

int letter1

letter1 set in register_name

Definition at line 122 of file main.h.

int letter2

letter2 set in register_name

Definition at line 123 of file main.h.

int letter3

letter3 set in register_name

Definition at line 124 of file main.h.

letter_counter set in register_name

Definition at line 125 of file main.h.

menu_viewed set and flipped in menu

Definition at line 93 of file main.h.

char name[3]

name set in register_name

Definition at line 132 of file main.h.

char name1[4]

name1 set in menu and new_highscore

Definition at line 133 of file main.h.

char name2[4]

name2 set in menu and new_highscore

Definition at line 134 of file main.h.

char name3[4]

name3 set in menu and new_highscore

Definition at line 135 of file main.h.

char name4[4]

name4 set in menu and new_highscore

Definition at line 136 of file main.h.

char name5[4]

name5 set in menu and new_highscore

Definition at line 137 of file main.h.

int option

option set in menu

Definition at line 102 of file main.h.

float refresh_rate

refresh_rate set in main

Definition at line 88 of file main.h.

char score[10]

score set in death

Definition at line 126 of file main.h.

char score1[10]

score1 set in highscores

Definition at line 127 of file main.h.

char score2[10]

score2 set in highscores

Definition at line 128 of file main.h.

char score3[10]

score3 set in highscores

Definition at line 129 of file main.h.

char score4[10]

score4 set in highscores

Definition at line 130 of file main.h.

char score5[10]

score5 set in highscores

Definition at line 131 of file main.h.

score_counter set in init_game and start_game

Definition at line 115 of file main.h.

int selector

selector set in menu

Definition at line 101 of file main.h.

spike1_counter set in init_game and start_game

Definition at line 109 of file main.h.

spike1_there set in init_game and flipped in start_game

Definition at line 95 of file main.h.

spike2_counter set in init_game and start_game

Definition at line 110 of file main.h.

spike2_there set in init_game and flipped in start_game

Definition at line 96 of file main.h.

hspike3_counterealth set in init_game and start_game

Definition at line 111 of file main.h.

spike3_there set in init_game and flipped in start_game

Definition at line 97 of file main.h.

spike4_counter set in init_game and start_game

Definition at line 112 of file main.h.

spike4_there set in init_game and flipped in start_game

Definition at line 98 of file main.h.

spike5_counter set in init_game and start_game

Definition at line 113 of file main.h.

spike5_there set in init_game and flipped in start_game

Definition at line 99 of file main.h.

int spike_x1

spike_x1 set in init_game and start_game

Definition at line 104 of file main.h.

int spike_x2

spike_x2 set in init_game and start_game

Definition at line 105 of file main.h.

int spike_x3

spike_x3 set in init_game and start_game

Definition at line 106 of file main.h.

int spike_x4

spike_x4 set in init_game and start_game

Definition at line 107 of file main.h.

int spike_x5

spike_x5 set in init_game and start_game

Definition at line 108 of file main.h.

bool up_flag

up_flag set in ISR

Definition at line 90 of file main.h.