Class ConstraintImpl<T extends ConstraintImpl<?>>
java.lang.Object
codechicken.lib.gui.modular.lib.geometry.ConstraintImpl<T>
- All Implemented Interfaces:
Constraint
- Direct Known Subclasses:
ConstraintImpl.Between,ConstraintImpl.BetweenDynamic,ConstraintImpl.Dynamic,ConstraintImpl.Literal,ConstraintImpl.MidPoint,ConstraintImpl.MidPointDynamic,ConstraintImpl.Relative,ConstraintImpl.RelativeDynamic
public abstract non-sealed class ConstraintImpl<T extends ConstraintImpl<?>>
extends Object
implements Constraint
Created by brandon3055 on 04/07/2023
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Axisaxis()doubleget()This method will return the current value of this constraint.protected abstract doublegetImpl()booleanvoidThis is part of a late addition to improve performance.precise()By default, all constraint values are cast to (int).
-
Field Details
-
precise
protected boolean precise -
axis
-
-
Constructor Details
-
ConstraintImpl
public ConstraintImpl()
-
-
Method Details
-
isPrecise
public boolean isPrecise()- Returns:
- True if precise mode is enabled.
- See Also:
-
precise
By default, all constraint values are cast to (int). This helps avoid a lot of visual artifacts that can occur when using floating point positions in MC Screens.Calling this enables precise mode, which allows floating point precision to be used.
- Returns:
- The Constraint.
-
get
public double get()Description copied from interface:ConstraintThis method will return the current value of this constraint. This could be a fixed stored value, or a dynamically computed value depending on the type of constraint.All position and size values in ModularGui are doubles. However, by default, all the builtin constraints will cast their outputs to integer values. This avoids a lot of random visual artifacts that can occur when using floating point values in MC Screens.
If you need floating-point precision, it can be enabled calling .precise() on any of the builtin constraints.
- Specified by:
getin interfaceConstraint- Returns:
- The computed or stored value of this constraint.
-
axis
- Specified by:
axisin interfaceConstraint- Returns:
- the axis this constraint applies to, Ether X, Y or null for undefined.
-
setAxis
-
markDirty
public void markDirty()Description copied from interface:ConstraintThis is part of a late addition to improve performance. Rather than computing a constraint value every single time it is queried, which can be many, many times per render frame, We now cache the constraint value, and that cache is cleared at the start of each render frame.- Specified by:
markDirtyin interfaceConstraint
-
getImpl
protected abstract double getImpl()
-