Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Keyboard input  (Read 3373 times)
0 Members and 1 Guest are viewing this topic.
Offline ajmas

Junior Devvie

Miles away from here!

« Posted 2004-07-27 15:00:37 »

For a game that only uses keyboard input, would JInput provide that much of performance gain. At the moment I am using:

[CODE]Toolkit.getDefaultToolkit().addAWTEventListener(new MyAWTEventListener(),AWTEvent.KEY_EVENT_MASK);[/CODE]

and then in the eventDispatched() method of listener a switch statement.
Offline JuddMan

Senior Devvie

Medals: 1

Your Ad Here

« Reply #1 - Posted 2004-07-28 08:34:49 »

it's not so much a matter of performance but the question of whether you want to use AWT in the first place. JInput is your only choice for controllers other than keyb and mouse of course, so if you plan on using something else as well in the future you might as well go straight for jinput.

JInput can read controllers when the window is not in focus.

where you do not use AWT to do your drawing, you are limited on input too.

I would use JInput for a fullscreen game, a game that uses controller input, and even a windowed game but that's just because i am used to it now.

i really dont think you are going to notice any diference in the performance between them. there are other places in most games where optimizing is much more beneficial (like graphics).

if you are after response times, awt is great, jinput depends on how often you poll. it's usually best to poll at least every frame, then it's just as good.

AWT listeners can be serialized, which is convenient to save your config.
Offline gregof

Junior Devvie

in code we trust

« Reply #2 - Posted 2004-07-28 08:51:35 »

Another issue is that I dont think JInput has any way of handling different keyboard layouts automaticly as awt does, so if you dont have an US-en (I think) keymap or wish to support different keymaps you will have to handle that yourself.

// Gregof
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #3 - Posted 2004-07-28 09:15:32 »

 It's down to the OS, I have no idea what osx does in this respect. The linux kernel does no mapping (all handled outside of the kernel), so when talking with it there doesn't appear to be a way without writting a whole load of keymaps myself. Direct X sits above the windows kernel after the keyboard mapping is done, so on windows it's fine, on osx I suspect it is, it's only linux that is a little funny. As the console can have keyboard maps I assume there is someway to do it, but I need to explore further.
 Elsewhere I have said that I am planning on doing an AWT plugin for jinput for mouse and keyboard control, this will mean that you can use which ever you feel like from jinput without worrying about having to re-write your input layer. It's on the list, but a server crash has meant I've spent my free time the last few nights building a new mail/dns and web server box.


Offline gregof

Junior Devvie

in code we trust

« Reply #4 - Posted 2004-07-28 10:00:15 »

Of course, I run Linux...  Wink

// Gregof
Pages: [1]
  ignore  |  Print  

hadezbladez (335 views)
2018-11-16 13:46:03

hadezbladez (177 views)
2018-11-16 13:41:33

hadezbladez (336 views)
2018-11-16 13:35:35

hadezbladez (82 views)
2018-11-16 13:32:03

EgonOlsen (2175 views)
2018-06-10 19:43:48

EgonOlsen (2203 views)
2018-06-10 19:43:44

EgonOlsen (1376 views)
2018-06-10 19:43:20

DesertCoockie (2008 views)
2018-05-13 18:23:11

nelsongames (1646 views)
2018-04-24 18:15:36

nelsongames (2297 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!