@Fred, ExamineKeyboard()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

@Fred, ExamineKeyboard()

Post by Codemonger »

Hi Fred I was hoping you could implement a personal favour for me :twisted:

I am building the base layer to my engine and I have binding commands to speed up game programming, so the programmer does not have to keep track of user events, he/she simply binds them to procedures like so, works great so far except:

Code: Select all

 Declare ExitLoop()
 

 Init3D(32, 800, 600, #CMG3D_FSAA | #CMG3D_Windowed)

 BindWindowEvent(#PB_EventCloseWindow, @ExitLoop())
 BindKey(#PB_Shortcut_Tab, @ExitLoop(), #CMG3D_Pushed)
 
Repeat 

  Flip()          
  CheckBindings()                                 
                   
Until Quit = 1 


 CleanUp()


 Procedure ExitLoop()
    Shared Quit 
    Quit = 1
 EndProcedure

I would like to give the option of the user to use internal PB commands, also because I am currently trying to get the direct input keyboard DIOBJECTDATAFORMAT & DIDATAFORMAT working as it is hard to find the constant of this and convert it to PB ...

Anyway, when I use ExamineKeyboard() I get an error message "OpenScreen or OpenWindowedScreen must be called before this" ... It would be great, if I could use the command without the OpenScreen or OpenWindowedScren being called first :D

In the meantime I'll just try to do a quick hack for testing purposes ...
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Actually it should work, just try to disable the debugger. It shouldn't be used tough..
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post by Codemonger »

Yeah works perfectly with debugger disabled, Thanks Fred.

I'll use it in the meantime until I get Direct Input fully working. Is their any way for me to disable that one check in the debugger ? While I test.
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post by Codemonger »

ah, don't worry Fred I just found a quick way around it .. Thanks.
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You can put the keyboard commands in a 'DisableDebugger' & 'EnableDebuger' block
Post Reply