use of jcog.tree.rtree.rect.RectFloat2D in project narchy by automenta.
the class SubOrtho method doLayout.
@Override
protected void doLayout(int dtMS) {
int ww = window.getWidth();
int wh = window.getHeight();
pos(new RectFloat2D(boundsWin.x * ww, boundsWin.y * wh, boundsWin.w * ww, boundsWin.h * wh));
super.doLayout(dtMS);
}
use of jcog.tree.rtree.rect.RectFloat2D in project narchy by automenta.
the class ExeCharts method metaGoalControls.
public static Surface metaGoalControls(NAR n) {
CheckBox auto = new CheckBox("Auto");
auto.set(false);
float[] want = n.emotion.want;
Gridding g = grid(// Stream.of(auto),
IntStream.range(0, want.length).mapToObj(w -> new FloatSlider(want[w], -1f, +1f) {
@Override
protected void paintWidget(GL2 gl, RectFloat2D bounds) {
if (auto.on()) {
value(want[w]);
}
}
}.text(MetaGoal.values()[w].name()).type(BaseSlider.Knob).on((s, v) -> {
if (!auto.on())
want[w] = v;
})).toArray(Surface[]::new));
return g;
}
use of jcog.tree.rtree.rect.RectFloat2D in project narchy by automenta.
the class Label method doLayout.
@Override
protected void doLayout(float tx, float ty, float tw, float th) {
innerBounds = new RectFloat2D(tx, ty, tx + tw, ty + th);
int len = text().length();
if (len == 0)
return;
float charAspect = 1.4f;
this.textScaleX = 1f / len;
this.textScaleY = 1 * charAspect;
float visAspect = th / tw;
if (textScaleY / textScaleX <= visAspect) {
this.textScaleX = 1f / (charAspect * len);
this.textScaleY = textScaleX * charAspect;
} else {
this.textScaleY = textScaleX / visAspect;
}
if (textScaleY > 1f) {
// (charAspect * len);
textScaleX = 1f / (len * textScaleY);
textScaleY = 1f;
}
textY = 0.5f - textScaleY / 2f;
}
Aggregations