RenderWindow.MapPixelToCoords Method (Vector2i, View)

SFML.Net

RenderWindowMapPixelToCoords Method (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.

Namespace: SFML.Graphics
Assembly: sfmlnet-graphics-2 (in sfmlnet-graphics-2.dll) Version: 2.2.0.0 (2.2.0)
Syntax
public Vector2f MapPixelToCoords(
	Vector2i point,
	View view
)
Public Function MapPixelToCoords ( 
	point As Vector2i,
	view As View
) As Vector2f
public:
virtual Vector2f MapPixelToCoords(
	Vector2i point, 
	View^ view
) sealed
abstract MapPixelToCoords : 
        point : Vector2i * 
        view : View -> Vector2f 
override MapPixelToCoords : 
        point : Vector2i * 
        view : View -> Vector2f 

Parameters

point
Type: SFML.SystemVector2i
Pixel to convert
view
Type: SFML.GraphicsView
The view to use for converting the point

Return Value

Type: Vector2f
The converted point, in "world" coordinates

Implements

RenderTargetMapPixelToCoords(Vector2i, View)
See Also