1. RE: Exclamation Point in DirectInput Key List

-- SNIPPET --

integer shift
shift = 0

shift = keyboard_keystate(DIK_LSHIFT) or keyboard_keystate(DIK_RSHIFT)
if shift and keyboard_keystate(DIK_1) then
   -- EXCLAMATION PRESSED
end if

-- END --

Chris

C. K. Lester wrote:
> Where's the exclamation point?!
> 
> DIK_! <-- :)
> 
> I'm guessing I have to trap a shift key and check it with DIK_1, but how 
> do
> I do dat?
> 
>

new topic     » topic index » view message » categorize

2. RE: Exclamation Point in DirectInput Key List

bensler at mail.com wrote:
> shift = keyboard_keystate(DIK_LSHIFT) or
> keyboard_keystate(DIK_RSHIFT)
> if shift and keyboard_keystate(DIK_1) then
>    -- EXCLAMATION PRESSED
> end if

I thought it only returned one key unless you used the multi-key 
processing code... which I'm not using.

new topic     » goto parent     » topic index » view message » categorize

3. RE: Exclamation Point in DirectInput Key List

Yes, you are right. My example isn't exactly correct. You must poll each 
key in a seperate cycle of exotica. That's why you need the shift 
variable.
here's a better example:

-- SNIPPET --
while 1 do
if aActive()=1 then
 dinput_update()
 if keyboard_keystate(DIK_LSHIFT) or keyboard_keystate(DIK_RSHIFT) then
   shift = 1
 elsif shift and keyboard_keystate(DIK_1) then
    -- EXCLAMATION PRESSED
 end if
end if
 if exotica_error() then exotica_abort(1) end if
end while
-- END --

Chris

C. K. Lester wrote:
> bensler at mail.com wrote:
> > shift = keyboard_keystate(DIK_LSHIFT) or
> > keyboard_keystate(DIK_RSHIFT)
> > if shift and keyboard_keystate(DIK_1) then
> >    -- EXCLAMATION PRESSED
> > end if
> 
> I thought it only returned one key unless you used the multi-key 
> processing code... which I'm not using.
> 
>

new topic     » goto parent     » topic index » view message » categorize

4. RE: Exclamation Point in DirectInput Key List

DirectInput only maps the keyboard, not every possible keystroke. There 
are no DIK_KEY constants for masked keystrokes. DIK_ESCAPE simply refers 
to the very top-left button on the keyboard, DIK_1 refers to the second 
button on the second row. Etc..

You don't have to use DInput for keyboard handling though.
I didn't document it, but if you look in exoticaX.ew, you will find a 
couple of routines for Windows keyboard handling. I use them in 
guiX_dlg.ew for the edit controls.
Actually, I believe windows handles keystrokes the same way, but it's 
alot more versatile.
I think you would encounter the same problem.

Chris

Martin Stachon wrote:
> But exclamation point isn't always shift+1. On my keyboard (Czech 
> layout)
> it's on a different place. There must be another way to find out this...
> 
>     Martin
> 
> 
> > Yes, you are right. My example isn't exactly correct. You must poll each 
> > 
> > key in a seperate cycle of exotica. That's why you need the shift 
> > variable.
> > here's a better example:
> > 
> > -- SNIPPET --
> > while 1 do
> > if aActive()=1 then
> >  dinput_update()
> >  if keyboard_keystate(DIK_LSHIFT) or keyboard_keystate(DIK_RSHIFT) then
> >    shift = 1
> >  elsif shift and keyboard_keystate(DIK_1) then
> >     -- EXCLAMATION PRESSED
> >  end if
> > end if
> >  if exotica_error() then exotica_abort(1) end if
> > end while
> > -- END --
> > 
> > Chris
> > 
> > C. K. Lester wrote:
> > > bensler at mail.com wrote:
> > > > shift = keyboard_keystate(DIK_LSHIFT) or
> > > > keyboard_keystate(DIK_RSHIFT)
> > > > if shift and keyboard_keystate(DIK_1) then
> > > >    -- EXCLAMATION PRESSED
> > > > end if
> > > 
> > > I thought it only returned one key unless you used the multi-key 
> > > processing code... which I'm not using.
> > > 
> > >

new topic     » goto parent     » topic index » view message » categorize

5. RE: Exclamation Point in DirectInput Key List

Mostly guessing, I've never used code pages, but instead of writing 
something like this..
char = DIK_KEY+'A'

You would do something like this..
code_page = codepages[COUNTRY_CODE]
char = code_page[DIK_KEY]

Or are code pages ascii based?

Igor, or others, would know better than I.

Chris


Martin Stachon wrote:
> Chir wrote:
> > DirectInput only maps the keyboard, not every possible keystroke. There
> > are no DIK_KEY constants for masked keystrokes. DIK_ESCAPE simply refers
> > to the very top-left button on the keyboard, DIK_1 refers to the second
> > button on the second row. Etc..
> >
> > You don't have to use DInput for keyboard handling though.
> > I didn't document it, but if you look in exoticaX.ew, you will find a
> > couple of routines for Windows keyboard handling. I use them in
> > guiX_dlg.ew for the edit controls.
> > Actually, I believe windows handles keystrokes the same way, but it's
> > alot more versatile.
> > I think you would encounter the same problem.
> 
> For example, in Need for Speed 2, when I press [SHIFT] + [ยง] (on English 
> keyboard =
> [SHIFT] + ['] )
> it correctly reports it as [!] , on english keyboard this would be ["]
> 
> Maybe it uses API to get known the correct keycodes and then DInput?
> 
>     Martin
> 
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu