예제 #1
0
int main(void)
{
	cout.precision(3);
	cout<<"Wheel spinning at 1 radian per iteration:"<<endl<<"Position"<<endl;
	Delta<Radians> rotationalVelocity;
	for(rotationalVelocity = Radians(1.0); rotationalVelocity.get() < 10.0; rotationalVelocity.increment())
		cout<<double(rotationalVelocity.get())<<endl;
	
	cout<<"Now lets start trying to spin it the other way. Every 5 iterations we'll decrease the speed by one third of a radian per iteration"<<endl<<"Position\tVelocity"<<endl;
	for(int i = 0; i < 4; i++)
	{
		rotationalVelocity -= 2.0/3.0;
		for(int j = 0; j < 5; j++)
		{
			cout<<double(rotationalVelocity.get())<<'\t'<<'\t'<<double(rotationalVelocity)<<endl;
			rotationalVelocity.increment();
		}
	}
	
	cout<<"Das p cool, but I want continuity. Let's increase the Delta every instant, using a delta"<<endl<<"Position\tVelocity\tAcceleration"<<endl;
	for(Delta<Delta<Radians> > rotationalAccel(Delta<Radians>(Radians(0.2)), rotationalVelocity); rotationalAccel.get() < 100.0; rotationalAccel.increment())
		cout<<double(rotationalAccel.get(Delta<Radians>::N_DERIVATIVE))<<'\t'<<'\t'<<
		double(rotationalAccel.get(Delta<Delta<Radians> >::N_DERIVATIVE))<<'\t'<<'\t'<<
		double(rotationalAccel)<<endl;
	
	cout<<"Wowee. I wonder what else this thing can do..."<<endl;
	return 0;
}
예제 #2
0
 const SUCCESS mouseMove(const Uint32 window, const Uint32 mouse, const Delta<Point<int> > &movement,
                         const bitset<N_MOUSE_BUTTONS> &buttons) override
 {
     SUCCESS ret = SUCCEEDED;
     if(window == ren.getWin()->getID() && buttons[SDL_BUTTON_LEFT-1])
         ret = ren.drawLine(Line<int>(movement.get(), prev));
     prev = movement.get();
     return ret;
 };
예제 #3
0
 const SUCCESS mouseMove(const Uint32 window, const Uint32 mouse, const Delta<Point<int> > &movement,
                         const bitset<N_MOUSE_BUTTONS> &buttons)
 {
     if(current == NULL)
         return SUCCEEDED;
     
     current->setImage(new ScaledTexture(stamp, movement.get()-current->getPixelPosition()));
     return SUCCEEDED;
 }