player controller + renderer
This commit is contained in:
parent
4913fc7667
commit
a1f8e26d9a
21 changed files with 348 additions and 279 deletions
|
@ -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
15
include/player.hpp
Normal 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);
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue