FBA The Creator

The True Multiplatform PC / PocketPC Opensource Development Tool - Read Only Mode - Kept only for historical purposes - Thank you all ;)
It is currently Thu Jun 04, 2026 3:48 am

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Input Keys
PostPosted: Fri Mar 28, 2008 1:30 pm 
Offline
User avatar

Joined: Wed Mar 26, 2008 12:44 pm
Posts: 16
Ok next question (you're going to get fed up with me)

Is there any way to detect a key pressed other than keyleft, keyright, keyup, keydown, keyfire1, keyfire2 and keyfire3?

We have a few extra keys on the Gizmondo

_________________
Join us at http://www.gizmondoforums.com


Top
   
 Post subject: Re: Input Keys
PostPosted: Fri Mar 28, 2008 1:47 pm 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
keyleft(),keyright(), etc, give the ascii codes for main common keys sequence.
If you need more specific keycodes, you could use the onkeydown event and print the code on your device.

Then you can check it with this:
if (numkeypress(keycode) > 0) then

Regards.


Top
   
 Post subject: Re: Input Keys
PostPosted: Sat Mar 29, 2008 11:55 pm 
Offline
User avatar

Joined: Wed Mar 26, 2008 12:44 pm
Posts: 16
Thanks for the quick answer. Bit confused though. Do you mean onbuttondown?

I feel this bit of code should work but it seems to crash FBA on the second key press



function onmainloop()
end

function onbuttondown(key)
print(50,100,"key pressed: "..key,0,255,0)
end

_________________
Join us at http://www.gizmondoforums.com


Top
   
 Post subject: Re: Input Keys
PostPosted: Sun Mar 30, 2008 12:23 am 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
This is almost correct.
Actually main display pointer is valid only inside onmainloop event (I'm going to update the documentation for this issue).
This means you should avoid screen output inside the input events. (see tutorial 05).
Here's the correct code:

Code:
local last_key = 0

function onmainloop()
        clear(0,0,0)
        print(50,100,"last key pressed: "..last_key,0,255,0)
end

function onbuttondown(key)
        last_key = key
end


Top
   
 Post subject: Re: Input Keys
PostPosted: Mon Mar 31, 2008 8:22 am 
Offline
User avatar

Joined: Wed Mar 26, 2008 12:44 pm
Posts: 16
Thanks evilmaio

I've written a little app based on your code for us Gizmondo users to show which key you've pressed.

See here: http://www.gizmondoforums.com/forums/index.php?s=&showtopic=12742&view=findpost&p=164058

_________________
Join us at http://www.gizmondoforums.com


Top
   
 Post subject: Re: Input Keys
PostPosted: Mon Mar 31, 2008 8:30 am 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
Cool!
I knew gizmondo from your forum, it looks very nice ;)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited