public class RenderWindow extends Window implements RenderTarget
CLOSE, DEFAULT, FULLSCREEN, NONE, RESIZE, TITLEBAR
Constructor and Description |
---|
RenderWindow()
Constructs a new render window without actually creating (opening) it.
|
RenderWindow(VideoMode mode,
String title)
Constructs a new render window and creates it with default style and context settings.
|
RenderWindow(VideoMode mode,
String title,
int style)
Constructs a new render window and creates it with default context settings.
|
RenderWindow(VideoMode mode,
String title,
int style,
ContextSettings settings)
Constructs a new render window and creates it with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
Image |
capture()
Copies the current contents of the window to an image.
|
void |
clear()
Clears the target with black.
|
void |
clear(Color color)
Clears the render target and fills it with a constant color.
|
void |
create(VideoMode mode,
String title,
int style,
ContextSettings settings)
Creates and opens a window or re-creates it if it was already opened.
|
void |
draw(Drawable drawable)
Draws a drawable object to the render target using the default render states.
|
void |
draw(Drawable drawable,
RenderStates renderStates)
Draws a drawable object to the render target using the given render states.
|
void |
draw(Vertex[] vertices,
PrimitiveType type)
Draws a primitive of the given type using the given vertices and the default render states.
|
void |
draw(Vertex[] vertices,
PrimitiveType type,
RenderStates states)
Draws a primitive of the given type using the given vertices and the given render states.
|
ConstView |
getDefaultView()
Gets the target's default view.
|
ConstView |
getView()
Gets the target's current view.
|
IntRect |
getViewport(ConstView view)
Computes the viewport of the given view applied to this render target.
|
Vector2i |
mapCoordsToPixel(Vector2f point)
Converts a point from world coordinates to target coordinates using the target's
current view.
|
Vector2i |
mapCoordsToPixel(Vector2f point,
ConstView view)
Converts a point from world coordinates to target coordinates for a certain view.
|
Vector2f |
mapPixelToCoords(Vector2i point)
Converts a point from target coordinates to world coordinates using the target's
current view.
|
Vector2f |
mapPixelToCoords(Vector2i point,
ConstView view)
Converts a point from target coordinates to world coordinates for a certain view.
|
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
void |
popGLStates()
Pops the last OpenGL states and matrices from the top of the stack.
|
void |
pushGLStates()
Pushes the current OpenGL states and matrices to the stack.
|
void |
resetGLStates()
Resets the internal OpenGL states so that the target is ready for drawing.
|
void |
setView(ConstView view)
Sets the target's view.
|
close, create, create, display, getPosition, getSettings, getSize, isLegalWindowThread, isOpen, pollEvent, pollEvents, setActive, setActive, setFramerateLimit, setIcon, setJoystickTreshold, setKeyRepeatEnabled, setMouseCursorVisible, setPosition, setSize, setTitle, setVerticalSyncEnabled, setVisible, waitEvent
finalize
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSize
public RenderWindow()
public RenderWindow(VideoMode mode, String title, int style, ContextSettings settings)
mode
- the video mode to use for rendering.title
- the window title.style
- the window style.settings
- the settings for the OpenGL context.create(org.jsfml.window.VideoMode, String, int, org.jsfml.window.ContextSettings)
public RenderWindow(VideoMode mode, String title, int style)
mode
- the video mode to use for rendering.title
- the window title.style
- the window style.Window.create(org.jsfml.window.VideoMode, String, int)
@Deprecated protected long nativeCreate()
SFMLNativeObject
nativeCreate
in class Window
@Deprecated protected void nativeSetExPtr()
SFMLNativeObject
nativeSetExPtr
in class Window
@Deprecated protected void nativeDelete()
SFMLNativeObject
nativeDelete
in class Window
public void create(VideoMode mode, String title, int style, ContextSettings settings)
Window
create
in class Window
mode
- the video mode that determines the window's size.
This must be a valid video mode in case WindowStyle.FULLSCREEN
is set.title
- the window title.style
- the style of the window.
This should be a combination (using OR
of the style flags
WindowStyle.TITLEBAR
, WindowStyle.RESIZE
, WindowStyle.CLOSE
and
WindowStyle.FULLSCREEN
, or WindowStyle.NONE
for no style.
WindowStyle.DEFAULT
provides a default combination of style flags.settings
- the context settings for the created OpenGL context.VideoMode.isValid()
,
WindowStyle
,
ContextSettings
public Image capture()
Texture.update(org.jsfml.window.Window)
or a RenderTexture
instead.public void clear(Color color)
RenderTarget
clear
in interface RenderTarget
color
- the color to fill the target with.public void clear()
public void setView(ConstView view)
RenderTarget
setView
in interface RenderTarget
view
- the target's new view.public ConstView getView()
RenderTarget
getView
in interface RenderTarget
public ConstView getDefaultView()
RenderTarget
getDefaultView
in interface RenderTarget
public IntRect getViewport(ConstView view)
RenderTarget
getViewport
in interface RenderTarget
view
- the view.public final Vector2f mapPixelToCoords(Vector2i point)
RenderTarget
mapPixelToCoords
in interface RenderTarget
point
- the point on the render target.public Vector2f mapPixelToCoords(Vector2i point, ConstView view)
RenderTarget
mapPixelToCoords
in interface RenderTarget
point
- the point on the render target.view
- the view to use for conversion.public final Vector2i mapCoordsToPixel(Vector2f point)
RenderTarget
mapCoordsToPixel
in interface RenderTarget
point
- the point in the world.public Vector2i mapCoordsToPixel(Vector2f point, ConstView view)
RenderTarget
mapCoordsToPixel
in interface RenderTarget
point
- the point in the world.view
- the view to use for conversion.public final void draw(Drawable drawable)
RenderTarget
draw
in interface RenderTarget
drawable
- the object to draw.public void draw(Drawable drawable, RenderStates renderStates)
RenderTarget
draw
in interface RenderTarget
drawable
- the object to draw.renderStates
- the render states to use for drawing.public final void draw(Vertex[] vertices, PrimitiveType type)
RenderTarget
draw
in interface RenderTarget
vertices
- the vertices to draw.type
- the type of OpenGL primitive to draw.public void draw(Vertex[] vertices, PrimitiveType type, RenderStates states)
RenderTarget
draw
in interface RenderTarget
vertices
- the vertices to draw.type
- the type of OpenGL primitive to draw.states
- the render states to use for drawing.public void pushGLStates()
RenderTarget
pushGLStates
in interface RenderTarget
public void popGLStates()
RenderTarget
popGLStates
in interface RenderTarget
public void resetGLStates()
RenderTarget
resetGLStates
in interface RenderTarget