Ja pinta cosetes per pantalla

This commit is contained in:
2025-03-04 14:24:30 +01:00
parent 05f91b2a94
commit 57481a1e97
69 changed files with 481 additions and 478 deletions

View File

@@ -52,10 +52,28 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer)
SDL_RenderSetIntegerScale(renderer_, options.video.integer_scale ? SDL_TRUE : SDL_FALSE);
// Crea la textura donde se dibujan los graficos del juego
game_texture_ = createTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, options.game.width, options.game.height);
game_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, options.game.width, options.game.height);
//game_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, options.game.width, options.game.height);
if (!game_texture_)
{
// Registrar el error si está habilitado
if (options.console)
{
std::cerr << "Error: game_texture_ could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
}
}
// Crea la textura donde se dibuja el borde que rodea el area de juego
border_texture_ = createTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, options.game.width + options.video.border.width * 2, options.game.height + options.video.border.height * 2);
border_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, options.game.width + options.video.border.width * 2, options.game.height + options.video.border.height * 2);
//border_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, options.game.width + options.video.border.width * 2, options.game.height + options.video.border.height * 2);
if (!border_texture_)
{
// Registrar el error si está habilitado
if (options.console)
{
std::cerr << "Error: border_texture_ could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
}
}
// Crea la surface donde se dibujan los graficos del juego
game_surface_ = std::make_shared<Surface>(nullptr, options.game.width, options.game.height);
@@ -107,7 +125,7 @@ void Screen::render()
game_surface_->copyToTexture(renderer_, game_texture_);
// Renderiza sobre gameCanvas los overlays
renderNotifications();
//renderNotifications();
// Si está el borde activo, vuelca gameCanvas sobre borderCanvas
if (options.video.border.enabled)