Some progress
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 215 B |
42
items/item.c
42
items/item.c
@@ -108,11 +108,11 @@ void registerItem(char name[20], SDL_Renderer *renderer) {
|
|||||||
memcpy(ItemRegistry[itemRegistryIndex].name, name, dot - name);
|
memcpy(ItemRegistry[itemRegistryIndex].name, name, dot - name);
|
||||||
char texturePath[80];
|
char texturePath[80];
|
||||||
snprintf(texturePath, 80, "./assets/items/%s", name);
|
snprintf(texturePath, 80, "./assets/items/%s", name);
|
||||||
ItemRegistry[itemRegistryIndex].texture = IMG_LoadTexture(renderer, texturePath);
|
ItemRegistry[itemRegistryIndex].texture[ORIENT_LEFT] = IMG_LoadTexture(renderer, texturePath);
|
||||||
SDL_SetTextureBlendMode(ItemRegistry[itemRegistryIndex].texture, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(ItemRegistry[itemRegistryIndex].texture[0], SDL_BLENDMODE_BLEND);
|
||||||
ItemRegistry[itemRegistryIndex].textureOnBelt = ScaleTexture(renderer, ItemRegistry[itemRegistryIndex].texture,
|
ItemRegistry[itemRegistryIndex].textureOnBelt[ORIENT_LEFT] = ScaleTexture(renderer, ItemRegistry[itemRegistryIndex].texture[ORIENT_LEFT],
|
||||||
TILE_SIZE / 2, TILE_SIZE / 2);
|
TILE_SIZE / 2, TILE_SIZE / 2);
|
||||||
SDL_SetTextureBlendMode(ItemRegistry[itemRegistryIndex].textureOnBelt, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(ItemRegistry[itemRegistryIndex].textureOnBelt[ORIENT_LEFT], SDL_BLENDMODE_BLEND);
|
||||||
ItemRegistry[itemRegistryIndex].type = itemRegistryIndex;
|
ItemRegistry[itemRegistryIndex].type = itemRegistryIndex;
|
||||||
|
|
||||||
itemRegistryIndex++;
|
itemRegistryIndex++;
|
||||||
@@ -248,12 +248,12 @@ void renderItem(ItemOnBelt item, SDL_Renderer *renderer, int lane) {
|
|||||||
adjustRect(&rect);
|
adjustRect(&rect);
|
||||||
|
|
||||||
// (Optional debug overlay)
|
// (Optional debug overlay)
|
||||||
SDL_Rect tileArea = {item.tileX * TILE_SIZE, item.tileY * TILE_SIZE,
|
// SDL_Rect tileArea = {item.tileX * TILE_SIZE, item.tileY * TILE_SIZE,
|
||||||
TILE_SIZE, TILE_SIZE};
|
// TILE_SIZE, TILE_SIZE};
|
||||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
// SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 32);
|
// SDL_SetRenderDrawColor(renderer, 255, 0, 0, 32);
|
||||||
adjustRect(&tileArea);
|
// adjustRect(&tileArea);
|
||||||
SDL_RenderFillRect(renderer, &tileArea);
|
// SDL_RenderFillRect(renderer, &tileArea);
|
||||||
|
|
||||||
char tempStr[50];
|
char tempStr[50];
|
||||||
|
|
||||||
@@ -267,11 +267,8 @@ void renderItem(ItemOnBelt item, SDL_Renderer *renderer, int lane) {
|
|||||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 32);
|
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 32);
|
||||||
adjustRect(&rectA);
|
adjustRect(&rectA);
|
||||||
SDL_RenderFillRect(renderer, &rectA);
|
SDL_RenderFillRect(renderer, &rectA);
|
||||||
SDL_RenderCopy(renderer, ItemRegistry[item.type].textureOnBelt, NULL, &rect);
|
SDL_RenderCopy(renderer, ItemRegistry[item.type].textureOnBelt[ORIENT_LEFT], NULL, &rect);
|
||||||
SDL_Texture *oldRenderTarget = SDL_GetRenderTarget(renderer);
|
|
||||||
SDL_SetRenderTarget(renderer, NULL);
|
|
||||||
renderText(renderer, fonts[3], tempStr, rectA.x, rectA.y);
|
renderText(renderer, fonts[3], tempStr, rectA.x, rectA.y);
|
||||||
SDL_SetRenderTarget(renderer, oldRenderTarget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderBeltItems(SDL_Renderer *renderer) {
|
void renderBeltItems(SDL_Renderer *renderer) {
|
||||||
@@ -287,6 +284,23 @@ void putItem(int x, int y, uint16_t itemType, uint8_t lane, uint8_t itemIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loadItems(SDL_Renderer *renderer) {
|
void loadItems(SDL_Renderer *renderer) {
|
||||||
|
for(int i = 0; i < tileTypeIndex; i++) {
|
||||||
|
TileType tile = TileRegistry[i];
|
||||||
|
|
||||||
|
strcpy(ItemRegistry[itemRegistryIndex].name, tile.name);
|
||||||
|
memcpy(ItemRegistry[itemRegistryIndex].texture, tile.textures, sizeof (tile.textures));
|
||||||
|
for (int a = 0; a < ORIENT_DIRECTION_COUNT; a++) {
|
||||||
|
SDL_SetTextureBlendMode(ItemRegistry[itemRegistryIndex].texture[a], SDL_BLENDMODE_BLEND);
|
||||||
|
ItemRegistry[itemRegistryIndex].textureOnBelt[a] = ScaleTexture(renderer, tile.textures[a],
|
||||||
|
TILE_SIZE / 2, TILE_SIZE / 2);
|
||||||
|
SDL_SetTextureBlendMode(ItemRegistry[itemRegistryIndex].textureOnBelt[a], SDL_BLENDMODE_BLEND);
|
||||||
|
}
|
||||||
|
ItemRegistry[itemRegistryIndex].type = itemRegistryIndex;
|
||||||
|
|
||||||
|
itemRegistryIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DIR *dir = opendir("./assets/items");
|
DIR *dir = opendir("./assets/items");
|
||||||
if (dir) {
|
if (dir) {
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
#include "../util/util.h"
|
||||||
|
|
||||||
#ifndef FACTORYGAME_ITEM_H
|
#ifndef FACTORYGAME_ITEM_H
|
||||||
#define FACTORYGAME_ITEM_H
|
#define FACTORYGAME_ITEM_H
|
||||||
@@ -10,8 +11,8 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
char name[20];
|
char name[20];
|
||||||
SDL_Texture * texture;
|
SDL_Texture * texture[ORIENT_DIRECTION_COUNT];
|
||||||
SDL_Texture * textureOnBelt;
|
SDL_Texture * textureOnBelt[ORIENT_DIRECTION_COUNT];
|
||||||
} Item;
|
} Item;
|
||||||
|
|
||||||
#define ITEMREGISTRY_SIZE 512
|
#define ITEMREGISTRY_SIZE 512
|
||||||
@@ -31,6 +32,8 @@ void loadItems(SDL_Renderer *renderer);
|
|||||||
|
|
||||||
void renderItem(ItemOnBelt item, SDL_Renderer *renderer, int lane);
|
void renderItem(ItemOnBelt item, SDL_Renderer *renderer, int lane);
|
||||||
|
|
||||||
|
extern uint16_t itemRegistryIndex;
|
||||||
|
|
||||||
extern uint8_t laneTarget;
|
extern uint8_t laneTarget;
|
||||||
extern float speed;
|
extern float speed;
|
||||||
|
|
||||||
|
160
main.c
160
main.c
@@ -9,19 +9,16 @@
|
|||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "player/player.h"
|
#include "player/player.h"
|
||||||
|
|
||||||
|
Player player;
|
||||||
|
|
||||||
|
float currentScale = 1;
|
||||||
|
|
||||||
//Screen dimension constants
|
//Screen dimension constants
|
||||||
const int SCREEN_WIDTH = DISPLAY_WIDTH;
|
#define SCREEN_WIDTH DISPLAY_WIDTH / currentScale
|
||||||
const int SCREEN_HEIGHT = DISPLAY_HEIGHT;
|
#define SCREEN_HEIGHT DISPLAY_HEIGHT/ currentScale
|
||||||
const int targetFPS = 60;
|
const int targetFPS = 60;
|
||||||
const int delayNeeded = 1000 / targetFPS;
|
const int delayNeeded = 1000 / targetFPS;
|
||||||
|
|
||||||
//The window we'll be rendering to
|
|
||||||
SDL_Window *window = NULL;
|
|
||||||
volatile bool running = true;
|
|
||||||
|
|
||||||
//The surface contained by the window
|
|
||||||
SDL_Renderer *renderer = NULL;
|
|
||||||
|
|
||||||
#define biggerFont fonts[0]
|
#define biggerFont fonts[0]
|
||||||
#define smallFont fonts[1]
|
#define smallFont fonts[1]
|
||||||
#define smallerFont fonts[2]
|
#define smallerFont fonts[2]
|
||||||
@@ -30,6 +27,7 @@ SDL_Renderer *renderer = NULL;
|
|||||||
|
|
||||||
unsigned long frames = 0;
|
unsigned long frames = 0;
|
||||||
bool cursor = true;
|
bool cursor = true;
|
||||||
|
|
||||||
void msleep(unsigned int milliseconds) {
|
void msleep(unsigned int milliseconds) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
ts.tv_sec = milliseconds / 1000;
|
ts.tv_sec = milliseconds / 1000;
|
||||||
@@ -42,11 +40,13 @@ int init() {
|
|||||||
//Initialize SDL
|
//Initialize SDL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
srand(0);
|
srand(0);
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, NULL);
|
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, NULL);
|
||||||
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
|
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
|
||||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
||||||
|
SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE, "1");
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
||||||
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
|
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
@@ -61,6 +61,7 @@ int init() {
|
|||||||
//Create window
|
//Create window
|
||||||
window = SDL_CreateWindow("Factory game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
|
window = SDL_CreateWindow("Factory game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
|
||||||
SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||||
|
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
printf("Window could not be created! SDL_Error: %s\n", SDL_GetError());
|
printf("Window could not be created! SDL_Error: %s\n", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
@@ -72,8 +73,8 @@ int init() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadItems(renderer);
|
|
||||||
loadTiles(renderer);
|
loadTiles(renderer);
|
||||||
|
loadItems(renderer);
|
||||||
// Create OpenGL context
|
// Create OpenGL context
|
||||||
SDL_GLContext glContext = SDL_GL_CreateContext(window);
|
SDL_GLContext glContext = SDL_GL_CreateContext(window);
|
||||||
if (!glContext) {
|
if (!glContext) {
|
||||||
@@ -102,7 +103,6 @@ int init() {
|
|||||||
|
|
||||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_SetRenderTarget(renderer, NULL);
|
|
||||||
|
|
||||||
SDL_Rect viewport = {0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
|
SDL_Rect viewport = {0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
|
||||||
SDL_RenderSetViewport(renderer, &viewport);
|
SDL_RenderSetViewport(renderer, &viewport);
|
||||||
@@ -114,6 +114,8 @@ int init() {
|
|||||||
smallestFont = prepText(renderer, 4, "assets/PublicPixel.ttf", 255, 255, 255, 255);
|
smallestFont = prepText(renderer, 4, "assets/PublicPixel.ttf", 255, 255, 255, 255);
|
||||||
SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT);
|
SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
|
|
||||||
|
initPlayer(&player);
|
||||||
|
|
||||||
generateTestMap();
|
generateTestMap();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -132,6 +134,8 @@ int render() {
|
|||||||
|
|
||||||
renderAllBelts(renderer);
|
renderAllBelts(renderer);
|
||||||
|
|
||||||
|
renderPlayer(&player);
|
||||||
|
|
||||||
|
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
frames++;
|
frames++;
|
||||||
@@ -162,28 +166,127 @@ int processEvent(SDL_Event e) {
|
|||||||
case SDLK_p:
|
case SDLK_p:
|
||||||
speed = speed == 0 ? 0.004f : 0;
|
speed = speed == 0 ? 0.004f : 0;
|
||||||
break;
|
break;
|
||||||
|
case SDLK_r:
|
||||||
|
if (player.cursor.canReach && player.cursor.targetTile->type == TYPE_BELT) {
|
||||||
|
player.cursor.direction = player.cursor.targetTile->direction;
|
||||||
|
}
|
||||||
|
player.cursor.direction = (player.cursor.direction + 2) % ORIENT_DIRECTION_COUNT;
|
||||||
|
if (player.cursor.canReach && player.cursor.targetTile->type == TYPE_BELT) {
|
||||||
|
player.cursor.targetTile->direction = player.cursor.direction;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (e.type == SDL_MOUSEBUTTONDOWN) {
|
} else if (e.type == SDL_MOUSEWHEEL) {
|
||||||
SDL_Rect viewport;
|
int dAmount = 0;
|
||||||
SDL_RenderGetViewport(renderer, &viewport);
|
if (e.wheel.y > 0) {
|
||||||
|
dAmount = 1;
|
||||||
|
} else if (e.wheel.y < 0) {
|
||||||
|
dAmount = -1;
|
||||||
|
}
|
||||||
|
const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
|
||||||
|
if (keyboardState[SDL_SCANCODE_LCTRL] || keyboardState[SDL_SCANCODE_RCTRL]) {
|
||||||
|
currentScale += dAmount / 10.0f;
|
||||||
|
if (currentScale > 4) {
|
||||||
|
currentScale = 4;
|
||||||
|
} else if (currentScale < 0.5f) {
|
||||||
|
currentScale = 0.5f;
|
||||||
|
}
|
||||||
|
//setZoom(currentScale);
|
||||||
|
|
||||||
SDL_Rect mouset;
|
|
||||||
mouset.w = 1;
|
} else {
|
||||||
mouset.h = 1;
|
setActivePlayerSlot(&player, player.inventory.activeSlotIndex + dAmount);
|
||||||
SDL_GetMouseState(&mouset.x, &mouset.y);
|
}
|
||||||
// Translate mouse coordinates to viewport space
|
|
||||||
SDL_Rect mouse;
|
|
||||||
mouse.w = 1;
|
|
||||||
mouse.h = 1;
|
|
||||||
mouse.x = ((mouset.x - viewport.x) * SCREEN_WIDTH) / viewport.w;
|
|
||||||
mouse.y = (mouset.y - viewport.y) * SCREEN_HEIGHT / viewport.h;
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void processMousePosition() {
|
||||||
|
SDL_Rect viewport;
|
||||||
|
SDL_RenderGetViewport(renderer, &viewport);
|
||||||
|
|
||||||
|
uint32_t mouseButtons = SDL_GetMouseState(&player.cursor.windowX, &player.cursor.windowY);
|
||||||
|
if (mouseButtons & SDL_BUTTON_LMASK) {
|
||||||
|
if(player.cursor.targetTile->type == TYPE_AIR && player.inventory.activeSlotIndex < tileTypeIndex) {
|
||||||
|
if (player.inventory.slotCounts[player.inventory.activeSlotIndex] > 0) {
|
||||||
|
player.inventory.slotCounts[player.inventory.activeSlotIndex]--;
|
||||||
|
player.cursor.targetTile->type = player.inventory.activeSlotIndex + 1;
|
||||||
|
player.cursor.targetTile->direction = player.cursor.direction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (mouseButtons & SDL_BUTTON_RMASK) {
|
||||||
|
if (player.cursor.targetTile != player.cursor.prevTargetTile) {
|
||||||
|
player.cursor.breakingProgress = 0;
|
||||||
|
}
|
||||||
|
int tileIndex = player.cursor.targetTile->type - 1;
|
||||||
|
uint16_t targetBreakTime = TileRegistry[tileIndex].breakTime;
|
||||||
|
if (targetBreakTime) {
|
||||||
|
if (player.cursor.breakingProgress >= targetBreakTime) {
|
||||||
|
if (player.cursor.targetTile->type - 1 < tileTypeIndex) {
|
||||||
|
player.inventory.slotCounts[player.cursor.targetTile->type - 1]++;
|
||||||
|
}
|
||||||
|
player.cursor.targetTile->type = TYPE_AIR;
|
||||||
|
player.cursor.breakingProgress = 0;
|
||||||
|
} else {
|
||||||
|
player.cursor.breakingProgress++;
|
||||||
|
}
|
||||||
|
printf("Player breaking %d\n", player.cursor.breakingProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (mouseButtons & SDL_BUTTON_MMASK) {
|
||||||
|
|
||||||
|
}
|
||||||
|
// Translate mouseRect coordinates to viewport space
|
||||||
|
|
||||||
|
player.cursor.windowX = ((player.cursor.windowX - viewport.x) * SCREEN_WIDTH) / viewport.w;
|
||||||
|
player.cursor.windowY = (player.cursor.windowY - viewport.y) * SCREEN_HEIGHT / viewport.h;
|
||||||
|
player.cursor.tileX = player.cursor.windowX / TILE_SIZE + (playerX / TILE_SIZE) - (SCREEN_WIDTH / TILE_SIZE / 2);
|
||||||
|
player.cursor.tileY = player.cursor.windowY / TILE_SIZE + (playerY / TILE_SIZE) - (SCREEN_HEIGHT / TILE_SIZE / 2);
|
||||||
|
player.cursor.prevTargetTile = player.cursor.targetTile;
|
||||||
|
player.cursor.targetTile = &tileMap[player.cursor.tileY][player.cursor.tileX];
|
||||||
|
}
|
||||||
|
|
||||||
|
void processKeyboardHeld() {
|
||||||
|
const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
|
||||||
|
|
||||||
|
int cameraSpeed = playerSpeed;
|
||||||
|
|
||||||
|
if (keyboardState[SDL_SCANCODE_LSHIFT] || keyboardState[SDL_SCANCODE_RSHIFT]) {
|
||||||
|
cameraSpeed *= 2;
|
||||||
|
}
|
||||||
|
if (keyboardState[SDL_SCANCODE_LCTRL] || keyboardState[SDL_SCANCODE_RCTRL]) {
|
||||||
|
cameraSpeed /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyboardState[SDL_SCANCODE_W]) {
|
||||||
|
// Example: move up
|
||||||
|
playerY -= cameraSpeed;
|
||||||
|
if (playerY < (SCREEN_HEIGHT / 2)) {
|
||||||
|
playerY = (SCREEN_HEIGHT / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keyboardState[SDL_SCANCODE_S]) {
|
||||||
|
playerY += cameraSpeed;
|
||||||
|
if (playerY > (MAP_HEIGHT * TILE_SIZE) - (SCREEN_HEIGHT / 2)) {
|
||||||
|
playerY = (MAP_HEIGHT * TILE_SIZE) - (SCREEN_HEIGHT / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keyboardState[SDL_SCANCODE_A]) {
|
||||||
|
playerX -= cameraSpeed;
|
||||||
|
if (playerX < (SCREEN_WIDTH / 2)) {
|
||||||
|
playerX = (SCREEN_WIDTH / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keyboardState[SDL_SCANCODE_D]) {
|
||||||
|
playerX += cameraSpeed;
|
||||||
|
if (playerX > (MAP_WIDTH * TILE_SIZE) - (SCREEN_WIDTH / 2)) {
|
||||||
|
playerX = (MAP_WIDTH * TILE_SIZE) - (SCREEN_WIDTH / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(__attribute__((unused)) int argc, __attribute__((unused)) char *args[]) {
|
int main(__attribute__((unused)) int argc, __attribute__((unused)) char *args[]) {
|
||||||
int status = init();
|
int status = init();
|
||||||
if (status) {
|
if (status) {
|
||||||
@@ -191,8 +294,8 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char *args[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t type = 0;
|
uint8_t type = 0;
|
||||||
for (int x = 142; x < 154; x+=3) {
|
for (int x = 142; x < 154; x += 3) {
|
||||||
for(int y = 80; y < 94; y+=3) {
|
for (int y = 80; y < 94; y += 3) {
|
||||||
putItem(x, y, type++ % ITEMREGISTRY_SIZE, 0, 0);
|
putItem(x, y, type++ % ITEMREGISTRY_SIZE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,6 +308,9 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char *args[])
|
|||||||
while (running) {
|
while (running) {
|
||||||
start = SDL_GetTicks64();
|
start = SDL_GetTicks64();
|
||||||
|
|
||||||
|
processMousePosition();
|
||||||
|
processKeyboardHeld();
|
||||||
|
|
||||||
while (SDL_PollEvent(&e)) {
|
while (SDL_PollEvent(&e)) {
|
||||||
running = processEvent(e);
|
running = processEvent(e);
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,23 @@
|
|||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "../tiles/tile.h"
|
#include "../tiles/tile.h"
|
||||||
|
|
||||||
|
int playerSpeed = 4;
|
||||||
|
|
||||||
|
int playerReach = 4;
|
||||||
|
|
||||||
|
void setActivePlayerSlot(Player *plr, uint16_t activeSlotIndex) {
|
||||||
|
activeSlotIndex = activeSlotIndex % ITEMREGISTRY_SIZE;
|
||||||
|
if (activeSlotIndex < 0) {
|
||||||
|
activeSlotIndex = 0;
|
||||||
|
}
|
||||||
|
plr->inventory.activeSlotIndex = activeSlotIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int playerX = (MAP_WIDTH / 2) * 16;
|
int playerX = (MAP_WIDTH / 2) * 16;
|
||||||
int playerY = (MAP_HEIGHT / 2) * 16;
|
int playerY = (MAP_HEIGHT / 2) * 16;
|
||||||
|
|
||||||
void adjustRect(SDL_Rect * rect) {
|
void adjustRect(SDL_Rect *rect) {
|
||||||
rect->x -= playerX;
|
rect->x -= playerX;
|
||||||
rect->y -= playerY;
|
rect->y -= playerY;
|
||||||
rect->x += DISPLAY_WIDTH / 2;
|
rect->x += DISPLAY_WIDTH / 2;
|
||||||
@@ -17,8 +30,9 @@ void adjustRect(SDL_Rect * rect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isInboundsTile(int x, int y) {
|
bool isInboundsTile(int x, int y) {
|
||||||
return (playerX / TILE_SIZE) - (DISPLAY_MAP_WIDTH / 2) < x && (playerY / TILE_SIZE) - (DISPLAY_MAP_HEIGHT / 2) < y &&
|
return (playerX / TILE_SIZE) - (DISPLAY_MAP_WIDTH / 2) < x &&
|
||||||
(playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2) > x && (playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2) > y;
|
(playerY / TILE_SIZE) - (DISPLAY_MAP_HEIGHT / 2) < y &&
|
||||||
|
(playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2) > x && (playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2) > y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInbounds(int x, int y) {
|
bool isInbounds(int x, int y) {
|
||||||
@@ -45,4 +59,49 @@ bool isInboundsRect(SDL_Rect rect) {
|
|||||||
rect.y -= rect.h;
|
rect.y -= rect.h;
|
||||||
}
|
}
|
||||||
return isInbounds(rect.x, rect.y);
|
return isInbounds(rect.x, rect.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initPlayer(Player *plr) {
|
||||||
|
plr->cursor.direction = ORIENT_UP;
|
||||||
|
setActivePlayerSlot(plr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderPlayer(Player *plr) {
|
||||||
|
|
||||||
|
plr->cursor.targetTileRect.x = plr->cursor.tileX * TILE_SIZE;
|
||||||
|
plr->cursor.targetTileRect.y = plr->cursor.tileY * TILE_SIZE;
|
||||||
|
plr->cursor.targetTileRect.w = TILE_SIZE;
|
||||||
|
plr->cursor.targetTileRect.h = TILE_SIZE;
|
||||||
|
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||||
|
plr->cursor.tileDiffX = plr->cursor.tileX - playerTileX;
|
||||||
|
plr->cursor.tileDiffY = plr->cursor.tileY - playerTileY;
|
||||||
|
if (plr->cursor.tileDiffX > plr->cursor.tileDiffY) {
|
||||||
|
plr->cursor.tileDiff = plr->cursor.tileDiffX;
|
||||||
|
} else {
|
||||||
|
plr->cursor.tileDiff = plr->cursor.tileDiffY;
|
||||||
|
}
|
||||||
|
plr->cursor.canReach = abs(plr->cursor.tileDiff) <= playerReach;
|
||||||
|
SDL_SetRenderDrawColor(renderer, plr->cursor.canReach ? 0 : 255, plr->cursor.canReach ? 255 : 0, 0, 128);
|
||||||
|
adjustRect(&plr->cursor.targetTileRect);
|
||||||
|
DrawThickRect(renderer, plr->cursor.targetTileRect, 4);
|
||||||
|
|
||||||
|
uint16_t itemIndex = plr->inventory.activeSlotIndex;
|
||||||
|
if (itemIndex < itemRegistryIndex) {
|
||||||
|
if (plr->inventory.slotCounts[itemIndex] > 0) {
|
||||||
|
SDL_Rect heldItemRect;
|
||||||
|
heldItemRect.x = plr->cursor.windowX;
|
||||||
|
heldItemRect.y = plr->cursor.windowY;
|
||||||
|
heldItemRect.w = TILE_SIZE;
|
||||||
|
heldItemRect.h = TILE_SIZE;
|
||||||
|
SDL_Texture *itemTex = ItemRegistry[itemIndex].textureOnBelt[plr->cursor.direction];
|
||||||
|
if (itemTex == NULL) {
|
||||||
|
itemTex = ItemRegistry[itemIndex].textureOnBelt[ORIENT_LEFT];
|
||||||
|
}
|
||||||
|
if (itemTex != NULL) {
|
||||||
|
SDL_RenderCopy(renderer, ItemRegistry[itemIndex].textureOnBelt[plr->cursor.direction], NULL,
|
||||||
|
&heldItemRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//printf("Player inventory index: %d\n", plr->inventory.activeSlotIndex);
|
||||||
}
|
}
|
@@ -5,12 +5,54 @@
|
|||||||
#ifndef FACTORYGAME_PLAYER_H
|
#ifndef FACTORYGAME_PLAYER_H
|
||||||
#define FACTORYGAME_PLAYER_H
|
#define FACTORYGAME_PLAYER_H
|
||||||
|
|
||||||
|
#include "../tiles/tile.h"
|
||||||
|
|
||||||
|
extern int playerReach;
|
||||||
extern int playerX;
|
extern int playerX;
|
||||||
extern int playerY;
|
extern int playerY;
|
||||||
|
#define playerTileX (playerX / TILE_SIZE)
|
||||||
|
#define playerTileY (playerY / TILE_SIZE)
|
||||||
|
extern int playerSpeed;
|
||||||
|
|
||||||
bool isInbounds(int x, int y);
|
bool isInbounds(int x, int y);
|
||||||
|
|
||||||
bool isInboundsRect(SDL_Rect rect);
|
bool isInboundsRect(SDL_Rect rect);
|
||||||
|
|
||||||
bool isInboundsTile(int x, int y);
|
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
|
#endif //FACTORYGAME_PLAYER_H
|
||||||
|
32
tiles/belt.c
32
tiles/belt.c
@@ -17,7 +17,7 @@ void renderBelt(int x, int y, int w, int h, OrientDirection dir, SDL_Renderer *r
|
|||||||
int px = x * TILE_SIZE;
|
int px = x * TILE_SIZE;
|
||||||
int py = y * TILE_SIZE;
|
int py = y * TILE_SIZE;
|
||||||
|
|
||||||
uint16_t tileType = tileMap[y][x].type;
|
uint16_t tileType = tileMap[y][x].type - 1;
|
||||||
|
|
||||||
SDL_Rect src1, src2, dst1, dst2;
|
SDL_Rect src1, src2, dst1, dst2;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ void renderBelt(int x, int y, int w, int h, OrientDirection dir, SDL_Renderer *r
|
|||||||
|
|
||||||
|
|
||||||
void renderAllBelts(SDL_Renderer *renderer) {
|
void renderAllBelts(SDL_Renderer *renderer) {
|
||||||
int scrollSpeed = 0; // pixels per step
|
int scrollSpeed = 1; // pixels per step
|
||||||
int scrollDelay = 1; // frames between steps
|
int scrollDelay = 1; // frames between steps
|
||||||
|
|
||||||
if (beltFrames++ % scrollDelay == 0) {
|
if (beltFrames++ % scrollDelay == 0) {
|
||||||
@@ -72,19 +72,31 @@ void renderAllBelts(SDL_Renderer *renderer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int tileSize = TILE_SIZE;
|
int tileSize = TILE_SIZE;
|
||||||
for (int y = (playerY / TILE_SIZE) - (DISPLAY_MAP_HEIGHT / 2);
|
for (int y = (playerY / TILE_SIZE) - (DISPLAY_MAP_HEIGHT / 2) - 1;
|
||||||
y < (playerY / TILE_SIZE) + (DISPLAY_MAP_HEIGHT / 2); y++) {
|
y < (playerY / TILE_SIZE) + (DISPLAY_MAP_HEIGHT / 2) + 1; y++) {
|
||||||
for (int x = (playerX / TILE_SIZE) - (DISPLAY_MAP_WIDTH / 2);
|
if (y < 0 || y >= MAP_HEIGHT) {
|
||||||
x < (playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2); x++) {
|
continue;
|
||||||
|
}
|
||||||
|
for (int x = (playerX / TILE_SIZE) - (DISPLAY_MAP_WIDTH / 2) - 1;
|
||||||
|
x < (playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2) + 1; x++) {
|
||||||
|
if (x < 0 || x >= MAP_WIDTH) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Tile t = tileMap[y][x];
|
Tile t = tileMap[y][x];
|
||||||
if (t.type != TYPE_BELT) continue;
|
if (t.type != TYPE_BELT) continue;
|
||||||
renderBelt(x, y, tileSize, tileSize, t.direction, renderer);
|
renderBelt(x, y, tileSize, tileSize, t.direction, renderer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int y = (playerY / TILE_SIZE) - (DISPLAY_MAP_HEIGHT / 2);
|
for (int y = (playerY / TILE_SIZE) - (DISPLAY_MAP_HEIGHT / 2) - 1;
|
||||||
y < (playerY / TILE_SIZE) + (DISPLAY_MAP_HEIGHT / 2); y++) {
|
y < (playerY / TILE_SIZE) + (DISPLAY_MAP_HEIGHT / 2) + 1; y++) {
|
||||||
for (int x = (playerX / TILE_SIZE) - (DISPLAY_MAP_WIDTH / 2);
|
if (y < 0 || y >= MAP_HEIGHT) {
|
||||||
x < (playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2); x++) {
|
continue;
|
||||||
|
}
|
||||||
|
for (int x = (playerX / TILE_SIZE) - (DISPLAY_MAP_WIDTH / 2) - 1;
|
||||||
|
x < (playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2) + 1; x++) {
|
||||||
|
if (x < 0 || x >= MAP_WIDTH) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Tile t = tileMap[y][x];
|
Tile t = tileMap[y][x];
|
||||||
if (t.type != TYPE_BELT) continue;
|
if (t.type != TYPE_BELT) continue;
|
||||||
for (uint8_t lane = 0; lane < 2; lane++) {
|
for (uint8_t lane = 0; lane < 2; lane++) {
|
||||||
|
@@ -23,10 +23,8 @@ void generateTestMap() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = (playerX / TILE_SIZE) - (DISPLAY_MAP_WIDTH / 2);
|
for (int x = 0; x < MAP_WIDTH; x += 1) {
|
||||||
x < (playerX / TILE_SIZE) + (DISPLAY_MAP_WIDTH / 2); x += 1) {
|
for (int y = 0; y < MAP_HEIGHT; y += 1) {
|
||||||
for (int y = (playerY / TILE_SIZE) - (DISPLAY_MAP_HEIGHT / 2);
|
|
||||||
y < (playerY / TILE_SIZE) + (DISPLAY_MAP_HEIGHT / 2); y += 1) {
|
|
||||||
|
|
||||||
tileMap[y][x].type = TYPE_BELT;
|
tileMap[y][x].type = TYPE_BELT;
|
||||||
tileMap[y][x].frameOffset = 0;
|
tileMap[y][x].frameOffset = 0;
|
||||||
@@ -43,12 +41,13 @@ void registerTile(char name[20], SDL_Renderer *renderer) {
|
|||||||
memcpy(TileRegistry[tileTypeIndex].name, name, dot - name);
|
memcpy(TileRegistry[tileTypeIndex].name, name, dot - name);
|
||||||
char texturePath[80];
|
char texturePath[80];
|
||||||
snprintf(texturePath, 80, "./assets/tiles/%s", name);
|
snprintf(texturePath, 80, "./assets/tiles/%s", name);
|
||||||
SDL_Texture * texture = IMG_LoadTexture(renderer, texturePath);
|
SDL_Texture *texture = IMG_LoadTexture(renderer, texturePath);
|
||||||
TileRegistry[tileTypeIndex].textures[ORIENT_LEFT] = texture;
|
TileRegistry[tileTypeIndex].textures[ORIENT_LEFT] = texture;
|
||||||
TileRegistry[tileTypeIndex].textures[ORIENT_RIGHT] = createFlippedTexture(renderer, texture, SDL_FLIP_HORIZONTAL);
|
TileRegistry[tileTypeIndex].textures[ORIENT_RIGHT] = createFlippedTexture(renderer, texture, SDL_FLIP_HORIZONTAL);
|
||||||
TileRegistry[tileTypeIndex].textures[ORIENT_UP] = createRotatedTexture(renderer, texture, 90);
|
TileRegistry[tileTypeIndex].textures[ORIENT_UP] = createRotatedTexture(renderer, texture, 90);
|
||||||
TileRegistry[tileTypeIndex].textures[ORIENT_DOWN] = createRotatedTexture(renderer, texture, 270);
|
TileRegistry[tileTypeIndex].textures[ORIENT_DOWN] = createRotatedTexture(renderer, texture, 270);
|
||||||
TileRegistry[tileTypeIndex].type = tileTypeIndex;
|
TileRegistry[tileTypeIndex].type = tileTypeIndex;
|
||||||
|
TileRegistry[tileTypeIndex].breakTime = 60;
|
||||||
|
|
||||||
tileTypeIndex++;
|
tileTypeIndex++;
|
||||||
}
|
}
|
||||||
|
@@ -24,13 +24,15 @@ typedef struct {
|
|||||||
uint16_t type;
|
uint16_t type;
|
||||||
char name[20];
|
char name[20];
|
||||||
SDL_Texture *textures[ORIENT_DIRECTION_COUNT];
|
SDL_Texture *textures[ORIENT_DIRECTION_COUNT];
|
||||||
|
uint16_t breakTime;
|
||||||
} TileType;
|
} TileType;
|
||||||
|
|
||||||
#define TILEREGISTRY_SIZE 512
|
#define TILEREGISTRY_SIZE 512
|
||||||
|
|
||||||
extern TileType TileRegistry[TILEREGISTRY_SIZE];
|
extern TileType TileRegistry[TILEREGISTRY_SIZE];
|
||||||
|
|
||||||
#define TYPE_BELT 0
|
#define TYPE_AIR 0
|
||||||
|
#define TYPE_BELT 1
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
OrientDirection direction;
|
OrientDirection direction;
|
||||||
@@ -46,4 +48,6 @@ extern Tile tileMap[MAP_HEIGHT][MAP_WIDTH];
|
|||||||
void generateTestMap();
|
void generateTestMap();
|
||||||
void loadTiles(SDL_Renderer *renderer);
|
void loadTiles(SDL_Renderer *renderer);
|
||||||
|
|
||||||
|
extern uint16_t tileTypeIndex;
|
||||||
|
|
||||||
#endif //FACTORYGAME_TILE_H
|
#endif //FACTORYGAME_TILE_H
|
||||||
|
23
util/util.c
23
util/util.c
@@ -3,14 +3,25 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "../tiles/tile.h"
|
||||||
|
|
||||||
|
//The window we'll be rendering to
|
||||||
|
SDL_Window *window = NULL;
|
||||||
|
volatile bool running = true;
|
||||||
|
|
||||||
|
//The surface contained by the window
|
||||||
|
SDL_Renderer *renderer = NULL;
|
||||||
|
|
||||||
SDL_Texture* createFlippedTexture(SDL_Renderer* renderer, SDL_Texture* src, SDL_RendererFlip flip) {
|
SDL_Texture* createFlippedTexture(SDL_Renderer* renderer, SDL_Texture* src, SDL_RendererFlip flip) {
|
||||||
int w, h;
|
int w, h;
|
||||||
SDL_QueryTexture(src, NULL, NULL, &w, &h);
|
SDL_QueryTexture(src, NULL, NULL, &w, &h);
|
||||||
|
|
||||||
|
SDL_Texture *renderTarget = SDL_GetRenderTarget(renderer);
|
||||||
|
|
||||||
SDL_Texture* target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h);
|
SDL_Texture* target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h);
|
||||||
SDL_SetRenderTarget(renderer, target);
|
SDL_SetRenderTarget(renderer, target);
|
||||||
SDL_RenderCopyEx(renderer, src, NULL, NULL, 0, NULL, flip);
|
SDL_RenderCopyEx(renderer, src, NULL, NULL, 0, NULL, flip);
|
||||||
SDL_SetRenderTarget(renderer, NULL);
|
SDL_SetRenderTarget(renderer, renderTarget);
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
@@ -18,11 +29,12 @@ SDL_Texture* createFlippedTexture(SDL_Renderer* renderer, SDL_Texture* src, SDL_
|
|||||||
SDL_Texture* createRotatedTexture(SDL_Renderer* renderer, SDL_Texture* src, double angle) {
|
SDL_Texture* createRotatedTexture(SDL_Renderer* renderer, SDL_Texture* src, double angle) {
|
||||||
int w, h;
|
int w, h;
|
||||||
SDL_QueryTexture(src, NULL, NULL, &w, &h);
|
SDL_QueryTexture(src, NULL, NULL, &w, &h);
|
||||||
|
SDL_Texture *renderTarget = SDL_GetRenderTarget(renderer);
|
||||||
|
|
||||||
SDL_Texture* target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h);
|
SDL_Texture* target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h);
|
||||||
SDL_SetRenderTarget(renderer, target);
|
SDL_SetRenderTarget(renderer, target);
|
||||||
SDL_RenderCopyEx(renderer, src, NULL, NULL, angle, NULL, SDL_FLIP_NONE);
|
SDL_RenderCopyEx(renderer, src, NULL, NULL, angle, NULL, SDL_FLIP_NONE);
|
||||||
SDL_SetRenderTarget(renderer, NULL);
|
SDL_SetRenderTarget(renderer, renderTarget);
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
@@ -53,3 +65,10 @@ SDL_Texture* ScaleTexture(SDL_Renderer* renderer, SDL_Texture* src, int newWidth
|
|||||||
|
|
||||||
return scaledTex;
|
return scaledTex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawThickRect(SDL_Renderer* renderer, SDL_Rect rect, int thickness) {
|
||||||
|
for (int i = 0; i < thickness; i++) {
|
||||||
|
SDL_Rect r = { rect.x - i, rect.y - i, rect.w + i * 2, rect.h + i * 2 };
|
||||||
|
SDL_RenderDrawRect(renderer, &r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -6,6 +6,12 @@
|
|||||||
#define FACTORYGAME_UTIL_H
|
#define FACTORYGAME_UTIL_H
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
//The window we'll be rendering to
|
||||||
|
extern SDL_Window *window;
|
||||||
|
extern volatile bool running;
|
||||||
|
|
||||||
|
//The surface contained by the window
|
||||||
|
extern SDL_Renderer *renderer;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ORIENT_LEFT_DOWN,
|
ORIENT_LEFT_DOWN,
|
||||||
@@ -25,4 +31,6 @@ SDL_Texture *createFlippedTexture(SDL_Renderer *renderer, SDL_Texture *src, SDL_
|
|||||||
|
|
||||||
SDL_Texture* ScaleTexture(SDL_Renderer* renderer, SDL_Texture* src, int newWidth, int newHeight);
|
SDL_Texture* ScaleTexture(SDL_Renderer* renderer, SDL_Texture* src, int newWidth, int newHeight);
|
||||||
|
|
||||||
|
void DrawThickRect(SDL_Renderer* renderer, SDL_Rect rect, int thickness);
|
||||||
|
|
||||||
#endif //FACTORYGAME_UTIL_H
|
#endif //FACTORYGAME_UTIL_H
|
||||||
|
Reference in New Issue
Block a user