Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SDL Problems
#11
**MULTI_KEY KEYBOARD PROBLEM**

ok so I have another problem and i might as well put it in the same topic - I am using SDL_PollEvent to get keyboard inputs, but it will not allow me to use more than 1 key at a time, I though it was a setting somewhere but I can't find it. There must be a way to do it, so I just need to know what to use to get the same effect as multikey.
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Reply
#12
here a little demo

all keystate is , is a byte pointer to an array that sdl has set up which hold the current state of what keys are being pressed at the time. the [27] for example is pointer indexing to the 27 byte which is the exit key. SDLK_3 are defines you can find a list at the SDL wiki page.


Dim keystate as byte ptr

do
SDL_PumpEvents
keystate = SDL_GetKeyState(NULL)

if Keystate[27] = 1 then
'code
sdl_quit
end if

if keystate[SDLK_3] then
print "you pressed 3"
end if
loop
Reply
#13
kk it works now thx ^^

all I had to do was put brackets keystate[SDL_KEY] rather than keystate=SDL_KEY

i mistook the c code examples...but it all works now =D
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)