Añadido degradado en el fondo
This commit is contained in:
16
main.cpp
16
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,6 +73,20 @@ int main(int argc, char *argv[])
|
||||
// Dibuja en pantalla
|
||||
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
// 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user