Mouse and Key effect can be fires in same program !

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
thanvilk
Posts: 23
Joined: Tue Mar 15, 2011 6:39 pm
Location: india

Mouse and Key effect can be fires in same program !

Post by thanvilk »

I want to implement mouse event and key event with the same program where the functionality is like following !

user will provide cube/cone/sphere co-ordinates in text boxes and then clicking on the button the related 3d object will be rendered on the screen then after renderring on object i want to rotate,scale and drag and drop that 3d object with my needs !

I hope you get it want i mean to say here !
Laxmikant Thanvi
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

i've implemented a system like what you say you want. for my platform animation and level editor.

i'm not sure if you're just expecting someone to write it all for you, but here is how i did it

write interface to get data, floats, check boxes, neatly from wchar_t using irrlicht gui as backend.

write a platform editor to call methods from gui get data interface and also change the attritbutes of whatever it is you're editing.

you can optimize it be "putting in standby", that is ,don't call data from gui when editor is not in focus on object.

however i am not sure what built in functionality irrlicht has for your needs. i had to build mine a certain way because i am using several other libraries besides irrlicht

EDIT: :shock: i barely even remember being on this late at night... i was about to pass out,., felt like i was dreaming... meds taking heavy effect :P
anyways, look into the irrEdit tool in the irrlicht dist. should be in the tools directory in the folder of your irrlicht copy.
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
thanvilk
Posts: 23
Joined: Tue Mar 15, 2011 6:39 pm
Location: india

Prototype !

Post by thanvilk »

If possible then please give me the prototype what you are discribing as i am facing problem of event receivers as i wrote different event receivers for mouse and key events !

But as after execution of mouse event (on button pressing) i want to use key event for rotation of object which is created on mouse event(on button pressing after filling co-ordinates for objects i.e cube) ...

But problem arises is: i want to do all these above thing in single Irrlich device and for that at a time i can send only 1 event receiver either it is on key or mouse !

but as i mentioned above i want both with in the single irrlicht device then what should i do for that !

I had tried by altering : on fire of key event i am changing the event reciever parameter on createDevice by using the funtion seteventreceiver but it is not working !

Code: Select all

MyKeyEventReceiver receiver;
device->setEventReceiver(&receiver);

[b] before above code device last parameter is of MyMouseEventReceiver reference !

But is not changing on run time this is problem !

IF you have any solution then do suggest me ![/b]
Laxmikant Thanvi
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

what you are trying to achieve can be accomplished easily by reading AND working through examples 06, user interface, and understanding how to manipulate scene nodes.

you can write an event receiver for both mouse and key events in one, I don't see a need to separate them out.

also, i think you can pass events down a chain by returning false in the OnEvent() method and passing the event to whatever else needs to process it.

EDIT:

like this

Code: Select all

//! pseudo code

bool OnEvent( SEvent event )
{

/* process event */

otherReceiver->OnEvent( event );

return false;

}

ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

If possible then please give me the prototype what you are discribing as i am facing problem of event receivers as i wrote different event receivers for mouse and key events !

But as after execution of mouse event (on button pressing) i want to use key event for rotation of object which is created on mouse event(on button pressing after filling co-ordinates for objects i.e cube) ...

But problem arises is: i want to do all these above thing in single Irrlich device and for that at a time i can send only 1 event receiver either it is on key or mouse !

but as i mentioned above i want both with in the single irrlicht device then what should i do for that !
This is plainly your lack of coding experience, c++ knowledge.

What you could do to have multiple receivers to run is make one main event receiver which would contain a list of other receivers(GUI,key,mouse) and just pass the events to those receivers.
Or you could also do what ChaiRuiPeng said and use only one receiver for everything.

You could also search the forum as it contains various implementations of event receivers.
Working on game: Marrbles (Currently stopped).
thanvilk
Posts: 23
Joined: Tue Mar 15, 2011 6:39 pm
Location: india

My problem !

Post by thanvilk »

As My Application contains basic shapes/primitives that are created by filling textboxes with the related co-ordinates and on button clicking the shape is drawn of screen !
furthur i want that created shape can be drag and droped anywhere with in the irrlicht device engine so i am programing for that using mouse events (mouse left button down and up) on event generation i am seting the position with the mouse left button up co-ordinates !

problem : when i program with mouse left button down and up events then when i move mouse for menu selection the related position of share chages before the creation so it not shows itself when it requires .

The Conclusion is that i want to implement drag and droping scenenode on mouse event !

Is is possible then please do reply anyone !

thanks in advance !
Laxmikant Thanvi
Post Reply