Hello,
I am working on the network portion of a game. I have it setup to take in an
event. When the game gets an event off the network it constructs a new event
in the following way:
{
event = geteventfromnetwork();
SDL_Event net_event;
net_event.type = WOD_NETEVENT;
net_event.user.code = event.type;
net_event.user.data1 = &event; //pointer to the incoming event
net_event.user.data2 = NULL; //We have no data to put here
SDL_PushEvent(&net_event); //put event on queue
}
then I have a game loop that get’s events off the queue and proccesses them
by what type they are, i then hand off the event to a function to process
it.
SDL_Event event;
event=*(SDL_Event *) net_event->user.data1;
but now here is my problem, when I try to get the keysym like so:
int test = event.key.keysym.sym;
the keysym magically becomes zero somehow. I have done some checking and
when right up before I push the event containing the pointer to the event
the keysym has a valid number, but after i wait for the event and take it
off the queue the keysym from the event pointer in data1 is changed to 0.
Other properties from the data1 pointer to the event work, like type, code,
etc.
Is this a possible bug or am I doing something wrong? Help would be
appreciated.
Thanks,
Jordan Wilberding_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com