afegides zones
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// © 2025 Port a C++20 amb SDL3
|
||||
|
||||
#include "escena_joc.hpp"
|
||||
#include "../../core/rendering/line_renderer.hpp"
|
||||
#include "../../core/system/gestor_escenes.hpp"
|
||||
#include "../../core/system/global_events.hpp"
|
||||
#include <cmath>
|
||||
@@ -117,6 +118,9 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
}
|
||||
|
||||
void EscenaJoc::dibuixar() {
|
||||
// Dibuixar marges de la zona de joc
|
||||
dibuixar_marges();
|
||||
|
||||
// Dibuixar nau
|
||||
nau_.dibuixar();
|
||||
|
||||
@@ -129,14 +133,6 @@ void EscenaJoc::dibuixar() {
|
||||
for (const auto &bala : bales_) {
|
||||
bala.dibuixar();
|
||||
}
|
||||
|
||||
// [PRUEBA] Text vectorial
|
||||
text_.render("0123456789", {10, 10}, 1.5f);
|
||||
text_.render("SCORE: 1234", {10, 40}, 1.0f);
|
||||
text_.render("10:45", {10, 70}, 2.0f);
|
||||
text_.render("LEVEL-3", {10, 110}, 1.5f);
|
||||
|
||||
// TODO: Dibuixar marges (Fase 11)
|
||||
}
|
||||
|
||||
void EscenaJoc::processar_input(const SDL_Event &event) {
|
||||
@@ -169,3 +165,20 @@ void EscenaJoc::processar_input(const SDL_Event &event) {
|
||||
void EscenaJoc::tocado() {
|
||||
// TODO: Implementar seqüència de mort
|
||||
}
|
||||
|
||||
void EscenaJoc::dibuixar_marges() const {
|
||||
// Dibuixar rectangle de la zona de joc
|
||||
const SDL_FRect& zona = Defaults::Zones::GAME;
|
||||
|
||||
// Coordenades dels cantons
|
||||
int x1 = static_cast<int>(zona.x);
|
||||
int y1 = static_cast<int>(zona.y);
|
||||
int x2 = static_cast<int>(zona.x + zona.w);
|
||||
int y2 = static_cast<int>(zona.y + zona.h);
|
||||
|
||||
// 4 línies per formar el rectangle
|
||||
Rendering::linea(sdl_.obte_renderer(), x1, y1, x2, y1, true); // Top
|
||||
Rendering::linea(sdl_.obte_renderer(), x1, y2, x2, y2, true); // Bottom
|
||||
Rendering::linea(sdl_.obte_renderer(), x1, y1, x1, y2, true); // Left
|
||||
Rendering::linea(sdl_.obte_renderer(), x2, y1, x2, y2, true); // Right
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user