jargon

Sx Keystrokes.bas

Feb 14th, 2021 (edited)
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dim shared ckey as string
  2. ckey = space(0)
  3.  
  4. type sx_glyph_type
  5.      As fb.Image Ptr sx_and
  6.      As fb.Image Ptr sx_or
  7. end type
  8.  
  9. redim shared as sx_glyph_type sx_placeholder ( 0 to 0 )
  10.  
  11. sx_placeholder(0).sx_and = imagecreate(16,16,0,8)
  12. sx_placeholder(0).sx_or = imagecreate(16,16,0,8)
  13.  
  14. line sx_placeholder(0).sx_and(0,0)-(15,15)15, bf
  15. line sx_placeholder(0).sx_or,   (0,0)-(15,15)0,  bf
  16.  
  17. declare sub sx_clearscreen()
  18.  
  19. declare sub sx_keywait( _
  20.     byref c as string   =   "", _
  21.     message as string   =   "*", _
  22.     fg as integer       =   15, _
  23.     bg as integer       =   9, _
  24.     wipe as integer     =   0, _
  25.     delay as single     =   2, _
  26.     refresh as integer  =   1, _
  27.     posx as integer     =   0, _
  28.     posy as integer     =   0, _
  29.     glyph_i as integer  =   0, _
  30.     glyph_masked() as sx_glyph_type _
  31. )
  32.  
  33. declare function sx_status( _
  34.     header as string, _
  35.     subject as string, _
  36.     numeric as integer, _
  37.     d as integer, _
  38.     ext as string _
  39. ) as string
  40.  
  41. sub sx_clearscreen()
  42.     dim as integer w=0,h=0,fg=0,bg=0,c=0
  43.    
  44.     ScreenInfo w, h '', depth, bpp, pitch, rate, driver
  45.    
  46.     fg=LoWord(color())
  47.     bg=HiWord(color())
  48.    
  49.     line(0,0)-(w-1,h-1),HiWord(color()),bf
  50.  
  51. end sub
  52.  
  53. sub sx_keywait( _
  54.     byref c as string   =   "", _
  55.     message as string   =   "*", _
  56.     fg as integer       =   15, _
  57.     bg as integer       =   9, _
  58.     wipe as integer     =   0, _
  59.     delay as single     =   2, _
  60.     refresh as integer  =   1, _
  61.     posx as integer     =   0, _
  62.     posy as integer     =   0, _
  63.     glyph_i as integer  =   0, _
  64.     glyph_masked() as sx_glyph_type _
  65. )
  66.    
  67.     dim as single start=timer
  68.    
  69.     c=space(0)
  70.    
  71.     If not(fg=-1) then color fg
  72.     If not(bg=-1) then color ,bg
  73.  
  74.     If not(fg=-1) then color fg
  75.     If not(bg=-1) then color ,bg
  76.    
  77.     if not(wipe=0) then
  78.         sx_clearscreen
  79.     end if
  80.    
  81.     if len(message)>0 then
  82.         print message                  
  83.     end if
  84.                
  85.     if ubound(glyph_masked,0)=1 then
  86.         if _
  87.             glyph_i<=ubound(glyph_masked,1) _
  88.             and _
  89.             glyph_i>=lbound(glyph_masked,1) _
  90.         then
  91.        
  92.             put (posx, posy), glyph_masked(glyph_i).sx_and, and
  93.             put (posx, posy), glyph_masked(glyph_i).sx_or, or
  94.        
  95.         end if
  96.     end if
  97.    
  98.     if not(refresh=0) then
  99.         pcopy 1,0
  100.     end if 
  101.    
  102.     do while len(c)=0
  103.         c=inkey
  104.        
  105.         select case delay
  106.        
  107.         case -1:
  108.             exit do
  109.            
  110.         case 0:
  111.            
  112.         case is > 0:
  113.            
  114.             if timer-start>=delay then
  115.                 exit do
  116.             end if
  117.        
  118.         end select
  119.     loop
  120.  
  121.     if c=chr(27) then
  122.         screen 0,0,0,0
  123.         color 15,0
  124.         width 80
  125.         view print 1 to 25
  126.         cls
  127.         end
  128.     end if
  129.  
  130. end sub
  131.  
  132. function sx_status( _
  133.     header as string, _
  134.     subject as string, _
  135.     numeric as integer, _
  136.     d as integer, _
  137.     ext as string _
  138. ) as string
  139.  
  140.     dim as string ret
  141.     ret=space(0)
  142.  
  143.  
  144.     if len(header)>0 then
  145.         ret += ucase(header)+":"
  146.     end if
  147.     if len(subject)>0 then
  148.         ret += quot +lcase(subject) +quot
  149.     end if
  150.     if d>0 then
  151.         ret += quot +nconcat(numeric,d) +quot
  152.     end if
  153.     if len(ext)>0 then
  154.         ret += lcase(ext)
  155.     end if
  156.  
  157.     sx_status = ret
  158.  
  159. end function
Add Comment
Please, Sign In to add comment