Fixed the current view management in RenderWindow and RenderImage, in SFML.Net

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1638 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-11-14 15:23:19 +00:00
parent d69903765b
commit afbe386bca
3 changed files with 45 additions and 18 deletions

View File

@ -43,7 +43,6 @@ namespace SFML
{
myDefaultView = new View(sfRenderImage_GetDefaultView(This));
myImage = new Image(sfRenderImage_GetImage(This));
myCurrentView = myDefaultView;
GC.SuppressFinalize(myDefaultView);
GC.SuppressFinalize(myImage);
}
@ -93,13 +92,24 @@ namespace SFML
////////////////////////////////////////////////////////////
/// <summary>
/// Current view active in the render image
/// Return the current active view
/// </summary>
/// <returns>The current view</returns>
////////////////////////////////////////////////////////////
public View CurrentView
public View GetView()
{
get {return myCurrentView;}
set {myCurrentView = value; sfRenderImage_SetView(This, value.This);}
return new View(sfRenderImage_GetView(This));
}
////////////////////////////////////////////////////////////
/// <summary>
/// Change the current active view
/// </summary>
/// <param name="view">New view</param>
////////////////////////////////////////////////////////////
public void SetView(View view)
{
sfRenderImage_SetView(This, view.This);
}
////////////////////////////////////////////////////////////
@ -126,7 +136,7 @@ namespace SFML
////////////////////////////////////////////////////////////
public Vector2 ConvertCoords(uint x, uint y)
{
return ConvertCoords(x, y, CurrentView);
return ConvertCoords(x, y, GetView());
}
////////////////////////////////////////////////////////////
@ -255,7 +265,7 @@ namespace SFML
" Height(" + Height + ")" +
" Image(" + Image + ")" +
" DefaultView(" + DefaultView + ")" +
" CurrentView(" + CurrentView + ")";
" View(" + GetView() + ")";
}
////////////////////////////////////////////////////////////
@ -281,7 +291,6 @@ namespace SFML
Context.Global.SetActive(false);
}
private View myCurrentView = null;
private View myDefaultView = null;
private Image myImage = null;

View File

@ -37,10 +37,19 @@ namespace SFML
////////////////////////////////////////////////////////////
/// <summary>
/// Current view active in the window
/// Return the current active view
/// </summary>
/// <returns>The current view</returns>
////////////////////////////////////////////////////////////
View CurrentView {get;}
View GetView();
////////////////////////////////////////////////////////////
/// <summary>
/// Change the current active view
/// </summary>
/// <param name="view">New view</param>
////////////////////////////////////////////////////////////
void SetView(View view);
////////////////////////////////////////////////////////////
/// <summary>

View File

@ -316,13 +316,24 @@ namespace SFML
////////////////////////////////////////////////////////////
/// <summary>
/// Current view active in the window
/// Return the current active view
/// </summary>
/// <returns>The current view</returns>
////////////////////////////////////////////////////////////
public View CurrentView
public View GetView()
{
get {return myCurrentView;}
set {myCurrentView = value; sfRenderWindow_SetView(This, value.This);}
return new View(sfRenderWindow_GetView(This));
}
////////////////////////////////////////////////////////////
/// <summary>
/// Change the current active view
/// </summary>
/// <param name="view">New view</param>
////////////////////////////////////////////////////////////
public void SetView(View view)
{
sfRenderWindow_SetView(This, view.This);
}
////////////////////////////////////////////////////////////
@ -349,7 +360,7 @@ namespace SFML
////////////////////////////////////////////////////////////
public Vector2 ConvertCoords(uint x, uint y)
{
return ConvertCoords(x, y, CurrentView);
return ConvertCoords(x, y, GetView());
}
////////////////////////////////////////////////////////////
@ -448,7 +459,7 @@ namespace SFML
" Height(" + Height + ")" +
" Settings(" + Settings + ")" +
" DefaultView(" + DefaultView + ")" +
" CurrentView(" + CurrentView + ")";
" View(" + GetView() + ")";
}
////////////////////////////////////////////////////////////
@ -498,11 +509,9 @@ namespace SFML
{
myInput = new Input(sfRenderWindow_GetInput(This));
myDefaultView = new View(sfRenderWindow_GetDefaultView(This));
myCurrentView = myDefaultView;
GC.SuppressFinalize(myDefaultView);
}
private View myCurrentView = null;
private View myDefaultView = null;
#region Imports