forked from jaildesigner-jailgames/jaildoctors_dilemma
netejat codi mort en screen.cpp
This commit is contained in:
@@ -44,7 +44,7 @@ Screen::Screen()
|
||||
|
||||
// Ajusta los tamaños
|
||||
game_surface_dstrect_ = {options.video.border.width, options.video.border.height, options.game.width, options.game.height};
|
||||
adjustWindowSize();
|
||||
//adjustWindowSize();
|
||||
current_palette_ = findPalette(options.video.palette);
|
||||
|
||||
// Define el color del borde para el modo de pantalla completa
|
||||
@@ -70,18 +70,6 @@ Screen::Screen()
|
||||
}
|
||||
SDL_SetTextureScaleMode(border_texture_, SDL_SCALEMODE_NEAREST);
|
||||
|
||||
// Crea la textura para los shaders
|
||||
const int EXTRA_WIDTH = options.video.border.enabled ? options.video.border.width * 2 : 0;
|
||||
const int EXTRA_HEIGHT = options.video.border.enabled ? options.video.border.height * 2 : 0;
|
||||
shaders_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, options.game.width + EXTRA_WIDTH, options.game.height + EXTRA_HEIGHT);
|
||||
if (!shaders_texture_) {
|
||||
// Registrar el error si está habilitado
|
||||
if (options.console) {
|
||||
std::cerr << "Error: shaders_texture_ could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
}
|
||||
SDL_SetTextureScaleMode(shaders_texture_, SDL_SCALEMODE_NEAREST);
|
||||
|
||||
// Crea la surface donde se dibujan los graficos del juego
|
||||
game_surface_ = std::make_shared<Surface>(options.game.width, options.game.height);
|
||||
game_surface_->setPalette(readPalFile(palettes_.at(current_palette_)));
|
||||
@@ -95,9 +83,6 @@ Screen::Screen()
|
||||
// Establece la surface que actuará como renderer para recibir las llamadas a render()
|
||||
renderer_surface_ = std::make_shared<std::shared_ptr<Surface>>(game_surface_);
|
||||
|
||||
// Muestra la ventana
|
||||
show();
|
||||
|
||||
// Extrae el nombre de las paletas desde su ruta
|
||||
processPaletteList();
|
||||
|
||||
@@ -114,7 +99,6 @@ Screen::Screen()
|
||||
Screen::~Screen() {
|
||||
SDL_DestroyTexture(game_texture_);
|
||||
SDL_DestroyTexture(border_texture_);
|
||||
SDL_DestroyTexture(shaders_texture_);
|
||||
}
|
||||
|
||||
// Limpia el renderer
|
||||
@@ -199,7 +183,6 @@ void Screen::setBorderColor(Uint8 color) {
|
||||
void Screen::toggleBorder() {
|
||||
options.video.border.enabled = !options.video.border.enabled;
|
||||
setVideoMode(options.video.fullscreen);
|
||||
//createShadersTexture();
|
||||
initShaders();
|
||||
}
|
||||
|
||||
@@ -314,9 +297,6 @@ void Screen::textureToRenderer() {
|
||||
SDL_Texture* texture_to_render = options.video.border.enabled ? border_texture_ : game_texture_;
|
||||
|
||||
if (options.video.shaders && shader_backend_) {
|
||||
SDL_SetRenderTarget(renderer_, shaders_texture_);
|
||||
SDL_RenderTexture(renderer_, texture_to_render, nullptr, nullptr);
|
||||
SDL_SetRenderTarget(renderer_, nullptr);
|
||||
shader_backend_->render();
|
||||
} else {
|
||||
SDL_SetRenderTarget(renderer_, nullptr);
|
||||
@@ -345,24 +325,6 @@ size_t Screen::findPalette(const std::string& name) {
|
||||
return static_cast<size_t>(0);
|
||||
}
|
||||
|
||||
// Recrea la textura para los shaders
|
||||
void Screen::createShadersTexture() {
|
||||
if (shaders_texture_) {
|
||||
SDL_DestroyTexture(shaders_texture_);
|
||||
}
|
||||
|
||||
// Crea la textura donde se dibuja el borde que rodea el area de juego
|
||||
const int EXTRA_WIDTH = options.video.border.enabled ? options.video.border.width * 2 : 0;
|
||||
const int EXTRA_HEIGHT = options.video.border.enabled ? options.video.border.height * 2 : 0;
|
||||
shaders_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, options.game.width + EXTRA_WIDTH, options.game.height + EXTRA_HEIGHT);
|
||||
if (!shaders_texture_) {
|
||||
// Registrar el error si está habilitado
|
||||
if (options.console) {
|
||||
std::cerr << "Error: shaders_texture_ could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Muestra información por pantalla
|
||||
void Screen::renderInfo() {
|
||||
if (show_debug_info_ && Resource::get()) {
|
||||
|
||||
Reference in New Issue
Block a user