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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetX()intgetY()voidreadBytes(InputStream in) Reads from anInputStreamand sets this object's fields.voidset(int x, int y) Sets the coordinates of this vertex.voidsetX(int x) Sets the X-coordinate value of this vertex.voidsetY(int y) Sets the Y-coordinate value of this vertex.toString()voidwriteBytes(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:BinaryObjectReads from anInputStreamand 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:
readBytesin interfaceBinaryObject- Parameters:
in- theInputStreamto read from.- Throws:
IOException- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObjectWrites this object to anOutputStream.- Specified by:
writeBytesin interfaceBinaryObject- Parameters:
out- theOutputStreamto write to.- Throws:
IOException- if a write error occurs.
-
toString
-