escape key to quit
Code: Select all
Procedure aGray(x)
ProcedureReturn RGBA(x, x, x, x)
EndProcedure
Procedure transform(sp, z.d, x0, y0, x1, y1, x2, y2, x3, y3)
TransformSprite(sp, x0 * z, y0 * z, x1 * z, y1 * z, x2 * z, y2 * z, x3 * z, y3 * z)
EndProcedure
InitSprite()
InitKeyboard()
InitMouse()
ExamineDesktops()
scW = DesktopWidth(0)
scH = DesktopHeight(0)
OpenScreen(scW, scH, 32, "", #PB_Screen_SmartSynchronization)
scBackC = RGB(32, 64, 128)
msCursZoom.d = 3.2
msCurs = CreateSprite(#PB_Any, 64, 64)
StartDrawing(SpriteOutput(msCurs) )
Box(0, 0, 64, 64, RGB(0, 0, 0) )
Box(10, 5, 50, 50, RGB(255, 255, 255) )
StopDrawing()
transform(msCurs, msCursZoom, 8, 8, 3, 8, 0, 12, 0, 0)
pen = CreateSprite(#PB_Any, 3, 3, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(pen) )
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, 3, 3, RGBA(0, 0, 0, 0) )
Box(0, 1, 3, 1, RGBA(255, 255, 255, 255) )
StopDrawing()
head = CreateSprite(#PB_Any, 32, 32, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(head) )
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, 32, 32, RGBA(0, 0, 0, 0) )
For i = 16 To 1 Step -1
Circle(16, 16, i, aGray(256 - Pow(i, 3/5) * 16) )
Next
StopDrawing()
Structure xy
x.d
y.d
EndStructure
Procedure pointCreate(x.d, y.d)
Protected *r.xy = AllocateMemory(SizeOf(xy) )
With *r
\x = x
\y = y
EndWith
ProcedureReturn *r
EndProcedure
Structure transform
A.xy
B.xy
ang.d
rad.d
an0.d
an1.d
an2.d
an3.d
rd0.d
pen.i
C.xy
D.xy
E.xy
F.xy
EndStructure
Procedure traceCreate()
Protected *r.transform = AllocateMemory(SizeOf(transform) )
ProcedureReturn *r
EndProcedure
Procedure trans(pen, *a.xy, *r.xy, ang.d, rad.d, thickness.d = 1.0)
Define.d ax, ay, bx, by, cx, cy, dx, dy, ex, ey, fx, fy
Define.d an0, an1, an2, an3
Define.d rd
ax = *a\x
ay = *a\y
;rd = Sqr(2) * 1.5 * thickness ; 1.5 = spriteHeight (3) / 2
rd = Sqr(1) * 1.5 * thickness ; 1.5 = spriteHeight (3) / 2
bx = ax + Cos(ang) * rad
by = ay - Sin(ang) * rad
;an0 = ang + (3 * #PI / 4)
;an1 = ang + (1 * #PI / 4)
;an2 = ang - (1 * #PI / 4)
;an3 = ang - (3 * #PI / 4)
an0 = ang + (#PI / 2)
an1 = ang + (#PI / 2)
an2 = ang - (#PI / 2)
an3 = ang - (#PI / 2)
cx = ax + Cos(an0) * rd
cy = ay - Sin(an0) * rd
dx = bx + Cos(an1) * rd
dy = by - Sin(an1) * rd
ex = bx + Cos(an2) * rd
ey = by - Sin(an2) * rd
fx = ax + Cos(an3) * rd
fy = ay - Sin(an3) * rd
TransformSprite(pen, cx, cy, dx, dy, ex, ey, fx, fy)
DisplayTransparentSprite(pen, 0, 0, RGB(255, 0, 0) )
*r\x = bx
*r\y = by
ProcedureReturn *r
EndProcedure
Procedure.d max(a.d, b.d)
If a > b
ProcedureReturn a
Else
ProcedureReturn b
EndIf
EndProcedure
#pMax = 31
Global Dim *p.xy(#pMax)
Global Dim *gp.xy(63, #pMax)
Procedure guy(man, pen, head, j.d, timeScale.d, scW.d, scH.d)
For i = 0 To #pMax
If i <> pen
;*p(i) = *gp(man, i)
EndIf
Next
trans(pen, *p(0), *p(1), 3*#PI/2 + Cos(j) / 4 * timeScale, scW/32, 20)
trans(pen, *p(1), *p(2), 3*#PI/2 + (Cos(j) / 4 - ((1 - Cos(j) ) / 8) ) * timeScale, scW/32, 20)
trans(pen, *p(0), *p(4), 3*#PI/2 + Cos(j+#PI) / 4 * timeScale, scW/32, 20)
trans(pen, *p(4), *p(5), 3*#PI/2 + (Cos(j+#PI) / 4 - ((1 - Cos(j+#PI) ) / 8) ) * timeScale, scW/32, 20)
*p(8)\x = *p(0)\x
*p(8)\y = *p(0)\y - scW/32
trans(pen, *p(8), *p(12), 3*#PI/2 + Cos(j+#PI) / 4 * timeScale, scW/40, 16)
trans(pen, *p(12), *p(13), 3*#PI/2 + ((Cos(j+#PI) / 4) + ((1 + Cos(j+#PI) ) / 8 * (1 * timeScale) ) ) * timeScale, scW/40, 16)
trans(pen, *p(8), *p(9), 3*#PI/2 + Cos(j) / 4 * timeScale, scW/40, 16)
trans(pen, *p(9), *p(10), 3*#PI/2 + ((Cos(j) / 4) + ((1 + Cos(j) ) / 8 * (1 * timeScale) ) ) * timeScale, scW/40, 16)
*p(16)\x = *p(8)\x + (scW / 640) * Pow(timeScale, 2)
*p(16)\y = *p(8)\y
trans(head, *p(16), *p(17), #PI/2, scW/40, scW/160)
*p(0)\x + 3*Sqr(max((Cos(j) + 1), Cos(j + #PI) + 1) )*Pow(timeScale, 2)
For i = 0 To #pMax
;*gp(man, i) = *p(i)
Next
EndProcedure
Procedure released(x)
Static Dim stat(255)
k = KeyboardPushed(x)
If k And stat(x) = 0
stat(x) = k
ProcedureReturn 1
EndIf
stat(x) = k
EndProcedure
For i = 0 To #pMax
*p(i) = AllocateMemory(SizeOf(xy) )
Next
SpriteQuality(#PB_Sprite_BilinearFiltering)
*p(0)\x = scW / 2
*p(0)\y = scH / 2
timeScale.d = 0
Repeat
*p(0)\x - MouseDeltaX()
*p(0)\y - MouseDeltaY()
Delay(1)
ExamineKeyboard()
ExamineMouse()
ClearScreen(scBackC)
j.d = ElapsedMilliseconds() / 100 * timeScale
For i = 0 To 0
guy(0, pen, head, j, timeScale, scW, scH)
*p(20)\x = 0
*p(20)\y = scH / 2
trans(pen, *p(20), *p(21), 0, scW, 1)
*p(22)\x = scW / 2
*p(22)\y = 0
trans(pen, *p(22), *p(23), 3*#PI/2, scH, 1)
Next
If *p(0)\x > scW
*p(0)\x - scW
EndIf
If Released(#PB_Key_Right)
timeScale + 0.5
EndIf
If Released(#PB_Key_Left)
If timeScale >= 0.5
timeScale - 0.5
EndIf
EndIf
;DisplaySprite(msCurs, MouseX(), MouseY() )
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or MouseButton(#PB_MouseButton_Middle)Code: Select all
Global Dim T.F(6)
Procedure.F Sum(n.I)
For I = 1 To n
Result.F + T(I)
Next I
ProcedureReturn Result
EndProcedure
InitSprite()
InitKeyboard()
InitMouse()
OpenScreen(800, 600, 32, "")
BackFrame.I = CreateSprite(#PB_Any, 800, 600)
StartDrawing(SpriteOutput(BackFrame) )
Box(0, 0, 800, 600, RGB(1, 1, 1) )
StopDrawing()
T0V.F = 0.1
Dim X.F(6)
Dim Y.F(6)
Dim W.F(6)
Dim H.F(6)
Dim L.F(6)
L(1) = 100.0
L(2) = 100.0
L(3) = 10.0
L(4) = 5.0
L(5) = 25.0
L(6) = 10.0
Repeat
Delay(1)
DisplaySprite(BackFrame, 0, 0)
StartDrawing(ScreenOutput() )
TB0.F + T0V
For I = 0 To 1
T(0) = TB0 + #PI * I
T(1) = Sin(T(0) ) * 0.4 + #PI / 2.0
T(2) = Sin(T(0) - #PI / 2.0) * 1.0 + 1.0
T(3) = Sin(T(0) ) * 0.5 + 0.5
T(4) = #PI / 2.0
T(5) = #PI
T(6) = Sin(T(0) - #PI / 2.0) * 1.0
W(0) = Cos(T(0) + #PI / 4.0) * 10
H(0) = Sin(T(0) + #PI / 4.0) * 10
For J = 1 To 6
X(J) = X(J - 1) + W(J - 1)
Y(J) = Y(J - 1) + H(J - 1)
S.F = Sum(J) - (J > 4) * T(4)
W(J) = Cos(Sum(J) ) * L(J)
H(J) = Sin(Sum(J) ) * L(J)
Line(X(J), Y(J), W(J), H(J), #White)
Next J
Next
StopDrawing()
FlipBuffers()
ExamineKeyboard()
ExamineMouse()
X(0) = MouseX()
Y(0) = MouseY()
T0V + MouseWheel() / 100.0
Until KeyboardPushed(#PB_Key_Escape)
CloseScreen()Code: Select all
DisableDebugger
Structure GraphInfo
ThreadNo.I
ScreenOpened.I
ScreenClosed.I
ScreenActive.I
Quit.I
BackFrame.I
TestFrame.I
EndStructure
Procedure GraphProcess(*Graph.GraphInfo)
With *Graph
InitSprite()
InitKeyboard()
InitMouse()
OpenScreen(800, 600, 32, "")
\BackFrame = CreateSprite(#PB_Any, 800, 600)
StartDrawing(SpriteOutput(\BackFrame) )
Box(0, 0, 800, 600, RGB(1, 1, 1) )
StopDrawing()
\TestFrame = CreateSprite(#PB_Any, 80, 60)
StartDrawing(SpriteOutput(\TestFrame) )
Box(0, 0, 80, 60, #Red)
StopDrawing()
\ScreenOpened = 1
TG0.F = #PI
T0V.F = 0.1
Repeat
Delay(1)
T0.F + T0V.F
T1.F = #PI / 2.0 + Sin(T0) * 0.4
T2.F = 1.0 + Sin(T0 - #PI / 2.0) * 1.0
T3.F = 0.5 + Sin(T0) * 0.5
T4.F = #PI / 2.0
T5.F = 0.0 - #PI / 2.0
T6.F = Sin(T0 - #PI / 2.0) * 1.0
TG0.F + T0V.F
TG1.F = #PI / 2.0 + Sin(TG0) * 0.4
TG2.F = 1.0 + Sin(TG0 - #PI / 2.0) * 1.0
TG3.F = 0.5 + Sin(TG0) * 0.5
TG4.F = #PI / 2.0
TG5.F = 0.0 - #PI / 2.0
TG6.F = Sin(TG0 - #PI / 2.0) * 1.0
DColX.F = 400.0
DColY.F = 300.0
DColWidth.F = Cos(T0 + #PI / 4.0) * 10
DColHeight.F = Sin(T0 + #PI / 4.0) * 10
DCuisseX.F = DColX + DColWidth
DCuisseY.F = DColY + DColHeight
DCuisseWidth.F = Cos(T1) * 100
DCuisseHeight.F = Sin(T1) * 100
DJambeX.F = DCuisseX + DCuisseWidth
DJambeY.F = DCuisseY + DCuisseHeight
DJambeWidth.F = Cos(T1 + T2) * 100
DJambeHeight.F = Sin(T1 + T2) * 100
DChevilleX.F = DJambeX + DJambeWidth
DChevilleY.F = DJambeY + DJambeHeight
DChevilleWidth.F = Cos(T1 + T2 + T3) * 10
DChevilleHeight.F = Sin(T1 + T2 + T3) * 10
DTalonX.F = DChevilleX + DChevilleWidth
DTalonY.F = DChevilleY + DChevilleHeight
DTalonWidth.F = Cos(T1 + T2 + T3 + T4) * 5
DTalonHeight.F = Sin(T1 + T2 + T3 + T4) * 5
DPiedX.F = DChevilleX + DChevilleWidth
DPiedY.F = DChevilleY + DChevilleHeight
DPiedWidth.F = Cos(T1 + T2 + T3 + T5) * 20
DPiedHeight.F = Sin(T1 + T2 + T3 + T5) * 20
DOrteilX.F = DPiedX + DPiedWidth
DOrteilY.F = DPiedY + DPiedHeight
DOrteilWidth.F = Cos(T1 + T2 + T3 + T5 + T6) * 10
DOrteilHeight.F = Sin(T1 + T2 + T3 + T5 + T6) * 10
GColX.F = 400.0
GColY.F = 300.0
GColWidth.F = Cos(TG0 + #PI / 4.0) * 10
GColHeight.F = Sin(TG0 + #PI / 4.0) * 10
GCuisseX.F = GColX + GColWidth
GCuisseY.F = GColY + GColHeight
GCuisseWidth.F = Cos(TG1) * 100
GCuisseHeight.F = Sin(TG1) * 100
GJambeX.F = GCuisseX + GCuisseWidth
GJambeY.F = GCuisseY + GCuisseHeight
GJambeWidth.F = Cos(TG1 + TG2) * 100
GJambeHeight.F = Sin(TG1 + TG2) * 100
GChevilleX.F = GJambeX + GJambeWidth
GChevilleY.F = GJambeY + GJambeHeight
GChevilleWidth.F = Cos(TG1 + TG2 + TG3) * 10
GChevilleHeight.F = Sin(TG1 + TG2 + TG3) * 10
GTalonX.F = GChevilleX + GChevilleWidth
GTalonY.F = GChevilleY + GChevilleHeight
GTalonWidth.F = Cos(TG1 + TG2 + TG3 + TG4) * 5
GTalonHeight.F = Sin(TG1 + TG2 + TG3 + TG4) * 5
GPiedX.F = GChevilleX + GChevilleWidth
GPiedY.F = GChevilleY + GChevilleHeight
GPiedWidth.F = Cos(TG1 + TG2 + TG3 + TG5) * 20
GPiedHeight.F = Sin(TG1 + TG2 + TG3 + TG5) * 20
GOrteilX.F = GPiedX + GPiedWidth
GOrteilY.F = GPiedY + GPiedHeight
GOrteilWidth.F = Cos(TG1 + TG2 + TG3 + TG5 + TG6) * 10
GOrteilHeight.F = Sin(TG1 + TG2 + TG3 + TG5 + TG6) * 10
DisplaySprite(\BackFrame, 0, 0)
StartDrawing(ScreenOutput() )
Line(DCuisseX, DCuisseY, DCuisseWidth, DCuisseHeight, #White)
Line(DJambeX, DJambeY, DJambeWidth, DJambeHeight, #White)
Line(DChevilleX, DChevilleY, DChevilleWidth, DChevilleHeight, #White)
Line(DTalonX, DTalonY, DTalonWidth, DTalonHeight, #White)
Line(DPiedX, DPiedY, DPiedWidth, DPiedHeight, #White)
Line(DOrteilX, DOrteilY, DOrteilWidth, DOrteilHeight, #White)
Line(GCuisseX, GCuisseY, GCuisseWidth, GCuisseHeight, #White)
Line(GJambeX, GJambeY, GJambeWidth, GJambeHeight, #White)
Line(GChevilleX, GChevilleY, GChevilleWidth, GChevilleHeight, #White)
Line(GTalonX, GTalonY, GTalonWidth, GTalonHeight, #White)
Line(GPiedX, GPiedY, GPiedWidth, GPiedHeight, #White)
Line(GOrteilX, GOrteilY, GOrteilWidth, GOrteilHeight, #White)
StopDrawing()
FlipBuffers()
If IsScreenActive()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
\Quit = 1
EndIf
ExamineMouse()
T0V + MouseWheel() / 100.0
EndIf
Until \Quit
CloseScreen()
\ScreenOpened = 0
\ScreenClosed = 1
EndWith
EndProcedure
Procedure Graph(*Graph.GraphInfo)
*Graph\ThreadNo = CreateThread(@GraphProcess(), *Graph)
EndProcedure
Define Graph.GraphInfo
Graph(Graph)
Repeat
Delay(1)
If IsThread(Graph\ThreadNo) = 0
Break
EndIf
ForEver
End


As you can see, you have a yellow key on the top-right keyboard named "F" (= Function), and you have yellow keywords present on top of each letter ! The EXL100 computer has started to be sold in 1984, later than the ZX8n.