From afbe386bca86419e65b68231e8f492afcafe3d17 Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Sun, 14 Nov 2010 15:23:19 +0000 Subject: [PATCH] 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 --- bindings/dotnet/src/Graphics/RenderImage.cs | 25 +++++++++++++------- bindings/dotnet/src/Graphics/RenderTarget.cs | 13 ++++++++-- bindings/dotnet/src/Graphics/RenderWindow.cs | 25 +++++++++++++------- 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/bindings/dotnet/src/Graphics/RenderImage.cs b/bindings/dotnet/src/Graphics/RenderImage.cs index 6dac3f4a..d53c87db 100644 --- a/bindings/dotnet/src/Graphics/RenderImage.cs +++ b/bindings/dotnet/src/Graphics/RenderImage.cs @@ -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 //////////////////////////////////////////////////////////// /// - /// Current view active in the render image + /// Return the current active view /// + /// The current view //////////////////////////////////////////////////////////// - public View CurrentView + public View GetView() { - get {return myCurrentView;} - set {myCurrentView = value; sfRenderImage_SetView(This, value.This);} + return new View(sfRenderImage_GetView(This)); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the current active view + /// + /// New view + //////////////////////////////////////////////////////////// + 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; diff --git a/bindings/dotnet/src/Graphics/RenderTarget.cs b/bindings/dotnet/src/Graphics/RenderTarget.cs index bcbfa489..0961e4cc 100644 --- a/bindings/dotnet/src/Graphics/RenderTarget.cs +++ b/bindings/dotnet/src/Graphics/RenderTarget.cs @@ -37,10 +37,19 @@ namespace SFML //////////////////////////////////////////////////////////// /// - /// Current view active in the window + /// Return the current active view /// + /// The current view //////////////////////////////////////////////////////////// - View CurrentView {get;} + View GetView(); + + //////////////////////////////////////////////////////////// + /// + /// Change the current active view + /// + /// New view + //////////////////////////////////////////////////////////// + void SetView(View view); //////////////////////////////////////////////////////////// /// diff --git a/bindings/dotnet/src/Graphics/RenderWindow.cs b/bindings/dotnet/src/Graphics/RenderWindow.cs index 7251c685..114d7897 100644 --- a/bindings/dotnet/src/Graphics/RenderWindow.cs +++ b/bindings/dotnet/src/Graphics/RenderWindow.cs @@ -316,13 +316,24 @@ namespace SFML //////////////////////////////////////////////////////////// /// - /// Current view active in the window + /// Return the current active view /// + /// The current view //////////////////////////////////////////////////////////// - public View CurrentView + public View GetView() { - get {return myCurrentView;} - set {myCurrentView = value; sfRenderWindow_SetView(This, value.This);} + return new View(sfRenderWindow_GetView(This)); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the current active view + /// + /// New view + //////////////////////////////////////////////////////////// + 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