Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

PacSimulator.cpp

Go to the documentation of this file.
00001 // PacSimulator.cpp: implementation of the PacSimulator class.
00002 //
00004 
00005 #include "PacSimulator.h"
00006 #include "Pac.h"
00007 #include "Circle.h"
00008 #include "CappedRectangle.h"
00009 
00011 // Construction/Destruction
00013 
00014 PacSimulator::PacSimulator(){
00015 
00016    real width=6, height=4;
00017    //set the borders of the simulator space
00018    registerObject(new Border(0, height/2, 1, 0, "left border"));
00019    registerObject(new Border(width, height/2, -1, 0, "right border"));
00020    registerObject(new Border(width/2, 0,  0, 1, "bottom border"));
00021    registerObject(new Border(width/2, height, 0,  -1, "upper border"));
00022    
00023    registerObject(new Pac(1,1));
00024    registerObject(new Pac(2,2));
00025 
00027    float circles[6][3] = {
00028       {0.1f, 5.0f, 3.0f},
00029       {0.2f, 0.4f, 0.6f},
00030       {0.1f, 0.8f, 0.9f},
00031       {0.2f, 1.7f, 2.8f},
00032       {0.25f, 4.7f, 2.5f},
00033       {0.1f, 3.5f, 1.0f}
00034    };
00035 
00036    //add balls
00037   for (unsigned i = 0; i < 6; ++i) {
00038       Circle *circle = 
00039           new Circle(circles[i][0], circles[i][1], circles[i][2], "ball");
00040       registerObject(circle);
00041   }
00042 
00043    registerObject(new CappedRectangle(0.3f,  0.1f, 3.0f, 2.2f, 10*degrees, "capsule 1"));
00044 }
00045 
00046 PacSimulator::~PacSimulator(){
00047 
00048 }

Thyrix homepageUsers' guide

(C) Arxia 2004-2005