@c -*-texinfo-*-
@node AWS Quick Start, AWS Signals, AWS, AWS
@subsection Quick Start

In order to startup and use @sc{aws}, the following tasks must be performed.

@enumerate
@item
Initialize the Crystal Space facilities in the normal fashion.
(@pxref{Tutorial Simple}).  In particular,
@code{csInitializer::OpenApplication()} must be invoked before any of the
following tasks are performed.  Initializing an @sc{aws} application also
involves loading the @sc{aws} plugin.  You can do this via the normal
@code{csInitializer::RequestPlugins()} invocation (the common approach), or you
can load it separately, if desired:

@example
csRef<iAws> aws = csLoadPlugin<iAws> (plugin_mgr,
  "crystalspace.window.alternatemanager");
@end example

@noindent
If you know ahead of time that your application will be using @sc{aws}, then
loading the plugin via @code{csInitializer::OpenApplication()} is more
convenient and less error-prone.

@item
Setup the @sc{aws} canvas.

@example
awsCanvas = aws->SetupCanvas (0, myG2D, myG3D);
@c Needed? aws->SetFlag (AWSF_AlwaysRedrawWindows);
@end example

@noindent
Where @code{myG2D} and @code{myG3D} are your @code{iGraphics2D} and 
@code{iGraphics3D} cavas objects, respectively.

@item
Load definition files.

@example
aws->GetPrefMgr()->Load("/aws/awstest.def");
@end example

@noindent
Substitute the @sc{vfs} path of your own definition file in place of the path
shown in the example.

@item
Select a default skin that @emph{all} windows will use.

@example
aws->GetPrefMgr()->SelectDefaultSkin("Normal Windows");
@end example

@item
Create and display your windows.

@example
csRef<iAwsWindow> test2 = aws->CreateWindowFrom("Another");
csRef<iAwsWindow> test1 = aws->CreateWindowFrom("Form1");
if (test1) test1->Show();
if (test2) test2->Show();
@end example

@item
Finally, you have to make sure it actually renders to the display.
So, in your program's main drawing loop you might use code similar to this:

@example
// 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);
@end example
@end enumerate

That's all there is to it.  @sc{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 (@pxref{AWS Signals}) and custom
components (@pxref{AWS Custom Components}).
