-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path1385.bas
More file actions
57 lines (53 loc) · 1.87 KB
/
Copy path1385.bas
File metadata and controls
57 lines (53 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'screen labels tests.bas for SmallBASIC 0.12.2 [B+=MGA] 2016-01-25
'originally inspired to help Johnno write a shuffleboard game
'hope to be very reusable, well not much use in Johnno's
'test code for reusable sub printlabel(text,lineNum,alignment)
'alignment =Left, Right, Middle,l,m,r, L, M, or R in quotes!?
? Int(ymax/txth("By"));" lines avaiable to your screen, probably start scrolling one or two before that"
input "Enter to continue...";dummy
cls
s="My test string"
'goto skip
printlabel(s,1,"lr")
printlabel(s,1,"r")
printlabel(s,1,"mr")
for i=1 to 10
printlabel(s,(int(rnd*30))+2,"r")
printlabel(s,(int(rnd*30))+2,"m")
printlabel(s,(int(rnd*30))+2,"l")
next
label Skip
for i=1 to Int(ymax/txth("By")) 'this will scroll unless sub is fixed, fixed!
printlabel s+" "+str(i),i,"m"
next
'a couple of beepers
'printlabel(s,100,r) 'this better beep!
printlabel("beep",35,"r") 'fix one beeper
pause
sub printlabel(labelstring, linenum, alignment)
'linenum assumes all labels have same height
'alignment choice of L,M,R or left, middle, right we will be looking at case insensitive first letter
'if nothing gets printed linenum is too big or alignment not spec'd correctly or showpage was not used in maine
'2016-01-26 fix max lineNum - 2 lines! to keep screen from scrolling after a print
local LMR,th,margin,tw,y
LMR=upper(left(alignment,1))
th=int(txth(labelstring))
' see how everything turns blue code Library has trouble with the less than symbol insert that sign and code in comment
' if you copied code from library ----V (less than) int(ymax-2*th) then
if instr("LMR",LMR) and linenum*th< int(ymax-2*th) then
margin=10
tw=txtw(labelstring)
y=margin+(lineNum-1)*th
select case LMR
case "L"
AT margin,y
case "M"
AT (xmax-tw)/2,y
case "R"
AT xmax-tw-margin,y
end select
print labelstring
else
beep
end if
end