Page 1 of 1 1
Topic Options
#52278 - 2000-11-17 06:48 PM box painter (code formatted)
Anonymous
Unregistered


apologies thius should be better

code:

;Box painter

:INIT
break on
cls
$tlr =10
$tlc =10
$brw =20
$brc =20
$quit = q
$x=10
$y=10
$string = "+"
$grid = "2,2,39,79 "
$quit = "q"
$minX = val(substr("$grid",1,instr("$grid",",")-1))
$grid = substr("$grid",len("$minx")+2,len("$grid"))
$miny = val(substr("$grid",1,instr("$grid",",")-1))
$grid = substr("$grid",len("$minx")+2,len("$grid"))
$MaxX = val(substr("$grid",1,instr("$grid",",")-1))
$maxy = val(substr("$grid",len("$maxX")+2,len("$grid")))

:MAIN
GOSUB "DISPLAY_INIT"
GOSUB "MARK"
GOSUB "DRAW_BOX"
EXIT

ISPLAY_INIT
?"PLease input your box type from the selction below"
?" 1. SINGLE"
?" 2. DOUBLE"
?" 3. FULL"
?" 4. GRID"
?
get $boxtype
Select
Case $boxtype ="1"
$boxtype = "single"
Case $boxtype ="2"
$boxtype = "double"
Case $boxtype ="3"
$boxtype = "full"
Case $boxtype = "4"
$boxtype = "grid"
ENDSELECT

?"move your starting point around to display screen location"
?"using the number pad, and press 'p' to mark the top left of your box"
? " 7 8 9"
? " 4 6"
? " 1 2 3"
? " Press 'c' and then a function key F1 - F7 to change the colour of the box"
?"press any key but Q to start. press Q to quit"


RETURN

:MARK
get $move
cls
box($minx,$miny,$maxX,$maxY,"+-+|+-+| ")
gosub "check_area"
gosub "display"
while $move <> $quit

get $move

Select
Case $move ="p"
RETURN
Case $move ="4"
gosub "wipe"
$y = $y - 1
gosub "check_area"
gosub "display"
Case $move ="6"
gosub "wipe"
$y = $y + 1
gosub "check_area"
gosub "display"
case $move ="8"
gosub "wipe"
$x = $x -1
gosub "check_area"
gosub "display"
Case $move ="2"
gosub "wipe"
$x = $x + 1
gosub "check_area"
gosub "display"
Case $move ="7"
gosub "wipe"
$x = $x -1
$y = $y - 1
gosub "check_area"
gosub "display"
Case $move ="9"
gosub "wipe"
$x = $x -1
$y = $y + 1
gosub "check_area"
gosub "display"
Case $move ="3"
gosub "wipe"
$y = $y + 1
$x = $x + 1
gosub "check_area"
gosub "display"
Case $move ="1"
gosub "wipe"
$y = $y - 1
$x = $x + 1
gosub "check_area"
gosub "display"

endselect
loop
RETURN

RAW_BOX
;CLS
AT($x,$y)
$string
$brw = $x
$brc = $y
while $move <> $quit

get $move

Select

case $move ="c"
gosub "colour_ch"
case $move ="4"
gosub "box_wipe"
$brc = $brc - 1
gosub "box_check"
gosub "box_paint"
Case $move ="6"
gosub "box_wipe"
$brc = $brc + 1
gosub "box_check"
gosub "box_paint"
case $move ="8"
gosub "box_wipe"
$brw = $brw -1
gosub "box_check"
gosub "box_paint"
Case $move ="2"
gosub "box_wipe"
$brw = $brw + 1
gosub "box_check"
gosub "box_paint"
Case $move ="7"
gosub "box_wipe"
$brw = $brw -1
$brc = $brc - 1
gosub "box_check"
gosub "box_paint"
Case $move ="9"
gosub "box_wipe"
$brw = $brw -1
$brc = $brc + 1
gosub "box_check"
gosub "box_paint"
Case $move ="3"
gosub "box_wipe"
$brc = $brc + 1
$brw = $brw + 1
gosub "box_check"
gosub "box_paint"
Case $move ="1"
gosub "box_wipe"
$brc = $brc - 1
$brw = $brw + 1
gosub "box_check"
gosub "box_paint"

