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.
koso
Posts: 27 Joined: Thu May 21, 2009 11:10 am
Post
by koso » Sat Jul 11, 2009 12:31 pm
i want make my animated mesh looping when i press left mouse button.
this is reciever:
Code: Select all
class MyEventReceiver : public IEventReceiver
{
public:
MyEventReceiver(bool shoot)
{
Shoot=shoot;
}
bool onEvent(const SEvent& event)
{
if(event.EventType == EET_MOUSE_INPUT_EVENT)
{
if(event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
{
Shoot = true;
return true;
}
else if(event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP)
{
Shoot = false;
return true;
}
}
}
private:
bool Shoot;
};
and this i have in main game loop
Code: Select all
if (shoot)
{
gunNode->setFrameLoop(1,130);
}
it doesnt works.
some ideas???
Sylence
Posts: 725 Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:
Post
by Sylence » Sat Jul 11, 2009 3:15 pm
My standard advise for newbies:
You should first learn at least the basics of C++ before starting with irrlicht.
Shoot and shoot are two completely different variables.
You could use a pointer to the shoot variable in your event receiver class or you add an extra method to the event receiver that returns the Shoot variable.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
koso
Posts: 27 Joined: Thu May 21, 2009 11:10 am
Post
by koso » Sat Jul 11, 2009 6:13 pm
when i try it with pointer i got this error:
error C2259: 'MyEventReceiver' : cannot instantiate abstract class
Sylence
Posts: 725 Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:
Post
by Sylence » Sat Jul 11, 2009 7:42 pm
It's OnEvent not onEvent
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.