Dumb-ways-to-memorize
2D game
Functions | Variables
parsefunction.h File Reference
#include "entity.h"
#include "SDL.h"
+ Include dependency graph for parsefunction.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void * ParseToFunction (const char *name)
 
void GetWorld (entity_t *self, entity_t **targ)
 
void GetAtPoint (entity_t *self, entity_t **targ)
 
void GetSelf (entity_t *self, entity_t **targ)
 
void GetX (entity_t *self, int *button)
 
void GetMousePos (entity_t *self, vec2_t *pos)
 
void GetXMouse (entity_t *self, int *button, vec2_t *pos)
 

Variables

char * FunctionNames []
 
void *[] FunctionSymbols
 

Function Documentation

void GetAtPoint ( entity_t *  self,
entity_t **  targ 
)

Gets the entity at the point specified by the mouse.

Parameters
[in,out]selfIf non-null, the class instance that this method operates on.
[in,out]targIf non-null, the targ.
Author
Anthony Rios
Date
3/30/2016

Definition at line 31 of file parsefunction.c.

References GetMousePos(), and LookForEntityAtPos().

32 {
33  vec2_t *temp = (vec2_t*) malloc(sizeof(vec2_t));
34  GetMousePos(self, temp);
35  *targ = LookForEntityAtPos(*temp);
36  free(temp);
37  return;
38 }
void GetMousePos(entity_t *self, vec2_t *pos)
Definition: parsefunction.c:53
entity_t * LookForEntityAtPos(vec2_t position)
Definition: entity.c:355
Definition: globals.h:19
void GetMousePos ( entity_t *  self,
vec2_t pos 
)

Gets mouse position.

Parameters
[in,out]selfIf non-null, the class instance that this method operates on.
[in,out]posIf non-null, the position.
Author
Anthony Rios
Date
3/30/2016

Definition at line 53 of file parsefunction.c.

References vec2_t::x, and vec2_t::y.

Referenced by CallInfo(), GetAtPoint(), and GetXMouse().

54 {
55  SDL_GetRelativeMouseState( &pos->x, &pos->y);
56  return;
57 }
int y
Definition: globals.h:22
int x
Definition: globals.h:21
void GetSelf ( entity_t *  self,
entity_t **  targ 
)

Gets self and makes it targ.

Parameters
[in,out]selfIf non-null, the class instance that this method operates on.
[in,out]targIf non-null, the targ.
Author
Anthony Rios
Date
3/30/2016

Definition at line 40 of file parsefunction.c.

41 {
42  *targ = self;
43  return;
44 }
void GetWorld ( entity_t *  self,
entity_t **  targ 
)

Gets the world entities.

Parameters
[in,out]selfIf non-null, the class instance that this method operates on.
[in,out]targIf non-null, the targ.
Author
Anthony Rios
Date
3/30/2016

Definition at line 25 of file parsefunction.c.

References gEntities.

26 {
27  *targ = gEntities;
28  return;
29 }
entity_t * gEntities
Definition: entity.c:11
void GetX ( entity_t *  self,
int *  button 
)

Get the status of the button of the power_up.

Parameters
[in,out]selfIf non-null, the class instance that this method operates on.
[in,out]buttonIf non-null, the button.
Author
Anthony Rios
Date
3/30/2016

Definition at line 47 of file parsefunction.c.

Referenced by CallInfo(), and GetXMouse().

48 {
49  *button = SDL_GetKeyFromName("X");
50  return;
51 }
void GetXMouse ( entity_t *  self,
int *  button,
vec2_t pos 
)

Gets status of button and mouse position.

Parameters
[in,out]selfIf non-null, the class instance that this method operates on.
[in,out]buttonIf non-null, the button.
[in,out]posIf non-null, the position.
Author
Anthony Rios
Date
3/30/2016

Definition at line 59 of file parsefunction.c.

References GetMousePos(), and GetX().

Referenced by CallInfo().

60 {
61  GetX(self, button);
62  GetMousePos(self, pos);
63 }
void GetMousePos(entity_t *self, vec2_t *pos)
Definition: parsefunction.c:53
void GetX(entity_t *self, int *button)
Definition: parsefunction.c:47
void* ParseToFunction ( const char *  name)

Definition at line 11 of file parsefunction.c.

References FunctionNames, and FunctionSymbols.

Referenced by ParseToPowerUp().

12 {
13  int i;
14 
15  for(i = 0; FunctionNames[i]; i++)
16  {
17  if(!strcmp(FunctionNames[i], name))
18  {
19  return FunctionSymbols[i];
20  }
21  }
22  return NULL;
23 }
void FunctionSymbols
Definition: parsefunction.c:9
char * FunctionNames[]
Definition: parsefunction.c:8

Variable Documentation

char* FunctionNames[]

Definition at line 8 of file parsefunction.c.

Referenced by ParseToFunction(), and ParseToPowerUp().

void*[] FunctionSymbols

Definition at line 9 of file parsefunction.c.

Referenced by ParseToFunction().