BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 01-29-2009, 11:47 AM   #1
RLord321
Knows Where the Search Button Is
 
Join Date: Sep 2007
Location: Delaware
Model: 8310
Carrier: AT&T
Posts: 23
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
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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
RLord321
Knows Where the Search Button Is
 
Join Date: Sep 2007
Location: Delaware
Model: 8310
Carrier: AT&T
Posts: 23
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Genuine SAMSUNG Range Oven Relay Board DG92-01207D picture

Genuine SAMSUNG Range Oven Relay Board DG92-01207D

$99.95



Samsung OfficServ 100 Enterprise IP Solution picture

Samsung OfficServ 100 Enterprise IP Solution

$280.00



Samsung WiseNET SNV-7084RN 3Mp 3-8.5Mm Lens Network Dome Security Camera picture

Samsung WiseNET SNV-7084RN 3Mp 3-8.5Mm Lens Network Dome Security Camera

$199.00



Samsung MMAG41M Network Card EP96-02639C picture

Samsung MMAG41M Network Card EP96-02639C

$249.00



Samsung, PT212ATP, Integrated Circuit, New, Lot of 13 picture

Samsung, PT212ATP, Integrated Circuit, New, Lot of 13

$195.00



NEW Samsung LTM190ET01 LCD Screen Display Panel 19-inch   picture

NEW Samsung LTM190ET01 LCD Screen Display Panel 19-inch

$173.91







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