Added automatic batching to improve performances
Moved the ConvertCoords function from RenderWindow to RenderTarget git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1221 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
1852614e16
commit
565172fc75
51 changed files with 2835 additions and 865 deletions
|
@ -104,18 +104,48 @@ namespace SFML
|
|||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Tell SFML to preserve external OpenGL states, at the expense of
|
||||
/// more CPU charge. Use this function if you don't want SFML
|
||||
/// to mess up your own OpenGL states (if any).
|
||||
/// Don't enable state preservation if not needed, as it will allow
|
||||
/// SFML to do internal optimizations and improve performances.
|
||||
/// This parameter is false by default
|
||||
/// Get the viewport of a view applied to this target
|
||||
/// </summary>
|
||||
/// <param name="preserve">True to preserve OpenGL states, false to let SFML optimize</param>
|
||||
/// <param name="view">Target view</param>
|
||||
/// <returns>Viewport rectangle, expressed in pixels in the current target</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public void PreserveOpenGLStates(bool preserve)
|
||||
public IntRect GetViewport(View view)
|
||||
{
|
||||
sfRenderImage_PreserveOpenGLStates(This, preserve);
|
||||
return sfRenderImage_GetViewport(This, view.This);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Convert a point in target coordinates into view coordinates
|
||||
/// This version uses the current view of the window
|
||||
/// </summary>
|
||||
/// <param name="x">X coordinate of the point to convert, relative to the target</param>
|
||||
/// <param name="y">Y coordinate of the point to convert, relative to the target</param>
|
||||
/// <returns>Converted point</returns>
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
public Vector2 ConvertCoords(uint x, uint y)
|
||||
{
|
||||
return ConvertCoords(x, y, CurrentView);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Convert a point in target coordinates into view coordinates
|
||||
/// This version uses the given view
|
||||
/// </summary>
|
||||
/// <param name="x">X coordinate of the point to convert, relative to the target</param>
|
||||
/// <param name="y">Y coordinate of the point to convert, relative to the target</param>
|
||||
/// <param name="view">Target view to convert the point to</param>
|
||||
/// <returns>Converted point</returns>
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
public Vector2 ConvertCoords(uint x, uint y, View view)
|
||||
{
|
||||
Vector2 point;
|
||||
sfRenderImage_ConvertCoords(This, x, y, out point.X, out point.Y, view.This);
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -237,7 +267,10 @@ namespace SFML
|
|||
static extern IntPtr sfRenderImage_GetDefaultView(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfRenderImage_PreserveOpenGLStates(IntPtr This, bool Preserve);
|
||||
static extern IntRect sfRenderImage_GetViewport(IntPtr This, IntPtr TargetView);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfRenderImage_ConvertCoords(IntPtr This, uint WindowX, uint WindowY, out float ViewX, out float ViewY, IntPtr TargetView);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfRenderImage_DrawPostFX(IntPtr This, IntPtr PostFx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue