diff --git a/Makefile b/Makefile index 7b662fd..7b7a7c4 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ else FixPath = $1 SOURCES := $(shell find $(DIR_SOURCES) -name '*.cpp') CXXFLAGS:= -std=c++11 -Wall -Os -ffunction-sections -fdata-sections -Wno-deprecated - LDFLAGS := -lSDL2 + LDFLAGS := -lSDL2 RM = rm -f MKD:= mkdir -p UNAME_S := $(shell uname -s) @@ -116,11 +116,9 @@ print-variables: @echo RM: $(RM) -.PHONY: peiv - -peiv: - if not exist peiv mkdir $(subst /,\,peiv) - if exist peiv rmdir /Q /S peiv +raspi: + $(CXX) $(SOURCES) -D RASPI $(CXXFLAGS) lSDL2 -o "$(TARGET_FILE) + strip -s -R .comment -R .gnu.version "$(TARGET_FILE)_debug" --strip-unneeded windows: @echo off diff --git a/source/common/screen.cpp b/source/common/screen.cpp index 02a6871..64a5b14 100644 --- a/source/common/screen.cpp +++ b/source/common/screen.cpp @@ -78,6 +78,7 @@ void Screen::blit() // Atenua la pantalla doAttenuate(); +#ifndef RASPI if (options->video.shaders) { shader::render(); @@ -97,6 +98,20 @@ void Screen::blit() // Muestra por pantalla el renderizador SDL_RenderPresent(renderer); } +#else + // Vuelve a dejar el renderizador en modo normal + SDL_SetRenderTarget(renderer, nullptr); + + // Borra el contenido previo + SDL_SetRenderDrawColor(renderer, borderColor.r, borderColor.g, borderColor.b, 0xFF); + SDL_RenderClear(renderer); + + // Copia la textura de juego en el renderizador en la posición adecuada + SDL_RenderCopy(renderer, gameCanvas, nullptr, &dest); + + // Muestra por pantalla el renderizador + SDL_RenderPresent(renderer); +#endif } // Establece el modo de video @@ -183,6 +198,7 @@ void Screen::setVideoMode(int videoMode) } } +#ifndef RASPI // Reinicia los shaders if (options->video.shaders) { @@ -197,6 +213,9 @@ void Screen::setVideoMode(int videoMode) { SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight); } +#else + SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight); +#endif // Actualiza las opciones options->video.mode = videoMode; diff --git a/source/director.cpp b/source/director.cpp index 92cf075..9cd1f7b 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -178,8 +178,8 @@ bool Director::initSDL() std::cout << "Warning: texture filtering not enabled!\n"; } } - - if (options->video.shaders || true) +#ifndef RASPI + if (options->video.shaders) if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl")) { if (options->console) @@ -187,7 +187,7 @@ bool Director::initSDL() std::cout << "Warning: opengl not enabled!\n"; } } - +#endif // Crea la ventana int incW = 0; int incH = 0; @@ -213,13 +213,13 @@ bool Director::initSDL() { flags = flags | SDL_RENDERER_PRESENTVSYNC; } - +#ifndef RASPI // La aceleración se activa según las opciones if (options->video.shaders || true) { flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE; } - +#endif renderer = SDL_CreateRenderer(window, -1, flags); if (renderer == nullptr)