Añadidos defines para compilar en raspberry pi
This commit is contained in:
8
Makefile
8
Makefile
@@ -116,11 +116,9 @@ print-variables:
|
|||||||
|
|
||||||
@echo RM: $(RM)
|
@echo RM: $(RM)
|
||||||
|
|
||||||
.PHONY: peiv
|
raspi:
|
||||||
|
$(CXX) $(SOURCES) -D RASPI $(CXXFLAGS) lSDL2 -o "$(TARGET_FILE)
|
||||||
peiv:
|
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)_debug" --strip-unneeded
|
||||||
if not exist peiv mkdir $(subst /,\,peiv)
|
|
||||||
if exist peiv rmdir /Q /S peiv
|
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
@echo off
|
@echo off
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ void Screen::blit()
|
|||||||
// Atenua la pantalla
|
// Atenua la pantalla
|
||||||
doAttenuate();
|
doAttenuate();
|
||||||
|
|
||||||
|
#ifndef RASPI
|
||||||
if (options->video.shaders)
|
if (options->video.shaders)
|
||||||
{
|
{
|
||||||
shader::render();
|
shader::render();
|
||||||
@@ -97,6 +98,20 @@ void Screen::blit()
|
|||||||
// Muestra por pantalla el renderizador
|
// Muestra por pantalla el renderizador
|
||||||
SDL_RenderPresent(renderer);
|
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
|
// Establece el modo de video
|
||||||
@@ -183,6 +198,7 @@ void Screen::setVideoMode(int videoMode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef RASPI
|
||||||
// Reinicia los shaders
|
// Reinicia los shaders
|
||||||
if (options->video.shaders)
|
if (options->video.shaders)
|
||||||
{
|
{
|
||||||
@@ -197,6 +213,9 @@ void Screen::setVideoMode(int videoMode)
|
|||||||
{
|
{
|
||||||
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Actualiza las opciones
|
// Actualiza las opciones
|
||||||
options->video.mode = videoMode;
|
options->video.mode = videoMode;
|
||||||
|
|||||||
@@ -178,8 +178,8 @@ bool Director::initSDL()
|
|||||||
std::cout << "Warning: texture filtering not enabled!\n";
|
std::cout << "Warning: texture filtering not enabled!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifndef RASPI
|
||||||
if (options->video.shaders || true)
|
if (options->video.shaders)
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"))
|
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"))
|
||||||
{
|
{
|
||||||
if (options->console)
|
if (options->console)
|
||||||
@@ -187,7 +187,7 @@ bool Director::initSDL()
|
|||||||
std::cout << "Warning: opengl not enabled!\n";
|
std::cout << "Warning: opengl not enabled!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Crea la ventana
|
// Crea la ventana
|
||||||
int incW = 0;
|
int incW = 0;
|
||||||
int incH = 0;
|
int incH = 0;
|
||||||
@@ -213,13 +213,13 @@ bool Director::initSDL()
|
|||||||
{
|
{
|
||||||
flags = flags | SDL_RENDERER_PRESENTVSYNC;
|
flags = flags | SDL_RENDERER_PRESENTVSYNC;
|
||||||
}
|
}
|
||||||
|
#ifndef RASPI
|
||||||
// La aceleración se activa según las opciones
|
// La aceleración se activa según las opciones
|
||||||
if (options->video.shaders || true)
|
if (options->video.shaders || true)
|
||||||
{
|
{
|
||||||
flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
|
flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||||
|
|
||||||
if (renderer == nullptr)
|
if (renderer == nullptr)
|
||||||
|
|||||||
Reference in New Issue
Block a user