endselect

loop
RETURN

:check_area
if $x = $minX
play "1d 400f"
$x = $x+1
endif
if $y = $miny
play "1d 400f"
$y = $y+1
endif
if $x = $maxX
play "1d 400f"
$x = $x-1
endif
if $y = $maxY - (len("$string")-1)
play "1d 400f"
$y = $y-1
endif
return

:wipe
$count = 0
while $count <> len("$string")
at($x,$y + $count) " "
$count = $count + 1
loop
at (1,1) " "
RETURN

:check_area
if $x = $minX
play "1d 400f"
$x = $x+1
endif
if $y = $miny
play "1d 400f"
$y = $y+1
endif
if $x = $maxX
play "1d 400f"
$x = $x-1
endif
if $y = $maxY - (len("$string")-1)
play "1d 400f"
$y = $y-1
endif
return

:display
at ($x,$y)
$string
at (1,1)
"$x"+","+"$y"
RETURN

:colour_ch
get $color
Select

Case @error = 59
color b+/n
gosub "box_paint"
Case @error = 60
color g+/n
gosub "box_paint"
Case @error = 61
color c+/n
gosub "box_paint"
Case @error = 62
color r+/n
gosub "box_paint"
Case @error = 63
color m+/n
gosub "box_paint"
Case @error = 64
color y+/n
gosub "box_paint"
case @error = 65
color w+/n
gosub "box_paint"
endselect
Return


:box_wipe
BOX($x,$y,$brw,$brc," ")
RETURN


:box_check
if $brw = $maxX
play "1d 400f"
$brw = $brw-1
endif
if $brc = $maxY
play "1d 400f"
$brc = $brc-1
endif
return

:box_paint

BOX($x,$y,$brw,$brc,$boxtype)
AT (1,1)
"$brw" + "," + "$brc"
RETURN

:colour_ch
get $color
Select

Case @error = 59
color b+/n
gosub "box_paint"
Case @error = 60
color g+/n
gosub "box_paint"
Case @error = 61
color c+/n
gosub "box_paint"
Case @error = 62
color r+/n
gosub "box_paint"
Case @error = 63
color m+/n
gosub "box_paint"
Case @error = 64
color y+/n
gosub "box_paint"
case @error = 65
color w+/n
gosub "box_paint"
endselect
Return



Top
#52279 - 2000-11-17 08:26 PM Re: box painter (code formatted)
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hey frak:

This is looking sweet - when are you going to support drawing more than one box and also to allow one to drop some text strings down.

Shawn.

Top
#52280 - 2000-11-17 08:59 PM Re: box painter (code formatted)
Anonymous
Unregistered


Shawn,
I would have done more with it by now if you hadn't and gone and developed kixwin and kixlib this stuff is really good. it will make kix look so much more elegant as well as add an immense amount of power. keep it up mate. if there is any more interest or call for the screen painter i will do it. to be honest though most of the ideas i had for it were covered in tetris and pacman

Top
#52281 - 2000-11-17 09:13 PM Re: box painter (code formatted)
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
NO WAY MATE !

Pure KIX scripting is always the best and most highly sought after work. I wouldn't give up the ghost on a generic screen designer just yet !

Just think about all the neat stuff you'll learn (and all the coding problems you'll have to tackle) - That's why I do all this sh*t !

Shawn.

Top
#52282 - 2000-11-17 09:43 PM Re: box painter (code formatted)
Anonymous
Unregistered


Shawn,
Ok well i'll stick with it for now then. Anybody else wnat to modify then feel free to. I won't get chance to do anything more until monday though now i am away for the weekend. Let me know when you update either of the lib files.


frak

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1452 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.161 seconds in which 0.13 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org