Package com.io7m.jcamera
Class JCameraFPSStyleMouseRegion
java.lang.Object
com.io7m.jcamera.JCameraFPSStyleMouseRegion
- All Implemented Interfaces:
JCameraFPSStyleMouseRegionType
public final class JCameraFPSStyleMouseRegion
extends Object
implements JCameraFPSStyleMouseRegionType
An immutable rectangular region that maps mouse positions to movements.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeJCameraFPSStyleMouseRegion. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forJCameraFPSStyleMouseRegion.doublecenterX()doublecenterY()static JCameraFPSStyleMouseRegioncopyOf(JCameraFPSStyleMouseRegionType instance) Creates an immutable copy of aJCameraFPSStyleMouseRegionTypevalue.booleanThis instance is equal to all instances ofJCameraFPSStyleMouseRegionthat have equal attribute values.inthashCode()Computes a hash code from attributes:origin,width,height,centerX,centerY.doubleheight()static JCameraFPSStyleMouseRegionof(JCameraScreenOrigin origin, double width, double height) Construct a new immutableJCameraFPSStyleMouseRegioninstance.origin()toString()Prints the immutable valueJCameraFPSStyleMouseRegionwith attribute values.doublewidth()withHeight(double value) Copy the current immutable object by setting a value for theheightattribute.withOrigin(JCameraScreenOrigin value) Copy the current immutable object by setting a value for theoriginattribute.withWidth(double value) Copy the current immutable object by setting a value for thewidthattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.jcamera.JCameraFPSStyleMouseRegionType
checkPreconditions, coefficients
-
Method Details
-
origin
- Specified by:
originin interfaceJCameraFPSStyleMouseRegionType- Returns:
- The current screen origin
-
width
public double width()- Specified by:
widthin interfaceJCameraFPSStyleMouseRegionType- Returns:
- The width of the region
-
height
public double height()- Specified by:
heightin interfaceJCameraFPSStyleMouseRegionType- Returns:
- The height of the region
-
centerX
public double centerX()- Specified by:
centerXin interfaceJCameraFPSStyleMouseRegionType- Returns:
- The X coordinate of the center of the region
-
centerY
public double centerY()- Specified by:
centerYin interfaceJCameraFPSStyleMouseRegionType- Returns:
- The Y coordinate of the center of the region
-
withOrigin
Copy the current immutable object by setting a value for theoriginattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for origin- Returns:
- A modified copy of the
thisobject
-
withWidth
Copy the current immutable object by setting a value for thewidthattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for width- Returns:
- A modified copy of the
thisobject
-
withHeight
Copy the current immutable object by setting a value for theheightattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for height- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofJCameraFPSStyleMouseRegionthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:origin,width,height,centerX,centerY. -
toString
Prints the immutable valueJCameraFPSStyleMouseRegionwith attribute values. -
of
public static JCameraFPSStyleMouseRegion of(JCameraScreenOrigin origin, double width, double height) Construct a new immutableJCameraFPSStyleMouseRegioninstance.- Parameters:
origin- The value for theoriginattributewidth- The value for thewidthattributeheight- The value for theheightattribute- Returns:
- An immutable JCameraFPSStyleMouseRegion instance
-
copyOf
Creates an immutable copy of aJCameraFPSStyleMouseRegionTypevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable JCameraFPSStyleMouseRegion instance
-
builder
Creates a builder forJCameraFPSStyleMouseRegion.JCameraFPSStyleMouseRegion.builder() .setOrigin(com.io7m.jcamera.JCameraScreenOrigin) // requiredorigin.setWidth(double) // requiredwidth.setHeight(double) // requiredheight.build();- Returns:
- A new JCameraFPSStyleMouseRegion builder
-