Timer

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Boca
Posts: 12
Joined: Tue Mar 04, 2008 4:35 pm
Location: Spain

Timer

Post by Boca »

Hi! I'm Boca and I'm beginer in c++ and Irrlicht. I want to solve this problems with your help.
I have a problem. I finded info in this forum but I can't solve it.
I have this code:

Code: Select all

//---first code---
ITimer* tempo = device.getTimer;
	u32 h = tempo->getRealTime;
	
	while(device->run())
	{	

	if (device->isWindowActive())
	{
		driver->beginScene(true, true, video::SColor(0,200,200,200));
		smgr->drawAll();
		driver->endScene();
	}

//usa el tiempo (comparando) para saber si cambiar de camara o no
	
	if ((h - tempo->getRealTime) == (20000))
		{
	camara->setPosition (irr::core::vector3df (-530.918945, 504.894623, -577.184937));
	camara->setUpVector (irr::core::vector3df (+127.418869, 266.598022, -127.464622));
	h = tempo->getRealTime
		}
	}
	device->drop();
	
	return 0;
}
With this code I want to move a static camera every 20 seconds. When I try to compile my program, my compiler (visual c++ 2008) says me this:

Code: Select all

1>.\main.cpp(57) : error C2228: left of '.getTimer' must have class/struct/union
1>        type is 'irr::IrrlichtDevice *'
1>        did you intend to use '->' instead?
1>.\main.cpp(58) : error C3867: 'irr::ITimer::getRealTime': function call missing argument list; use '&irr::ITimer::getRealTime' to create a pointer to member
1>.\main.cpp(72) : error C3867: 'irr::ITimer::getRealTime': function call missing argument list; use '&irr::ITimer::getRealTime' to create a pointer to member
1>.\main.cpp(72) : error C2297: '-' : illegal, right operand has type 'irr::u32 (__thiscall irr::ITimer::* )(void) const'
1>.\main.cpp(77) : error C3867: 'irr::ITimer::getRealTime': function call missing argument list; use '&irr::ITimer::getRealTime' to create a pointer to member
Please, answer to me, What's my error?

Thanks!
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

That code is really messed up...

device is a pointer so the first line should be device->getTimer()

Which also shows that you should have brackets after each function call, which a lot of yours are missing.

I would advise learning C++ basics before embarking on work with a 3D engine ;)
Image Image Image
Boca
Posts: 12
Joined: Tue Mar 04, 2008 4:35 pm
Location: Spain

Post by Boca »

Oh, sorry. I am solved the problem. Dont worry! :D Thanks, I am finding a c++ manual. I am sorry to have made yourself lose the time. :(
Post Reply