コード例 #1
0
ファイル: app.cpp プロジェクト: romanz/crystal-maze-3d
// Runs the game
TSize App::Run()
{
    Timer t; // to switch the clock

    t.Start(1);

    for (;;)
    {
        Mouse.Update();

        // Current control tag
        status = controls.Tag();

        // If anything was updated, show it
        if (controls.Update() != 0 || t.Done())
        {
            if (t.Done()) // Start new timer
                t.Start(1);

            if (maze.Found()) // Increase number of crystals
                if (!--crystals)
                    return (clock() - Start) / CLK_TCK;

            UpdateInfo(); // Updates information labels

            controls.Show(); // Shows the controls

            Mouse.Hide(); // Hide mouse

            g_Screen.Switch(Delay); // Switch pages
            Mouse.Page(g_Screen.Visual()); // Switch mouse

            Mouse.Show(); // Show mouse
        }

        ButtonInput(); // Get buttons input

        if (done.Click()) // Exit if "Exit" is clicked
            return 0;

        if (!KeyInput()) // Escape pressed
            return 0;

    }
}