BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 01-29-2009, 11:47 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2007
Location: Delaware
Model: 8310
Carrier: AT&T
Posts: 23
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post J2ME getKeyStates equivalent using RIM API's

Please Login to Remove!

I just recently converted many of my games to use the blackberry API's instead of the J2ME API's and there is only one thing that I cant find a nice equivalent with. It's the getKeyStates() in the GameCanvas class. Is there an quivalent in the MainScreen or FullScreen BlackBerry API classes?

getKeyStates() allows you to check if any key (multiple keys too!) is down or up. And please folks, I'm not looking for the keydown or keypressed events as this is a little different. I want the equivalent of getKeyStates().

The goal is to have the user press a key on the blackberry and move them in that direction until the user releases the key. A smooth movement.. not how when you press a key, pause, and then the key repeats itself.

Also, I tried the keydown and keyup events and that is a workaround but sometimes it fails by not recognizing the keyup event if you open up a menu or whatever.

Thanks,

Ron
Offline  
Old 01-29-2009, 12:24 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

I'm not familiar with getKeyStates(), but did try overriding keyChar() in your screen class?

This will give you an event for each key pressed.
Offline  
Old 01-29-2009, 01:08 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2007
Location: Delaware
Model: 8310
Carrier: AT&T
Posts: 23
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes. keyChar() does give you the key that was pressed but again, I want smooth operation. Press and hold any letter on your keyboard to make it repeat. Do you see how it pauses before it starts repeating? Try it! That's the movement that I'm trying to avoid.

The getKeyStates() function in the J2ME API gave you a state on or off for each key. So there would be no pause here... I know the RIM API's must have an equivalent.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

IBM 1299790 Quietwriter Typewriter Ribbon Non Correctable Ribbon Cartridge OEM
$4.99
IBM 1299790 Quietwriter Typewriter Ribbon Non Correctable Ribbon Cartridge OEM pictureIBM Selectric 72 Typewriter Ribbon 1136138 OEM 8 Ribbon Cartridges
$84.99
IBM Selectric 72 Typewriter Ribbon 1136138 OEM 8 Ribbon Cartridges picture *NEW Genuine-OEM-1337761-IBM-Easystrike-Correctable-Ribbon-Cassette Made in USA
$7.19
 *NEW Genuine-OEM-1337761-IBM-Easystrike-Correctable-Ribbon-Cassette Made in USA pictureOEM VIDEO GRAPHICS CARD 14R0019 TSCC0036901 --IBM SURE POS 4840-563 TOUCH SCREEN
$5.99
OEM VIDEO GRAPHICS CARD 14R0019 TSCC0036901 --IBM SURE POS 4840-563 TOUCH SCREEN pictureLOT OF GENUINE OEM ORIGINAL SCREWS/BOLTS--IBM SURE POS 4840-563 TOUCH SCREEN
$3.99
LOT OF GENUINE OEM ORIGINAL SCREWS/BOLTS--IBM SURE POS 4840-563 TOUCH SCREEN picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.