Added some basic font rendering and texas holdem
This commit is contained in:
48
src/world/entity/entities/player.c
Normal file
48
src/world/entity/entities/player.c
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "player.h"
|
||||
|
||||
void playerInit(entityid_t id, entity_t *entity) {
|
||||
}
|
||||
|
||||
void playerUpdate(entityid_t id, entity_t *entity) {
|
||||
// Movement
|
||||
if(entity->state & ENTITY_STATE_WALKING) {
|
||||
entityCommonMoveUpdate(id, entity);
|
||||
} else {
|
||||
if(inputIsPressed(INPUT_UP)) {
|
||||
entityCommonTurn(id, entity, ENTITY_DIRECTION_NORTH);
|
||||
} else if(inputIsPressed(INPUT_DOWN)) {
|
||||
entityCommonTurn(id, entity, ENTITY_DIRECTION_SOUTH);
|
||||
} else if(inputIsPressed(INPUT_LEFT)) {
|
||||
entityCommonTurn(id, entity, ENTITY_DIRECTION_WEST);
|
||||
} else if(inputIsPressed(INPUT_RIGHT)) {
|
||||
entityCommonTurn(id, entity, ENTITY_DIRECTION_EAST);
|
||||
|
||||
} else if(inputIsDown(INPUT_UP)) {
|
||||
entityCommonTurn(id, entity, ENTITY_DIRECTION_NORTH);
|
||||
entityCommonMove(id, entity, 0, 1, 0);
|
||||
} else if(inputIsDown(INPUT_DOWN)) {
|
||||
entityCommonTurn(id, entity, ENTITY_DIRECTION_SOUTH);
|
||||
entityCommonMove(id, entity, 0, -1, 0);
|
||||
} else if(inputIsDown(INPUT_LEFT)) {
|
||||
entityCommonTurn(id, entity, ENTITY_DIRECTION_WEST);
|
||||
entityCommonMove(id, entity, -1, 0, 0);
|
||||
} else if(inputIsDown(INPUT_RIGHT)) {
|
||||
entityCommonTurn(id, entity, ENTITY_DIRECTION_EAST);
|
||||
entityCommonMove(id, entity, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void playerRender(entityid_t id, entity_t *entity) {
|
||||
entityCommonRender(id, entity);
|
||||
}
|
||||
|
||||
void playerDispose(entityid_t id, entity_t *entity) {
|
||||
}
|
16
src/world/entity/entities/player.h
Normal file
16
src/world/entity/entities/player.h
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "../common.h"
|
||||
#include "../../../input/input.h"
|
||||
|
||||
void playerInit(entityid_t entityId, entity_t *entity);
|
||||
void playerUpdate(entityid_t entityId, entity_t *entity);
|
||||
void playerRender(entityid_t entityId, entity_t *entity);
|
||||
void playerDispose(entityid_t entityId, entity_t *entity);
|
Reference in New Issue
Block a user