Package net.mtrop.doom.map.data
Class DoomVertex
java.lang.Object
net.mtrop.doom.map.data.DoomVertex
- All Implemented Interfaces:
BinaryObject
The 4-byte representation of a vertex.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.mtrop.doom.object.BinaryObject
BinaryObject.InlineScanner<BO extends BinaryObject>, BinaryObject.Reflect, BinaryObject.Scanner<BO extends BinaryObject>, BinaryObject.Shared, BinaryObject.Transformer<BO extends BinaryObject>
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getX()
int
getY()
void
readBytes
(InputStream in) Reads from anInputStream
and sets this object's fields.void
set
(int x, int y) Sets the coordinates of this vertex.void
setX
(int x) Sets the X-coordinate value of this vertex.void
setY
(int y) Sets the Y-coordinate value of this vertex.toString()
void
writeBytes
(OutputStream out) Writes this object to anOutputStream
.
-
Field Details
-
LENGTH
public static final int LENGTHByte length of this object.- See Also:
-
-
Constructor Details
-
DoomVertex
public DoomVertex()Creates a new vertex with default values set.
-
-
Method Details
-
set
public void set(int x, int y) Sets the coordinates of this vertex.- Parameters:
x
- the new x-coordinate value.y
- the new y-coordinate value.
-
getX
public int getX()- Returns:
- the X-coordinate value of this vertex.
-
setX
public void setX(int x) Sets the X-coordinate value of this vertex.- Parameters:
x
- the new x-coordinate value.- Throws:
IllegalArgumentException
- if x is outside of the range -32768 to 32767.
-
getY
public int getY()- Returns:
- the Y-coordinate value of this vertex.
-
setY
public void setY(int y) Sets the Y-coordinate value of this vertex.- Parameters:
y
- the new y-coordinate value.- Throws:
IllegalArgumentException
- if y is outside of the range -32768 to 32767.
-
readBytes
Description copied from interface:BinaryObject
Reads from anInputStream
and sets this object's fields. Only reads the amount of bytes that it takes to read a single instance of the object. Note that not every object may have a consistent length!- Specified by:
readBytes
in interfaceBinaryObject
- Parameters:
in
- theInputStream
to read from.- Throws:
IOException
- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObject
Writes this object to anOutputStream
.- Specified by:
writeBytes
in interfaceBinaryObject
- Parameters:
out
- theOutputStream
to write to.- Throws:
IOException
- if a write error occurs.
-
toString
-