if (font == null)
this.setDrawActionText(false);
else
this.setDrawActionText(true);
b = new Vector3D(this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT)/2, this.getHeightXY(TransformSpace.RELATIVE_TO_PARENT)/2, 0);
outerBar = new MTRectangle(0, 0, 0, 200, 30, pa);
outerBar.setStrokeWeight(1);
// outerBar.setNoStroke(true);
outerBar.setStrokeColor(new MTColor(0, 0, 0, 255));
outerBar.setFillColor(new MTColor(100, 100, 100, 200));
outerBar.setGestureAllowance(DragProcessor.class, false);
outerBar.setGestureAllowance(RotateProcessor.class, false);
outerBar.setGestureAllowance(ScaleProcessor.class, false);
outerBar.setGestureAllowance(TapProcessor.class, false);
c = new Vector3D(b.x - outerBar.getWidthXY(TransformSpace.RELATIVE_TO_PARENT)/2, b.y - outerBar.getHeightXY(TransformSpace.RELATIVE_TO_PARENT)/2, 0);
outerBar.translate(c);
outerBar.setName("MTProgressbar outer bar");
this.addChild(outerBar);
innerBar = new MTRectangle(0, 0, 0, 199, 29, pa);
innerBar.setStrokeWeight(1);
innerBar.setNoStroke(true);
innerBar.setStrokeColor(new MTColor(255, 255, 255, 200));
innerBar.setFillColor(new MTColor(250, 150, 150, 200));
innerBar.setGestureAllowance(DragProcessor.class, false);
innerBar.setGestureAllowance(RotateProcessor.class, false);
innerBar.setGestureAllowance(ScaleProcessor.class, false);
//Progress bar colors
innerBar.getGeometryInfo().getVertices()[0].setRGBA(50, 50, 100, 200);
innerBar.getGeometryInfo().getVertices()[1].setRGBA(50, 50, 250, 200);
innerBar.getGeometryInfo().getVertices()[2].setRGBA(50, 50, 250, 200);
innerBar.getGeometryInfo().getVertices()[3].setRGBA(50, 50, 100, 200);
innerBar.getGeometryInfo().getVertices()[4].setRGBA(50, 50, 100, 200);
innerBar.getGeometryInfo().updateVerticesColorBuffer();
innerBar.translate(new Vector3D(0.5f, 0.5f, 0));
innerBar.setName("MTProgressbar inner bar");
outerBar.addChild(innerBar);
targetWidth = innerBar.getWidthXY(TransformSpace.RELATIVE_TO_PARENT);
this.innerBar.scale(1/targetWidth, 1, 1, zero, TransformSpace.LOCAL);
this.innerBar.scale(1, 1, 1, zero, TransformSpace.LOCAL);
this.translateGlobal(new Vector3D(
MT4jSettings.getInstance().getWindowWidth()/2 - this.getWidthXY(TransformSpace.GLOBAL)/2,
MT4jSettings.getInstance().getWindowHeight()/2 - this.getHeightXY(TransformSpace.GLOBAL)/2 ,
0) );
this.upperLeft = new Vector3D(0,0,0);
this.lowerRight = new Vector3D(upperLeft.x + this.getWidthXY(TransformSpace.LOCAL), upperLeft.y + this.getHeightXY(TransformSpace.LOCAL), 0);
this.upperLeftProjected = new Vector3D(0,0,0);
this.lowerRightProjected = new Vector3D(0,0,0);
this.setName("MTProgressbar");
//Draw this component and its children above
//everything previously drawn and avoid z-fighting with its children