diff --git a/main.cpp b/main.cpp index 9263e98..c1a6a07 100644 --- a/main.cpp +++ b/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) Text *text = new Text("data/smb2.txt", "data/smb2.png", renderer); // Bucle principal - JA_PlayMusic(music, true); + // JA_PlayMusic(music, true); bool should_exit = false; while (!should_exit) { @@ -73,7 +73,21 @@ int main(int argc, char *argv[]) // Dibuja en pantalla SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); SDL_RenderClear(renderer); - text->writeCentered(options->gameWidth / 2 ,text->getCharacterSize(),"Jail Engine DEMO"); + // Dibuja un degradado de fondo + const int gradFirstLine = options->gameHeight / 3; + const int gradLastLine = options->gameHeight; + const int gradNumLines = gradLastLine - gradFirstLine; + const int gradColorFrom = 0; + const int gradColorTo = 192; + + for (int i = gradFirstLine; i < gradLastLine; ++i) + { + float step = ((float)(i - gradFirstLine) / gradNumLines); + int color = gradColorFrom + ((gradColorTo - gradColorFrom) * step); + SDL_SetRenderDrawColor(renderer, color, 0x00, 0x00, 0xFF); + SDL_RenderDrawLine(renderer, 0, i, options->gameWidth, i); + } + text->writeCentered(options->gameWidth / 2, text->getCharacterSize(), "Jail Engine DEMO"); SDL_RenderPresent(renderer); }