// Objects.cc
// Gloobs example program
//
// demonstrates the use of Gloobs objects
//
// by Smylers
// 2000 Jan 10: original version
// 2000 Jan 17: improved comments
#include <gloobs.h>
int main()
{
Gloobs::Canvas Seascape(Gloobs::X11, 400, 200, "Boats");
// define the colours used int the picture:
int Sea = Seascape.ink(0.2, 0.5, 0.8);
int Hull = Seascape.ink(0.7, 0.6, 0.4);
int Mast = Seascape.ink(0.5, 0.3, 0.2);
int Sail = Seascape.ink(0.9, 0.0, 0.0);
Seascape.set_background(Sea);
// declare Boat as a Gloobs Object:
Gloobs::Object Boat;
// add primitives to the boat:
double HullCoords[] =
{
15, 0,
5, 15,
60, 15,
50, 0
};
Boat.push_back(new Gloobs::Polygon(Hull, Gloobs::Filled, 4, HullCoords));
Boat.push_back(new Gloobs::Line(Mast, 4, 35, 15, 35, 60));
Boat.push_back
(new Gloobs::Triangle(Sail, Gloobs::Filled, 0, 25, 35, 60, 35, 25));
// now draw the boat on the canvas:
Seascape.draw_object(Boat);
Seascape.pause();
// lets have another one, in a different place:
Seascape.draw_object(Boat, 300, 100);
Seascape.pause();
// and another couple, scaled to other sizes:
Seascape.draw_object(Boat, 100, 20, 2.5);
Seascape.draw_object(Boat, 20, 120, 0.7);
Seascape.pause();
return 0;
}