drawcircle doesn't reset transform
increpare opened this issue · comments
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);
}
}
oops wrong project