BBC BASIC
« Improving efficiency and retrieving a key »

Welcome Guest. Please Login or Register.
Sep 24th, 2017, 01:27am


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Improving efficiency and retrieving a key  (Read 59 times)
michael
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 94
xx Improving efficiency and retrieving a key
« Thread started on: Aug 15th, 2017, 01:51am »

This is a VERY efficient way to manage input from the keyboard, yet also keep the CPU cool

This modification is an expansion of Raspberry Pi topic which is greatly dependent on Richards solution,

It is highly valuable on BBCSDL and BBC4W ...



Code:
      k%=0:resp%=0
      what%=0
      REM This section gives a keypressed value that can be stored to a string

      REPEAT
        WAIT 1
        what%=FNkeychk
        IF what%>0 THEN PRINT STR$(what%)+"  "+CHR$(what%)
      UNTIL FALSE
      END
      REM keep FNkeychk and FNmoucheck together
      REM ****************************************************************
      DEFFNkeychk
      REPEAT
        k% = INKEY(4)
        resp%=FNmoucheck
      UNTIL k%<>-1 OR resp% >0
      =k%
      DEF FNmoucheck
      PRIVATE mx%,my%,mb%,x%,y%,b%
      MOUSE x%,y%,b%
      IF mx%=0 AND my%=0 AND mb%=0 THEN mx%=x%:my%=y%:mb%=b%: =-1
      IF mx%=x% AND my%=y% AND mb%=b% THEN =-1 ELSE mx%=x%:my%=y%:mb%=b%:=1
      REM ********* END OF EFFICIENT CONTROLS  ****************************
 
User IP Logged

I like reinventing the wheel, but for now I will work on tools for D3D
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls