Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

InitAppData function

The MyApp_InitAppData() function created by the C Application Wizard saves the IDisplay and IShell pointers in the applet structure and calls ISHELL_GetDeviceInfo() to get device information such as screen height and width.

boolean MyApp_InitAppData(MyApp * pMe)
{
    // Save local copy for easy access:
    pMe->piDisplay = pMe->applet.m_pIDisplay;
    pMe->piShell   = pMe->applet.m_pIShell;

    // Get the device information for this handset.
    // Reference all the data by looking at the pMe->deviceInfo structure.
    // Check the API reference guide for all the handy device info you can get.
    pMe->deviceInfo.wStructSize = sizeof(pMe->deviceInfo);
    ISHELL_GetDeviceInfo(pMe->applet.m_pIShell,&pMe->deviceInfo);
    
   

You can add other application initialization to MyApp_InitAppData(). For example, in c_basicapp, the following additions were made:

 // Store the width and height of the device screen for easy access:
    pMe->nWidth =  pMe->deviceInfo.cxScreen;
    pMe->nHeight = pMe->deviceInfo.cyScreen;

    pMe->piImage = NULL; // Initialize image to NULL.
    
    // Initialize the cursor position:
    pMe->nCursorX = pMe->nWidth/2;
    pMe->nCursorY = pMe->nHeight*2/3;
    
    // Load the cursor image from the resource file:
    pMe->piImage = ISHELL_LoadResImage(pMe->piShell, C_BASICAPP_RES_FILE, 
                                      IDI_IMG_CURSOR);

    return TRUE;  // No failures up to this point, so return TRUE.
}