Hi.
I am using boost.threads with SDL. Am using vc++2010.
I have wrapped the SDL input functions in a class SDL_Input.
eg.
class SDL_Input {
public:
bool* GetKeyState();
void ProcessEvents(){
static SDL_Event event;
while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_KEYDOWN:
keystate[event.key.keysym.sym] = true;
break;
//and all cases as mousebuttonup....so on
}
};
now in my program i tried using boost threads to run like :
SDL_Input in;
void Draw() {
in.ProcessEvents();
//other stuffs to manipulate the processed events
}
int _tmain(int argc, _TCHAR* argv[])
{
boost::thread th(Draw);
th.join();
return 0;
}
Now when I run the program everything works fine but the input functions of the SDL.
Is there anything I have done wrong regarding use of boost.threads.
Or should I do sth else to use threads with sdl_events...
Input works well if i dont use threas;
Also other classes as SDL_Graphics(i have wrapped) work well.. even with the threads.
Input is creating all the trouble..
Need help plz...