示例#1
0
//-------------------------------------------------------------------------- 
// Main global function 
//-------------------------------------------------------------------------- 
S3E_MAIN_DECL void IwMain() 
{ 
#ifdef EXAMPLE_DEBUG_ONLY 
// Test for Debug only examples 
#endif 
  
// Example main loop 
ExampleInit(); 
while (1) 
{ 
s3eDeviceYield(0); 
s3eKeyboardUpdate(); 
bool result = ExampleUpdate(); 
if ( 
(result == false) || 
(s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) 
|| 
(s3eKeyboardGetState(s3eKeyLSK) & S3E_KEY_STATE_DOWN) 
|| 
(s3eDeviceCheckQuitRequest()) 
) 
break; 
ExampleRender(); 
s3eSurfaceShow(); 
} 
ExampleShutDown(); 
} 
示例#2
0
//--------------------------------------------------------------------------
// Main global function
//--------------------------------------------------------------------------
S3E_MAIN_DECL void IwMain()
{
#ifdef EXAMPLE_DEBUG_ONLY
    // Test for Debug only examples
#endif

    // Example main loop
    ExampleInit();
    uint64 timeOld = s3eTimerGetMs();
    while (1)
    {
        s3eDeviceYield(0);
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        uint64 timeNew = s3eTimerGetMs();
        float dt = (timeNew - timeOld) * 0.001f;
        timeOld = timeNew;

        bool result = ExampleUpdate(dt);
        if (
            (result == false) ||
            (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN)||
            (s3eKeyboardGetState(s3eKeyLSK) & S3E_KEY_STATE_DOWN)||
            (s3eDeviceCheckQuitRequest())
        )
            break;
        ExampleRender();
        //s3eSurfaceShow();
    }
    ExampleShutDown();
}
示例#3
0
//-----------------------------------------------------------------------------
// Main global function
//-----------------------------------------------------------------------------
int main()
{
#ifdef EXAMPLE_DEBUG_ONLY
    // Test for Debug only examples
#ifndef IW_DEBUG
    DisplayMessage("This example is designed to run from a Debug build. Please build the example in Debug mode and run it again.");
    return 0;
#endif
#endif

    //IwGx can be initialised in a number of different configurations to help the linker eliminate unused code.
    //Normally, using IwGxInit() is sufficient.
    //To only include some configurations, see the documentation for IwGxInit_Base(), IwGxInit_GLRender() etc.
    IwGxInit();

    // Example main loop
    ExampleInit();

    // Set screen clear colour
    IwGxSetColClear(0xff, 0xff, 0xff, 0xff);
    IwGxPrintSetColour(128, 128, 128);
    
    while (1)
    {
        s3eDeviceYield(0);
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        int64 start = s3eTimerGetMs();

        bool result = ExampleUpdate();
        if  (
            (result == false) ||
            (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) ||
            (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) ||
            (s3eDeviceCheckQuitRequest())
            )
            break;

        // Clear the screen
        IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);
        RenderButtons();
        RenderSoftkeys();
        ExampleRender();

        // Attempt frame rate
        while ((s3eTimerGetMs() - start) < MS_PER_FRAME)
        {
            int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start));
            if (yield<0)
                break;
            s3eDeviceYield(yield);
        }
    }
    ExampleShutDown();
    DeleteButtons();
    IwGxTerminate();
    return 0;
}
示例#4
0
//-----------------------------------------------------------------------------
// Main global function
//-----------------------------------------------------------------------------
int main()
{
#ifdef EXAMPLE_DEBUG_ONLY
    // Test for Debug only examples
#ifndef IW_DEBUG
    DisplayMessage("This example is designed to run from a Debug build. Please build the example in Debug mode and run it again.");
    return 0;
#endif
#endif

    Iw2DInit();

    // Example main loop
    ExampleInit();
    // Set screen clear colour

    while (1)
    {
        s3eDeviceYield(0);
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        int64 start = s3eTimerGetMs();

        bool result = ExampleUpdate();
        if  (
            (result == false) ||
            (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) ||
            (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) ||
            (s3eDeviceCheckQuitRequest())
            )
            break;

        // Clear the screen
        Iw2DSurfaceClear(0xffffffff);
        RenderSoftkeys();
        ExampleRender();

        // Attempt frame rate
        while ((s3eTimerGetMs() - start) < MS_PER_FRAME)
        {
            int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start));
            if (yield<0)
                break;
            s3eDeviceYield(yield);
        }
    }
    ExampleShutDown();
    Iw2DTerminate();
    return 0;
}