RenderWindow Methods

SFML.Net

RenderWindow Methods

The RenderWindow type exposes the following members.

Methods
  Name Description
Public method Capture
Capture the current contents of the window into an image
Public method Clear
Clear the entire window with black color
Public method Clear(Color)
Clear the entire window with a single color
Public method Close
Close (destroy) the window. The Window instance remains valid and you can call Create to recreate the window
(Overrides WindowClose.)
Protected method Destroy
Handle the destruction of the object
(Overrides WindowDestroy(Boolean).)
Public method DispatchEvents
Call the event handlers for each pending event
(Inherited from Window.)
Public method Display
Display the window on screen
(Overrides WindowDisplay.)
Public method Dispose
Explicitely dispose the object
(Inherited from ObjectBase.)
Public method Draw(Drawable)
Draw a drawable object to the render-target, with default render states
Public method Draw(Drawable, RenderStates)
Draw a drawable object to the render-target
Public method Draw(Vertex, PrimitiveType)
Draw primitives defined by an array of vertices, with default render states
Public method Draw(Vertex, PrimitiveType, RenderStates)
Draw primitives defined by an array of vertices
Public method Draw(Vertex, UInt32, UInt32, PrimitiveType)
Draw primitives defined by a sub-array of vertices, with default render states
Public method Draw(Vertex, UInt32, UInt32, PrimitiveType, RenderStates)
Draw primitives defined by a sub-array of vertices
Public method Equals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected method Finalize
Dispose the object
(Inherited from ObjectBase.)
Public method GetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public method GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method GetView
Return the current active view
Public method GetViewport
Get the viewport of a view applied to this target
Public method HasFocus
Check whether the window has the input focus
(Overrides WindowHasFocus.)
Protected method InternalGetMousePosition
Internal function to get the mouse position relative to the window. This function is public because it is called by another class, it is not meant to be called by users.
(Overrides WindowInternalGetMousePosition.)
Protected method InternalGetTouchPosition
Internal function to get the touch position relative to the window. This function is protected because it is called by another class of another module, it is not meant to be called by users.
(Overrides WindowInternalGetTouchPosition(UInt32).)
Protected method InternalSetMousePosition
Internal function to set the mouse position relative to the window. This function is public because it is called by another class, it is not meant to be called by users.
(Overrides WindowInternalSetMousePosition(Vector2i).)
Public method MapCoordsToPixel(Vector2f)
Convert a point from world coordinates to target coordinates, using the current view This function is an overload of the mapCoordsToPixel function that implicitely uses the current view. It is equivalent to: target.MapCoordsToPixel(point, target.GetView());
Public method MapCoordsToPixel(Vector2f, View)
Convert a point from world coordinates to target coordinates This function finds the pixel of the render-target that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point. Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-target -- if the view is translated by (140, 25). This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.
Public method MapPixelToCoords(Vector2i)
Convert a point from target coordinates to world coordinates, using the current view This function is an overload of the MapPixelToCoords function that implicitely uses the current view. It is equivalent to: target.MapPixelToCoords(point, target.GetView());
Public method MapPixelToCoords(Vector2i, View)
Convert a point from target coordinates to world coordinates This function finds the 2D position that matches the given pixel of the render-target. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel. Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (10, 50) in your render-target may map to the point (150, 75) in your 2D world -- if the view is translated by (140, 25). For render-windows, this function is typically used to find which point (or object) is located below the mouse cursor. This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.
Protected method MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected method PollEvent
Internal function to get the next event
(Overrides WindowPollEvent(Event).)
Public method PopGLStates
Restore the previously saved OpenGL render states and matrices. See the description of PushGLStates to get a detailed description of these functions.
Public method PushGLStates
Save the current OpenGL render states and matrices. This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with PopGLStates, it ensures that: \li SFML's internal states are not messed up by your OpenGL code \li your OpenGL states are not modified by a call to a SFML function More specifically, it must be used around code that calls Draw functions. Example: // OpenGL code here... window.PushGLStates(); window.Draw(...); window.Draw(...); window.PopGLStates(); // OpenGL code here... Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the ResetGLStates function if you do so.
Public method RequestFocus
Request the current window to be made the active foreground window
(Overrides WindowRequestFocus.)
Public method ResetGLStates
Reset the internal OpenGL states so that the target is ready for drawing. This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use PushGLStates/PopGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent Draw() calls will work as expected. Example: // OpenGL code here... glPushAttrib(...); window.ResetGLStates(); window.Draw(...); window.Draw(...); glPopAttrib(...); // OpenGL code here...
Public method SetActive
Activate the window as the current target for rendering
(Inherited from Window.)
Public method SetActive(Boolean)
Activate of deactivate the window as the current target for rendering
(Overrides WindowSetActive(Boolean).)
Public method SetFramerateLimit
Limit the framerate to a maximum fixed frequency
(Overrides WindowSetFramerateLimit(UInt32).)
Public method SetIcon
Change the window's icon
(Overrides WindowSetIcon(UInt32, UInt32, Byte).)
Public method SetJoystickThreshold
Change the joystick threshold, ie. the value below which no move event will be generated
(Overrides WindowSetJoystickThreshold(Single).)
Public method SetKeyRepeatEnabled
Enable or disable automatic key-repeat. Automatic key-repeat is enabled by default
(Overrides WindowSetKeyRepeatEnabled(Boolean).)
Public method SetMouseCursorVisible
Show or hide the mouse cursor
(Overrides WindowSetMouseCursorVisible(Boolean).)
Public method SetTitle
Change the title of the window
(Overrides WindowSetTitle(String).)
Public method SetVerticalSyncEnabled
Enable / disable vertical synchronization
(Overrides WindowSetVerticalSyncEnabled(Boolean).)
Public method SetView
Change the current active view
Public method SetVisible
Show or hide the window
(Overrides WindowSetVisible(Boolean).)
Public method ToString
Provide a string describing the object
(Overrides WindowToString.)
Public method WaitAndDispatchEvents
Wait for a new event and dispatch it to the corresponding event handler
(Inherited from Window.)
Protected method WaitEvent
Internal function to get the next event (blocking)
(Overrides WindowWaitEvent(Event).)
Top
See Also