Author Topic: Boxes with shadows  (Read 1317 times)

MrTAToad

  • Guest
Boxes with shadows
« on: 2011-Dec-04 »
Quick routine for producing boxes with shadows :

Code: (glbasic) [Select]
LOCAL dir%=1
LOCAL dist%=4

LIMITFPS 30

WHILE TRUE
ShadowBox(8,8,64,64,dist%,RGB(255,0,0),RGB(128,0,0),RGB(0,255,0))
INC dist%,dir%
IF dist%=0 OR dist%=12
dir%=0-dir%
ENDIF
SHOWSCREEN
WEND
KEYWAIT
END

FUNCTION ShadowBox%:x%,y%,width%,height%,dist%,mColour%,bColour%,lColour%
DRAWRECT x%+dist%,y%+dist%,width%,height%,bColour%
DRAWRECT x%,y%,width%,height%,mColour%

DRAWLINE x%+1,y%+1,x%+(width%-2),y%+1,lColour%
DRAWLINE x%+1,y%+1,x%+1,y%+(height%-2),lColour%
DRAWLINE x%+(width%-2),y%+1,x%+(width%-2),y%+(height%-2),lColour%
DRAWLINE x%+1,y%+(height%-2),x%+(width%-2),y%+(height%-2),lColour%
ENDFUNCTION