Añadidos defines para compilar en raspberry pi

This commit is contained in:
2024-07-01 09:11:13 +02:00
parent 59671d6e55
commit b05e1c6025
3 changed files with 28 additions and 11 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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)