RenderWindow Class

SFML.Net

RenderWindow Class
Simple wrapper for Window that allows easy 2D rendering
Inheritance Hierarchy
SystemObject  SFMLObjectBase
    SFML.WindowWindow
      SFML.GraphicsRenderWindow

Namespace: SFML.Graphics
Assembly: sfmlnet-graphics-2 (in sfmlnet-graphics-2.dll) Version: 2.2.0.0 (2.2.0)
Syntax
public class RenderWindow : Window, 
	RenderTarget
Public Class RenderWindow
	Inherits Window
	Implements RenderTarget
public ref class RenderWindow : public Window, 
	RenderTarget
type RenderWindow =  
    class
        inherit Window
        interface RenderTarget
    end

The RenderWindow type exposes the following members.

Constructors
  NameDescription
Public methodRenderWindow(IntPtr)
Create the window from an existing control with default creation settings
Public methodRenderWindow(IntPtr, ContextSettings)
Create the window from an existing control
Public methodRenderWindow(VideoMode, String)
Create the window with default style and creation settings
Public methodRenderWindow(VideoMode, String, Styles)
Create the window with default creation settings
Public methodRenderWindow(VideoMode, String, Styles, ContextSettings)
Create the window
Top
Methods
  NameDescription
Public methodCapture
Capture the current contents of the window into an image
Public methodClear
Clear the entire window with black color
Public methodClear(Color)
Clear the entire window with a single color
Public methodClose
Close (destroy) the window. The Window instance remains valid and you can call Create to recreate the window
(Overrides WindowClose.)
Protected methodDestroy
Handle the destruction of the object
(Overrides WindowDestroy(Boolean).)
Public methodDispatchEvents
Call the event handlers for each pending event
(Inherited from Window.)
Public methodDisplay
Display the window on screen
(Overrides WindowDisplay.)
Public methodDispose
Explicitely dispose the object
(Inherited from ObjectBase.)
Public methodDraw(Drawable)
Draw a drawable object to the render-target, with default render states
Public methodDraw(Drawable, RenderStates)
Draw a drawable object to the render-target
Public methodDraw(Vertex, PrimitiveType)
Draw primitives defined by an array of vertices, with default render states
Public methodDraw(Vertex, PrimitiveType, RenderStates)
Draw primitives defined by an array of vertices
Public methodDraw(Vertex, UInt32, UInt32, PrimitiveType)
Draw primitives defined by a sub-array of vertices, with default render states
Public methodDraw(Vertex, UInt32, UInt32, PrimitiveType, RenderStates)
Draw primitives defined by a sub-array of vertices
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Dispose the object
(Inherited from ObjectBase.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetView
Return the current active view
Public methodGetViewport
Get the viewport of a view applied to this target
Public methodHasFocus
Check whether the window has the input focus
(Overrides WindowHasFocus.)
Protected methodInternalGetMousePosition
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 methodInternalGetTouchPosition
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 methodInternalSetMousePosition
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 methodMapCoordsToPixel(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 methodMapCoordsToPixel(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 methodMapPixelToCoords(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 methodMapPixelToCoords(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 methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodPollEvent
Internal function to get the next event
(Overrides WindowPollEvent(Event).)
Public methodPopGLStates
Restore the previously saved OpenGL render states and matrices. See the description of PushGLStates to get a detailed description of these functions.
Public methodPushGLStates
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 methodRequestFocus
Request the current window to be made the active foreground window
(Overrides WindowRequestFocus.)
Public methodResetGLStates
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 methodSetActive
Activate the window as the current target for rendering
(Inherited from Window.)
Public methodSetActive(Boolean)
Activate of deactivate the window as the current target for rendering
(Overrides WindowSetActive(Boolean).)
Public methodSetFramerateLimit
Limit the framerate to a maximum fixed frequency
(Overrides WindowSetFramerateLimit(UInt32).)
Public methodSetIcon
Change the window's icon
(Overrides WindowSetIcon(UInt32, UInt32, Byte).)
Public methodSetJoystickThreshold
Change the joystick threshold, ie. the value below which no move event will be generated
(Overrides WindowSetJoystickThreshold(Single).)
Public methodSetKeyRepeatEnabled
Enable or disable automatic key-repeat. Automatic key-repeat is enabled by default
(Overrides WindowSetKeyRepeatEnabled(Boolean).)
Public methodSetMouseCursorVisible
Show or hide the mouse cursor
(Overrides WindowSetMouseCursorVisible(Boolean).)
Public methodSetTitle
Change the title of the window
(Overrides WindowSetTitle(String).)
Public methodSetVerticalSyncEnabled
Enable / disable vertical synchronization
(Overrides WindowSetVerticalSyncEnabled(Boolean).)
Public methodSetView
Change the current active view
Public methodSetVisible
Show or hide the window
(Overrides WindowSetVisible(Boolean).)
Public methodToString
Provide a string describing the object
(Overrides WindowToString.)
Public methodWaitAndDispatchEvents
Wait for a new event and dispatch it to the corresponding event handler
(Inherited from Window.)
Protected methodWaitEvent
Internal function to get the next event (blocking)
(Overrides WindowWaitEvent(Event).)
Top
Properties
  NameDescription
Public propertyCPointer
Access to the internal pointer of the object. For internal use only
(Inherited from ObjectBase.)
Public propertyDefaultView
Default view of the window
Public propertyIsOpen
Tell whether or not the window is opened (ie. has been created). Note that a hidden window (Show(false)) will still return true
(Overrides WindowIsOpen.)
Public propertyPosition
Position of the window
(Overrides WindowPosition.)
Public propertySettings
Creation settings of the window
(Overrides WindowSettings.)
Public propertySize
Size of the rendering region of the window
(Overrides WindowSize.)
Public propertySystemHandle
OS-specific handle of the window
(Overrides WindowSystemHandle.)
Top
Events
  NameDescription
Public eventClosed
Event handler for the Closed event
(Inherited from Window.)
Public eventGainedFocus
Event handler for the GainedFocus event
(Inherited from Window.)
Public eventJoystickButtonPressed
Event handler for the JoystickButtonPressed event
(Inherited from Window.)
Public eventJoystickButtonReleased
Event handler for the JoystickButtonReleased event
(Inherited from Window.)
Public eventJoystickConnected
Event handler for the JoystickConnected event
(Inherited from Window.)
Public eventJoystickDisconnected
Event handler for the JoystickDisconnected event
(Inherited from Window.)
Public eventJoystickMoved
Event handler for the JoystickMoved event
(Inherited from Window.)
Public eventKeyPressed
Event handler for the KeyPressed event
(Inherited from Window.)
Public eventKeyReleased
Event handler for the KeyReleased event
(Inherited from Window.)
Public eventLostFocus
Event handler for the LostFocus event
(Inherited from Window.)
Public eventMouseButtonPressed
Event handler for the MouseButtonPressed event
(Inherited from Window.)
Public eventMouseButtonReleased
Event handler for the MouseButtonReleased event
(Inherited from Window.)
Public eventMouseEntered
Event handler for the MouseEntered event
(Inherited from Window.)
Public eventMouseLeft
Event handler for the MouseLeft event
(Inherited from Window.)
Public eventMouseMoved
Event handler for the MouseMoved event
(Inherited from Window.)
Public eventMouseWheelMoved
Event handler for the MouseWheelMoved event
(Inherited from Window.)
Public eventResized
Event handler for the Resized event
(Inherited from Window.)
Public eventSensorChanged
Event handler for the SensorChanged event
(Inherited from Window.)
Public eventTextEntered
Event handler for the TextEntered event
(Inherited from Window.)
Public eventTouchBegan
Event handler for the TouchBegan event
(Inherited from Window.)
Public eventTouchEnded
Event handler for the TouchEnded event
(Inherited from Window.)
Public eventTouchMoved
Event handler for the TouchMoved event
(Inherited from Window.)
Top
See Also