public class View extends SFMLNativeObject implements ConstView
Constructor and Description |
---|
View()
Constructs a new view for the area of (0, 0, 1000, 1000).
|
View(FloatRect rect)
Constructs a new view for the specified area.
|
View(Vector2f center,
Vector2f size)
Constructs a view for the specified area.
|
Modifier and Type | Method and Description |
---|---|
Vector2f |
getCenter()
Gets the current center of the view.
|
Transform |
getInverseTransform()
Gets the inverse of the view's current transformation matrix as determined
by its center, size and rotation angle.
|
float |
getRotation()
Gets the current rotation angle of the view in degrees.
|
Vector2f |
getSize()
Gets the current dimensions of the view in pixels.
|
Transform |
getTransform()
Gets the view's current transformation matrix as determined by its center,
size and rotation angle.
|
FloatRect |
getViewport()
Gets the current viewport rectangle of this view.
|
void |
move(float x,
float y)
Moves the center of the view.
|
void |
move(Vector2f v)
Moves the center of the view.
|
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
void |
reset(FloatRect rect)
Resets the view to a certain viewport rectangle, resetting the rotation angle in the process.
|
void |
rotate(float angle)
Rotates the view around its center.
|
void |
setCenter(float x,
float y)
Sets the center of the view.
|
void |
setCenter(Vector2f v)
Sets the center of the view.
|
void |
setRotation(float angle)
Sets the rotation of the view around its center.
|
void |
setSize(float width,
float height)
Sets the dimensions of the view.
|
void |
setSize(Vector2f v)
Sets the dimensions of the view.
|
void |
setViewport(FloatRect rect)
Sets the viewport rectangle of this view.
|
void |
zoom(float factor)
Resizes the view.
|
finalize
public View()
public View(FloatRect rect)
rect
- the area visible by this view.@Deprecated protected final long nativeCreate()
SFMLNativeObject
nativeCreate
in class SFMLNativeObject
@Deprecated protected void nativeSetExPtr()
SFMLNativeObject
nativeSetExPtr
in class SFMLNativeObject
@Deprecated protected void nativeDelete()
SFMLNativeObject
nativeDelete
in class SFMLNativeObject
public final void setCenter(float x, float y)
x
- the new X coordinate of the view's center.y
- the new Y coordinate of the view's center.public void setCenter(Vector2f v)
v
- the new center of the view.public void setSize(float width, float height)
width
- the new width of the view in pixels.height
- the new height of the view in pixels.public void setSize(Vector2f v)
v
- the new size of the view in pixels.public void setRotation(float angle)
angle
- the new rotation angle in degrees.public void setViewport(FloatRect rect)
rect
- the new viewport rectangle.public void reset(FloatRect rect)
rect
- the viewport rectangle.public Vector2f getCenter()
ConstView
public Vector2f getSize()
ConstView
public float getRotation()
ConstView
getRotation
in interface ConstView
public FloatRect getViewport()
ConstView
getViewport
in interface ConstView
public final void rotate(float angle)
angle
- the angle to rotate by, in degrees.public final void move(float x, float y)
x
- the X offset to move the view's center by.y
- the Y offset to move the view's center by.public final void move(Vector2f v)
v
- the offset vector to move the view's center by.public final void zoom(float factor)
factor
- the zoom factor.public Transform getTransform()
ConstView
getTransform
in interface ConstView
public Transform getInverseTransform()
ConstView
getInverseTransform
in interface ConstView