[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to startup and use AWS, the following tasks must be performed.
csInitializer::OpenApplication()
must be invoked before any of the
following tasks are performed. Initializing an AWS application also
involves loading the AWS plugin. You can do this via the normal
csInitializer::RequestPlugins()
invocation (the common approach), or you
can load it separately, if desired:
csRef<iAws> aws = CS_LOAD_PLUGIN(plugin_mgr, "crystalspace.window.alternatemanager", iAws); |
If you know ahead of time that your application will be using AWS, then
loading the plugin via csInitializer::OpenApplication()
is more
convenient and less error-prone.
awsCanvas = aws->SetupCanvas (0, myG2D, myG3D); |
Where myG2D
and myG3D
are your iGraphics2D
and
iGraphics3D
cavas objects, respectively.
aws->GetPrefMgr()->Load("/aws/awstest.def"); |
Substitute the VFS path of your own definition file in place of the path shown in the example.
aws->GetPrefMgr()->SelectDefaultSkin("Normal Windows"); |
csRef<iAwsWindow> test2 = aws->CreateWindowFrom("Another"); csRef<iAwsWindow> test1 = aws->CreateWindowFrom("Form1"); if (test1) test1->Show(); if (test2) test2->Show(); |
// Start drawing 2D graphics. if (!myG3D->BeginDraw (CSDRAW_2DGRAPHICS)) return; // Make sure invalidated areas get a chance to // redraw themselves. aws->Redraw (); // Draw the current view of the window system to a // graphics context with a certain alpha value. aws->Print (myG3D, 64); |
That's all there is to it. AWS is designed to be easy to use. Of course, this brief examination does not illustrate how to get user input from components in the windows, nor does it illustrate how to do anything other than display your windows. However, the windows created here are full-fledged windows with all the controls listed in the definition that you've created. For more advanced topics, read about signals (see section 7.11.2 Signals: Responding To User Input) and custom components (see section 7.11.3 Creating Custom AWS Components).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |