Merge remote-tracking branch 'origin'
This commit is contained in:
22
code/game/impl/player.c
Normal file
22
code/game/impl/player.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "../player.h"
|
||||
|
||||
void PlayerUpdate(SDL_Event *event, Player *player)
|
||||
{
|
||||
SDL_KeyboardEvent key = event->key;
|
||||
if (key.key == SDLK_W)
|
||||
{
|
||||
player->pos.y += 10;
|
||||
}
|
||||
if (key.key == SDLK_A)
|
||||
{
|
||||
player->pos.x -= 10;
|
||||
}
|
||||
if (key.key == SDLK_D)
|
||||
{
|
||||
player->pos.x += 10;
|
||||
}
|
||||
if (key.key == SDLK_S)
|
||||
{
|
||||
player->pos.y -= 10;
|
||||
}
|
||||
}
|
||||
11
code/game/player.h
Normal file
11
code/game/player.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "core/types.h"
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include "../core/macros.h"
|
||||
|
||||
typedef struct Player Player;
|
||||
struct Player
|
||||
{
|
||||
V2f pos;
|
||||
};
|
||||
|
||||
function void PlayerUpdate(SDL_Event *event, Player *player);
|
||||
Reference in New Issue
Block a user