Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
New Developer
Posts: 1
Registered: ‎08-26-2009
My Device: Not Specified

making an open source app work for the blackberry storm

Hi,

 

 To start i would like to say that my java skills are not all that good and put the blackberry JDK into the mix and that skill has gone down a little, this is really the first time i've given it a go.

 

I've found an open source application that i like, but the problem i have with it is when i install it to my Strom (9500) i runs well but when i have to use the numeric pad for controls it doesn't seem to pick them up.

 

the app is a Gameboy emulator that has been built to be cross platform and it does work on most phones that i've used. So because of cross platform the conrols code is not specific to any device, which i guess is why the storm doesn't work with it. I was wondering if someone could point me to the right direction, maybe some good tutorials that would allow me to make a convertion, or even start something in this thread where i we can tried different things.

 

this is the code i found for hte controls:

 

public void keyReleased(int keyCode) { for (int i = 0; i < 8; i++) { if (keyCode == key[i]) { cpu.buttonUp(i); } } }//end Keyreleased

 

 

 

 

public void keyPressed(int keyCode) { if (settingKeys) { key[keySetCounter++] = keyCode; if (keySetCounter == 8) { writeSettings(); settingKeys = false; } repaint(); return; } for (int i = 0; i < 8; i++) { if (keyCode == key[i]) { cpu.buttonDown(i); } } }//End KeyPressed

 

 

 

 

 

 

i've only just installed all the JDK's amd plugins needed for blackberry development on using eclipse so its all up ti date and so is the firmware for my storm.

 

Any pointers would be awesome, if you need more information please let me know.

 

Thanks Brian. 

Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: making an open source app work for the blackberry storm

From what code you posted it looks good to me. Have you tried setting a breakpoint inside the keyPressed/keyReleased functions and seeing if they are called when you press a numeric key?

 

Wait, scratch that. I just remebered that you are trying this with the Storm, take a look at net.rim.device.api.lcdui.BlackBerryCanvas (or net.rim.device.api.lcdui.game.BlackBerryGameCanvas). It kills the cross platform system but it has a touchEvent support. I would suspect that it calls the keyPressed/keyReleased functions but don't know for sure (haven't coded MIDP applications).

 

Hope that helps.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.