game-input doesnt need a backend, now loads dinput or iokit directly
parent
7597f38a08
commit
7538928754
|
@ -1,21 +0,0 @@
|
|||
USING: eval multiline system combinators ;
|
||||
IN: game-input.backend
|
||||
|
||||
STRING: set-backend-for-macosx
|
||||
USING: namespaces parser game-input.backend.iokit ;
|
||||
<< "game-input" (use+) >>
|
||||
iokit-game-input-backend game-input-backend set-global
|
||||
;
|
||||
|
||||
STRING: set-backend-for-windows
|
||||
USING: namespaces parser game-input.backend.dinput ;
|
||||
<< "game-input" (use+) >>
|
||||
dinput-game-input-backend game-input-backend set-global
|
||||
;
|
||||
|
||||
{
|
||||
{ [ os macosx? ] [ set-backend-for-macosx eval ] }
|
||||
{ [ os windows? ] [ set-backend-for-windows eval ] }
|
||||
{ [ t ] [ ] }
|
||||
} cond
|
||||
|
|
@ -1 +0,0 @@
|
|||
Joe Groff
|
|
@ -1 +0,0 @@
|
|||
Platform-specific backends for game-input
|
|
@ -1 +0,0 @@
|
|||
games
|
0
extra/game-input/backend/authors.txt → extra/game-input/dinput/authors.txt
Normal file → Executable file
0
extra/game-input/backend/authors.txt → extra/game-input/dinput/authors.txt
Normal file → Executable file
|
@ -1,16 +1,16 @@
|
|||
USING: windows.dinput windows.dinput.constants parser symbols
|
||||
alien.c-types windows.ole32 namespaces assocs kernel arrays
|
||||
vectors windows.kernel32 windows.com windows.dinput shuffle
|
||||
windows.user32 windows.messages sequences combinators
|
||||
windows.user32 windows.messages sequences combinators locals
|
||||
math.geometry.rect ui.windows accessors math windows alien
|
||||
alien.strings io.encodings.utf16 io.encodings.utf16n
|
||||
continuations byte-arrays locals
|
||||
game-input.backend.dinput.keys-array ;
|
||||
<< "game-input" (use+) >>
|
||||
IN: game-input.backend.dinput
|
||||
continuations byte-arrays game-input.dinput.keys-array ;
|
||||
IN: game-input.dinput
|
||||
|
||||
SINGLETON: dinput-game-input-backend
|
||||
|
||||
dinput-game-input-backend game-input-backend set-global
|
||||
|
||||
SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
|
||||
+controller-devices+ +controller-guids+
|
||||
+device-change-window+ +device-change-handle+ ;
|
|
@ -1,6 +1,6 @@
|
|||
USING: sequences sequences.private math alien.c-types
|
||||
accessors ;
|
||||
IN: game-input.backend.dinput.keys-array
|
||||
IN: game-input.dinput.keys-array
|
||||
|
||||
TUPLE: keys-array underlying ;
|
||||
C: <keys-array> keys-array
|
|
@ -1,5 +1,6 @@
|
|||
USING: arrays accessors continuations kernel symbols
|
||||
combinators.lib sequences namespaces init vocabs ;
|
||||
USING: arrays accessors continuations kernel symbols system
|
||||
combinators.lib sequences namespaces init vocabs vocabs.loader
|
||||
combinators ;
|
||||
IN: game-input
|
||||
|
||||
SYMBOLS: game-input-backend game-input-opened ;
|
||||
|
@ -19,10 +20,6 @@ M: f (reset-game-input) ;
|
|||
game-input-opened off
|
||||
(reset-game-input) ;
|
||||
|
||||
: load-game-input-backend ( -- )
|
||||
game-input-backend get
|
||||
[ "game-input.backend" load-vocab drop ] unless ;
|
||||
|
||||
[ reset-game-input ] "game-input" add-init-hook
|
||||
|
||||
PRIVATE>
|
||||
|
@ -76,5 +73,8 @@ M: keyboard-state clone
|
|||
|
||||
HOOK: read-keyboard game-input-backend ( -- keyboard-state )
|
||||
|
||||
load-game-input-backend
|
||||
|
||||
{
|
||||
{ [ os windows? ] [ "game-input.dinput" require ] }
|
||||
{ [ os macosx? ] [ "game-input.iokit" require ] }
|
||||
{ [ t ] [ ] }
|
||||
} cond
|
||||
|
|
0
extra/game-input/backend/dinput/authors.txt → extra/game-input/iokit/authors.txt
Executable file → Normal file
0
extra/game-input/backend/dinput/authors.txt → extra/game-input/iokit/authors.txt
Executable file → Normal file
|
@ -3,12 +3,13 @@ kernel cocoa.enumeration destructors math.parser cocoa.application
|
|||
sequences locals combinators.short-circuit threads
|
||||
symbols namespaces assocs vectors arrays combinators
|
||||
core-foundation.run-loop accessors sequences.private
|
||||
alien.c-types math parser ;
|
||||
<< "game-input" (use+) >>
|
||||
IN: game-input.backend.iokit
|
||||
alien.c-types math parser game-input ;
|
||||
IN: game-input.iokit
|
||||
|
||||
SINGLETON: iokit-game-input-backend
|
||||
|
||||
iokit-game-input-backend game-input-backend set-global
|
||||
|
||||
: hid-manager-matching ( matching-seq -- alien )
|
||||
f 0 IOHIDManagerCreate
|
||||
[ swap >plist IOHIDManagerSetDeviceMatchingMultiple ]
|
Loading…
Reference in New Issue