[ScreenSaver] v1.2

This commit is contained in:
Tomek Wójcik 2022-10-23 19:27:26 +02:00
parent edf0f9c26a
commit 9459cb0f29
4 changed files with 259 additions and 259 deletions

BIN
ScreenSaver/ScreenSaver.AMOS Normal file → Executable file

Binary file not shown.

518
ScreenSaver/ScreenSaver.AMOS.txt Normal file → Executable file
View File

@ -1,259 +1,259 @@
' Screen Saver v1.1
' Created By Tomek Wojcik <tomek@bthlabs.pl>
' Copyright 2020-present by BTHLabs (https://bthlabs.pl)
' Licensed under terms of MIT License
' *** Globals
WIDTH=320
HEIGHT=200
PADDING=10
XMIN=PADDING
XMAX=WIDTH-PADDING
YMIN=PADDING
YMAX=HEIGHT-PADDING
PAL_MIN=4
PAL_MAX=15
Global WIDTH,HEIGHT,PADDING,XMIN,YMIN,XMAX,YMAX
' *** Setup
Degree
Auto View Off
Default Palette $0,$FFF,$0,$0,$BA6,$B30,$625,$FC0,$690,$CB6,$373,$F0,$8EE,$AAA,$737,$A26
Screen Open 0,WIDTH,HEIGHT,16,Lowres : Screen Show 0
Screen Open 1,WIDTH,HEIGHT,16,Lowres : Screen Hide 1
Screen Open 2,WIDTH,HEIGHT,16,Lowres : Screen Hide 2
Hide : Flash Off
Screen 0 : Curs Off
Screen 1 : Curs Off
Screen 2 : Curs Off
' *** Main Stuff
Procedure MAIN_DRAW_BORDER
Cls 0
Ink 1,0
Box 4,4 To 316,196
Pen 1 : Paper 0
Locate 0,0
Centre "Screen Saver"
Locate 0,24
Centre "By BTHLabs. For teh lulz."
Locate 35,0 : Pen 13 : Paper 0
Print "v1.1";
End Proc
Screen 0
MAIN_DRAW_BORDER
View
' *** The Rect Module
RECT_PEN_MIN=4
RECT_PEN_MAX=15
RECT_MIN_SIZE=8
Global RECT_PEN_MIN,RECT_PEN_MAX,RECT_MIN_SIZE
Procedure RECT_TICK
If Timer mod 3=0
Randomize Timer
RECT_PEN=RECT_PEN_MIN+Rnd(RECT_PEN_MAX-RECT_PEN_MIN)
RECT_WIDTH=RECT_MIN_SIZE+Rnd(XMAX-PADDING-RECT_MIN_SIZE)
RECT_HEIGHT=RECT_MIN_SIZE+Rnd(YMAX-PADDING-RECT_MIN_SIZE)
If RECT_WIDTH=XMAX-PADDING
RECT_X=0
Else
RECT_X=Rnd(XMAX-PADDING-RECT_WIDTH)
End If
If RECT_HEIGHT=YMAX-PADDING
RECT_Y=0
Else
RECT_Y=Rnd(YMAX-PADDING-RECT_HEIGHT)
End If
Ink RECT_PEN,RECT_PEN
RECT_FX=XMIN+RECT_X
RECT_FY=YMIN+RECT_Y
RECT_TX=RECT_FX+RECT_WIDTH
RECT_TY=RECT_FY+RECT_HEIGHT
Bar RECT_FX,RECT_FY To RECT_TX,RECT_TY
End If
End Proc
' *** The Radar Module
RADAR_CX=WIDTH/2
RADAR_CY=HEIGHT/2
RADAR_RADIUS=64
RADAR_STEP=0
RADAR_MAX_STEP=35
Dim RADAR_POINTS(36,2)
Global RADAR_CX,RADAR_CY,RADAR_RADIUS,RADAR_STEP,RADAR_MAX_STEP,RADAR_POINTS()
Procedure RADAR_INIT
MAIN_DRAW_BORDER
RADAR_STEP=0
For I=0 To RADAR_MAX_STEP
RADAR_POINTS(I,0)=0
RADAR_POINTS(I,1)=0
Next I
Ink 1,0
Circle RADAR_CX,RADAR_CY,RADAR_RADIUS
Ink 10,0
Paint RADAR_CX,RADAR_CY
Ink 1,0
Circle RADAR_CX,RADAR_CY,1
Ink 11,0
Circle RADAR_CX,RADAR_CY,48
Circle RADAR_CX,RADAR_CY,32
Circle RADAR_CX,RADAR_CY,16
End Proc
Procedure RADAR_TICK
Screen Copy 2 To 1
Randomize Timer
RADAR_ANGLE=10*RADAR_STEP
RADAR_POINT_DIST=8+Rnd(RADAR_RADIUS-10)
RADAR_POINT_X=RADAR_POINT_DIST*Cos(RADAR_ANGLE)
RADAR_POINT_Y=RADAR_POINT_DIST*Sin(RADAR_ANGLE)
RADAR_POINTS(RADAR_STEP,0)=RADAR_POINT_X
RADAR_POINTS(RADAR_STEP,1)=RADAR_POINT_Y
Ink 7,0
For I=0 To RADAR_MAX_STEP
If RADAR_POINTS(I,0)<>0 and RADAR_POINTS(I,1)<>0
Plot RADAR_CX-RADAR_POINTS(I,0),RADAR_CY-RADAR_POINTS(I,1)
End If
Next I
If RADAR_STEP=RADAR_MAX_STEP
RADAR_STEP=0
Else
RADAR_STEP=RADAR_STEP+1
End If
RADAR_ANGLE=10*RADAR_STEP
RADAR_HAND_X=(RADAR_RADIUS)*Cos(RADAR_ANGLE)
RADAR_HAND_Y=(RADAR_RADIUS)*Sin(RADAR_ANGLE)
Ink 1,0
Draw RADAR_CX,RADAR_CY To RADAR_CX-RADAR_HAND_X,RADAR_CY-RADAR_HAND_Y
End Proc
' *** The Text Module
TXT_PEN_BASE=13
TXT_PEN_SPECIAL=1
Dim TXT_SPECIAL_STRINGS$(4)
TXT_SPECIAL_STRINGS$(0)="Basia"
TXT_SPECIAL_STRINGS$(1)="Ziomek"
TXT_SPECIAL_STRINGS$(2)="Tomek"
TXT_SPECIAL_STRINGS$(3)="Pecia"
Dim TXT_SPECIAL_STRING_COORDS(4,2)
Global TXT_PEN_BASE,TXT_PEN_SPECIAL,TXT_SPECIAL_STRINGS$(),TXT_SPECIAL_STRING_COORDS()
Procedure TXT_INIT
Randomize Timer
For Y=1 To 23
For X=1 To 38
Pen TXT_PEN_BASE
Locate X,Y : Print Chr$(32+Rnd(64));
Next X
Next Y
For I=0 To 3
TXT_SPECIAL_STRING$=TXT_SPECIAL_STRINGS$(I)
TXT_SPECIAL_STRING_COORDS(I,0)=1+Rnd(37-Len(TXT_SPECIAL_STRING$))
TXT_SPECIAL_STRING_COORDS(I,1)=1+Rnd(23)
Next I
End Proc
Procedure TXT_TICK
Randomize Timer
TXT_HIGHLIGHT_COUNT=Rnd(50)
For I=0 To TXT_HIGHLIGHT_COUNT
TXT_HIGHLIGHT_X=1+Rnd(37)
TXT_HIGHLIGHT_Y=1+Rnd(22)
TXT_HIGHLIGHT_PEN=4+Rnd(11)
Locate TXT_HIGHLIGHT_X,TXT_HIGHLIGHT_Y
Pen TXT_HIGHLIGHT_PEN : Paper 0
Print Chr$(32+Rnd(64));
Next I
For I=0 To 3
Pen TXT_PEN_SPECIAL : Paper 0
Locate TXT_SPECIAL_STRING_COORDS(I,0),TXT_SPECIAL_STRING_COORDS(I,1)
Print TXT_SPECIAL_STRINGS$(I);
Next I
End Proc
' *** The Main Loop
CURRENT_MOD=0
CURRENT_MOD_MAX_TIME=250
LOCK_CURRENT_MOD=False
Global CURRENT_MOD
Procedure CURRENT_MOD_INIT
Screen 2
MAIN_DRAW_BORDER
If CURRENT_MOD=1
RADAR_INIT
Else If CURRENT_MOD=2
TXT_INIT
End If
Screen Copy 2 To 1
End Proc
CURRENT_MOD_INIT
CURRENT_MOD_START=Timer
Do
CURRENT_MOD_TIME=Timer-CURRENT_MOD_START
If LOCK_CURRENT_MOD=False and CURRENT_MOD_TIME>=CURRENT_MOD_MAX_TIME
CURRENT_MOD=CURRENT_MOD+1
If CURRENT_MOD>2
CURRENT_MOD=0
End If
CURRENT_MOD_START=Timer
CURRENT_MOD_INIT
End If
Screen 1
If CURRENT_MOD=0
RECT_TICK
Else If CURRENT_MOD=1
RADAR_TICK
Else If CURRENT_MOD=2
TXT_TICK
End If
Screen Copy 1 To 0
View
Wait Vbl
If Mouse Click<>0 or Key State(69)=True
Exit
End If
Loop
' Screen Saver v1.2
' Created By Tomek Wojcik <tomek@bthlabs.pl>
' Copyright 2020-present by BTHLabs (https://bthlabs.pl)
' Licensed under terms of MIT License
' *** Globals
WIDTH=320
HEIGHT=200
PADDING=10
XMIN=PADDING
XMAX=WIDTH-PADDING
YMIN=PADDING
YMAX=HEIGHT-PADDING
PAL_MIN=4
PAL_MAX=15
Global WIDTH,HEIGHT,PADDING,XMIN,YMIN,XMAX,YMAX
' *** Setup
Degree
Auto View Off
Default Palette $0,$FFF,$0,$0,$BA6,$B30,$625,$FC0,$690,$CB6,$373,$F0,$8EE,$AAA,$737,$A26
Screen Open 0,WIDTH,HEIGHT,16,Lowres : Screen Show 0
Screen Open 1,WIDTH,HEIGHT,16,Lowres : Screen Hide 1
Screen Open 2,WIDTH,HEIGHT,16,Lowres : Screen Hide 2
Hide : Flash Off
Screen 0 : Curs Off
Screen 1 : Curs Off
Screen 2 : Curs Off
' *** Main Stuff
Procedure MAIN_DRAW_BORDER
Cls 0
Ink 1,0
Box 4,4 To 316,196
Pen 1 : Paper 0
Locate 0,0
Centre "Screen Saver"
Locate 0,24
Centre "By BTHLabs. For teh lulz."
Locate 35,0 : Pen 13 : Paper 0
Print "v1.2";
End Proc
Screen 0
MAIN_DRAW_BORDER
View
' *** The Rect Module
RECT_PEN_MIN=4
RECT_PEN_MAX=15
RECT_MIN_SIZE=8
Global RECT_PEN_MIN,RECT_PEN_MAX,RECT_MIN_SIZE
Procedure RECT_TICK
If Timer mod 3=0
Randomize Timer
RECT_PEN=RECT_PEN_MIN+Rnd(RECT_PEN_MAX-RECT_PEN_MIN)
RECT_WIDTH=RECT_MIN_SIZE+Rnd(XMAX-PADDING-RECT_MIN_SIZE)
RECT_HEIGHT=RECT_MIN_SIZE+Rnd(YMAX-PADDING-RECT_MIN_SIZE)
If RECT_WIDTH=XMAX-PADDING
RECT_X=0
Else
RECT_X=Rnd(XMAX-PADDING-RECT_WIDTH)
End If
If RECT_HEIGHT=YMAX-PADDING
RECT_Y=0
Else
RECT_Y=Rnd(YMAX-PADDING-RECT_HEIGHT)
End If
Ink RECT_PEN,RECT_PEN
RECT_FX=XMIN+RECT_X
RECT_FY=YMIN+RECT_Y
RECT_TX=RECT_FX+RECT_WIDTH
RECT_TY=RECT_FY+RECT_HEIGHT
Bar RECT_FX,RECT_FY To RECT_TX,RECT_TY
End If
End Proc
' *** The Radar Module
RADAR_CX=WIDTH/2
RADAR_CY=HEIGHT/2
RADAR_RADIUS=64
RADAR_STEP=0
RADAR_MAX_STEP=35
Dim RADAR_POINTS(36,2)
Global RADAR_CX,RADAR_CY,RADAR_RADIUS,RADAR_STEP,RADAR_MAX_STEP,RADAR_POINTS()
Procedure RADAR_INIT
MAIN_DRAW_BORDER
RADAR_STEP=0
For I=0 To RADAR_MAX_STEP
RADAR_POINTS(I,0)=0
RADAR_POINTS(I,1)=0
Next I
Ink 1,0
Circle RADAR_CX,RADAR_CY,RADAR_RADIUS
Ink 10,0
Paint RADAR_CX,RADAR_CY
Ink 1,0
Circle RADAR_CX,RADAR_CY,1
Ink 11,0
Circle RADAR_CX,RADAR_CY,48
Circle RADAR_CX,RADAR_CY,32
Circle RADAR_CX,RADAR_CY,16
End Proc
Procedure RADAR_TICK
Screen Copy 2 To 1
Randomize Timer
RADAR_ANGLE=10*RADAR_STEP
RADAR_POINT_DIST=8+Rnd(RADAR_RADIUS-10)
RADAR_POINT_X=RADAR_POINT_DIST*Cos(RADAR_ANGLE)
RADAR_POINT_Y=RADAR_POINT_DIST*Sin(RADAR_ANGLE)
RADAR_POINTS(RADAR_STEP,0)=RADAR_POINT_X
RADAR_POINTS(RADAR_STEP,1)=RADAR_POINT_Y
Ink 7,0
For I=0 To RADAR_MAX_STEP
If RADAR_POINTS(I,0)<>0 and RADAR_POINTS(I,1)<>0
Plot RADAR_CX-RADAR_POINTS(I,0),RADAR_CY-RADAR_POINTS(I,1)
End If
Next I
If RADAR_STEP=RADAR_MAX_STEP
RADAR_STEP=0
Else
RADAR_STEP=RADAR_STEP+1
End If
RADAR_ANGLE=10*RADAR_STEP
RADAR_HAND_X=(RADAR_RADIUS)*Cos(RADAR_ANGLE)
RADAR_HAND_Y=(RADAR_RADIUS)*Sin(RADAR_ANGLE)
Ink 1,0
Draw RADAR_CX,RADAR_CY To RADAR_CX-RADAR_HAND_X,RADAR_CY-RADAR_HAND_Y
End Proc
' *** The Text Module
TXT_PEN_BASE=13
TXT_PEN_SPECIAL=1
Dim TXT_SPECIAL_STRINGS$(4)
TXT_SPECIAL_STRINGS$(0)="Basia"
TXT_SPECIAL_STRINGS$(1)="Ziomek"
TXT_SPECIAL_STRINGS$(2)="Tomek"
TXT_SPECIAL_STRINGS$(3)="Pecia"
Dim TXT_SPECIAL_STRING_COORDS(4,2)
Global TXT_PEN_BASE,TXT_PEN_SPECIAL,TXT_SPECIAL_STRINGS$(),TXT_SPECIAL_STRING_COORDS()
Procedure TXT_INIT
Randomize Timer
For Y=1 To 23
For X=1 To 38
Pen TXT_PEN_BASE
Locate X,Y : Print Chr$(32+Rnd(64));
Next X
Next Y
For I=0 To 3
TXT_SPECIAL_STRING$=TXT_SPECIAL_STRINGS$(I)
TXT_SPECIAL_STRING_COORDS(I,0)=1+Rnd(37-Len(TXT_SPECIAL_STRING$))
TXT_SPECIAL_STRING_COORDS(I,1)=1+Rnd(22)
Next I
End Proc
Procedure TXT_TICK
Randomize Timer
TXT_HIGHLIGHT_COUNT=Rnd(50)
For I=0 To TXT_HIGHLIGHT_COUNT
TXT_HIGHLIGHT_X=1+Rnd(37)
TXT_HIGHLIGHT_Y=1+Rnd(22)
TXT_HIGHLIGHT_PEN=4+Rnd(11)
Locate TXT_HIGHLIGHT_X,TXT_HIGHLIGHT_Y
Pen TXT_HIGHLIGHT_PEN : Paper 0
Print Chr$(32+Rnd(64));
Next I
For I=0 To 3
Pen TXT_PEN_SPECIAL : Paper 0
Locate TXT_SPECIAL_STRING_COORDS(I,0),TXT_SPECIAL_STRING_COORDS(I,1)
Print TXT_SPECIAL_STRINGS$(I);
Next I
End Proc
' *** The Main Loop
CURRENT_MOD=0
CURRENT_MOD_MAX_TIME=250
LOCK_CURRENT_MOD=False
Global CURRENT_MOD
Procedure CURRENT_MOD_INIT
Screen 2
MAIN_DRAW_BORDER
If CURRENT_MOD=1
RADAR_INIT
Else If CURRENT_MOD=2
TXT_INIT
End If
Screen Copy 2 To 1
End Proc
CURRENT_MOD_INIT
CURRENT_MOD_START=Timer
Do
CURRENT_MOD_TIME=Timer-CURRENT_MOD_START
If LOCK_CURRENT_MOD=False and CURRENT_MOD_TIME>=CURRENT_MOD_MAX_TIME
CURRENT_MOD=CURRENT_MOD+1
If CURRENT_MOD>2
CURRENT_MOD=0
End If
CURRENT_MOD_START=Timer
CURRENT_MOD_INIT
End If
Screen 1
If CURRENT_MOD=0
RECT_TICK
Else If CURRENT_MOD=1
RADAR_TICK
Else If CURRENT_MOD=2
TXT_TICK
End If
Screen Copy 1 To 0
View
Wait Vbl
If Mouse Click<>0 or Key State(69)=True
Exit
End If
Loop

BIN
ScreenSaver/ScreenSaver.adf Normal file → Executable file

Binary file not shown.

BIN
ScreenSaver/ScreenSaver.exe Normal file → Executable file

Binary file not shown.