![]() ![]() ![]()
|
BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1 |
Nothing is displayed on the screen. The application is terminated when the "Select" key is pressed.
In the SFC application the screen need to be drawn within the function such as Draw called in the key handler.
The "graphics->Update();" statement must be included in the "Draw" function to update the screen.
Example 4.6. Draw function for drawing the screen
Void Draw(Void)
{
// create instance of SFXGraphics class
SFXGraphicsPtr graphics = SFXGraphics::GetInstance();
// clear screen
// get rectangular screen corrdinates by SFXGraphics::GetDeviceRectangle function
// SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00) defines white
graphics->FillRectangle(SFXGraphics::GetDeviceRectangle(),
SFXRGBColor(0xFF, 0xFF, 0xFF, 0x00));
// draw "Hello World" on screen
graphics->DrawText("Hello World", SFXGraphics::GetDeviceRectangle(),
SFXRGBColor(0x00, 0x00, 0x00, 0x00));
// MUST update screen
graphics->Update();
}
Customize the key handler to call the Draw function when the "1" key is pressed.
Example 4.7. Customize the key handler "OnKey"
// Key handler: OnKey function Bool HelloWorld::OnKey(UInt16 key) { // processing for key events switch (key) { case AVK_SELECT: // when "Select" key is pressed Terminate(); // terminate application return true; // *** the following are added case AVK_1: // when "1" key is pressed Draw(); // call Draw function return true; } return false; }
|
Copyright (C) 2002 - 2008 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|