Author Topic: Boring demo code.  (Read 1317 times)

MrTAToad

  • Guest
Boring demo code.
« on: 2010-Jul-11 »
This is the source code to my boring graphic demo thats in the showroom :

Code: (glbasic) [Select]
// --------------------------------- //
// Project: Graphic
// Start: Saturday, July 03, 2010
// IDE Version: 8.006
CONSTANT STEPSIZE% = 4

TYPE tPixel
x%
y%
colour%
ENDTYPE

TYPE tClock
size
angle
speed
alpha
ENDTYPE

LOCAL pixel[] AS tPixel
LOCAL clock[] AS tClock

LOCAL mx%,sW%,sH%
LOCAL alpha

GETSCREENSIZE sW%,sH%
LIMITFPS -1

mx%=sW%/4

DIM pixel[mx%]
DIM clock[9]

SEEDRND GETTIMERALL()
FOR loop%=0 TO mx%-1
pixel[loop%].x%=loop%*4
pixel[loop%].y%=sH%/2
pixel[loop%].colour%=RGB(128,128,128)
NEXT

alpha=-0.1
FOR loop%=0 TO 8
clock[loop%].size=RND(MIN(sW%,sH%)/2)+8; clock[loop%].angle=RND(359); clock[loop%].alpha=alpha
clock[loop%].speed=0.0
WHILE clock[loop%].speed=0.0
clock[loop%].speed=(RND(100)-50)/20.0
WEND

DEC alpha,0.1
NEXT

WHILE TRUE
FOR loop%=0 TO 8
ALPHAMODE clock[loop%].alpha
DRAWLINE (sW%/2),(sH%/2), _
(sW%/2)+(clock[loop%].size%*SIN(clock[loop%].angle)), _
(sH%/2)+(clock[loop%].size%*COS(clock[loop%].angle)), _
RGB(255,255,0)

INC clock[loop%].angle,clock[loop%].speed
IF clock[loop%].angle>=360.0 THEN DEC clock[loop%].angle,360.0
NEXT

FOR loop%=0 TO mx%-2
ALPHAMODE 0.0
DRAWLINE pixel[loop%].x%,pixel[loop%].y%,pixel[loop%+1].x%,pixel[loop%+1].y%,pixel[loop%].colour%
ALPHAMODE -0.8
DRAWLINE sW%-pixel[loop%].x%,sH%-pixel[loop%].y%,sW%-pixel[loop%+1].x%,sH%-pixel[loop%+1].y%,RGB(128,128,128)
NEXT

SHOWSCREEN

FOR loop%=1 TO mx%-1
pixel[loop%-1].y%=pixel[loop%].y%
pixel[loop%-1].colour%=pixel[loop%].colour%
NEXT

INC pixel[mx%-1].y%,(RND(10)-5)*STEPSIZE%
IF pixel[mx%-1].y%<0 THEN pixel[mx%-1].y%=0
IF pixel[mx%-1].y%>sH% THEN pixel[mx%-1].y%=sH%
pixel[mx%-1].colour%=RGB(RND(255),RND(255),RND(255))
WEND