In other Pc's the Press_button Event does not work!!!

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
kostas123

In other Pc's the Press_button Event does not work!!!

Post by kostas123 »

Hi,
I have done an application in combination with RakNet.Well,the registration which is done with password sending,is going OK and the two sides can communicate.But,when I press the 'N' button,the engine is supposed to send a message to the client to tell him to load some staff.
I think the problem is that the press button event is not accepted in other pc's except mine.So the packet is not sent to the clients.
Can you tell me what might be wrong?
Thanks...
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

why would you be accepting the button press on other machines? If i understand you, the button is pressed on the server machine, which causes a packet to be sent to the client, so wouldn't you only need to detect the button press on the server machine?
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

Yeah this question does seem like it has an obvious conclusion doesn't it?

I think maybe he's having trouble with his keypress to packet code
Kostas123

Post by Kostas123 »

Well,when the client press the 'N' button, it's supposed to send a message to the server,but the message is not sent.The fact is that all the other messages(like the string password for the authorization) are sent normally.I think the problem is from the Irrlicht engine which cannot take the press button events in other machines.The strange is that in my machine,when running the .exe's files,everything work perfectly.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

okay this is a bit confusing. You have two machine right, one is running some server code and one is running client code. When you press the 'N' button on the client you want to send a message to the server. I understand all that, what i don't understand is why you would be recieving the button press event in the server.

I would suggest detecting the button press on the client, the clients event handler should then send a message to the server. The server should detect this message using you network code and then do its own processing.

I really don't understand why you think this is a problem with irrlicht, communication between the two machines should be handled completly through your network code, events on both machine should be abstracted through this. The server should not detect that the N button was pressed on a client, it should just respond to any message sent by the client.
Kostas123

Post by Kostas123 »

Well,I do not want to receive the button press event to the server,but I want my client application to be able to take from the user the press of the button from the keyboard.In my machine(on my home) everything go OK,but in other machines(in work)the press button event does not correspond.
Since the Irrlicht engine has the ability to detect events from keyboard,I would like to use it,so when the user in client end press the 'N' key,I added RakNet code to send a distinct message.But the key is not "pressed".I think I am clear now.

BTW:Any other messages(like password input in dos mode) are OK.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

okay we'll need to see your event handling code. It would also be useful to know what O/S you are using at work and at home.
Kostas123

Post by Kostas123 »

My O/S is XP Pro both in work and at home.
My code is the following:


class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)

switch(event.KeyInput.Key)
{
case KEY_KEY_N:
{
BitStream bitstream;
bitstream.Write((unsigned char)ID_NEXT_MOVE);
CLIENT->Send(&bitstream,HIGH_PRIORITY, RELIABLE_ORDERED, 0);
return true;
}
/* case KEY_KEY_C:
{

camera->setPosition(core::vector3df(5850*2,2500*2,13800*2));
camera->setTarget(core::vector3df(8500*2,343*2,-19000*2));
return true;
}*/
case KEY_KEY_S:
{
BitStream bitstream;
bitstream.Write((unsigned char)ID_CHANGE_STORY);
CLIENT->Send(&bitstream,HIGH_PRIORITY, RELIABLE_ORDERED, 0);
return true;
}
}
return false;
}

};
Post Reply