haxegon / zeedonk

Haxegon + Puzzlescript = Zeedonk!
http://www.zeedonk.net
12 stars 2 forks source link

drawcircle doesn't reset transform #445

Closed increpare closed 8 years ago

increpare commented 8 years ago

should gfx.drawcircle have a shapematrix.identity(); at the end of the second version?

this is broken with out, and fixed with the extra line. import haxegon.*;

    class Main {
        function new(){

        }

        function drawPerson(px:Float,py:Float,params:Dynamic){
            var w:Float = 15*params.weight+10;
            var h:Float = 20*params.height+20;
            var legr:Float = 3+3*params.weight;
            var legheight:Float = 10*params.height+10;
            var legoffset:Float = w/2;
            var headradius:Float=6;
            var armlength = h*1.2;
            var armdx = Math.sin(-Math.PI/4)*armlength;
            var armdy = Math.cos(Math.PI/4)*armlength;
            trace((px-w)+","+(py-legheight-h)+","+(2*w)+","+h);

/*          //hair
            Gfx.fillcircle(
                px,
                py-legheight-h-headradius,
                headradius+5,Col.BLUE);
            Gfx.fillcircle(
                px,
                py-legheight-h-headradius,
                headradius,Col.BLACK);
            Gfx.fillbox(
                px-headradius-1,
                py-legheight-h-headradius,
                2*headradius+2,
                headradius+1,
                Col.BLACK);

_/ //left leg Gfx.drawbox( px-legoffset-legr, py-legheight, legr_2, legheight,Col.BLUE); //right leg Gfx.drawbox( px+legoffset-legr, py-legheight, legr_2, legheight,Col.BLUE); //torso Gfx.drawbox( px-w, py-legheight-h, 2_w, h,Col.BLUE); //head Gfx.drawcircle( px, py-legheight-h-headradius, headradius,Col.BLUE);

            //left arm
            Gfx.drawline(
                px-w,
                py-legheight-h,
                px-w+armdx,
                py-legheight-h+armdy,
                Col.BLUE
                );
            //right arm
            Gfx.drawline(
                px+w,
                py-legheight-h,
                px+w-armdx,
                py-legheight-h+armdy,
                Col.BLUE
                );

        }

        function update(){
            var params:Dynamic = {
                hairshade:0.5,//blond-black
                skinshade:0.5,//yellow-black
                hairlength:0.5,//bald - hair
                height:0.5,
                weight:0.5,
                pantscol: 0.5,
                jacketcol: 0.5
            };
            drawPerson(Gfx.screenwidthmid,Gfx.screenheightmid,params);
        }
    }
increpare commented 8 years ago

oops wrong project