#include "config.hpp" #include #include #include #include #include PhoenixTexture PLoadTexture(std::string filePath) { SDL_Log("Loading texture from path: %s", filePath.c_str()); PhoenixTexture texture{}; texture.texture = IMG_LoadTexture(state.renderer, filePath.c_str()); if (texture.texture == NULL) { SDL_Log("Failed to load image: %s", SDL_GetError()); abort(); } return texture; } void PDestroyTexture(PhoenixTexture *texture) { SDL_DestroyTexture(texture->texture); } void PRenderTexture(PhoenixTexture *texture, int x, int y) { SDL_Rect dstRect{}; dstRect.x = x - state.camera.x; dstRect.y = y - state.camera.y; dstRect.w = TEXTURE_WIDTH; dstRect.h = TEXTURE_HEIGHT; SDL_RenderCopy(state.renderer, texture->texture, NULL, &dstRect); }