예제 #1
0
void AreaVisitor::visit( Rectangle & r)
{
	double l = r.getLength();
	double b = r.getBreadth();
	_area = l * b;
	printArea( r );
}
예제 #2
0
void AreaVisitor::visit( Triangle & t)
{
	double b = t.getBase();
	double h = t.getHeight();
	_area = 0.5 * b * h;
	printArea( t );
}
예제 #3
0
파일: main.cpp 프로젝트: Karvajalka/Zgame
void MainModule::start()
{
	srand (time(NULL));
	if ( !netMod.initNetwork() )
		return;
	Area * a = new Area( 101, 101 );
	worldMod.areaVec.push_back(a);
	worldMod.areaVec[0]->id = 9;
	printArea( 0, &worldMod );
	std::cout<<"Starting mainloop"<<std::endl;
	while ( true )  //mainloop
	{
		netMod.checkNewConnection(); //check for incoming connections
		clientMod.playerCheck();  // check player input and send view();
		SDL_Delay( DELAY_AMOUNT );
	}
}
예제 #4
0
void AreaVisitor::visit( Circle & c)
{
	double r = c.getRadius();
	_area = PI * r * r;
	printArea( c );
}