forked from kdx/jtmm2-old
Use `bool` instead of `_Bool`
This commit is contained in:
parent
01c8782e8c
commit
559c00a840
|
@ -10,10 +10,10 @@
|
|||
/* return tile at the given position
|
||||
* -1 is out of bound */
|
||||
uint8_t collide_point(Vec point, const Level *level, uint layer);
|
||||
_Bool collide_right(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
_Bool collide_left(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
_Bool collide_down(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
_Bool collide_up(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
_Bool collide_full(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
bool collide_right(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
bool collide_left(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
bool collide_down(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
bool collide_up(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
bool collide_full(Player *player, Vec position, const Level *level, uint layer_id);
|
||||
|
||||
#endif /* _DEF_PLAYER_COLLIDE */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _DEF_INPUT
|
||||
|
||||
#include <gint/defs/types.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define KEYS_COUNT 5
|
||||
|
||||
|
@ -35,9 +36,9 @@ void input_init(Input *input);
|
|||
/* display all keys states and information */
|
||||
void input_draw_debug(Input *input);
|
||||
|
||||
_Bool input_is_pressed(Input *input, uint8_t key);
|
||||
_Bool input_is_down(Input *input, uint8_t key);
|
||||
_Bool input_is_released(Input *input, uint8_t key);
|
||||
_Bool input_is_up(Input *input, uint8_t key);
|
||||
bool input_is_pressed(Input *input, uint8_t key);
|
||||
bool input_is_down(Input *input, uint8_t key);
|
||||
bool input_is_released(Input *input, uint8_t key);
|
||||
bool input_is_up(Input *input, uint8_t key);
|
||||
|
||||
#endif /* _DEF_INPUT */
|
||||
|
|
|
@ -21,7 +21,7 @@ uint8_t collide_point(Vec point, const Level *level, uint layer_id)
|
|||
}
|
||||
}
|
||||
|
||||
_Bool collide_right(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
bool collide_right(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
{
|
||||
Vec pos;
|
||||
vec_cpy(&pos, position);
|
||||
|
@ -39,7 +39,7 @@ _Bool collide_right(Player *player, Vec position, const Level *level, uint layer
|
|||
return false;
|
||||
}
|
||||
|
||||
_Bool collide_left(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
bool collide_left(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
{
|
||||
Vec pos;
|
||||
vec_cpy(&pos, position);
|
||||
|
@ -56,7 +56,7 @@ _Bool collide_left(Player *player, Vec position, const Level *level, uint layer_
|
|||
return false;
|
||||
}
|
||||
|
||||
_Bool collide_down(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
bool collide_down(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
{
|
||||
Vec pos;
|
||||
vec_cpy(&pos, position);
|
||||
|
@ -74,7 +74,7 @@ _Bool collide_down(Player *player, Vec position, const Level *level, uint layer_
|
|||
return false;
|
||||
}
|
||||
|
||||
_Bool collide_up(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
bool collide_up(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
{
|
||||
Vec pos;
|
||||
vec_cpy(&pos, position);
|
||||
|
@ -91,7 +91,7 @@ _Bool collide_up(Player *player, Vec position, const Level *level, uint layer_id
|
|||
return false;
|
||||
}
|
||||
|
||||
_Bool collide_full(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
bool collide_full(Player *player, Vec position, const Level *level, uint layer_id)
|
||||
{
|
||||
return collide_up(player, position, level, layer_id) ||
|
||||
collide_down(player, position, level, layer_id);
|
||||
|
|
10
src/input.c
10
src/input.c
|
@ -13,7 +13,7 @@ void input_step(Input *input)
|
|||
uint8_t *state = &input->states[i];
|
||||
uint8_t key = input->keys[i];
|
||||
/* get if the key is pressed */
|
||||
_Bool pressed = keydown(key);
|
||||
bool pressed = keydown(key);
|
||||
/* update input status */
|
||||
if (pressed)
|
||||
{
|
||||
|
@ -53,22 +53,22 @@ void input_draw_debug(Input *input)
|
|||
}
|
||||
}
|
||||
|
||||
_Bool input_is_pressed(Input *input, uint8_t key)
|
||||
bool input_is_pressed(Input *input, uint8_t key)
|
||||
{
|
||||
return input->states[key] == S_PRESSED;
|
||||
}
|
||||
|
||||
_Bool input_is_down(Input *input, uint8_t key)
|
||||
bool input_is_down(Input *input, uint8_t key)
|
||||
{
|
||||
return (input->states[key] == S_DOWN) || (input->states[key] == S_PRESSED);
|
||||
}
|
||||
|
||||
_Bool input_is_released(Input *input, uint8_t key)
|
||||
bool input_is_released(Input *input, uint8_t key)
|
||||
{
|
||||
return input->states[key] == S_RELEASED;
|
||||
}
|
||||
|
||||
_Bool input_is_up(Input *input, uint8_t key)
|
||||
bool input_is_up(Input *input, uint8_t key)
|
||||
{
|
||||
return (input->states[key] == S_UP) || (input->states[key] == S_RELEASED);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue