replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Keyboard monitoring
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Keyboard monitoring

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Mon Mar 10, 2014 7:27 pm    Post subject: Keyboard monitoring Reply with quote

G'day, folks Very Happy

I seek an example of using -

Code:
subroutine add_keyboard_monitor@( cb_func )
external cb_func


- to collect anything typed at the keyboard. In particular I seek example(s) of the 'anatomy' of the call-back function 'cb_func'

My manual states that keyboard call-back functions use clearwin_info@ parameter 'keyboard_key' but the list of parameters in my manual does not include 'keyboard_key'. My manual lists -

intermediate_scroll
latest_formatted_window

No mention of keyboard_key

Eric, in Perth, Western Australia
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Mon Mar 10, 2014 8:16 pm    Post subject: Reply with quote

I used something like the following piece of code for a Tetris game:
Code:

   integer function kbd_monitor()
     integer :: key

     key = CLEARWIN_INFO@('KEYBOARD_KEY')
     if (key.eq.Z'148') up    = .true.
     if (key.eq.Z'150') down  = .true.
     if (key.eq.Z'14B') left  = .true.
     if (key.eq.Z'14D') right = .true.
     if (key.eq.Z'20') space = .true.

     kbd_monitor=2
   end function kbd_monitor


Then inside the game loop I tested if a key was set to .true. , handled a key press and reseted the key state to .false.
Back to top
View user's profile Send private message
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Tue Mar 11, 2014 3:35 am    Post subject: Re: Reply with quote

jalih wrote:

Code:

       key = CLEARWIN_INFO@('KEYBOARD_KEY')

Then inside the game loop I tested if a key was set to .true. , handled a key press and reseted the key state to .false.


Thankyou so much, jalih Very Happy Your help is warmly appreciated. The assignment to 'key' is the missing link I was searching for.

Eric - enthused Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group