This commit is contained in:
2025-06-07 00:57:00 +02:00
parent d4665c4e9b
commit 64cac7578d
100 changed files with 464 additions and 169 deletions

View File

@@ -6,6 +6,9 @@
#define FACTORYGAME_UTIL_H
#include <SDL2/SDL.h>
#include "atlas.h"
extern int animationStep;
//The window we'll be rendering to
extern SDL_Window *window;
@@ -16,7 +19,7 @@ extern SDL_Renderer *mainRenderer;
extern SDL_Rect screenRect;
typedef enum OrientDirection{
typedef enum OrientDirection {
ORIENT_LEFT_DOWN,
ORIENT_LEFT,
ORIENT_LEFT_UP,
@@ -28,10 +31,28 @@ typedef enum OrientDirection{
ORIENT_DIRECTION_COUNT
} OrientDirection;
extern const char OrientStrings[ORIENT_DIRECTION_COUNT][10];
extern bool debugMode;
extern bool itemViewing;
extern bool renderAtlas;
typedef struct Animation {
SDL_Texture *textures[TILE_SIZE];
SDL_Rect atlasRects[TILE_SIZE];
unsigned char frameCount;
unsigned char divisor;
} Animation;
typedef struct OrientedAnimation {
SDL_Texture *textures[ORIENT_DIRECTION_COUNT][TILE_SIZE * 2];
SDL_Rect atlasRects[ORIENT_DIRECTION_COUNT][TILE_SIZE * 2];
unsigned char frameCount;
unsigned char divisor;
} OrientedAnimation;
SDL_Texture *createRotatedTexture(SDL_Renderer *renderer, SDL_Texture *src, double angle);
SDL_Texture *createFlippedTexture(SDL_Renderer *renderer, SDL_Texture *src, SDL_RendererFlip flip);