[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.6.5 Quick Tutorial

In the following discussion I will try to explain how to build simple applications using the Crystal Space Windowing System. I hope you will understand enough to start writing your own applications; I also hope you will get a deeper knowledge of CSWS during your development (or lab) sessions. In fact, I highly recommend perusing the CSWS header files (or alternatively at the HTML documentation generated from the header files) as they contain a lot of useful information which is not present here.

A Simple Application

The simplest possible application should do the following:

Let's try:

 
#include "csws/csws.h"

int main(int argc, char const* const argv[])
{
  SysSystemDriver sys;
  if (!sys.Initialize(argc, argv, "/config/cswstest,cfg"))
    return -1;
  if (!sys.Open("Crystal Space Windowing System"))
    return -1;

  csApp app(&sys);
  if (app.Initialize("/csws/csws.cfg"))
    app.Loop();
}

Pretty simple, eh? So the result is simple as well. We got a grey background, a mouse and nothing more. What the program does is:

If you observe, the above program does not delete the `SysSystemDriver' or `csApp' objects. That's because they are automatic variables and not pointers, so they are automatically deleted when they go out of scope.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html