Some progress

This commit is contained in:
2025-05-29 22:37:44 +02:00
parent f6e59e74c7
commit d01bdbe819
11 changed files with 331 additions and 65 deletions

View File

@@ -5,12 +5,54 @@
#ifndef FACTORYGAME_PLAYER_H
#define FACTORYGAME_PLAYER_H
#include "../tiles/tile.h"
extern int playerReach;
extern int playerX;
extern int playerY;
#define playerTileX (playerX / TILE_SIZE)
#define playerTileY (playerY / TILE_SIZE)
extern int playerSpeed;
bool isInbounds(int x, int y);
bool isInboundsRect(SDL_Rect rect);
bool isInboundsTile(int x, int y);
void adjustRect(SDL_Rect * rect);
void adjustRect(SDL_Rect *rect);
typedef struct {
uint16_t slotCounts[ITEMREGISTRY_SIZE];
uint16_t activeSlotIndex;
} PlayerInventory;
typedef struct {
int windowX;
int windowY;
int tileX;
int tileY;
int tileDiffX;
int tileDiffY;
int tileDiff;
bool canReach;
OrientDirection direction;
SDL_Rect targetTileRect;
Tile *targetTile;
Tile *prevTargetTile;
int breakingProgress;
} PlayerCursor;
typedef struct {
PlayerCursor cursor;
PlayerInventory inventory;
SDL_Renderer *renderer;
} Player;
void setActivePlayerSlot(Player * plr, uint16_t activeSlotIndex);
void renderPlayer(Player * plr);
void initPlayer(Player * plr);
#endif //FACTORYGAME_PLAYER_H