02-16-2026, 01:38 PM
(This post was last modified: 02-16-2026, 01:58 PM by bplus.
Edit Reason: update
)
@dbox going through samples (boy that link to tutorial was helpful!) I see an obvious quick fix to improve the Draw Contest Sample authored by yours truely.
quick fix for QBJS sample Draw Contest:
Gets it out of tiny screen 13 and centered in normal sized screen much more enjoyable to stretch drawing out.
Now I got to see why this isn't working in QB64pe but so much better in QBJS, I suspect screen new image needs 12 not 32.
Update again: yep that was it! Now fixed for both QB64pe and QBJS see code run below.
Update still again, helpful hint: note to quit run hit escape as instructed, that puts you back in forum, but if your screen is like mine you need to know you have to scroll up on forum page to see you are really escaped from QBJS.
quick fix for QBJS sample Draw Contest:
Code: (Select All)
' Mod MG DRAW by bplus 2023-10-08
'ref https://qb64.boards.net/thread/219/qb64-dev-competition-idea?page=2&scrollTo=1228
Dim i As Integer, ai As Integer, cc As Integer, u As Integer
Dim a$, s$
Randomize Timer
Screen _newimage(800, 600, 12)
Do
a$ = ""
Do Until Len(a$) > 20
If Random1(2) = 1 Then
If Random1(2) = 1 Then a$ = a$ + "L" Else a$ = a$ + "R"
Else
If Random1(2) = 1 Then a$ = a$ + "D" Else a$ = a$ + "U"
End If
a$ = a$ + Str$(Rand(1, 15))
Loop
s$ = a$
Cls
For i = 1 To 24
stepper = Val(Mid$(" 10 12 15 18 20 30 40 45 60 72 90120180", Int(Rnd * 13) + 1, 3))
For ai = 0 To 360 - stepper Step stepper
cc = Rand(64, 160)
If i > 10 Then u = 10 Else u = i
If i Mod 2 Then cc = 9 Else cc = 15
PreSet (400, 300)
'Draw "ta0" ' this needed?
a$ = "S" + Str$(22 - u * 2) + "TA" + Str$(ai) + "C" + Str$(cc) + s$
Draw a$
Next
Next
Print "spacebar for another, esc to quit"
Sleep
Loop Until Asc(InKey$) = 27
Function Rand& (fromval&, toval&)
Dim sg%, f&, t&
If fromval& = toval& Then
Rand& = fromval&
Exit Function
End If
f& = fromval&
t& = toval&
If (f& < 0) And (t& < 0) Then
sg% = -1
f& = f& * -1
t& = t& * -1
Else
sg% = 1
End If
If f& > t& Then Swap f&, t&
Rand& = Int(Rnd * (t& - f& + 1) + f&) * sg%
End Function
Function Random1& (maxvaluu&)
Dim sg%
sg% = Sgn(maxvaluu&)
If sg% = 0 Then
Random1& = 0
Else
If sg% = -1 Then maxvaluu& = maxvaluu& * -1
Random1& = Int(Rnd * maxvaluu& + 1) * sg%
End If
End FunctionGets it out of tiny screen 13 and centered in normal sized screen much more enjoyable to stretch drawing out.
Now I got to see why this isn't working in QB64pe but so much better in QBJS, I suspect screen new image needs 12 not 32.
Update again: yep that was it! Now fixed for both QB64pe and QBJS see code run below.
Update still again, helpful hint: note to quit run hit escape as instructed, that puts you back in forum, but if your screen is like mine you need to know you have to scroll up on forum page to see you are really escaped from QBJS.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever


