PrevNextUpHome SophiaFramework UNIVERSE 5.3

9.9. Root(Applied)

9.9.1. Method to Enlarge the Responder Space to Full Screen

To enlarge the responder space to full screen, initialize the renderer (SFYRenderer) after setting the device screen to full screen mode.

The below is the code to enlarge the responder space to full screen.

In this code, after the device screen is set to full screen mode by calling the SFBDisplay::SetPrefs function, the renderer is re-initialized by calling the SFYRenderer::Initialize function. With this operation, the responder space is enlarged to full screen. And the default root (SFZRoot) internally contained by SFYApplication is also re-initialized.

All sample code is available at this site(fullscreen_sfy-en2.zip: 41.3 KB).

Example 9.47. Method to enlarge the responder space to full screen

SFMTYPEDEFCLASS(USRApplication)
class USRApplication : public SFYApplication {
    SFMSEALCOPY(USRApplication)
public:
    static  SFCInvokerPtr       Factory             (Void);
protected:
    explicit                    USRApplication      (Void) static_throws;
    virtual                     ~USRApplication     (Void);
private:
            SFCError            Initialize          (Void);

            // ...
};

// constructor of application class
USRApplication::USRApplication(Void) static_throws
{
    if (static_try()) {

        // re-initialize the renderer and the root in full screen mode
        static_throw(Initialize());
    }
    if (static_try()) {

        // describe the other initialization
 
        // ... 
    }
}

// re-initialize the renderer and the root in full screen mode
SFCError USRApplication::Initialize(Void)
{
    SFXGraphicsPtr  graphics;
    SFBDisplaySmp   display;
    SFYRendererPtr  renderer;
    SFZRootSmp      root;
    SFCError        error(SFERR_NO_ERROR);

    // get the SFXGraphics instance
    if ((graphics = SFXGraphics::GetInstance()) != null) {

        // get the SFBDisplay instance
        display = graphics->GetSFBDisplay();

        // change display settings(annunicators: yes, screen width / height: max)
        if ((error = display->SetPrefs("a:1,w:*,h:*")) == SFERR_NO_ERROR) {

            // reset the clipping rectangle to the default (destination bitmap bounds)
            display->ResetClipRect();

            // get the renderer
            if ((renderer = GetRenderer()) != null) {

                // initialize the renderer
                // * responder space will be enlarged to full screen
                renderer->Initialize();

                // get the root
                if ((root = static_pointer_cast<SFZRoot>(GetRoot())) != null) {

                    // set the root's real region to full screen
                    root->SetRealBound(root->GetSuitableBound());
                }
                else {
                    error = SFERR_INVALID_STATE;
                }
            }
            else {
                error = SFERR_INVALID_STATE;
            }
        }
    }
    else {
        error = SFERR_INVALID_STATE;
    }
    return error;
}
[Important] Setting of the mif file

To use the SFBDisplay::SetPrefs function, the AEEPRIVID_DISPSETTINGS previledge of the MIF file is needed. This previledge can be obtained by selecting the "dependent file" tab of the MIF editor and adding the external class "DISPSETTINGS (0x0103081D)" included in the include file of BREW SDK.

Full screen mode is not supprted by BREW simulator(as of 2011/6/13). To confirm this behaviour, a mobile phone is required. Some mobile phone may not support the full screen mode.