Fixes
This commit is contained in:
@@ -10,7 +10,6 @@ SDL_Texture *atlasTexture;
|
||||
int tileIndex16 = 0, quadrantIndex16 = 0;
|
||||
int tileIndex32 = 0;
|
||||
|
||||
#define MAX_RECTS 256
|
||||
int allocatedRectCount = 0;
|
||||
SDL_Rect allocatedRects[MAX_RECTS];
|
||||
|
||||
|
@@ -5,7 +5,8 @@
|
||||
#ifndef FACTORYGAME_ATLAS_H
|
||||
#define FACTORYGAME_ATLAS_H
|
||||
|
||||
#define ATLAS_SIZE 512
|
||||
#define ATLAS_SIZE 1024
|
||||
#define MAX_RECTS 2048
|
||||
#define TILE_SIZE 32
|
||||
#define QUADRANT_SIZE 16
|
||||
#define ATLAS_TILES_PER_ROW (ATLAS_SIZE / TILE_SIZE)
|
||||
|
13
util/util.c
13
util/util.c
@@ -11,6 +11,19 @@
|
||||
SDL_Window *window = NULL;
|
||||
volatile bool running = true;
|
||||
|
||||
const char OrientStrings[ORIENT_DIRECTION_COUNT][10] = {
|
||||
"LEFT_DOWN",
|
||||
"LEFT",
|
||||
"LEFT_UP",
|
||||
"UP",
|
||||
"RIGHT_UP",
|
||||
"RIGHT",
|
||||
"RIGHT_DOWN",
|
||||
"DOWN",
|
||||
};
|
||||
|
||||
int animationStep = 0;
|
||||
|
||||
bool debugMode = false;
|
||||
bool itemViewing = false;
|
||||
bool renderAtlas = false;
|
||||
|
23
util/util.h
23
util/util.h
@@ -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);
|
||||
|
Reference in New Issue
Block a user