Back to the roots - A very simple Arrowkey handler

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Back to the roots - A very simple Arrowkey handler

Post by mrminecrafttnt »

Code: Select all

dim as string inputbuffer
do
    inputbuffer = inkey
    select case inputbuffer
    CASE CHR(255)+"H" ' Arrowkey UP
        print "UP"   
    CASE CHR(255)+"P" ' Arrowkey DOWN
        print "DOWN"        
    CASE CHR(255)+"K" ' Arrowkey LEFT
        print "LEFT"        
    CASE CHR(255)+"M" ' Arrowkey RIGHT
        print "RIGHT"        
    case CHR(27)      ' ESC
        exit do
    end select
    sleep 1
loop
Post Reply