Añadidos colores al fondo
This commit is contained in:
22
main.cpp
22
main.cpp
@@ -59,7 +59,11 @@ int main(int argc, char *argv[])
|
||||
if (window != nullptr)
|
||||
{
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
if (renderer == nullptr)
|
||||
if (renderer != nullptr)
|
||||
{
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -98,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
sprite->setVelY(2);
|
||||
|
||||
// Bucle principal
|
||||
//JA_PlayMusic(music, true);
|
||||
// JA_PlayMusic(music, true);
|
||||
bool should_exit = false;
|
||||
while (!should_exit)
|
||||
{
|
||||
@@ -203,8 +207,6 @@ int main(int argc, char *argv[])
|
||||
// Dibuja en pantalla
|
||||
screen->start();
|
||||
screen->clean();
|
||||
// SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
|
||||
// SDL_RenderClear(renderer);
|
||||
|
||||
// Dibuja un degradado de fondo
|
||||
const int gradFirstLine = options->screen.nativeHeight / 3;
|
||||
@@ -220,9 +222,18 @@ int main(int argc, char *argv[])
|
||||
SDL_RenderDrawLine(renderer, 0, i, options->screen.nativeWidth, i);
|
||||
}
|
||||
|
||||
for (int i = gradLastLine; i > gradFirstLine; --i)
|
||||
{
|
||||
float step = ((float)(i - gradFirstLine) / gradNumLines);
|
||||
int alpha = 0 + ((255 - 0) * step);
|
||||
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0xFF, alpha);
|
||||
SDL_RenderDrawLine(renderer, 0, gradLastLine - i, options->screen.nativeWidth, gradLastLine - i);
|
||||
}
|
||||
|
||||
// Escribe el texto
|
||||
text->setZoom(2);
|
||||
text->writeCentered(options->screen.nativeWidth / 2, text->getCharacterSize(), "Jail Engine DEMO");
|
||||
// text->writeCentered(options->screen.nativeWidth / 2, text->getCharacterSize(), "Jail Engine DEMO");
|
||||
text->writeDX(TXT_CENTER | TXT_SHADOW, options->screen.nativeWidth / 2, text->getCharacterSize(), "Jail Engine DEMO", 1, {255, 255, 255}, 1, {48, 48, 48});
|
||||
text->disableZoom();
|
||||
text->writeCentered(options->screen.nativeWidth / 2, text->getCharacterSize() * 7, "Pulsa 'N' para mostrar");
|
||||
text->writeCentered(options->screen.nativeWidth / 2, text->getCharacterSize() * 8, "una notificacion");
|
||||
@@ -232,7 +243,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Vuelca el buffer en pantalla
|
||||
screen->blit();
|
||||
// SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
// Finaliza el sprite
|
||||
|
||||
@@ -29,6 +29,7 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options)
|
||||
std::cout << "TitleSurface could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
}
|
||||
SDL_SetTextureBlendMode(gameCanvas, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Establece el modo de video
|
||||
setVideoMode(options->screen.mode);
|
||||
|
||||
Reference in New Issue
Block a user