eliminat param.game.item_size

This commit is contained in:
2025-09-30 13:23:50 +02:00
parent 4500845dcd
commit 13b3702d00
8 changed files with 44 additions and 47 deletions

View File

@@ -2,7 +2,6 @@
# Formato: PARAMETRO VALOR # Formato: PARAMETRO VALOR
# --- GAME --- # --- GAME ---
game.item_size 20 # Tamaño de los items del juego (en píxeles)
game.item_text_outline_color E0E0E0F0 # Color del outline del texto de los items (RGBA hex) game.item_text_outline_color E0E0E0F0 # Color del outline del texto de los items (RGBA hex)
game.width 320 # Ancho de la resolución nativa del juego (en píxeles) game.width 320 # Ancho de la resolución nativa del juego (en píxeles)
game.height 240 # Alto de la resolución nativa del juego (en píxeles) game.height 240 # Alto de la resolución nativa del juego (en píxeles)

View File

@@ -15,7 +15,6 @@ namespace GameDefaults {
namespace Game { namespace Game {
constexpr float WIDTH = 320.0F; constexpr float WIDTH = 320.0F;
constexpr float HEIGHT = 256.0F; constexpr float HEIGHT = 256.0F;
constexpr float ITEM_SIZE = 20.0F;
constexpr int NAME_ENTRY_IDLE_TIME = 10; constexpr int NAME_ENTRY_IDLE_TIME = 10;
constexpr int NAME_ENTRY_TOTAL_TIME = 60; constexpr int NAME_ENTRY_TOTAL_TIME = 60;
constexpr bool HIT_STOP = false; constexpr bool HIT_STOP = false;

View File

@@ -26,8 +26,6 @@ Item::Item(ItemType type, float x, float y, SDL_FRect &play_area, const std::sha
break; break;
} }
default: { default: {
width_ = param.game.item_size;
height_ = param.game.item_size;
pos_x_ = x; pos_x_ = x;
pos_y_ = y; pos_y_ = y;
// 6 velocidades: 3 negativas (-1.0, -0.66, -0.33) y 3 positivas (0.33, 0.66, 1.0) // 6 velocidades: 3 negativas (-1.0, -0.66, -0.33) y 3 positivas (0.33, 0.66, 1.0)

View File

@@ -27,8 +27,10 @@ enum class ItemType : int {
class Item { class Item {
public: public:
// --- Constantes --- // --- Constantes ---
static constexpr int COFFEE_MACHINE_WIDTH = 30; // Anchura de la máquina de café static constexpr float WIDTH = 20.0F; // Anchura del item
static constexpr int COFFEE_MACHINE_HEIGHT = 39; // Altura de la máquina de café static constexpr float HEIGHT = 20.0F; // ALtura del item
static constexpr int COFFEE_MACHINE_WIDTH = 30; // Anchura de la máquina de café
static constexpr int COFFEE_MACHINE_HEIGHT = 39; // Altura de la máquina de café
static constexpr float LIFETIME_DURATION_S = 10.0f; // Duración de vida del ítem en segundos static constexpr float LIFETIME_DURATION_S = 10.0f; // Duración de vida del ítem en segundos
// Velocidades base (pixels/segundo) - Coffee Machine // Velocidades base (pixels/segundo) - Coffee Machine
@@ -37,10 +39,10 @@ class Item {
static constexpr float COFFEE_MACHINE_ACCEL_Y = 360.0F; // Aceleración Y de máquina de café (0.1*60²fps = 360 pixels/segundo²) static constexpr float COFFEE_MACHINE_ACCEL_Y = 360.0F; // Aceleración Y de máquina de café (0.1*60²fps = 360 pixels/segundo²)
// Velocidades base (pixels/segundo) - Items normales // Velocidades base (pixels/segundo) - Items normales
static constexpr float ITEM_VEL_X_BASE = 60.0F; // Velocidad X base para items (1.0F*60fps) static constexpr float ITEM_VEL_X_BASE = 60.0F; // Velocidad X base para items (1.0F*60fps)
static constexpr float ITEM_VEL_X_STEP = 20.0F; // Incremento de velocidad X (0.33F*60fps) static constexpr float ITEM_VEL_X_STEP = 20.0F; // Incremento de velocidad X (0.33F*60fps)
static constexpr float ITEM_VEL_Y = -240.0F; // Velocidad Y inicial de items (-4.0F*60fps) static constexpr float ITEM_VEL_Y = -240.0F; // Velocidad Y inicial de items (-4.0F*60fps)
static constexpr float ITEM_ACCEL_Y = 720.0F; // Aceleración Y de items (0.2*60²fps = 720 pixels/segundo²) static constexpr float ITEM_ACCEL_Y = 720.0F; // Aceleración Y de items (0.2*60²fps = 720 pixels/segundo²)
// Constantes de física de rebote // Constantes de física de rebote
static constexpr float BOUNCE_VEL_THRESHOLD = 60.0F; // Umbral de velocidad para parar (1.0F*60fps) static constexpr float BOUNCE_VEL_THRESHOLD = 60.0F; // Umbral de velocidad para parar (1.0F*60fps)
@@ -49,14 +51,14 @@ class Item {
static constexpr float HORIZONTAL_DAMPING = 0.75F; // Factor de amortiguación horizontal static constexpr float HORIZONTAL_DAMPING = 0.75F; // Factor de amortiguación horizontal
// --- Constructor y destructor --- // --- Constructor y destructor ---
Item(ItemType type, float x, float y, SDL_FRect &play_area, const std::shared_ptr<Texture> &texture, const std::vector<std::string> &animation); // Constructor principal Item(ItemType type, float x, float y, SDL_FRect& play_area, const std::shared_ptr<Texture>& texture, const std::vector<std::string>& animation); // Constructor principal
~Item() = default; // Destructor ~Item() = default; // Destructor
// --- Métodos principales --- // --- Métodos principales ---
void alignTo(int x); // Centra el objeto en la posición X indicada void alignTo(int x); // Centra el objeto en la posición X indicada
void render(); // Renderiza el objeto en pantalla void render(); // Renderiza el objeto en pantalla
void disable(); // Desactiva el objeto void disable(); // Desactiva el objeto
void update(float deltaTime); // Actualiza la posición, animación y contadores (time-based) void update(float deltaTime); // Actualiza la posición, animación y contadores (time-based)
// --- Getters --- // --- Getters ---
[[nodiscard]] auto getPosX() const -> float { return pos_x_; } // Obtiene la posición X [[nodiscard]] auto getPosX() const -> float { return pos_x_; } // Obtiene la posición X
@@ -66,7 +68,7 @@ class Item {
[[nodiscard]] auto getType() const -> ItemType { return type_; } // Obtiene el tipo [[nodiscard]] auto getType() const -> ItemType { return type_; } // Obtiene el tipo
[[nodiscard]] auto isEnabled() const -> bool { return enabled_; } // Verifica si está habilitado [[nodiscard]] auto isEnabled() const -> bool { return enabled_; } // Verifica si está habilitado
[[nodiscard]] auto isOnFloor() const -> bool { return floor_collision_; } // Verifica si está en el suelo [[nodiscard]] auto isOnFloor() const -> bool { return floor_collision_; } // Verifica si está en el suelo
auto getCollider() -> Circle & { return collider_; } // Obtiene el colisionador auto getCollider() -> Circle& { return collider_; } // Obtiene el colisionador
private: private:
// --- Objetos y punteros --- // --- Objetos y punteros ---
@@ -82,9 +84,9 @@ class Item {
float vel_y_; // Velocidad en el eje Y float vel_y_; // Velocidad en el eje Y
float accel_x_ = 0.0F; // Aceleración en el eje X float accel_x_ = 0.0F; // Aceleración en el eje X
float accel_y_; // Aceleración en el eje Y float accel_y_; // Aceleración en el eje Y
int width_; // Ancho del objeto float width_ = WIDTH; // Ancho del objeto
int height_; // Alto del objeto float height_ = HEIGHT; // Alto del objeto
float lifetime_timer_ = 0.0f; // Acumulador de tiempo de vida del ítem (segundos) float lifetime_timer_ = 0.0f; // Acumulador de tiempo de vida del ítem (segundos)
bool floor_collision_ = false; // Indica si el objeto colisiona con el suelo bool floor_collision_ = false; // Indica si el objeto colisiona con el suelo
bool enabled_ = true; // Indica si el objeto está habilitado bool enabled_ = true; // Indica si el objeto está habilitado
@@ -92,6 +94,6 @@ class Item {
void shiftColliders(); // Alinea el círculo de colisión con la posición del objeto void shiftColliders(); // Alinea el círculo de colisión con la posición del objeto
void shiftSprite(); // Coloca el sprite en la posición del objeto void shiftSprite(); // Coloca el sprite en la posición del objeto
void move(float deltaTime); // Actualiza la posición y estados del objeto (time-based) void move(float deltaTime); // Actualiza la posición y estados del objeto (time-based)
void updateTimeToLive(float deltaTime); // Actualiza el contador de tiempo de vida (time-based) void updateTimeToLive(float deltaTime); // Actualiza el contador de tiempo de vida (time-based)
static auto getCoffeeMachineSpawn(int player_x, int item_width, int area_width, int margin = 2) -> int; // Calcula la zona de aparición de la máquina de café static auto getCoffeeMachineSpawn(int player_x, int item_width, int area_width, int margin = 2) -> int; // Calcula la zona de aparición de la máquina de café
}; };

View File

@@ -87,7 +87,6 @@ auto setParams(const std::string& var, const std::string& value) -> bool {
static const std::unordered_map<std::string, std::function<void(const std::string&)>> INT_PARAMS = { static const std::unordered_map<std::string, std::function<void(const std::string&)>> INT_PARAMS = {
{"game.width", [](const std::string& v) { param.game.width = std::stoi(v); }}, {"game.width", [](const std::string& v) { param.game.width = std::stoi(v); }},
{"game.height", [](const std::string& v) { param.game.height = std::stoi(v); }}, {"game.height", [](const std::string& v) { param.game.height = std::stoi(v); }},
{"game.item_size", [](const std::string& v) { param.game.item_size = std::stoi(v); }},
{"game.play_area.rect.x", [](const std::string& v) { param.game.play_area.rect.x = std::stoi(v); }}, {"game.play_area.rect.x", [](const std::string& v) { param.game.play_area.rect.x = std::stoi(v); }},
{"game.play_area.rect.y", [](const std::string& v) { param.game.play_area.rect.y = std::stoi(v); }}, {"game.play_area.rect.y", [](const std::string& v) { param.game.play_area.rect.y = std::stoi(v); }},
{"game.play_area.rect.w", [](const std::string& v) { param.game.play_area.rect.w = std::stoi(v); }}, {"game.play_area.rect.w", [](const std::string& v) { param.game.play_area.rect.w = std::stoi(v); }},

View File

@@ -14,7 +14,6 @@
struct ParamGame { struct ParamGame {
float width = GameDefaults::Game::WIDTH; float width = GameDefaults::Game::WIDTH;
float height = GameDefaults::Game::HEIGHT; float height = GameDefaults::Game::HEIGHT;
float item_size = GameDefaults::Game::ITEM_SIZE;
Zone play_area{}; // Se inicializa en el constructor de Param Zone play_area{}; // Se inicializa en el constructor de Param
Zone game_area{}; // Se inicializa en el constructor de Param Zone game_area{}; // Se inicializa en el constructor de Param
int name_entry_idle_time = GameDefaults::Game::NAME_ENTRY_IDLE_TIME; int name_entry_idle_time = GameDefaults::Game::NAME_ENTRY_IDLE_TIME;

View File

@@ -786,8 +786,8 @@ void Game::throwCoffee(int x, int y) {
smart_sprites_.back()->setPosX(x - 8); smart_sprites_.back()->setPosX(x - 8);
smart_sprites_.back()->setPosY(y - 8); smart_sprites_.back()->setPosY(y - 8);
smart_sprites_.back()->setWidth(param.game.item_size); smart_sprites_.back()->setWidth(Item::WIDTH);
smart_sprites_.back()->setHeight(param.game.item_size); smart_sprites_.back()->setHeight(Item::HEIGHT);
smart_sprites_.back()->setVelX((-1.0F + ((rand() % 5) * 0.5F)) * 60.0f); // Convertir a pixels/segundo smart_sprites_.back()->setVelX((-1.0F + ((rand() % 5) * 0.5F)) * 60.0f); // Convertir a pixels/segundo
smart_sprites_.back()->setVelY(-4.0F * 60.0f); // Convertir a pixels/segundo smart_sprites_.back()->setVelY(-4.0F * 60.0f); // Convertir a pixels/segundo
smart_sprites_.back()->setAccelX(0.0F); smart_sprites_.back()->setAccelX(0.0F);
@@ -796,8 +796,8 @@ void Game::throwCoffee(int x, int y) {
smart_sprites_.back()->setDestY(param.game.height + 1); smart_sprites_.back()->setDestY(param.game.height + 1);
smart_sprites_.back()->setEnabled(true); smart_sprites_.back()->setEnabled(true);
smart_sprites_.back()->setFinishedDelay(0.0F); smart_sprites_.back()->setFinishedDelay(0.0F);
smart_sprites_.back()->setSpriteClip(0, param.game.item_size, param.game.item_size, param.game.item_size); smart_sprites_.back()->setSpriteClip(0, Item::HEIGHT, Item::WIDTH, Item::HEIGHT);
smart_sprites_.back()->setRotatingCenter({param.game.item_size / 2, param.game.item_size / 2}); smart_sprites_.back()->setRotatingCenter({Item::WIDTH / 2, Item::HEIGHT / 2});
smart_sprites_.back()->setRotate(true); smart_sprites_.back()->setRotate(true);
smart_sprites_.back()->setRotateSpeed(10); smart_sprites_.back()->setRotateSpeed(10);
smart_sprites_.back()->setRotateAmount(90.0); smart_sprites_.back()->setRotateAmount(90.0);

View File

@@ -14,6 +14,7 @@
#include "global_events.h" // Para check #include "global_events.h" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.h" // Para check
#include "input.h" // Para Input #include "input.h" // Para Input
#include "item.h" // Para Item
#include "lang.h" // Para getText #include "lang.h" // Para getText
#include "param.h" // Para Param, param, ParamGame, ParamFade, Param... #include "param.h" // Para Param, param, ParamGame, ParamFade, Param...
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
@@ -78,43 +79,43 @@ void Instructions::iniSprites() {
// Inicializa los sprites // Inicializa los sprites
for (int i = 0; i < (int)item_textures_.size(); ++i) { for (int i = 0; i < (int)item_textures_.size(); ++i) {
auto sprite = std::make_unique<Sprite>(item_textures_[i], 0, 0, param.game.item_size, param.game.item_size); auto sprite = std::make_unique<Sprite>(item_textures_[i], 0, 0, Item::WIDTH, Item::HEIGHT);
sprite->setPosition((SDL_FPoint){sprite_pos_.x, sprite_pos_.y + ((param.game.item_size + item_space_) * i)}); sprite->setPosition((SDL_FPoint){sprite_pos_.x, sprite_pos_.y + ((Item::HEIGHT + item_space_) * i)});
sprites_.push_back(std::move(sprite)); sprites_.push_back(std::move(sprite));
} }
} }
// Actualiza los sprites // Actualiza los sprites
void Instructions::updateSprites() { void Instructions::updateSprites() {
SDL_FRect src_rect = {0, 0, param.game.item_size, param.game.item_size}; SDL_FRect src_rect = {0, 0, Item::WIDTH, Item::HEIGHT};
// Disquito (desplazamiento 12/60 = 0.2s) // Disquito (desplazamiento 12/60 = 0.2s)
src_rect.y = param.game.item_size * (static_cast<int>((elapsed_time_ + 0.2f) / SPRITE_ANIMATION_CYCLE_S) % 2); src_rect.y = Item::HEIGHT * (static_cast<int>((elapsed_time_ + 0.2f) / SPRITE_ANIMATION_CYCLE_S) % 2);
sprites_[0]->setSpriteClip(src_rect); sprites_[0]->setSpriteClip(src_rect);
// Gavina (desplazamiento 9/60 = 0.15s) // Gavina (desplazamiento 9/60 = 0.15s)
src_rect.y = param.game.item_size * (static_cast<int>((elapsed_time_ + 0.15f) / SPRITE_ANIMATION_CYCLE_S) % 2); src_rect.y = Item::HEIGHT * (static_cast<int>((elapsed_time_ + 0.15f) / SPRITE_ANIMATION_CYCLE_S) % 2);
sprites_[1]->setSpriteClip(src_rect); sprites_[1]->setSpriteClip(src_rect);
// Pacmar (desplazamiento 6/60 = 0.1s) // Pacmar (desplazamiento 6/60 = 0.1s)
src_rect.y = param.game.item_size * (static_cast<int>((elapsed_time_ + 0.1f) / SPRITE_ANIMATION_CYCLE_S) % 2); src_rect.y = Item::HEIGHT * (static_cast<int>((elapsed_time_ + 0.1f) / SPRITE_ANIMATION_CYCLE_S) % 2);
sprites_[2]->setSpriteClip(src_rect); sprites_[2]->setSpriteClip(src_rect);
// Time Stopper (desplazamiento 3/60 = 0.05s) // Time Stopper (desplazamiento 3/60 = 0.05s)
src_rect.y = param.game.item_size * (static_cast<int>((elapsed_time_ + 0.05f) / SPRITE_ANIMATION_CYCLE_S) % 2); src_rect.y = Item::HEIGHT * (static_cast<int>((elapsed_time_ + 0.05f) / SPRITE_ANIMATION_CYCLE_S) % 2);
sprites_[3]->setSpriteClip(src_rect); sprites_[3]->setSpriteClip(src_rect);
// Coffee (sin desplazamiento) // Coffee (sin desplazamiento)
src_rect.y = param.game.item_size * (static_cast<int>(elapsed_time_ / SPRITE_ANIMATION_CYCLE_S) % 2); src_rect.y = Item::HEIGHT * (static_cast<int>(elapsed_time_ / SPRITE_ANIMATION_CYCLE_S) % 2);
sprites_[4]->setSpriteClip(src_rect); sprites_[4]->setSpriteClip(src_rect);
} }
// Rellena la textura de texto // Rellena la textura de texto
void Instructions::fillTexture() { void Instructions::fillTexture() {
const int X_OFFSET = param.game.item_size + 8; const int X_OFFSET = Item::WIDTH + 8;
// Modifica el renderizador para pintar en la textura // Modifica el renderizador para pintar en la textura
auto *temp = SDL_GetRenderTarget(renderer_); auto* temp = SDL_GetRenderTarget(renderer_);
SDL_SetRenderTarget(renderer_, texture_); SDL_SetRenderTarget(renderer_, texture_);
// Limpia la textura // Limpia la textura
@@ -130,7 +131,7 @@ void Instructions::fillTexture() {
constexpr int SPACE_POST_HEADER = 20; constexpr int SPACE_POST_HEADER = 20;
constexpr int SPACE_PRE_HEADER = 28; constexpr int SPACE_PRE_HEADER = 28;
const int SPACE_BETWEEN_LINES = text_->getCharacterSize() * 1.5F; const int SPACE_BETWEEN_LINES = text_->getCharacterSize() * 1.5F;
const int SPACE_BETWEEN_ITEM_LINES = param.game.item_size + item_space_; const int SPACE_BETWEEN_ITEM_LINES = Item::HEIGHT + item_space_;
const int SPACE_NEW_PARAGRAPH = SPACE_BETWEEN_LINES * 0.5F; const int SPACE_NEW_PARAGRAPH = SPACE_BETWEEN_LINES * 0.5F;
const int SIZE = (NUM_LINES * SPACE_BETWEEN_LINES) + (NUM_ITEM_LINES * SPACE_BETWEEN_ITEM_LINES) + (NUM_POST_HEADERS * SPACE_POST_HEADER) + (NUM_PRE_HEADERS * SPACE_PRE_HEADER) + (SPACE_NEW_PARAGRAPH); const int SIZE = (NUM_LINES * SPACE_BETWEEN_LINES) + (NUM_ITEM_LINES * SPACE_BETWEEN_ITEM_LINES) + (NUM_POST_HEADERS * SPACE_POST_HEADER) + (NUM_PRE_HEADERS * SPACE_PRE_HEADER) + (SPACE_NEW_PARAGRAPH);
@@ -144,7 +145,7 @@ void Instructions::fillTexture() {
Lang::getText("[INSTRUCTIONS] 09"), Lang::getText("[INSTRUCTIONS] 09"),
Lang::getText("[INSTRUCTIONS] 10"), Lang::getText("[INSTRUCTIONS] 10"),
Lang::getText("[INSTRUCTIONS] 11")}; Lang::getText("[INSTRUCTIONS] 11")};
for (const auto &desc : ITEM_DESCRIPTIONS) { for (const auto& desc : ITEM_DESCRIPTIONS) {
const int L = text_->length(desc); const int L = text_->length(desc);
length = L > length ? L : length; length = L > length ? L : length;
} }
@@ -178,13 +179,13 @@ void Instructions::fillTexture() {
// Da valor a la variable // Da valor a la variable
sprite_pos_.x = ANCHOR_ITEM; sprite_pos_.x = ANCHOR_ITEM;
sprite_pos_.y = ANCHOR3 - ((param.game.item_size - text_->getCharacterSize()) / 2); sprite_pos_.y = ANCHOR3 - ((Item::HEIGHT - text_->getCharacterSize()) / 2);
} }
// Rellena el backbuffer // Rellena el backbuffer
void Instructions::fillBackbuffer() { void Instructions::fillBackbuffer() {
// Modifica el renderizador para pintar en la textura // Modifica el renderizador para pintar en la textura
auto *temp = SDL_GetRenderTarget(renderer_); auto* temp = SDL_GetRenderTarget(renderer_);
SDL_SetRenderTarget(renderer_, backbuffer_); SDL_SetRenderTarget(renderer_, backbuffer_);
// Limpia la textura // Limpia la textura
@@ -195,7 +196,7 @@ void Instructions::fillBackbuffer() {
SDL_RenderTexture(renderer_, texture_, nullptr, nullptr); SDL_RenderTexture(renderer_, texture_, nullptr, nullptr);
// Dibuja los sprites // Dibuja los sprites
for (auto &sprite : sprites_) { for (auto& sprite : sprites_) {
sprite->render(); sprite->render();
} }
@@ -207,7 +208,7 @@ void Instructions::fillBackbuffer() {
void Instructions::update(float delta_time) { void Instructions::update(float delta_time) {
elapsed_time_ += delta_time; // Incrementa el tiempo transcurrido elapsed_time_ += delta_time; // Incrementa el tiempo transcurrido
static auto *const SCREEN = Screen::get(); static auto* const SCREEN = Screen::get();
SCREEN->update(delta_time); // Actualiza el objeto screen SCREEN->update(delta_time); // Actualiza el objeto screen
Audio::update(); // Actualiza el objeto audio Audio::update(); // Actualiza el objeto audio
@@ -220,7 +221,7 @@ void Instructions::update(float delta_time) {
// Pinta en pantalla // Pinta en pantalla
void Instructions::render() { void Instructions::render() {
static auto *const SCREEN = Screen::get(); static auto* const SCREEN = Screen::get();
SCREEN->start(); // Prepara para empezar a dibujar en la textura de juego SCREEN->start(); // Prepara para empezar a dibujar en la textura de juego
SCREEN->clean(); // Limpia la pantalla SCREEN->clean(); // Limpia la pantalla
@@ -287,11 +288,11 @@ auto Instructions::initializeLines(int height) -> std::vector<Line> {
} }
// Método para mover las líneas con suavizado // Método para mover las líneas con suavizado
auto Instructions::moveLines(std::vector<Line> &lines, int width, float duration, Uint32 start_delay) -> bool { auto Instructions::moveLines(std::vector<Line>& lines, int width, float duration, Uint32 start_delay) -> bool {
Uint32 current_time = SDL_GetTicks(); Uint32 current_time = SDL_GetTicks();
bool all_lines_off_screen = true; bool all_lines_off_screen = true;
for (auto &line : lines) { for (auto& line : lines) {
// Establecer start_time en el primer cuadro de animación // Establecer start_time en el primer cuadro de animación
if (line.start_time == 0) { if (line.start_time == 0) {
line.start_time = current_time + line.y * start_delay; line.start_time = current_time + line.y * start_delay;
@@ -316,8 +317,8 @@ auto Instructions::moveLines(std::vector<Line> &lines, int width, float duration
} }
// Método para renderizar las líneas // Método para renderizar las líneas
void Instructions::renderLines(SDL_Renderer *renderer, SDL_Texture *texture, const std::vector<Line> &lines) { void Instructions::renderLines(SDL_Renderer* renderer, SDL_Texture* texture, const std::vector<Line>& lines) {
for (const auto &line : lines) { for (const auto& line : lines) {
SDL_FRect src_rect = {0, static_cast<float>(line.y), 320, 1}; SDL_FRect src_rect = {0, static_cast<float>(line.y), 320, 1};
SDL_FRect dst_rect = {static_cast<float>(line.x), static_cast<float>(line.y), 320, 1}; SDL_FRect dst_rect = {static_cast<float>(line.x), static_cast<float>(line.y), 320, 1};
SDL_RenderTexture(renderer, texture, &src_rect, &dst_rect); SDL_RenderTexture(renderer, texture, &src_rect, &dst_rect);