File: powerup.h

package info (click to toggle)
rockdodger 0.9.2-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,220 kB
  • ctags: 756
  • sloc: ansic: 5,374; makefile: 159; sh: 21
file content (60 lines) | stat: -rw-r--r-- 1,490 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef __POWERUP_H__2010
#define __POWERUP_H__2010
#include <SDL/SDL.h>
#include "datafun.h"
#include "rockdodger_globals.h"

typedef enum powerup_types {
  POWERUP_NONE,
  POWERUP_LASER,
  POWERUP_SHIELD,
  POWERUP_LIFE
} powerup_types_t;

//!< This structure holds all information about the powerup.
typedef struct powerup {
  float x, y;			//!< Position on the display
  float dx, dy;			//!< velocity
  float countdown;		//!< countdown before we get a new one...
  enum powerup_types active;	//!< Is active? Which type?
  float img_ctr;		//!< Counter of the current image surface
} powerup_t;

/*! \brief Get the current powerup type.
 *
 * If currently no powerup is active then this will return
 * POWERUP_NONE.
 * 
 * \return current powerup
 */
powerup_types_t get_current_powerup(void);

/*! \brief Initialise powerups.
 *
 * Initialises the powerups. Must be called before all other
 * functions.
 *
 * \returns pointer to the powerup or NULL on error
 */
powerup_t *init_powerup();

void display_powerup(SDL_Surface * surf_screen);

void deactivate_powerup();

/*! Do per screen update for the powerup.
 *
 * If the powerup is active it will be moved. If it is inactive the
 * counter will be updated and if it is time a new powerup will be
 * created.
 */
void update_powerup();

/*! \brief Shut down the whole powerup engine.
 *
 * Make sure to stop using powerup functions after this. Otherwise you
 * will get, hmm, interesting results.
 */
void shutdown_powerups();

#endif