- Ara gestionem la finalització dels fades de altra forma més segura.
This commit is contained in:
@@ -57,9 +57,13 @@ namespace gamestate
|
|||||||
|
|
||||||
bool loop()
|
bool loop()
|
||||||
{
|
{
|
||||||
|
if (draw::isfading()) {
|
||||||
|
draw::render();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if ( (wait_until > 0) && (SDL_GetTicks() < wait_until) )
|
if ( (wait_until > 0) && (SDL_GetTicks() < wait_until) )
|
||||||
{
|
{
|
||||||
if (!draw::isfading() && (input::anyKeyPressed() || input::mouseBtn(1))) {
|
if (input::anyKeyPressed() || input::mouseBtn(1)) {
|
||||||
wait_until=0;
|
wait_until=0;
|
||||||
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) fseek(sequence_file, 0, SEEK_END);
|
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) fseek(sequence_file, 0, SEEK_END);
|
||||||
} else {
|
} else {
|
||||||
@@ -67,6 +71,7 @@ namespace gamestate
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feof(sequence_file))
|
if (feof(sequence_file))
|
||||||
{
|
{
|
||||||
fclose(sequence_file);
|
fclose(sequence_file);
|
||||||
@@ -90,14 +95,13 @@ namespace gamestate
|
|||||||
|
|
||||||
if (command=="ESPERAR") {
|
if (command=="ESPERAR") {
|
||||||
int res = fscanf(sequence_file, "%i", &val);
|
int res = fscanf(sequence_file, "%i", &val);
|
||||||
|
printf("ESPERAR %i\n", val);
|
||||||
wait_until = SDL_GetTicks() + val;
|
wait_until = SDL_GetTicks() + val;
|
||||||
|
|
||||||
} else if (command=="FADEIN") {
|
} else if (command=="FADEIN") {
|
||||||
int res = fscanf(sequence_file, " '%[^']'", text);
|
int res = fscanf(sequence_file, " '%[^']'", text);
|
||||||
drawPic(text);
|
drawPic(text);
|
||||||
draw::fadein();
|
draw::fadein();
|
||||||
draw::render();
|
|
||||||
wait_until = SDL_GetTicks() + 500;
|
|
||||||
|
|
||||||
} else if (command=="SHOW") {
|
} else if (command=="SHOW") {
|
||||||
int res = fscanf(sequence_file, " '%[^']'", text);
|
int res = fscanf(sequence_file, " '%[^']'", text);
|
||||||
@@ -114,12 +118,10 @@ namespace gamestate
|
|||||||
|
|
||||||
} else if (command=="FADEOUT") {
|
} else if (command=="FADEOUT") {
|
||||||
draw::fadeout();
|
draw::fadeout();
|
||||||
wait_until = SDL_GetTicks() + 500;
|
|
||||||
|
|
||||||
} else if (command=="FADEOUTMUSIC") {
|
} else if (command=="FADEOUTMUSIC") {
|
||||||
draw::fadeout();
|
draw::fadeout();
|
||||||
audio::fadeoutMusic();
|
audio::fadeoutMusic();
|
||||||
wait_until = SDL_GetTicks() + 500;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user