Jump to content

Projeto de API B no qual preciso de fazer um splash screen (uma animação, segundo o professor) que use ciclos para o jogo do galo


Palhota

Recommended Posts

 Este é um código que encontrei e tentei adaptar mas a "animação" está demasiado rápida para se perceber.

#include <stdio.h>

//Giving some delay
void delay( unsigned int value)
{
    unsigned int count1 =10;
    unsigned int count2 =10;

    for(count1 = 10; count1 < value ; count1++ )
    {
        for(count2 = 10; count2 < count1 ; count2++ )
        {

        }
    }
}


// string to display Rocket
const char rocket[] =R"EOF(
      _____                    _____                    _____
     /\    \                  /\    \                  /\    \
    /::\    \                /::\    \                /::\    \
    \:::\    \               \:::\    \              /::::\    \
     \:::\    \               \:::\    \            /::::::\    \
      \:::\    \               \:::\    \          /:::/\:::\    \
       \:::\    \               \:::\    \        /:::/  \:::\    \
       /::::\    \              /::::\    \      /:::/    \:::\    \
      /::::::\    \    ____    /::::::\    \    /:::/    / \:::\    \
     /:::/\:::\    \  /\   \  /:::/\:::\    \  /:::/    /   \:::\    \
    /:::/  \:::\____\/::\   \/:::/  \:::\____\/:::/____/     \:::\____\
   /:::/    \::/    /\:::/:::/    \::/    /\:::\    \      \::/    /
  /:::/    / \/____/  \:::\/:::/    / \/____/  \:::\    \      \/____/
 /:::/    /            \::::::/    /            \:::\    \
/:::/    /              \::::/____/              \:::\    \
\::/    /                \:::\    \               \:::\    \
 \/____/                  \:::\    \               \:::\    \
                           \:::\    \               \:::\    \
                            \:::\____\               \:::\____\
                             \::/    /                \::/    /
                              \/____/                  \/____/


)EOF";

const char rocket1[] =R"EOF(
      _____                    _____                    _____
     /\    \                  /\    \                  /\    \
    /::\    \                /::\    \                /::\    \
    \:::\    \              /::::\    \              /::::\    \
     \:::\    \            /::::::\    \            /::::::\    \
      \:::\    \          /:::/\:::\    \          /:::/\:::\    \
       \:::\    \        /:::/__\:::\    \        /:::/  \:::\    \
       /::::\    \      /::::\   \:::\    \      /:::/    \:::\    \
      /::::::\    \    /::::::\   \:::\    \    /:::/    / \:::\    \
     /:::/\:::\    \  /:::/\:::\   \:::\    \  /:::/    /   \:::\    \
    /:::/  \:::\____\/:::/  \:::\   \:::\____\/:::/____/     \:::\____\
   /:::/    \::/    /\::/    \:::/:::/    /\:::\    \      \::/    /
  /:::/    / \/____/  \/____/ \:::\/:::/    /  \:::\    \      \/____/
 /:::/    /                    \::::::/    /    \:::\    \
/:::/    /                      \::::/    /      \:::\    \
\::/    /                       /:::/    /        \:::\    \
 \/____/                       /:::/    /          \:::\    \
                              /:::/    /            \:::\    \
                             /:::/    /              \:::\____\
                             \::/    /                \::/    /
                              \/____/                  \/____/


)EOF";
const char rocket2[] =R"EOF(
      _____                   _______                   _____
     /\    \                 /::\    \                 /\    \
    /::\    \               /::::\    \               /::\    \
    \:::\    \             /::::::\    \             /::::\    \
     \:::\    \           /::::::::\    \           /::::::\    \
      \:::\    \         /:::/~~\:::\    \         /:::/\:::\    \
       \:::\    \       /:::/    \:::\    \       /:::/__\:::\    \
       /::::\    \     /:::/    / \:::\    \     /::::\   \:::\    \
      /::::::\    \   /:::/____/   \:::\____\   /::::::\   \:::\    \
     /:::/\:::\    \ |:::|    |     |:::|    | /:::/\:::\   \:::\    \
    /:::/  \:::\____\|:::|____|     |:::|    |/:::/__\:::\   \:::\____\
   /:::/    \::/    / \:::\    \   /:::/    / \:::\   \:::\   \::/    /
  /:::/    / \/____/   \:::\    \ /:::/    /   \:::\   \:::\   \/____/
 /:::/    /             \:::\    /:::/    /     \:::\   \:::\    \
/:::/    /               \:::\__/:::/    /       \:::\   \:::\____\
\::/    /                 \::::::::/    /         \:::\   \::/    /
 \/____/                   \::::::/    /           \:::\   \/____/
                            \::::/    /             \:::\    \
                             \::/____/               \:::\____\
                              ~~                      \::/    /
                                                       \/____/


)EOF" ;

int main()
{

    int jumpControlAtBottom = 0;
    const int someDelay = 16000;
    int shifControl = 0;


    //jump to bottom of console

    for (jumpControlAtBottom = 0; jumpControlAtBottom < 30; ++jumpControlAtBottom)
    {
        printf("\n");
    }

    //Print rocket
    fputs(rocket,stdout);
    fputs(rocket1, stdout);
    fputs(rocket2, stdout);

    for (shifControl = 0; shifControl < 30; ++shifControl)
    {
        // Rocket move on the basis of delay
        delay(someDelay);

        // move rocket a line upward
        printf("\n");
    }
    return 0;
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.