TGC Codebase Backup



little function to draw a box by Sven B

1st Jan 2005 13:37
Summary

A function I wrote to draw a box. I was tired of writing extra code to be sure the first coordinates where smaller then the second...



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `*********************************************
`function for fixed box
`*********************************************
`coded by sven boulanger
`*********************************************

sync on : sync rate 0

do

	cls

	box(320,240,mousex(),mousey())

	sync
loop

`**********************
`THE BIG FUNCTION
`**********************

function box(x,y,x2,y2)
	if x<x2
		startx=x : endx=x2
	else
		startx=x2 : endx=x
	endif
	if y<y2
		starty=y : endy=y2
	else
		starty=y2 : endy=y
	endif
	box startx,starty,endx,endy
endfunction