Location: PHPKode > projects > PHP Cad and Drawing Program > phpcad/functions/door.inc
AAAAAAAAAAAAAAAAAAAAAAAAA
//
//    Draws a door.  Don't overlap for .pov to look right.
//    $direction = <u>"R"</u>, <u>"D"</u> right or down.
//    $length = <u>"1-12"</u> pixel spaces.
//
function door($image, $length, $direction, $scale, $x, $y)
{
    $edge=ImageColorAllocate($image,160,160,150);
    $x=$x*$scale;
    $y=$y*$scale;
    if ($direction == "R") {
        ImageFilledRectangle($image, $x, $y,
        $x+($scale*$length), $y+$scale, $edge);
    } else {
        ImageFilledrectangle($image, $x, $y,
        $x+$scale, $y+($scale*$length), $edge);
    }
}
BBBBBBBBBBBBBBBBBBBBBBBBBBBB
if ($PObj=="door") {
    $a=fopen("./files/$pfilez", "a");
    if ($PDir == "D") $PDir = "D";
    if ($PDir == "R") $PDir = "R";
    $xp= "<?php " . $PObj . "($" . "image,";
    $xp .=  $PLen . ',"' . $PDir . '",';
    $xp .= '$scale,';
    $xp .=  $xx . "," . $yy . "); ?>\n";
    fwrite($a, $xp);
    fclose($a);
}
CCCCCCCCCCCCCCCCCCCCCCCC
function door($image,$length,$direction,$scale,$x,$y)
{
global $floor;
global $twall;
global $tfoundation;
global $zz;
if ($direction == "R") {
    $a = "box{<";
    $a .= $x . "," . (0+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+$length;
    $a .= "," . (1+$floor) . ",";
    $a .= $y+1;
    $a .= "> $tfoundation}\n";
    fwrite($zz,$a);
    fwrite($zz,"difference {\n");
    $a = "box{<";
    $a .= $x . "," . (1+$floor) . ",";
    $a .= $y+.45  . "><";
    $a .= $x+$length;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+.55;
    $a .= "> texture{T_Wood10}}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x+.2 . "," . (5+$floor) . ",";
    $a .= $y+.45  . "><";
    $a .= $x+$length-.2;
    $a .= "," . (7.5+$floor) . ",";
    $a .= $y+.55;
    $a .= "> texture {T_Glass3}} }\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (8+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+$length;
    $a .= "," . (9+$floor) . ",";
    $a .= $y+1;
    $a .= "> $twall}\n\n";
    fwrite($zz,$a);
} else {
    $a = "box{<";
    $a .= $x . "," . (0+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+1;
    $a .= "," . (1+$floor) . ",";
    $a .= $y+$length;
    $a .= "> $tfoundation}\n";
    fwrite($zz,$a);
    fwrite($zz,"difference {\n");
    $a = "box{<";
    $a .= $x . "," . (1+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+1;
    $a .= "," . (8+$floor) . ",";
    $a .= $y+$length;
    $a .= "> texture{T_Wood10}}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x+.45 . "," . (5+$floor) . ",";
    $a .= $y+0.2 . "><";
    $a .= $x+.55;
    $a .= "," . (7.5+$floor) . ",";
    $a .= $y+$length-0.2;
    $a .= "> texture {T_Glass3}}\n } \n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (8+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+1;
    $a .= "," . (9+$floor) . ",";
    $a .= $y+$length;
    $a .= "> $twall}\n\n";
    fwrite($zz,$a);
}
}
DDDDDDDDDDDDDDDDDDDDDDDD
$inthemenu = "yes";
$dirlist= array("D","R");
$lenlist= array("1","2","3","4","5","6","8","10","12","14");
$txtitem="";
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Return current item: PHP Cad and Drawing Program