player controller + renderer

This commit is contained in:
Hunter 2023-05-27 13:10:56 -04:00
parent 4913fc7667
commit a1f8e26d9a
21 changed files with 348 additions and 279 deletions

View file

@ -1,8 +1,8 @@
#pragma once
// GFX constants
#define SCREEN_WIDTH 1000
#define SCREEN_HEIGHT 1000
#define MAX_AMMO 400
// 32x32 textures
#define TEXTURE_WIDTH 32
@ -11,3 +11,12 @@
// Texture IDs
#define BRICK_WALL_TEXTURE_ID 0
#define FLOOR_TEXTURE_ID 1
// Player texture IDs
#define PLAYER_WALK_DOWN_TEXTURE_ID 2
#define PLAYER_WALK_UP_TEXTURE_ID 3
#define PLAYER_WALK_LEFT_TEXTURE_ID 4
#define PLAYER_WALK_RIGHT_TEXTURE_ID 5
// Gameplay constants
#define MAX_AMMO 200

15
include/player.hpp Normal file
View file

@ -0,0 +1,15 @@
#pragma once
#include <string>
enum PPlayerFacingDirection { Up, Down, Left, Right };
struct PPlayer {
std::string name;
int x;
int y;
int health = 100;
int maxHealth = 100;
PPlayerFacingDirection facing = Up;
};
void PRenderPlayer(PPlayer *player);

View file

@ -1,11 +1,13 @@
#pragma once
#include "assets.hpp"
#include "config.hpp"
#include "player.hpp"
#include <SDL.h>
struct GlobalState {
SDL_Window *window;
SDL_Renderer *renderer;
PPlayer player;
PhoenixAssets assets;
int scale = 20;
};