Go to the Xtreme home page!

Go SourceForge!
Hosted by SourceForge

Docs & Info
About...
License
Paradigm
Tutorial
Reference
FAQ
Who uses it?
Old Announcements
Get It!
CVS
Download/Install
Get In Touch
Bugs
Discussion Forum
Mailing Lists
Support

Xtreme - Tutorial

As described in the Xtreme paradigm, Xtreme follows the same line of thoughts as C++ streams. (cin, cout). From this concept, and from a set of standard graphics classes, follows the Xtreme way of programming:

Every window is an xstream object, which is opened, written to, read from, and closed just like a file stream.

The standard classes are a set of graphics objects like pixel, circle, line, etc. Furthermore, classes for querying string sizes or for setting the font style/size are provided.

To draw a line in a window, you just have to write out a Line object to the corresponding stream:
#include <unistd.h> // for sleep()
#include <xtreme>

int main ()
{
  xstream xs ("Some Title",0,0,320,200);
  xs << Line(5,5,315,195,Green);
  xs << Line(5,195,315,5,Green);
  sleep(5);   // 5 sec. pause
  xs.close(); // closing...
  return 0;
}
	  
Screenshot first example

The stream ansatz allows for natural handling of multiple windows, just like it would be opening multiple files:
#include <unistd.h>
#include <xtreme>

int main ()
{
  xstream xs1 ("Window #1",0,0,320,200);
  xstream xs2 ("Window #2",0,0,100,100);
  xs1 << Line(5,5,315,195,Green);
  xs1 << Line(5,195,315,5,Green);
  xs2 << Circle(50,50,45,Yellow);
  sleep(5);    // 5 sec. pause
  xs1.close(); // closing...
  xs2.close();
  return 0;
}
	  
You can write out built-in data types as well, of course, just like you could with cout:
#include <unistd.h>
#include <math.h> // sin()
#include <xtreme>

int main ()
{
  int i = 123;
  xstream xs ("Window",0,0,320,200);
  xs << "Hello World" << endl;
  xs << "i = " << i << endl;
  xs << "sin(1.5) = " << sin(1.5) << endl;
  sleep(5);    // 5 sec. pause
  xs.close();  // closing again...
  return 0;
}
	  
Screenshot first example

What next?

  • "cursor" positioning
  • text colours
  • fonts
  • mouse input
  • querying text width/height
  • "motion picures" (the Undo feature)
I have yet to write these. Please bear with me!


Last modified: Thu Aug 24 22:40:42 CEST 2000
Patrick Schemitz