diff --git a/bindings/dotnet/build/build-all-windows.bat b/bindings/dotnet/build/build-all-windows.bat deleted file mode 100644 index c70c7765a..000000000 --- a/bindings/dotnet/build/build-all-windows.bat +++ /dev/null @@ -1,10 +0,0 @@ -@echo off - -echo Compiling Visual C++ 2008 libraries... -cd vc2008\batch-build -call build.bat - -cd ..\.. - -echo Done -pause diff --git a/bindings/dotnet/build/vc2008/SFML.net.sln b/bindings/dotnet/build/vc2008/SFML.net.sln deleted file mode 100644 index f429856a9..000000000 --- a/bindings/dotnet/build/vc2008/SFML.net.sln +++ /dev/null @@ -1,96 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfml-window", "..\..\src\Window\sfml-window.csproj", "{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfml-graphics", "..\..\src\Graphics\sfml-graphics.csproj", "{46786269-57B9-48E7-AA4F-8F4D84609FE6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfml-audio", "..\..\src\Audio\sfml-audio.csproj", "{0B202C4D-A457-47FE-84A3-031DD878C6BE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "opengl", "..\..\examples\opengl\opengl.csproj", "{160AE11E-138A-4B77-9642-EA74F9A79B4D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "window", "..\..\examples\window\window.csproj", "{C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sound", "..\..\examples\sound\sound.csproj", "{16E177F3-A0FF-4091-8521-562E0EBAA3AB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sound_capture", "..\..\examples\sound_capture\sound_capture.csproj", "{F2F48990-F81E-41BA-AD01-168F6178C807}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "shader", "..\..\examples\shader\shader.csproj", "{9D4738F7-34EA-433A-A765-AF85A52A174D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|x64.ActiveCfg = Debug|x64 - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|x64.Build.0 = Debug|x64 - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|x86.ActiveCfg = Debug|x86 - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|x86.Build.0 = Debug|x86 - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|x64.ActiveCfg = Release|x64 - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|x64.Build.0 = Release|x64 - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|x86.ActiveCfg = Release|x64 - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|x86.Build.0 = Release|x64 - {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|x64.ActiveCfg = Debug|x64 - {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|x64.Build.0 = Debug|x64 - {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|x86.ActiveCfg = Debug|x86 - {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|x86.Build.0 = Debug|x86 - {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|x64.ActiveCfg = Release|x64 - {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|x64.Build.0 = Release|x64 - {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|x86.ActiveCfg = Release|x64 - {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|x86.Build.0 = Release|x64 - {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Debug|x64.ActiveCfg = Debug|x64 - {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Debug|x64.Build.0 = Debug|x64 - {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Debug|x86.ActiveCfg = Debug|x86 - {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Debug|x86.Build.0 = Debug|x86 - {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Release|x64.ActiveCfg = Release|x64 - {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Release|x64.Build.0 = Release|x64 - {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Release|x86.ActiveCfg = Release|x64 - {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Release|x86.Build.0 = Release|x64 - {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Debug|x64.ActiveCfg = Debug|x64 - {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Debug|x64.Build.0 = Debug|x64 - {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Debug|x86.ActiveCfg = Debug|x86 - {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Debug|x86.Build.0 = Debug|x86 - {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Release|x64.ActiveCfg = Release|x64 - {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Release|x64.Build.0 = Release|x64 - {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Release|x86.ActiveCfg = Release|x64 - {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Release|x86.Build.0 = Release|x64 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Debug|x64.ActiveCfg = Debug|x64 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Debug|x64.Build.0 = Debug|x64 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Debug|x86.ActiveCfg = Debug|x86 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Debug|x86.Build.0 = Debug|x86 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Release|x64.ActiveCfg = Release|x64 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Release|x64.Build.0 = Release|x64 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Release|x86.ActiveCfg = Release|x64 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Release|x86.Build.0 = Release|x64 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Debug|x64.ActiveCfg = Debug|x64 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Debug|x64.Build.0 = Debug|x64 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Debug|x86.ActiveCfg = Debug|x86 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Debug|x86.Build.0 = Debug|x86 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Release|x64.ActiveCfg = Release|x64 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Release|x64.Build.0 = Release|x64 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Release|x86.ActiveCfg = Release|x64 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Release|x86.Build.0 = Release|x64 - {F2F48990-F81E-41BA-AD01-168F6178C807}.Debug|x64.ActiveCfg = Debug|x64 - {F2F48990-F81E-41BA-AD01-168F6178C807}.Debug|x64.Build.0 = Debug|x64 - {F2F48990-F81E-41BA-AD01-168F6178C807}.Debug|x86.ActiveCfg = Debug|x86 - {F2F48990-F81E-41BA-AD01-168F6178C807}.Debug|x86.Build.0 = Debug|x86 - {F2F48990-F81E-41BA-AD01-168F6178C807}.Release|x64.ActiveCfg = Release|x64 - {F2F48990-F81E-41BA-AD01-168F6178C807}.Release|x64.Build.0 = Release|x64 - {F2F48990-F81E-41BA-AD01-168F6178C807}.Release|x86.ActiveCfg = Release|x64 - {F2F48990-F81E-41BA-AD01-168F6178C807}.Release|x86.Build.0 = Release|x64 - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|x64.ActiveCfg = Debug|x64 - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|x64.Build.0 = Debug|x64 - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|x86.ActiveCfg = Debug|x86 - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|x86.Build.0 = Debug|x86 - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|x64.ActiveCfg = Release|x64 - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|x64.Build.0 = Release|x64 - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|x86.ActiveCfg = Release|x64 - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|x86.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/bindings/dotnet/build/vc2008/batch-build/build.bat b/bindings/dotnet/build/vc2008/batch-build/build.bat deleted file mode 100644 index 7a18695be..000000000 --- a/bindings/dotnet/build/vc2008/batch-build/build.bat +++ /dev/null @@ -1,8 +0,0 @@ -@echo off - -set MSBUILD=%WINDIR%\Microsoft.NET\Framework\v3.5\msbuild - -echo Compiling release libraries... -%MSBUILD% ..\SFML.net.sln /verbosity:q /maxcpucount /target:sfml-window,sfml-graphics,sfml-audio /property:Configuration="Release" - -echo Done diff --git a/bindings/dotnet/doc/build/MainPage.html b/bindings/dotnet/doc/build/MainPage.html deleted file mode 100644 index 727d37899..000000000 --- a/bindings/dotnet/doc/build/MainPage.html +++ /dev/null @@ -1,71 +0,0 @@ -

Welcome

-

-Welcome to the official SFML.Net documentation. Here you will find a detailed -description of all the SFML.Net classes.
-If you are looking for tutorials, help or whatever, you can visit the official website -at www.sfml-dev.org. -

- -

Short example

-

-Here is a short example in C#, to show you how simple it is to use SFML.Net : -

- -
-using System;
-using SFML.Audio;
-using SFML.Window;
-using SFML.Graphics;
-
-namespace Example
-{
-    class Program
-    {
-        static void OnClose(object sender, EventArgs e)
-        {
-            // Close the window when OnClose event is received
-            RenderWindow window = (RenderWindow)sender;
-            window.Close();
-        }
-
-        static void Main(string[] args)
-        {
-            // Create the main window
-            RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window");
-            window.Closed += new EventHandler(OnClose);
-
-            // Load a sprite to display
-            Image  image  = new Image("cute_image.jpg");
-            Sprite sprite = new Sprite(image);
-
-            // Create a graphical string to display
-            Font font = new Font("arial.ttf");
-            Text text = new Text("Hello SFML.Net", font);
-
-            // Load a music to play
-            Music music = new Music("nice_music.ogg");
-            music.Play();
-
-            // Start the game loop
-            while (window.IsOpened())
-            {
-                // Process events
-                window.DispatchEvents();
-
-                // Clear screen
-                window.Clear();
-
-                // Draw the sprite
-                window.Draw(sprite);
-
-                // Draw the string
-                window.Draw(text);
-
-                // Update the window
-                window.Display();
-            }
-        }
-    }
-}
-
- diff --git a/bindings/dotnet/doc/build/SFML.ndoc b/bindings/dotnet/doc/build/SFML.ndoc deleted file mode 100644 index 71518f8b4..000000000 --- a/bindings/dotnet/doc/build/SFML.ndoc +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bindings/dotnet/examples/opengl/OpenGL.cs b/bindings/dotnet/examples/opengl/OpenGL.cs deleted file mode 100644 index 4eadc92a6..000000000 --- a/bindings/dotnet/examples/opengl/OpenGL.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System; -using SFML; -using SFML.Graphics; -using SFML.Window; -using Tao.OpenGl; - -namespace opengl -{ - static class Program - { - /// - /// The main entry point for the application. - /// - static void Main() - { - // Create main window - RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML.Net OpenGL", Styles.Default, new ContextSettings(32, 0)); - - // Setup event handlers - window.Closed += new EventHandler(OnClosed); - window.KeyPressed += new EventHandler(OnKeyPressed); - window.Resized += new EventHandler(OnResized); - - // Create a sprite for the background - Image backgroundImage = new Image("resources/background.jpg"); - Sprite background = new Sprite(backgroundImage); - - // Create a text to display - Text text = new Text("SFML / OpenGL demo"); - text.Position = new Vector2f(250.0F, 450.0F); - text.Color = new Color(255, 255, 255, 170); - - // Load an OpenGL texture. - // We could directly use a sf::Image as an OpenGL texture (with its Bind() member function), - // but here we want more control on it (generate mipmaps, ...) so we create a new one - int texture = 0; - using (Image image = new Image("resources/texture.jpg")) - { - Gl.glGenTextures(1, out texture); - Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture); - Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_RGBA, (int)image.Width, (int)image.Height, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, image.Pixels); - Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR); - Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR); - } - - // Enable Z-buffer read and write - Gl.glEnable(Gl.GL_DEPTH_TEST); - Gl.glDepthMask(Gl.GL_TRUE); - Gl.glClearDepth(1.0F); - - // Setup a perspective projection - Gl.glMatrixMode(Gl.GL_PROJECTION); - Gl.glLoadIdentity(); - Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F); - - // Bind our texture - Gl.glEnable(Gl.GL_TEXTURE_2D); - Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture); - Gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - float time = 0.0F; - - // Start game loop - while (window.IsOpened()) - { - // Process events - window.DispatchEvents(); - - // Clear the window - window.Clear(); - - // Draw background - window.SaveGLStates(); - window.Draw(background); - window.RestoreGLStates(); - - // Activate the window before using OpenGL commands. - // This is useless here because we have only one window which is - // always the active one, but don't forget it if you use multiple windows - window.SetActive(); - - // Clear depth buffer - Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT); - - // We get the position of the mouse cursor, so that we can move the box accordingly - float x = window.GetCursorPosition().X * 200.0F / window.Width - 100.0F; - float y = -window.GetCursorPosition().Y * 200.0F / window.Height + 100.0F; - - // Apply some transformations - time += window.GetFrameTime() / 1000.0F; - Gl.glMatrixMode(Gl.GL_MODELVIEW); - Gl.glLoadIdentity(); - Gl.glTranslatef(x, y, -100.0F); - Gl.glRotatef(time * 50, 1.0F, 0.0F, 0.0F); - Gl.glRotatef(time * 30, 0.0F, 1.0F, 0.0F); - Gl.glRotatef(time * 90, 0.0F, 0.0F, 1.0F); - - // Draw a cube - float size = 20.0F; - Gl.glBegin(Gl.GL_QUADS); - - Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, -size, -size); - Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size, size, -size); - Gl.glTexCoord2f(1, 1); Gl.glVertex3f( size, size, -size); - Gl.glTexCoord2f(1, 0); Gl.glVertex3f( size, -size, -size); - - Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, -size, size); - Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size, size, size); - Gl.glTexCoord2f(1, 1); Gl.glVertex3f( size, size, size); - Gl.glTexCoord2f(1, 0); Gl.glVertex3f( size, -size, size); - - Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, -size, -size); - Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size, size, -size); - Gl.glTexCoord2f(1, 1); Gl.glVertex3f(-size, size, size); - Gl.glTexCoord2f(1, 0); Gl.glVertex3f(-size, -size, size); - - Gl.glTexCoord2f(0, 0); Gl.glVertex3f(size, -size, -size); - Gl.glTexCoord2f(0, 1); Gl.glVertex3f(size, size, -size); - Gl.glTexCoord2f(1, 1); Gl.glVertex3f(size, size, size); - Gl.glTexCoord2f(1, 0); Gl.glVertex3f(size, -size, size); - - Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size, -size, size); - Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, -size, -size); - Gl.glTexCoord2f(1, 0); Gl.glVertex3f( size, -size, -size); - Gl.glTexCoord2f(1, 1); Gl.glVertex3f( size, -size, size); - - Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-size, size, size); - Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-size, size, -size); - Gl.glTexCoord2f(1, 0); Gl.glVertex3f( size, size, -size); - Gl.glTexCoord2f(1, 1); Gl.glVertex3f( size, size, size); - - Gl.glEnd(); - - // Draw some text on top of our OpenGL object - window.SaveGLStates(); - window.Draw(text); - window.RestoreGLStates(); - - // Finally, display the rendered frame on screen - window.Display(); - } - - // Don't forget to destroy our texture - Gl.glDeleteTextures(1, ref texture); - } - - /// - /// Function called when the window is closed - /// - static void OnClosed(object sender, EventArgs e) - { - RenderWindow window = (RenderWindow)sender; - window.Close(); - } - - /// - /// Function called when a key is pressed - /// - static void OnKeyPressed(object sender, KeyEventArgs e) - { - RenderWindow window = (RenderWindow)sender; - if (e.Code == Keyboard.Key.Escape) - window.Close(); - } - - /// - /// Function called when the window is resized - /// - static void OnResized(object sender, SizeEventArgs e) - { - Gl.glViewport(0, 0, (int)e.Width, (int)e.Height); - } - } -} diff --git a/bindings/dotnet/examples/opengl/opengl.csproj b/bindings/dotnet/examples/opengl/opengl.csproj deleted file mode 100644 index 9ec786dd0..000000000 --- a/bindings/dotnet/examples/opengl/opengl.csproj +++ /dev/null @@ -1,80 +0,0 @@ - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {160AE11E-138A-4B77-9642-EA74F9A79B4D} - WinExe - Properties - opengl - opengl - opengl.Program - - - 2.0 - - - - - true - .\ - DEBUG;TRACE - full - x86 - prompt - - - .\ - TRACE - true - pdbonly - x86 - prompt - - - true - .\ - DEBUG;TRACE - full - x64 - prompt - - - .\ - TRACE - true - pdbonly - x64 - prompt - - - - {46786269-57B9-48E7-AA4F-8F4D84609FE6} - sfml-graphics - - - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} - sfml-window - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bindings/dotnet/examples/opengl/resources/background.jpg b/bindings/dotnet/examples/opengl/resources/background.jpg deleted file mode 100644 index 20724fa92..000000000 Binary files a/bindings/dotnet/examples/opengl/resources/background.jpg and /dev/null differ diff --git a/bindings/dotnet/examples/opengl/resources/texture.jpg b/bindings/dotnet/examples/opengl/resources/texture.jpg deleted file mode 100644 index 6cf7528eb..000000000 Binary files a/bindings/dotnet/examples/opengl/resources/texture.jpg and /dev/null differ diff --git a/bindings/dotnet/examples/shader/Shader.cs b/bindings/dotnet/examples/shader/Shader.cs deleted file mode 100644 index 646e1a806..000000000 --- a/bindings/dotnet/examples/shader/Shader.cs +++ /dev/null @@ -1,247 +0,0 @@ -using System; -using System.Collections.Generic; -using SFML; -using SFML.Graphics; -using SFML.Window; - -namespace shader -{ - /// - /// A class to simplify shader selection - /// - class ShaderSelector - { - // Constructor - public ShaderSelector(Dictionary owner) - { - myOwner = owner; - myIterator = owner.GetEnumerator(); - myIterator.MoveNext(); - } - - // Select the next shader - public void GotoNext() - { - if (myIterator.MoveNext() == false) - { - myIterator = myOwner.GetEnumerator(); - myIterator.MoveNext(); - } - } - - // Update the shader parameters - public void Update(float x, float y) - { - if (myIterator.Current.Key == "blur") myIterator.Current.Value.SetParameter("offset", x * y * 0.05f); - else if (myIterator.Current.Key == "colorize") myIterator.Current.Value.SetParameter("color", 0.3f, x, y); - else if (myIterator.Current.Key == "fisheye") myIterator.Current.Value.SetParameter("mouse", x, y); - else if (myIterator.Current.Key == "wave") myIterator.Current.Value.SetParameter("offset", x, y); - else if (myIterator.Current.Key == "pixelate") myIterator.Current.Value.SetParameter("mouse", x, y); - } - - // Get the name of the current shader - public string Name - { - get {return myIterator.Current.Key;} - } - - // Get the current shader - public Shader Shader - { - get {return myIterator.Current.Value;} - } - - private Dictionary myOwner; - private Dictionary.Enumerator myIterator; - }; - - static class Program - { - private static Dictionary shaders; - private static ShaderSelector backgroundShader; - private static ShaderSelector entityShader; - private static ShaderSelector globalShader; - private static Text shaderText; - - /// - /// The main entry point for the application. - /// - static void Main() - { - // Create the main window - RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML.Net Shader"); - - // Setup event handlers - window.Closed += new EventHandler(OnClosed); - window.KeyPressed += new EventHandler(OnKeyPressed); - - // Check that the system can use shaders - if (Shader.IsAvailable == false) - { - DisplayError(window); - return; - } - - // Create the render image - RenderImage image = new RenderImage(window.Width, window.Height); - - // Load a background image to display - Sprite background = new Sprite(new Image("resources/background.jpg")); - background.Image.Smooth = false; - - // Load a sprite which we'll move into the scene - Sprite entity = new Sprite(new Image("resources/sprite.png")); - - // Load the text font - Font font = new Font("resources/arial.ttf"); - - // Load the image needed for the wave effect - Image waveImage = new Image("resources/wave.jpg"); - - // Load all effects - shaders = new Dictionary(); - shaders["nothing"] = new Shader("resources/nothing.sfx"); - shaders["blur"] = new Shader("resources/blur.sfx"); - shaders["colorize"] = new Shader("resources/colorize.sfx"); - shaders["fisheye"] = new Shader("resources/fisheye.sfx"); - shaders["wave"] = new Shader("resources/wave.sfx"); - shaders["pixelate"] = new Shader("resources/pixelate.sfx"); - backgroundShader = new ShaderSelector(shaders); - entityShader = new ShaderSelector(shaders); - globalShader = new ShaderSelector(shaders); - - // Do specific initializations - shaders["nothing"].SetCurrentTexture("texture"); - shaders["blur"].SetCurrentTexture("texture"); - shaders["blur"].SetParameter("offset", 0.0F); - shaders["colorize"].SetCurrentTexture("texture"); - shaders["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F); - shaders["fisheye"].SetCurrentTexture("texture"); - shaders["wave"].SetCurrentTexture("texture"); - shaders["wave"].SetTexture("wave", waveImage); - shaders["pixelate"].SetCurrentTexture("texture"); - - // Define a string for displaying current effect description - shaderText = new Text(); - shaderText.Font = font; - shaderText.CharacterSize = 20; - shaderText.Position = new Vector2f(5.0F, 0.0F); - shaderText.Color = new Color(250, 100, 30); - shaderText.DisplayedString = "Background shader: \"" + backgroundShader.Name + "\"\n" + - "Flower shader: \"" + entityShader.Name + "\"\n" + - "Global shader: \"" + globalShader.Name + "\"\n"; - - // Define a string for displaying help - Text infoText = new Text(); - infoText.Font = font; - infoText.CharacterSize = 20; - infoText.Position = new Vector2f(5.0F, 500.0F); - infoText.Color = new Color(250, 100, 30); - infoText.DisplayedString = "Move your mouse to change the shaders' parameters\n" + - "Press numpad 1 to change the background shader\n" + - "Press numpad 2 to change the flower shader\n" + - "Press numpad 3 to change the global shader"; - - // Start the game loop - float time = 0.0F; - while (window.IsOpened()) - { - // Process events - window.DispatchEvents(); - - // Get the mouse position in the range [0, 1] - float x = window.GetCursorPosition().X / (float)window.Width; - float y = window.GetCursorPosition().Y / (float)window.Height; - - // Update the shaders - backgroundShader.Update(x, y); - entityShader.Update(x, y); - globalShader.Update(x, y); - - // Animate the sprite - time += window.GetFrameTime() / 1000.0F; - float entityX = (float)(Math.Cos(time * 1.3) + 1.2) * 300; - float entityY = (float)(Math.Cos(time * 0.8) + 1.2) * 200; - entity.Position = new Vector2f(entityX, entityY); - entity.Rotation = time * 100; - - // Draw the background and the moving entity to the render image - image.Draw(background, backgroundShader.Shader); - image.Draw(entity, entityShader.Shader); - image.Display(); - - // Draw the contents of the render image to the window - window.Draw(new Sprite(image.Image), globalShader.Shader); - - // Draw interface texts - window.Draw(shaderText); - window.Draw(infoText); - - // Finally, display the rendered frame on screen - window.Display(); - } - } - - /// - /// Fonction called when the post-effects are not supported ; - /// Display an error message and wait until the user exits - /// - private static void DisplayError(RenderWindow window) - { - // Define a string for displaying the error message - Text error = new Text("Sorry, your system doesn't support shaders"); - error.Position = new Vector2f(100.0F, 250.0F); - error.Color = new Color(200, 100, 150); - - // Start the game loop - while (window.IsOpened()) - { - // Process events - window.DispatchEvents(); - - // Clear the window - window.Clear(); - - // Draw the error message - window.Draw(error); - - // Finally, display the rendered frame on screen - window.Display(); - } - } - - /// - /// Function called when the window is closed - /// - static void OnClosed(object sender, EventArgs e) - { - RenderWindow window = (RenderWindow)sender; - window.Close(); - } - - /// - /// Function called when a key is pressed - /// - static void OnKeyPressed(object sender, KeyEventArgs e) - { - RenderWindow window = (RenderWindow)sender; - - // Escape key : exit - if (e.Code == Keyboard.Key.Escape) - window.Close(); - - // Numpad : switch effect - switch (e.Code) - { - case Keyboard.Key.Numpad1: backgroundShader.GotoNext(); break; - case Keyboard.Key.Numpad2: entityShader.GotoNext(); break; - case Keyboard.Key.Numpad3: globalShader.GotoNext(); break; - } - - // Update the text - shaderText.DisplayedString = "Background shader: \"" + backgroundShader.Name + "\"\n" + - "Flower shader: \"" + entityShader.Name + "\"\n" + - "Global shader: \"" + globalShader.Name + "\"\n"; - } - } -} diff --git a/bindings/dotnet/examples/shader/resources/arial.ttf b/bindings/dotnet/examples/shader/resources/arial.ttf deleted file mode 100644 index ff0815cd8..000000000 Binary files a/bindings/dotnet/examples/shader/resources/arial.ttf and /dev/null differ diff --git a/bindings/dotnet/examples/shader/resources/background.jpg b/bindings/dotnet/examples/shader/resources/background.jpg deleted file mode 100644 index f37d7aed0..000000000 Binary files a/bindings/dotnet/examples/shader/resources/background.jpg and /dev/null differ diff --git a/bindings/dotnet/examples/shader/resources/blur.sfx b/bindings/dotnet/examples/shader/resources/blur.sfx deleted file mode 100644 index 4c9f11285..000000000 --- a/bindings/dotnet/examples/shader/resources/blur.sfx +++ /dev/null @@ -1,16 +0,0 @@ -uniform sampler2D texture; -uniform float offset; - -void main() -{ - vec2 offx = vec2(offset, 0.0); - vec2 offy = vec2(0.0, offset); - - vec4 c0 = texture2D(texture, gl_TexCoord[0].xy); - vec4 c1 = texture2D(texture, gl_TexCoord[0].xy - offy); - vec4 c2 = texture2D(texture, gl_TexCoord[0].xy + offy); - vec4 c3 = texture2D(texture, gl_TexCoord[0].xy - offx); - vec4 c4 = texture2D(texture, gl_TexCoord[0].xy + offx); - - gl_FragColor = gl_Color * (c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2); -} diff --git a/bindings/dotnet/examples/shader/resources/colorize.sfx b/bindings/dotnet/examples/shader/resources/colorize.sfx deleted file mode 100644 index eeb407c8e..000000000 --- a/bindings/dotnet/examples/shader/resources/colorize.sfx +++ /dev/null @@ -1,11 +0,0 @@ -uniform sampler2D texture; -uniform vec3 color; - -void main() -{ - vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * gl_Color; - float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11; - - gl_FragColor = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4; - gl_FragColor.a = pixel.a; -} diff --git a/bindings/dotnet/examples/shader/resources/fisheye.sfx b/bindings/dotnet/examples/shader/resources/fisheye.sfx deleted file mode 100644 index 97e3f8e45..000000000 --- a/bindings/dotnet/examples/shader/resources/fisheye.sfx +++ /dev/null @@ -1,13 +0,0 @@ -uniform sampler2D texture; -uniform vec2 mouse; - -void main() -{ - float len = distance(gl_TexCoord[0].xy, mouse) * 7.0; - - vec2 coords = gl_TexCoord[0].xy; - if (len < 1.0) - coords += (gl_TexCoord[0].xy - mouse) * len; - - gl_FragColor = texture2D(texture, coords) * gl_Color; -} diff --git a/bindings/dotnet/examples/shader/resources/nothing.sfx b/bindings/dotnet/examples/shader/resources/nothing.sfx deleted file mode 100644 index cde0473a7..000000000 --- a/bindings/dotnet/examples/shader/resources/nothing.sfx +++ /dev/null @@ -1,6 +0,0 @@ -uniform sampler2D texture; - -void main() -{ - gl_FragColor = texture2D(texture, gl_TexCoord[0].xy) * gl_Color; -} diff --git a/bindings/dotnet/examples/shader/resources/pixelate.sfx b/bindings/dotnet/examples/shader/resources/pixelate.sfx deleted file mode 100644 index 5b82f08d3..000000000 --- a/bindings/dotnet/examples/shader/resources/pixelate.sfx +++ /dev/null @@ -1,10 +0,0 @@ -uniform sampler2D texture; -uniform vec2 mouse; - -void main() -{ - float factor = 5 + 100 * length(mouse); - vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor; - - gl_FragColor = texture2D(texture, pos) * gl_Color; -} diff --git a/bindings/dotnet/examples/shader/resources/sprite.png b/bindings/dotnet/examples/shader/resources/sprite.png deleted file mode 100644 index 7b508f681..000000000 Binary files a/bindings/dotnet/examples/shader/resources/sprite.png and /dev/null differ diff --git a/bindings/dotnet/examples/shader/resources/wave.jpg b/bindings/dotnet/examples/shader/resources/wave.jpg deleted file mode 100644 index cd125b8c8..000000000 Binary files a/bindings/dotnet/examples/shader/resources/wave.jpg and /dev/null differ diff --git a/bindings/dotnet/examples/shader/resources/wave.sfx b/bindings/dotnet/examples/shader/resources/wave.sfx deleted file mode 100644 index 2d04763a0..000000000 --- a/bindings/dotnet/examples/shader/resources/wave.sfx +++ /dev/null @@ -1,12 +0,0 @@ -uniform sampler2D texture; -uniform sampler2D wave; -uniform vec2 offset; - -void main() -{ - vec2 texoffset = texture2D(wave, (gl_TexCoord[0].xy * offset).xy); - texoffset -= vec2(0.5, 0.5); - texoffset *= 0.05; - - gl_FragColor = texture2D(texture, gl_TexCoord[0].xy + texoffset) * gl_Color; -} diff --git a/bindings/dotnet/examples/shader/shader.csproj b/bindings/dotnet/examples/shader/shader.csproj deleted file mode 100644 index 7d0618616..000000000 --- a/bindings/dotnet/examples/shader/shader.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {9D4738F7-34EA-433A-A765-AF85A52A174D} - WinExe - Properties - shader - shader - - - 2.0 - - - shader.Program - - - true - .\ - DEBUG;TRACE - full - x86 - prompt - - - .\ - TRACE - true - pdbonly - x86 - prompt - - - true - .\ - DEBUG;TRACE - full - x64 - prompt - - - .\ - TRACE - true - pdbonly - x64 - prompt - - - - {46786269-57B9-48E7-AA4F-8F4D84609FE6} - sfml-graphics - - - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} - sfml-window - - - - - - - - - - - \ No newline at end of file diff --git a/bindings/dotnet/examples/sound/Sound.cs b/bindings/dotnet/examples/sound/Sound.cs deleted file mode 100644 index 952ebc14f..000000000 --- a/bindings/dotnet/examples/sound/Sound.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Threading; -using SFML; -using SFML.Audio; - -namespace sound -{ - static class Program - { - /// - /// The main entry point for the application. - /// - static void Main(string[] args) - { - // Play a sound - PlaySound(); - Console.Clear(); - - // Play a music - PlayMusic(); - } - - /// - /// Play a sound - /// - private static void PlaySound() - { - // Load a sound buffer from a wav file - SoundBuffer buffer = new SoundBuffer("resources/canary.wav"); - - // Display sound informations - Console.WriteLine("canary.wav :"); - Console.WriteLine(" " + buffer.Duration + " sec"); - Console.WriteLine(" " + buffer.SampleRate + " samples / sec"); - Console.WriteLine(" " + buffer.ChannelsCount + " channels"); - - // Create a sound instance and play it - Sound sound = new Sound(buffer); - sound.Play(); - - // Loop while the sound is playing - while (sound.Status == SoundStatus.Playing) - { - // Display the playing position - Console.CursorLeft = 0; - Console.Write("Playing... " + sound.PlayingOffset + " sec "); - - // Leave some CPU time for other processes - Thread.Sleep(100); - } - } - - /// - /// Play a music - /// - private static void PlayMusic() - { - // Load an ogg music file - Music music = new Music("resources/orchestral.ogg"); - - // Display music informations - Console.WriteLine("orchestral.ogg :"); - Console.WriteLine(" " + music.Duration + " sec"); - Console.WriteLine(" " + music.SampleRate + " samples / sec"); - Console.WriteLine(" " + music.ChannelsCount + " channels"); - - // Play it - music.Play(); - - // Loop while the music is playing - while (music.Status == SoundStatus.Playing) - { - // Display the playing position - Console.CursorLeft = 0; - Console.Write("Playing... " + music.PlayingOffset + " sec "); - - // Leave some CPU time for other processes - Thread.Sleep(100); - } - } - } -} diff --git a/bindings/dotnet/examples/sound/resources/canary.wav b/bindings/dotnet/examples/sound/resources/canary.wav deleted file mode 100644 index a0f3aecc5..000000000 Binary files a/bindings/dotnet/examples/sound/resources/canary.wav and /dev/null differ diff --git a/bindings/dotnet/examples/sound/resources/orchestral.ogg b/bindings/dotnet/examples/sound/resources/orchestral.ogg deleted file mode 100644 index f764d61db..000000000 Binary files a/bindings/dotnet/examples/sound/resources/orchestral.ogg and /dev/null differ diff --git a/bindings/dotnet/examples/sound/sound.csproj b/bindings/dotnet/examples/sound/sound.csproj deleted file mode 100644 index 729f4fce7..000000000 --- a/bindings/dotnet/examples/sound/sound.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {16E177F3-A0FF-4091-8521-562E0EBAA3AB} - Exe - Properties - sound - sound - sound.Program - - - 2.0 - - - - - true - .\ - DEBUG;TRACE - full - x86 - prompt - - - .\ - TRACE - true - pdbonly - x86 - prompt - - - true - .\ - DEBUG;TRACE - full - x64 - prompt - - - .\ - TRACE - true - pdbonly - x64 - prompt - - - - {0B202C4D-A457-47FE-84A3-031DD878C6BE} - sfml-audio - - - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} - sfml-window - - - - - - - - - - - \ No newline at end of file diff --git a/bindings/dotnet/examples/sound_capture/SoundCapture.cs b/bindings/dotnet/examples/sound_capture/SoundCapture.cs deleted file mode 100644 index 946936752..000000000 --- a/bindings/dotnet/examples/sound_capture/SoundCapture.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Threading; -using SFML; -using SFML.Audio; - -namespace sound_capture -{ - static class Program - { - /// - /// The main entry point for the application. - /// - static void Main(string[] args) - { - // Check that the device can capture audio - if (SoundRecorder.IsAvailable == false) - { - Console.WriteLine("Sorry, audio capture is not supported by your system"); - return; - } - - // Choose the sample rate - Console.WriteLine("Please choose the sample rate for sound capture (44100 is CD quality) : "); - uint sampleRate = uint.Parse(Console.ReadLine()); - - // Wait for user input... - Console.WriteLine("Press enter to start recording audio"); - Console.ReadLine(); - - // Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer - SoundBufferRecorder recorder = new SoundBufferRecorder(); - - // Audio capture is done in a separate thread, so we can block the main thread while it is capturing - recorder.Start(sampleRate); - Console.WriteLine("Recording... press enter to stop"); - Console.ReadLine(); - recorder.Stop(); - - // Get the buffer containing the captured data - SoundBuffer buffer = recorder.SoundBuffer; - - // Display captured sound informations - Console.WriteLine("Sound information :"); - Console.WriteLine(" " + buffer.Duration + " seconds"); - Console.WriteLine(" " + buffer.SampleRate + " samples / seconds"); - Console.WriteLine(" " + buffer.ChannelsCount + " channels"); - - // Choose what to do with the recorded sound data - Console.WriteLine("What do you want to do with captured sound (p = play, s = save) ? "); - char choice = char.Parse(Console.ReadLine()); - - if (choice == 's') - { - // Choose the filename - Console.WriteLine("Choose the file to create : "); - string filename = Console.ReadLine(); - - // Save the buffer - buffer.SaveToFile(filename); - } - else - { - // Create a sound instance and play it - Sound sound = new Sound(buffer); - sound.Play(); - - // Wait until finished - while (sound.Status == SoundStatus.Playing) - { - // Display the playing position - Console.CursorLeft = 0; - Console.Write("Playing... " + sound.PlayingOffset + " sec "); - - // Leave some CPU time for other threads - Thread.Sleep(100); - } - } - - // Finished ! - Console.WriteLine("\nDone !"); - } - } -} diff --git a/bindings/dotnet/examples/sound_capture/sound_capture.csproj b/bindings/dotnet/examples/sound_capture/sound_capture.csproj deleted file mode 100644 index b5db7a59c..000000000 --- a/bindings/dotnet/examples/sound_capture/sound_capture.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {F2F48990-F81E-41BA-AD01-168F6178C807} - Exe - Properties - sound_capture - sound_capture - sound_capture.Program - - - 2.0 - - - - - true - .\ - DEBUG;TRACE - full - x86 - prompt - - - .\ - TRACE - true - pdbonly - x86 - prompt - - - true - .\ - DEBUG;TRACE - full - x64 - prompt - - - .\ - TRACE - true - pdbonly - x64 - prompt - - - - {0B202C4D-A457-47FE-84A3-031DD878C6BE} - sfml-audio - - - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} - sfml-window - - - - - - - - - - - \ No newline at end of file diff --git a/bindings/dotnet/examples/visualbasic/My Project/Application.Designer.vb b/bindings/dotnet/examples/visualbasic/My Project/Application.Designer.vb deleted file mode 100644 index d73a4d866..000000000 --- a/bindings/dotnet/examples/visualbasic/My Project/Application.Designer.vb +++ /dev/null @@ -1,13 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:2.0.50727.3053 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - diff --git a/bindings/dotnet/examples/visualbasic/My Project/Application.myapp b/bindings/dotnet/examples/visualbasic/My Project/Application.myapp deleted file mode 100644 index 23b627fb3..000000000 --- a/bindings/dotnet/examples/visualbasic/My Project/Application.myapp +++ /dev/null @@ -1,10 +0,0 @@ - - - false - false - 0 - true - 0 - 2 - true - diff --git a/bindings/dotnet/examples/visualbasic/My Project/AssemblyInfo.vb b/bindings/dotnet/examples/visualbasic/My Project/AssemblyInfo.vb deleted file mode 100644 index ee7d3d648..000000000 --- a/bindings/dotnet/examples/visualbasic/My Project/AssemblyInfo.vb +++ /dev/null @@ -1,35 +0,0 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' General Information about an assembly is controlled through the following -' set of attributes. Change these attribute values to modify the information -' associated with an assembly. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - diff --git a/bindings/dotnet/examples/visualbasic/My Project/Resources.Designer.vb b/bindings/dotnet/examples/visualbasic/My Project/Resources.Designer.vb deleted file mode 100644 index 4c1f1ee65..000000000 --- a/bindings/dotnet/examples/visualbasic/My Project/Resources.Designer.vb +++ /dev/null @@ -1,63 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:2.0.50727.3053 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("visualbasic.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - End Module -End Namespace diff --git a/bindings/dotnet/examples/visualbasic/My Project/Resources.resx b/bindings/dotnet/examples/visualbasic/My Project/Resources.resx deleted file mode 100644 index ffecec851..000000000 --- a/bindings/dotnet/examples/visualbasic/My Project/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/bindings/dotnet/examples/visualbasic/My Project/Settings.Designer.vb b/bindings/dotnet/examples/visualbasic/My Project/Settings.Designer.vb deleted file mode 100644 index b6a816e3b..000000000 --- a/bindings/dotnet/examples/visualbasic/My Project/Settings.Designer.vb +++ /dev/null @@ -1,73 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:2.0.50727.3053 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.visualbasic.My.MySettings - Get - Return Global.visualbasic.My.MySettings.Default - End Get - End Property - End Module -End Namespace diff --git a/bindings/dotnet/examples/visualbasic/My Project/Settings.settings b/bindings/dotnet/examples/visualbasic/My Project/Settings.settings deleted file mode 100644 index 377f56d6b..000000000 --- a/bindings/dotnet/examples/visualbasic/My Project/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/bindings/dotnet/examples/visualbasic/OpenGL.vb b/bindings/dotnet/examples/visualbasic/OpenGL.vb deleted file mode 100644 index b25ec7081..000000000 --- a/bindings/dotnet/examples/visualbasic/OpenGL.vb +++ /dev/null @@ -1,161 +0,0 @@ -Imports SFML -Imports SFML.Window -Imports SFML.Graphics -Imports Tao.OpenGl -Imports Tao.FreeGlut - - -Module OpenGL - - Dim WithEvents window As RenderWindow - - ''' - ''' Entry point of application - ''' - Sub Main() - - ' Create main window - window = New RenderWindow(New VideoMode(800, 600), "SFML.Net OpenGL (Visual Basic)", Styles.Default, new ContextSettings(32, 0)) - - ' Create a sprite for the background - Dim backgroundImage = New Image("resources/background.jpg") - Dim background = New Sprite(backgroundImage) - - ' Create a text to display - Dim text = New Text("SFML / OpenGL demo") - text.Position = New Vector2f(250.0F, 450.0F) - text.Color = New Color(255, 255, 255, 170) - - ' Load an OpenGL texture. - ' We could directly use a SFML.Graphics.Image as an OpenGL texture (with its Bind() member function), - ' but here we want more control on it (generate mipmaps, ...) so we create a new one - Dim texture = 0 - Using tempImage = New Image("resources/texture.jpg") - Gl.glGenTextures(1, texture) - Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture) - Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_RGBA, tempImage.Width, tempImage.Height, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, tempImage.Pixels) - Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR) - Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR) - End Using - - ' Enable Z-buffer read and write - Gl.glEnable(Gl.GL_DEPTH_TEST) - Gl.glDepthMask(Gl.GL_TRUE) - Gl.glClearDepth(1.0F) - - ' Setup a perspective projection - Gl.glMatrixMode(Gl.GL_PROJECTION) - Gl.glLoadIdentity() - Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F) - - ' Bind our texture - Gl.glEnable(Gl.GL_TEXTURE_2D) - Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture) - Gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F) - - Dim time = 0.0F - - ' Start game loop - While (window.IsOpened()) - - ' Process events - window.DispatchEvents() - - ' Draw background - window.SaveGLStates() - window.Draw(background) - window.RestoreGLStates() - - ' Clear depth buffer - Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT) - - ' We get the position of the mouse cursor, so that we can move the box accordingly - Dim x = window.GetCursorPosition().X * 200.0F / window.Width - 100.0F - Dim y = -window.GetCursorPosition().Y * 200.0F / window.Height + 100.0F - - ' Apply some transformations - time += window.GetFrameTime() / 1000.0F - Gl.glMatrixMode(Gl.GL_MODELVIEW) - Gl.glLoadIdentity() - Gl.glTranslatef(x, y, -100.0F) - Gl.glRotatef(time * 50, 1.0F, 0.0F, 0.0F) - Gl.glRotatef(time * 30, 0.0F, 1.0F, 0.0F) - Gl.glRotatef(time * 90, 0.0F, 0.0F, 1.0F) - - ' Draw a cube - Dim size = 20.0F - Gl.glBegin(Gl.GL_QUADS) - - Gl.glTexCoord2f(0, 0) : Gl.glVertex3f(-size, -size, -size) - Gl.glTexCoord2f(0, 1) : Gl.glVertex3f(-size, size, -size) - Gl.glTexCoord2f(1, 1) : Gl.glVertex3f(size, size, -size) - Gl.glTexCoord2f(1, 0) : Gl.glVertex3f(size, -size, -size) - - Gl.glTexCoord2f(0, 0) : Gl.glVertex3f(-size, -size, size) - Gl.glTexCoord2f(0, 1) : Gl.glVertex3f(-size, size, size) - Gl.glTexCoord2f(1, 1) : Gl.glVertex3f(size, size, size) - Gl.glTexCoord2f(1, 0) : Gl.glVertex3f(size, -size, size) - - Gl.glTexCoord2f(0, 0) : Gl.glVertex3f(-size, -size, -size) - Gl.glTexCoord2f(0, 1) : Gl.glVertex3f(-size, size, -size) - Gl.glTexCoord2f(1, 1) : Gl.glVertex3f(-size, size, size) - Gl.glTexCoord2f(1, 0) : Gl.glVertex3f(-size, -size, size) - - Gl.glTexCoord2f(0, 0) : Gl.glVertex3f(size, -size, -size) - Gl.glTexCoord2f(0, 1) : Gl.glVertex3f(size, size, -size) - Gl.glTexCoord2f(1, 1) : Gl.glVertex3f(size, size, size) - Gl.glTexCoord2f(1, 0) : Gl.glVertex3f(size, -size, size) - - Gl.glTexCoord2f(0, 1) : Gl.glVertex3f(-size, -size, size) - Gl.glTexCoord2f(0, 0) : Gl.glVertex3f(-size, -size, -size) - Gl.glTexCoord2f(1, 0) : Gl.glVertex3f(size, -size, -size) - Gl.glTexCoord2f(1, 1) : Gl.glVertex3f(size, -size, size) - - Gl.glTexCoord2f(0, 1) : Gl.glVertex3f(-size, size, size) - Gl.glTexCoord2f(0, 0) : Gl.glVertex3f(-size, size, -size) - Gl.glTexCoord2f(1, 0) : Gl.glVertex3f(size, size, -size) - Gl.glTexCoord2f(1, 1) : Gl.glVertex3f(size, size, size) - - Gl.glEnd() - - ' Draw some text on top of our OpenGL object - window.SaveGLStates() - window.Draw(text) - window.RestoreGLStates() - - ' Finally, display the rendered frame on screen - window.Display() - - End While - - ' Don't forget to destroy our texture - Gl.glDeleteTextures(1, texture) - - End Sub - - ''' - ''' Function called when the window is closed - ''' - Sub App_Closed(ByVal sender As Object, ByVal e As EventArgs) Handles window.Closed - Dim window = CType(sender, RenderWindow) - window.Close() - End Sub - - ''' - ''' Function called when a key is pressed - ''' - Sub App_KeyPressed(ByVal sender As Object, ByVal e As KeyEventArgs) Handles window.KeyPressed - Dim window = CType(sender, RenderWindow) - If e.Code = Keyboard.Key.Escape Then - window.Close() - End If - End Sub - - ''' - ''' Function called when the window is resized - ''' - Sub App_Resized(ByVal sender As Object, ByVal e As SizeEventArgs) Handles window.Resized - Gl.glViewport(0, 0, e.Width, e.Height) - End Sub - -End Module diff --git a/bindings/dotnet/examples/visualbasic/resources/background.jpg b/bindings/dotnet/examples/visualbasic/resources/background.jpg deleted file mode 100644 index 20724fa92..000000000 Binary files a/bindings/dotnet/examples/visualbasic/resources/background.jpg and /dev/null differ diff --git a/bindings/dotnet/examples/visualbasic/resources/texture.jpg b/bindings/dotnet/examples/visualbasic/resources/texture.jpg deleted file mode 100644 index 6cf7528eb..000000000 Binary files a/bindings/dotnet/examples/visualbasic/resources/texture.jpg and /dev/null differ diff --git a/bindings/dotnet/examples/visualbasic/visualbasic.sln b/bindings/dotnet/examples/visualbasic/visualbasic.sln deleted file mode 100644 index 3d3809397..000000000 --- a/bindings/dotnet/examples/visualbasic/visualbasic.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "visualbasic", "visualbasic.vbproj", "{98552080-F688-46B4-A2FF-1AC7C50ECBE8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Debug|x64.ActiveCfg = Debug|x64 - {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Debug|x64.Build.0 = Debug|x64 - {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Debug|x86.ActiveCfg = Debug|x86 - {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Debug|x86.Build.0 = Debug|x86 - {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Release|x64.ActiveCfg = Release|x64 - {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Release|x64.Build.0 = Release|x64 - {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Release|x86.ActiveCfg = Release|x86 - {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/bindings/dotnet/examples/visualbasic/visualbasic.vbproj b/bindings/dotnet/examples/visualbasic/visualbasic.vbproj deleted file mode 100644 index 1c795974f..000000000 --- a/bindings/dotnet/examples/visualbasic/visualbasic.vbproj +++ /dev/null @@ -1,159 +0,0 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {98552080-F688-46B4-A2FF-1AC7C50ECBE8} - WinExe - visualbasic.OpenGL - visualbasic - visualbasic - 512 - WindowsFormsWithCustomSubMain - v3.5 - On - Binary - Off - On - - - true - full - true - true - .\ - visualbasic.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - pdbonly - false - true - true - bin\Release\ - visualbasic.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - true - true - true - .\ - visualbasic.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - full - x64 - - - true - bin\x64\Release\ - visualbasic.xml - true - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - pdbonly - x64 - - - true - true - true - .\ - visualbasic.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - full - x86 - - - true - bin\x86\Release\ - visualbasic.xml - true - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - pdbonly - x86 - - - - False - ..\..\lib\sfmlnet2-graphics.dll - - - False - ..\..\lib\sfmlnet2-window.dll - - - - - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - \ No newline at end of file diff --git a/bindings/dotnet/examples/window/Window.cs b/bindings/dotnet/examples/window/Window.cs deleted file mode 100644 index 1fc64416f..000000000 --- a/bindings/dotnet/examples/window/Window.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using SFML; -using SFML.Window; -using Tao.OpenGl; - -namespace window -{ - static class Program - { - /// - /// The main entry point for the application. - /// - static void Main() - { - // Create the main window - Window window = new Window(new VideoMode(640, 480, 32), "SFML.Net Window", Styles.Default, new ContextSettings(32, 0)); - - // Setup event handlers - window.Closed += new EventHandler(OnClosed); - window.KeyPressed += new EventHandler(OnKeyPressed); - window.Resized += new EventHandler(OnResized); - - // Set the color and depth clear values - Gl.glClearDepth(1.0F); - Gl.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); - - // Enable Z-buffer read and write - Gl.glEnable(Gl.GL_DEPTH_TEST); - Gl.glDepthMask(Gl.GL_TRUE); - - // Setup a perspective projection - Gl.glMatrixMode(Gl.GL_PROJECTION); - Gl.glLoadIdentity(); - Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F); - - float time = 0.0F; - - // Start the game loop - while (window.IsOpened()) - { - // Process events - window.DispatchEvents(); - - // Activate the window before using OpenGL commands. - // This is useless here because we have only one window which is - // always the active one, but don't forget it if you use multiple windows - window.SetActive(); - - // Clear color and depth buffer - Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); - - // Apply some transformations - time += window.GetFrameTime() / 1000.0F; - Gl.glMatrixMode(Gl.GL_MODELVIEW); - Gl.glLoadIdentity(); - Gl.glTranslatef(0.0F, 0.0F, -200.0F); - Gl.glRotatef(time * 50, 1.0F, 0.0F, 0.0F); - Gl.glRotatef(time * 30, 0.0F, 1.0F, 0.0F); - Gl.glRotatef(time * 90, 0.0F, 0.0F, 1.0F); - - // Draw a cube - Gl.glBegin(Gl.GL_QUADS); - - Gl.glColor3f(1.0F, 0.0F, 0.0F); - Gl.glVertex3f(-50.0F, -50.0F, -50.0F); - Gl.glVertex3f(-50.0F, 50.0F, -50.0F); - Gl.glVertex3f( 50.0F, 50.0F, -50.0F); - Gl.glVertex3f( 50.0F, -50.0F, -50.0F); - - Gl.glColor3f(1.0F, 0.0F, 0.0F); - Gl.glVertex3f(-50.0F, -50.0F, 50.0F); - Gl.glVertex3f(-50.0F, 50.0F, 50.0F); - Gl.glVertex3f( 50.0F, 50.0F, 50.0F); - Gl.glVertex3f( 50.0F, -50.0F, 50.0F); - - Gl.glColor3f(0.0F, 1.0F, 0.0F); - Gl.glVertex3f(-50.0F, -50.0F, -50.0F); - Gl.glVertex3f(-50.0F, 50.0F, -50.0F); - Gl.glVertex3f(-50.0F, 50.0F, 50.0F); - Gl.glVertex3f(-50.0F, -50.0F, 50.0F); - - Gl.glColor3f(0.0F, 1.0F, 0.0F); - Gl.glVertex3f(50.0F, -50.0F, -50.0F); - Gl.glVertex3f(50.0F, 50.0F, -50.0F); - Gl.glVertex3f(50.0F, 50.0F, 50.0F); - Gl.glVertex3f(50.0F, -50.0F, 50.0F); - - Gl.glColor3f(0.0F, 0.0F, 1.0F); - Gl.glVertex3f(-50.0F, -50.0F, 50.0F); - Gl.glVertex3f(-50.0F, -50.0F, -50.0F); - Gl.glVertex3f( 50.0F, -50.0F, -50.0F); - Gl.glVertex3f( 50.0F, -50.0F, 50.0F); - - Gl.glColor3f(0.0F, 0.0F, 1.0F); - Gl.glVertex3f(-50.0F, 50.0F, 50.0F); - Gl.glVertex3f(-50.0F, 50.0F, -50.0F); - Gl.glVertex3f( 50.0F, 50.0F, -50.0F); - Gl.glVertex3f( 50.0F, 50.0F, 50.0F); - - Gl.glEnd(); - - // Finally, display the rendered frame on screen - window.Display(); - } - } - - /// - /// Function called when the window is closed - /// - static void OnClosed(object sender, EventArgs e) - { - Window window = (Window)sender; - window.Close(); - } - - /// - /// Function called when a key is pressed - /// - static void OnKeyPressed(object sender, KeyEventArgs e) - { - Window window = (Window)sender; - if (e.Code == Keyboard.Key.Escape) - window.Close(); - } - - /// - /// Function called when the window is resized - /// - static void OnResized(object sender, SizeEventArgs e) - { - Gl.glViewport(0, 0, (int)e.Width, (int)e.Height); - } - } -} diff --git a/bindings/dotnet/examples/window/window.csproj b/bindings/dotnet/examples/window/window.csproj deleted file mode 100644 index c20647d57..000000000 --- a/bindings/dotnet/examples/window/window.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF} - WinExe - Properties - window - window - - - 2.0 - - - window.Program - - - true - .\ - DEBUG;TRACE - full - x86 - prompt - - - .\ - TRACE - true - pdbonly - x86 - prompt - - - true - .\ - DEBUG;TRACE - full - x64 - prompt - - - .\ - TRACE - true - pdbonly - x64 - prompt - - - - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} - sfml-window - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bindings/dotnet/extlibs/x64/csfml-audio-2.dll b/bindings/dotnet/extlibs/x64/csfml-audio-2.dll deleted file mode 100644 index 031d001d5..000000000 Binary files a/bindings/dotnet/extlibs/x64/csfml-audio-2.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x64/csfml-graphics-2.dll b/bindings/dotnet/extlibs/x64/csfml-graphics-2.dll deleted file mode 100644 index aeafa0c52..000000000 Binary files a/bindings/dotnet/extlibs/x64/csfml-graphics-2.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x64/csfml-window-2.dll b/bindings/dotnet/extlibs/x64/csfml-window-2.dll deleted file mode 100644 index 5041692d7..000000000 Binary files a/bindings/dotnet/extlibs/x64/csfml-window-2.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x64/libsndfile-1.dll b/bindings/dotnet/extlibs/x64/libsndfile-1.dll deleted file mode 100644 index c56c8e56f..000000000 Binary files a/bindings/dotnet/extlibs/x64/libsndfile-1.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x64/openal32.dll b/bindings/dotnet/extlibs/x64/openal32.dll deleted file mode 100644 index e1f079c8f..000000000 Binary files a/bindings/dotnet/extlibs/x64/openal32.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x86/csfml-audio-2.dll b/bindings/dotnet/extlibs/x86/csfml-audio-2.dll deleted file mode 100644 index 50c974b32..000000000 Binary files a/bindings/dotnet/extlibs/x86/csfml-audio-2.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x86/csfml-graphics-2.dll b/bindings/dotnet/extlibs/x86/csfml-graphics-2.dll deleted file mode 100644 index e067e5c8c..000000000 Binary files a/bindings/dotnet/extlibs/x86/csfml-graphics-2.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x86/csfml-window-2.dll b/bindings/dotnet/extlibs/x86/csfml-window-2.dll deleted file mode 100644 index b74998260..000000000 Binary files a/bindings/dotnet/extlibs/x86/csfml-window-2.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x86/libsndfile-1.dll b/bindings/dotnet/extlibs/x86/libsndfile-1.dll deleted file mode 100644 index 75acaa14b..000000000 Binary files a/bindings/dotnet/extlibs/x86/libsndfile-1.dll and /dev/null differ diff --git a/bindings/dotnet/extlibs/x86/openal32.dll b/bindings/dotnet/extlibs/x86/openal32.dll deleted file mode 100644 index 6a8990c0b..000000000 Binary files a/bindings/dotnet/extlibs/x86/openal32.dll and /dev/null differ diff --git a/bindings/dotnet/src/Audio/Listener.cs b/bindings/dotnet/src/Audio/Listener.cs deleted file mode 100644 index a47830a7a..000000000 --- a/bindings/dotnet/src/Audio/Listener.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace SFML -{ - namespace Audio - { - //////////////////////////////////////////////////////////// - /// - /// Listener is a global interface for defining the audio - /// listener properties ; the audio listener is the point in - /// the scene from where all the sounds are heard - /// - //////////////////////////////////////////////////////////// - public class Listener - { - //////////////////////////////////////////////////////////// - /// - /// Global volume of all sounds, in range [0 .. 100] (default is 100) - /// - //////////////////////////////////////////////////////////// - public static float GlobalVolume - { - get {return sfListener_GetGlobalVolume();} - set {sfListener_SetGlobalVolume(value);} - } - - //////////////////////////////////////////////////////////// - /// - /// 3D position of the listener (default is (0, 0, 0)) - /// - //////////////////////////////////////////////////////////// - public static Vector3f Position - { - get {Vector3f v; sfListener_GetPosition(out v.X, out v.Y, out v.Z); return v;} - set {sfListener_SetPosition(value.X, value.Y, value.Z);} - } - - //////////////////////////////////////////////////////////// - /// - /// 3D direction of the listener (default is (0, 0, -1)) - /// - //////////////////////////////////////////////////////////// - public static Vector3f Direction - { - get {Vector3f v; sfListener_GetDirection(out v.X, out v.Y, out v.Z); return v;} - set {sfListener_SetDirection(value.X, value.Y, value.Z);} - } - - #region Imports - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfListener_SetGlobalVolume(float Volume); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfListener_GetGlobalVolume(); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfListener_SetPosition(float X, float Y, float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfListener_GetPosition(out float X, out float Y, out float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfListener_SetDirection(float X, float Y, float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfListener_GetDirection(out float X, out float Y, out float Z); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Audio/Music.cs b/bindings/dotnet/src/Audio/Music.cs deleted file mode 100644 index 6aac0ef4a..000000000 --- a/bindings/dotnet/src/Audio/Music.cs +++ /dev/null @@ -1,333 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using System.IO; - -namespace SFML -{ - namespace Audio - { - //////////////////////////////////////////////////////////// - /// - /// Music defines a big sound played using streaming, - /// so usually what we call a music :) - /// - //////////////////////////////////////////////////////////// - public class Music : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Construct the music from a file - /// - /// Path of the music file to load - //////////////////////////////////////////////////////////// - public Music(string filename) : - base(sfMusic_CreateFromFile(filename)) - { - if (This == IntPtr.Zero) - throw new LoadingFailedException("music", filename); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the music from a file in a stream - /// - /// Stream containing the file contents - //////////////////////////////////////////////////////////// - public Music(Stream stream) : - base(IntPtr.Zero) - { - stream.Position = 0; - byte[] StreamData = new byte[stream.Length]; - uint Read = (uint)stream.Read(StreamData, 0, StreamData.Length); - unsafe - { - fixed (byte* dataPtr = StreamData) - { - SetThis(sfMusic_CreateFromMemory((char*)dataPtr, Read)); - } - } - if (This == IntPtr.Zero) - throw new LoadingFailedException("music"); - } - - //////////////////////////////////////////////////////////// - /// - /// Play the music - /// - //////////////////////////////////////////////////////////// - public void Play() - { - sfMusic_Play(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Pause the music - /// - //////////////////////////////////////////////////////////// - public void Pause() - { - sfMusic_Pause(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Stop the music - /// - //////////////////////////////////////////////////////////// - public void Stop() - { - sfMusic_Stop(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Samples rate, in samples per second - /// - //////////////////////////////////////////////////////////// - public uint SampleRate - { - get {return sfMusic_GetSampleRate(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Number of channels (1 = mono, 2 = stereo) - /// - //////////////////////////////////////////////////////////// - public uint ChannelsCount - { - get {return sfMusic_GetChannelsCount(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Current status of the music (see SoundStatus enum) - /// - //////////////////////////////////////////////////////////// - public SoundStatus Status - { - get {return sfMusic_GetStatus(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Total duration of the music, in milliseconds - /// - //////////////////////////////////////////////////////////// - public uint Duration - { - get {return sfMusic_GetDuration(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Loop state of the sound. Default value is false - /// - //////////////////////////////////////////////////////////// - public bool Loop - { - get {return sfMusic_GetLoop(This);} - set {sfMusic_SetLoop(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Pitch of the music. Default value is 1 - /// - //////////////////////////////////////////////////////////// - public float Pitch - { - get {return sfMusic_GetPitch(This);} - set {sfMusic_SetPitch(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Volume of the music, in range [0, 100]. Default value is 100 - /// - //////////////////////////////////////////////////////////// - public float Volume - { - get {return sfMusic_GetVolume(This);} - set {sfMusic_SetVolume(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// 3D position of the music. Default value is (0, 0, 0) - /// - //////////////////////////////////////////////////////////// - public Vector3f Position - { - get {Vector3f v; sfMusic_GetPosition(This, out v.X, out v.Y, out v.Z); return v;} - set {sfMusic_SetPosition(This, value.X, value.Y, value.Z);} - } - - //////////////////////////////////////////////////////////// - /// - /// Is the music's position relative to the listener's position, - /// or is it absolute? - /// Default value is false (absolute) - /// - //////////////////////////////////////////////////////////// - public bool RelativeToListener - { - get {return sfMusic_IsRelativeToListener(This);} - set {sfMusic_SetRelativeToListener(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Minimum distance of the music. Closer than this distance, - /// the listener will hear the sound at its maximum volume. - /// The default value is 1 - /// - //////////////////////////////////////////////////////////// - public float MinDistance - { - get {return sfMusic_GetMinDistance(This);} - set {sfMusic_SetMinDistance(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Attenuation factor. The higher the attenuation, the - /// more the sound will be attenuated with distance from listener. - /// The default value is 1 - /// - //////////////////////////////////////////////////////////// - public float Attenuation - { - get {return sfMusic_GetAttenuation(This);} - set {sfMusic_SetAttenuation(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Current playing position, in milliseconds - /// - //////////////////////////////////////////////////////////// - public uint PlayingOffset - { - get {return sfMusic_GetPlayingOffset(This);} - set {sfMusic_SetPlayingOffset(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Music]" + - " SampleRate(" + SampleRate + ")" + - " ChannelsCount(" + ChannelsCount + ")" + - " Status(" + Status + ")" + - " Duration(" + Duration + ")" + - " Loop(" + Loop + ")" + - " Pitch(" + Pitch + ")" + - " Volume(" + Volume + ")" + - " Position(" + Position + ")" + - " RelativeToListener(" + RelativeToListener + ")" + - " MinDistance(" + MinDistance + ")" + - " Attenuation(" + Attenuation + ")" + - " PlayingOffset(" + PlayingOffset + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfMusic_Destroy(This); - } - - #region Imports - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfMusic_CreateFromFile(string Filename); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern IntPtr sfMusic_CreateFromMemory(char* Data, uint SizeInBytes); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_Destroy(IntPtr MusicStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_Play(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_Pause(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_Stop(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern SoundStatus sfMusic_GetStatus(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfMusic_GetDuration(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfMusic_GetChannelsCount(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfMusic_GetSampleRate(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_SetPitch(IntPtr Music, float Pitch); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_SetLoop(IntPtr Music, bool Loop); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_SetVolume(IntPtr Music, float Volume); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_SetPosition(IntPtr Music, float X, float Y, float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_SetRelativeToListener(IntPtr Music, bool Relative); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_SetMinDistance(IntPtr Music, float MinDistance); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_SetAttenuation(IntPtr Music, float Attenuation); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_SetPlayingOffset(IntPtr Music, uint TimeOffset); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfMusic_GetLoop(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfMusic_GetPitch(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfMusic_GetVolume(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMusic_GetPosition(IntPtr Music, out float X, out float Y, out float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfMusic_IsRelativeToListener(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfMusic_GetMinDistance(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfMusic_GetAttenuation(IntPtr Music); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfMusic_GetPlayingOffset(IntPtr Music); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Audio/Sound.cs b/bindings/dotnet/src/Audio/Sound.cs deleted file mode 100644 index 69b390778..000000000 --- a/bindings/dotnet/src/Audio/Sound.cs +++ /dev/null @@ -1,325 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace SFML -{ - namespace Audio - { - //////////////////////////////////////////////////////////// - /// - /// Enumeration of all possible sound states - /// - //////////////////////////////////////////////////////////// - public enum SoundStatus - { - /// Sound is not playing - Stopped, - - /// Sound is paused - Paused, - - /// Sound is playing - Playing - } - - //////////////////////////////////////////////////////////// - /// - /// Sound defines the properties of a sound such as position, - /// volume, pitch, etc. - /// - //////////////////////////////////////////////////////////// - public class Sound : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Default constructor (invalid sound) - /// - //////////////////////////////////////////////////////////// - public Sound() : - base(sfSound_Create()) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the sound from a source buffer - /// - /// Sound buffer to play - //////////////////////////////////////////////////////////// - public Sound(SoundBuffer buffer) : - base(sfSound_Create()) - { - SoundBuffer = buffer; - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the sound from another source - /// - /// Sound to copy - //////////////////////////////////////////////////////////// - public Sound(Sound copy) : - base(sfSound_Copy(copy.This)) - { - SoundBuffer = copy.SoundBuffer; - } - - //////////////////////////////////////////////////////////// - /// - /// Play the sound - /// - //////////////////////////////////////////////////////////// - public void Play() - { - sfSound_Play(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Pause the sound - /// - //////////////////////////////////////////////////////////// - public void Pause() - { - sfSound_Pause(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Stop the sound - /// - //////////////////////////////////////////////////////////// - public void Stop() - { - sfSound_Stop(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Buffer containing the sound data to play through the sound - /// - //////////////////////////////////////////////////////////// - public SoundBuffer SoundBuffer - { - get {return myBuffer;} - set {myBuffer = value; sfSound_SetBuffer(This, value != null ? value.This : IntPtr.Zero);} - } - - //////////////////////////////////////////////////////////// - /// - /// Current status of the sound (see SoundStatus enum) - /// - //////////////////////////////////////////////////////////// - public SoundStatus Status - { - get {return sfSound_GetStatus(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Loop state of the sound. Default value is false - /// - //////////////////////////////////////////////////////////// - public bool Loop - { - get {return sfSound_GetLoop(This);} - set {sfSound_SetLoop(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Pitch of the sound. Default value is 1 - /// - //////////////////////////////////////////////////////////// - public float Pitch - { - get {return sfSound_GetPitch(This);} - set {sfSound_SetPitch(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Volume of the sound, in range [0, 100]. Default value is 100 - /// - //////////////////////////////////////////////////////////// - public float Volume - { - get {return sfSound_GetVolume(This);} - set {sfSound_SetVolume(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Current playing position of the sound, in milliseconds - /// - //////////////////////////////////////////////////////////// - public uint PlayingOffset - { - get {return sfSound_GetPlayingOffset(This);} - set {sfSound_SetPlayingOffset(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// 3D position of the sound. Default value is (0, 0, 0) - /// - //////////////////////////////////////////////////////////// - public Vector3f Position - { - get {Vector3f v; sfSound_GetPosition(This, out v.X, out v.Y, out v.Z); return v;} - set {sfSound_SetPosition(This, value.X, value.Y, value.Z);} - } - - //////////////////////////////////////////////////////////// - /// - /// Is the sound's position relative to the listener's position, - /// or is it absolute? - /// Default value is false (absolute) - /// - //////////////////////////////////////////////////////////// - public bool RelativeToListener - { - get {return sfSound_IsRelativeToListener(This);} - set {sfSound_SetRelativeToListener(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Minimum distance of the sound. Closer than this distance, - /// the listener will hear the sound at its maximum volume. - /// The default value is 1 - /// - //////////////////////////////////////////////////////////// - public float MinDistance - { - get {return sfSound_GetMinDistance(This);} - set {sfSound_SetMinDistance(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Attenuation factor. The higher the attenuation, the - /// more the sound will be attenuated with distance from listener. - /// The default value is 1 - /// - //////////////////////////////////////////////////////////// - public float Attenuation - { - get {return sfSound_GetAttenuation(This);} - set {sfSound_SetAttenuation(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Sound]" + - " Status(" + Status + ")" + - " Loop(" + Loop + ")" + - " Pitch(" + Pitch + ")" + - " Volume(" + Volume + ")" + - " Position(" + Position + ")" + - " RelativeToListener(" + RelativeToListener + ")" + - " MinDistance(" + MinDistance + ")" + - " Attenuation(" + Attenuation + ")" + - " PlayingOffset(" + PlayingOffset + ")" + - " SoundBuffer(" + SoundBuffer + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfSound_Destroy(This); - } - - private SoundBuffer myBuffer; - - #region Imports - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSound_Create(); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSound_Copy(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_Destroy(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_Play(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_Pause(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_Stop(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetBuffer(IntPtr Sound, IntPtr Buffer); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSound_GetBuffer(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetLoop(IntPtr Sound, bool Loop); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfSound_GetLoop(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern SoundStatus sfSound_GetStatus(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetPitch(IntPtr Sound, float Pitch); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetVolume(IntPtr Sound, float Volume); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetPosition(IntPtr Sound, float X, float Y, float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetRelativeToListener(IntPtr Sound, bool Relative); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetMinDistance(IntPtr Sound, float MinDistance); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetAttenuation(IntPtr Sound, float Attenuation); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_SetPlayingOffset(IntPtr Sound, uint TimeOffset); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSound_GetPitch(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSound_GetVolume(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSound_GetPosition(IntPtr Sound, out float X, out float Y, out float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfSound_IsRelativeToListener(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSound_GetMinDistance(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSound_GetAttenuation(IntPtr Sound); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSound_GetPlayingOffset(IntPtr Sound); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Audio/SoundBuffer.cs b/bindings/dotnet/src/Audio/SoundBuffer.cs deleted file mode 100644 index acf4f6c6f..000000000 --- a/bindings/dotnet/src/Audio/SoundBuffer.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using System.IO; - -namespace SFML -{ - namespace Audio - { - //////////////////////////////////////////////////////////// - /// - /// SoundBuffer is the low-level class for loading and manipulating - /// sound buffers. A sound buffer holds audio data (samples) - /// which can then be played by a Sound or saved to a file. - /// - //////////////////////////////////////////////////////////// - public class SoundBuffer : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Construct the sound buffer from a file - /// - /// Path of the sound file to load - /// - //////////////////////////////////////////////////////////// - public SoundBuffer(string filename) : - base(sfSoundBuffer_CreateFromFile(filename)) - { - if (This == IntPtr.Zero) - throw new LoadingFailedException("sound buffer", filename); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the sound buffer from a file in a stream - /// - /// Stream containing the file contents - //////////////////////////////////////////////////////////// - public SoundBuffer(Stream stream) : - base(IntPtr.Zero) - { - stream.Position = 0; - byte[] StreamData = new byte[stream.Length]; - uint Read = (uint)stream.Read(StreamData, 0, StreamData.Length); - unsafe - { - fixed (byte* dataPtr = StreamData) - { - SetThis(sfSoundBuffer_CreateFromMemory((char*)dataPtr, Read)); - } - } - if (This == IntPtr.Zero) - throw new LoadingFailedException("sound buffer"); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the sound buffer from an array of samples - /// - /// Array of samples - /// Channels count - /// Sample rate - /// - //////////////////////////////////////////////////////////// - public SoundBuffer(short[] samples, uint channelsCount, uint sampleRate) : - base(IntPtr.Zero) - { - unsafe - { - fixed (short* SamplesPtr = samples) - { - SetThis(sfSoundBuffer_CreateFromSamples(SamplesPtr, (uint)samples.Length, channelsCount, sampleRate)); - } - } - - if (This == IntPtr.Zero) - throw new LoadingFailedException("sound buffer"); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the sound buffer from another sound buffer - /// - /// Sound buffer to copy - //////////////////////////////////////////////////////////// - public SoundBuffer(SoundBuffer copy) : - base(sfSoundBuffer_Copy(copy.This)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Save the sound buffer to an audio file - /// - /// Path of the sound file to write - /// True if saving has been successful - //////////////////////////////////////////////////////////// - public bool SaveToFile(string filename) - { - return sfSoundBuffer_SaveToFile(This, filename); - } - - //////////////////////////////////////////////////////////// - /// - /// Samples rate, in samples per second - /// - //////////////////////////////////////////////////////////// - public uint SampleRate - { - get {return sfSoundBuffer_GetSampleRate(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Number of channels (1 = mono, 2 = stereo) - /// - //////////////////////////////////////////////////////////// - public uint ChannelsCount - { - get {return sfSoundBuffer_GetChannelsCount(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Total duration of the buffer, in milliseconds - /// - //////////////////////////////////////////////////////////// - public uint Duration - { - get {return sfSoundBuffer_GetDuration(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Array of samples contained in the buffer - /// - //////////////////////////////////////////////////////////// - public short[] Samples - { - get - { - short[] SamplesArray = new short[sfSoundBuffer_GetSamplesCount(This)]; - Marshal.Copy(sfSoundBuffer_GetSamples(This), SamplesArray, 0, SamplesArray.Length); - return SamplesArray; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[SoundBuffer]" + - " SampleRate(" + SampleRate + ")" + - " ChannelsCount(" + ChannelsCount + ")" + - " Duration(" + Duration + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfSoundBuffer_Destroy(This); - } - - #region Imports - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSoundBuffer_CreateFromFile(string Filename); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern IntPtr sfSoundBuffer_CreateFromMemory(char* Data, uint SizeInBytes); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern IntPtr sfSoundBuffer_CreateFromSamples(short* Samples, uint SamplesCount, uint ChannelsCount, uint SampleRate); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSoundBuffer_Copy(IntPtr SoundBuffer); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundBuffer_Destroy(IntPtr SoundBuffer); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfSoundBuffer_SaveToFile(IntPtr SoundBuffer, string Filename); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSoundBuffer_GetSamples(IntPtr SoundBuffer); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSoundBuffer_GetSamplesCount(IntPtr SoundBuffer); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSoundBuffer_GetSampleRate(IntPtr SoundBuffer); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSoundBuffer_GetChannelsCount(IntPtr SoundBuffer); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSoundBuffer_GetDuration(IntPtr SoundBuffer); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Audio/SoundBufferRecorder.cs b/bindings/dotnet/src/Audio/SoundBufferRecorder.cs deleted file mode 100644 index 1228d40f1..000000000 --- a/bindings/dotnet/src/Audio/SoundBufferRecorder.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using System.Collections.Generic; - -namespace SFML -{ - namespace Audio - { - //////////////////////////////////////////////////////////// - /// - /// Specialized SoundRecorder which saves the captured - /// audio data into a sound buffer - /// - //////////////////////////////////////////////////////////// - public class SoundBufferRecorder : SoundRecorder - { - //////////////////////////////////////////////////////////// - /// - /// Sound buffer containing the recorded data (invalid until the capture stops) - /// - //////////////////////////////////////////////////////////// - public SoundBuffer SoundBuffer - { - get - { - return mySoundBuffer; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[SoundBufferRecorder]" + - " SampleRate(" + SampleRate + ")" + - " SoundBuffer(" + SoundBuffer + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Called when a new capture starts - /// - /// False to abort recording audio data, true to continue - //////////////////////////////////////////////////////////// - protected override bool OnStart() - { - mySamplesArray.Clear(); - return true; - } - - //////////////////////////////////////////////////////////// - /// - /// Process a new chunk of recorded samples - /// - /// Array of samples to process - /// False to stop recording audio data, true to continue - //////////////////////////////////////////////////////////// - protected override bool OnProcessSamples(short[] samples) - { - mySamplesArray.AddRange(samples); - return true; - } - - //////////////////////////////////////////////////////////// - /// - /// Called when the current capture stops - /// - //////////////////////////////////////////////////////////// - protected override void OnStop() - { - mySoundBuffer = new SoundBuffer(mySamplesArray.ToArray(), 1, SampleRate); - } - - List mySamplesArray = new List(); - SoundBuffer mySoundBuffer = null; - } - } -} diff --git a/bindings/dotnet/src/Audio/SoundRecorder.cs b/bindings/dotnet/src/Audio/SoundRecorder.cs deleted file mode 100644 index e24c03840..000000000 --- a/bindings/dotnet/src/Audio/SoundRecorder.cs +++ /dev/null @@ -1,192 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace SFML -{ - namespace Audio - { - //////////////////////////////////////////////////////////// - /// - /// SoundRecorder is an interface for capturing sound data, - /// it is meant to be used as a base class - /// - //////////////////////////////////////////////////////////// - public abstract class SoundRecorder : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Default constructor - /// - //////////////////////////////////////////////////////////// - public SoundRecorder() : - base(IntPtr.Zero) - { - myStartCallback = new StartCallback(OnStart); - myProcessCallback = new ProcessCallback(ProcessSamples); - myStopCallback = new StopCallback(OnStop); - - SetThis(sfSoundRecorder_Create(myStartCallback, myProcessCallback, myStopCallback, IntPtr.Zero)); - } - - //////////////////////////////////////////////////////////// - /// - /// Start the capture using default sample rate (44100 Hz) - /// Warning : only one capture can happen at the same time - /// - //////////////////////////////////////////////////////////// - public void Start() - { - Start(44100); - } - - //////////////////////////////////////////////////////////// - /// - /// Start the capture. - /// Warning : only one capture can happen at the same time - /// - /// Sound frequency; the more samples, the higher the quality (44100 by default = CD quality) - //////////////////////////////////////////////////////////// - public void Start(uint sampleRate) - { - sfSoundRecorder_Start(This, sampleRate); - } - - //////////////////////////////////////////////////////////// - /// - /// Stop the capture - /// - //////////////////////////////////////////////////////////// - public void Stop() - { - sfSoundRecorder_Stop(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Sample rate of the recorder, in samples per second - /// - //////////////////////////////////////////////////////////// - public uint SampleRate - { - get {return sfSoundRecorder_GetSampleRate(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Tell if the system supports sound capture. - /// If not, this class won't be usable - /// - //////////////////////////////////////////////////////////// - public static bool IsAvailable - { - get {return sfSoundRecorder_IsAvailable();} - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[SoundRecorder]" + - " SampleRate(" + SampleRate + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Called when a new capture starts - /// - /// False to abort recording audio data, true to continue - //////////////////////////////////////////////////////////// - protected virtual bool OnStart() - { - // Does nothing by default - return true; - } - - //////////////////////////////////////////////////////////// - /// - /// Process a new chunk of recorded samples - /// - /// Array of samples to process - /// False to stop recording audio data, true to continue - //////////////////////////////////////////////////////////// - protected abstract bool OnProcessSamples(short[] samples); - - //////////////////////////////////////////////////////////// - /// - /// Called when the current capture stops - /// - //////////////////////////////////////////////////////////// - protected virtual void OnStop() - { - // Does nothing by default - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfSoundRecorder_Destroy(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Function called directly by the C library ; convert - /// arguments and forward them to the internal virtual function - /// - /// Pointer to the array of samples - /// Number of samples in the array - /// User data -- unused - /// False to stop recording audio data, true to continue - //////////////////////////////////////////////////////////// - private bool ProcessSamples(IntPtr samples, uint nbSamples, IntPtr userData) - { - short[] samplesArray = new short[nbSamples]; - Marshal.Copy(samples, samplesArray, 0, samplesArray.Length); - - return OnProcessSamples(samplesArray); - } - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate bool StartCallback(); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate bool ProcessCallback(IntPtr samples, uint nbSamples, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate void StopCallback(); - - private StartCallback myStartCallback; - private ProcessCallback myProcessCallback; - private StopCallback myStopCallback; - - #region Imports - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSoundRecorder_Create(StartCallback OnStart, ProcessCallback OnProcess, StopCallback OnStop, IntPtr UserData); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundRecorder_Destroy(IntPtr SoundRecorder); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundRecorder_Start(IntPtr SoundRecorder, uint SampleRate); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundRecorder_Stop(IntPtr SoundRecorder); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSoundRecorder_GetSampleRate(IntPtr SoundRecorder); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfSoundRecorder_IsAvailable(); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Audio/SoundStream.cs b/bindings/dotnet/src/Audio/SoundStream.cs deleted file mode 100644 index c44c13b89..000000000 --- a/bindings/dotnet/src/Audio/SoundStream.cs +++ /dev/null @@ -1,386 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace SFML -{ - namespace Audio - { - //////////////////////////////////////////////////////////// - /// - /// SoundStream is a streamed sound, ie. samples are acquired - /// while the sound is playing. Use it for big sounds that would - /// require hundreds of MB in memory (see Music), - /// or for streaming sound from the network - /// - //////////////////////////////////////////////////////////// - public abstract class SoundStream : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Default constructor - /// - //////////////////////////////////////////////////////////// - public SoundStream() : - base(IntPtr.Zero) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Play the sound stream - /// - //////////////////////////////////////////////////////////// - public void Play() - { - sfSoundStream_Play(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Pause the sound stream - /// - //////////////////////////////////////////////////////////// - public void Pause() - { - sfSoundStream_Pause(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Stop the sound stream - /// - //////////////////////////////////////////////////////////// - public void Stop() - { - sfSoundStream_Stop(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Samples rate, in samples per second - /// - //////////////////////////////////////////////////////////// - public uint SampleRate - { - get {return sfSoundStream_GetSampleRate(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Number of channels (1 = mono, 2 = stereo) - /// - //////////////////////////////////////////////////////////// - public uint ChannelsCount - { - get {return sfSoundStream_GetChannelsCount(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Current status of the sound stream (see SoundStatus enum) - /// - //////////////////////////////////////////////////////////// - public SoundStatus Status - { - get {return sfSoundStream_GetStatus(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Loop state of the sound stream. Default value is false - /// - //////////////////////////////////////////////////////////// - public bool Loop - { - get {return sfSoundStream_GetLoop(This);} - set {sfSoundStream_SetLoop(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Pitch of the sound stream. Default value is 1 - /// - //////////////////////////////////////////////////////////// - public float Pitch - { - get {return sfSoundStream_GetPitch(This);} - set {sfSoundStream_SetPitch(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Volume of the sound stream, in range [0, 100]. Default value is 100 - /// - //////////////////////////////////////////////////////////// - public float Volume - { - get {return sfSoundStream_GetVolume(This);} - set {sfSoundStream_SetVolume(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// 3D position of the sound stream. Default value is (0, 0, 0) - /// - //////////////////////////////////////////////////////////// - public Vector3f Position - { - get {Vector3f v; sfSoundStream_GetPosition(This, out v.X, out v.Y, out v.Z); return v;} - set {sfSoundStream_SetPosition(This, value.X, value.Y, value.Z);} - } - - //////////////////////////////////////////////////////////// - /// - /// Is the sound stream's position relative to the listener's position, - /// or is it absolute? - /// Default value is false (absolute) - /// - //////////////////////////////////////////////////////////// - public bool RelativeToListener - { - get {return sfSoundStream_IsRelativeToListener(This);} - set {sfSoundStream_SetRelativeToListener(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Minimum distance of the sound stream. Closer than this distance, - /// the listener will hear the sound at its maximum volume. - /// The default value is 1 - /// - //////////////////////////////////////////////////////////// - public float MinDistance - { - get {return sfSoundStream_GetMinDistance(This);} - set {sfSoundStream_SetMinDistance(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Attenuation factor. The higher the attenuation, the - /// more the sound will be attenuated with distance from listener. - /// The default value is 1 - /// - //////////////////////////////////////////////////////////// - public float Attenuation - { - get {return sfSoundStream_GetAttenuation(This);} - set {sfSoundStream_SetAttenuation(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Current playing position, in milliseconds - /// - //////////////////////////////////////////////////////////// - public uint PlayingOffset - { - get {return sfSoundStream_GetPlayingOffset(This);} - set {sfSoundStream_SetPlayingOffset(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[SoundStream]" + - " SampleRate(" + SampleRate + ")" + - " ChannelsCount(" + ChannelsCount + ")" + - " Status(" + Status + ")" + - " Loop(" + Loop + ")" + - " Pitch(" + Pitch + ")" + - " Volume(" + Volume + ")" + - " Position(" + Position + ")" + - " RelativeToListener(" + RelativeToListener + ")" + - " MinDistance(" + MinDistance + ")" + - " Attenuation(" + Attenuation + ")" + - " PlayingOffset(" + PlayingOffset + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Set the audio stream parameters, you must call it before Play() - /// - /// Number of channels - /// Sample rate, in samples per second - //////////////////////////////////////////////////////////// - protected void Initialize(uint channelsCount, uint sampleRate) - { - myGetDataCallback = new GetDataCallbackType(GetData); - mySeekCallback = new SeekCallbackType(Seek); - SetThis(sfSoundStream_Create(myGetDataCallback, mySeekCallback, channelsCount, sampleRate, IntPtr.Zero)); - } - - //////////////////////////////////////////////////////////// - /// - /// Virtual function called each time new audio data is needed to feed the stream - /// - /// Array of samples to fill for the stream - /// True to continue playback, false to stop - //////////////////////////////////////////////////////////// - protected abstract bool OnGetData(out short[] samples); - - //////////////////////////////////////////////////////////// - /// - /// Virtual function called to seek into the stream - /// - /// New position, in milliseconds - //////////////////////////////////////////////////////////// - protected abstract void OnSeek(uint timeOffset); - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfSoundStream_Destroy(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Structure mapping the C library arguments passed to the data callback - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - private struct Chunk - { - unsafe public short* samplesPtr; - public uint samplesCount; - } - - //////////////////////////////////////////////////////////// - /// - /// Called each time new audio data is needed to feed the stream - /// - /// Data chunk to fill with new audio samples - /// User data -- unused - /// True to continue playback, false to stop - //////////////////////////////////////////////////////////// - private bool GetData(ref Chunk dataChunk, IntPtr userData) - { - if (OnGetData(out myTempBuffer)) - { - unsafe - { - fixed (short* samplesPtr = myTempBuffer) - { - dataChunk.samplesPtr = samplesPtr; - dataChunk.samplesCount = (uint)myTempBuffer.Length; - } - } - - return true; - } - else - { - return false; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Called to seek in the stream - /// - /// New position, in milliseconds - /// User data -- unused - /// If false is returned, the playback is aborted - //////////////////////////////////////////////////////////// - private void Seek(uint timeOffset, IntPtr userData) - { - OnSeek(timeOffset); - } - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate bool GetDataCallbackType(ref Chunk dataChunk, IntPtr UserData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate void SeekCallbackType(uint timeOffset, IntPtr UserData); - - private GetDataCallbackType myGetDataCallback; - private SeekCallbackType mySeekCallback; - private short[] myTempBuffer; - - #region Imports - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSoundStream_Create(GetDataCallbackType OnGetData, SeekCallbackType OnSeek, uint ChannelsCount, uint SampleRate, IntPtr UserData); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_Destroy(IntPtr SoundStreamStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_Play(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_Pause(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_Stop(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern SoundStatus sfSoundStream_GetStatus(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSoundStream_GetChannelsCount(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSoundStream_GetSampleRate(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_SetLoop(IntPtr SoundStream, bool Loop); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_SetPitch(IntPtr SoundStream, float Pitch); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_SetVolume(IntPtr SoundStream, float Volume); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_SetPosition(IntPtr SoundStream, float X, float Y, float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_SetRelativeToListener(IntPtr SoundStream, bool Relative); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_SetMinDistance(IntPtr SoundStream, float MinDistance); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_SetAttenuation(IntPtr SoundStream, float Attenuation); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_SetPlayingOffset(IntPtr SoundStream, uint TimeOffset); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfSoundStream_GetLoop(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSoundStream_GetPitch(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSoundStream_GetVolume(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSoundStream_GetPosition(IntPtr SoundStream, out float X, out float Y, out float Z); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfSoundStream_IsRelativeToListener(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSoundStream_GetMinDistance(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSoundStream_GetAttenuation(IntPtr SoundStream); - - [DllImport("csfml-audio-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfSoundStream_GetPlayingOffset(IntPtr SoundStream); - #endregion - } - } -} \ No newline at end of file diff --git a/bindings/dotnet/src/Audio/Vector3.cs b/bindings/dotnet/src/Audio/Vector3.cs deleted file mode 100644 index 611e1968e..000000000 --- a/bindings/dotnet/src/Audio/Vector3.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace SFML -{ - namespace Audio - { - //////////////////////////////////////////////////////////// - /// - /// Vector3f is an utility class for manipulating 3 dimensional - /// vectors with float components - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct Vector3f - { - //////////////////////////////////////////////////////////// - /// - /// Construct the vector from its coordinates - /// - /// X coordinate - /// Y coordinate - /// Z coordinate - //////////////////////////////////////////////////////////// - public Vector3f(float x, float y, float z) - { - X = x; - Y = y; - Z = z; - } - - //////////////////////////////////////////////////////////// - /// - /// Operator - overload ; returns the opposite of a vector - /// - /// Vector to negate - /// -v - //////////////////////////////////////////////////////////// - public static Vector3f operator -(Vector3f v) - { - return new Vector3f(-v.X, -v.Y, -v.Z); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator - overload ; subtracts two vectors - /// - /// First vector - /// Second vector - /// v1 - v2 - //////////////////////////////////////////////////////////// - public static Vector3f operator -(Vector3f v1, Vector3f v2) - { - return new Vector3f(v1.X - v2.X, v1.Y - v2.X, v1.Z - v2.Z); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator + overload ; add two vectors - /// - /// First vector - /// Second vector - /// v1 + v2 - //////////////////////////////////////////////////////////// - public static Vector3f operator +(Vector3f v1, Vector3f v2) - { - return new Vector3f(v1.X + v2.X, v1.Y + v2.X, v1.Z + v2.Z); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator * overload ; multiply a vector by a scalar value - /// - /// Vector - /// Scalar value - /// v * x - //////////////////////////////////////////////////////////// - public static Vector3f operator *(Vector3f v, float x) - { - return new Vector3f(v.X * x, v.Y * x, v.Z * x); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator * overload ; multiply a scalar value by a vector - /// - /// Scalar value - /// Vector - /// x * v - //////////////////////////////////////////////////////////// - public static Vector3f operator *(float x, Vector3f v) - { - return new Vector3f(v.X * x, v.Y * x, v.Z * x); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator / overload ; divide a vector by a scalar value - /// - /// Vector - /// Scalar value - /// v / x - //////////////////////////////////////////////////////////// - public static Vector3f operator /(Vector3f v, float x) - { - return new Vector3f(v.X / x, v.Y / x, v.Z / x); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Vector3f]" + - " X(" + X + ")" + - " Y(" + Y + ")" + - " Z(" + Z + ")"; - } - - /// X (horizontal) component of the vector - public float X; - - /// Y (vertical) component of the vector - public float Y; - - /// Z (depth) component of the vector - public float Z; - } - } -} diff --git a/bindings/dotnet/src/Audio/sfml-audio.csproj b/bindings/dotnet/src/Audio/sfml-audio.csproj deleted file mode 100644 index 95f740ddc..000000000 --- a/bindings/dotnet/src/Audio/sfml-audio.csproj +++ /dev/null @@ -1,88 +0,0 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {0B202C4D-A457-47FE-84A3-031DD878C6BE} - Library - Properties - SFML.Audio - sfmlnet-audio-2 - - - - - 2.0 - - - - - true - ..\..\lib\x86\ - DEBUG;TRACE - true - ..\..\doc\build\audio-doc.xml - full - x86 - prompt - - - ..\..\lib\x86\ - TRACE - true - ..\..\doc\build\audio-doc.xml - true - pdbonly - x86 - prompt - - - true - ..\..\lib\x64\ - DEBUG;TRACE - true - ..\..\doc\build\audio-doc.xml - full - x64 - prompt - - - ..\..\lib\x64\ - TRACE - true - ..\..\doc\build\audio-doc.xml - true - pdbonly - x64 - prompt - - - - - - - - - - - - - - - - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} - sfml-window - - - - - - \ No newline at end of file diff --git a/bindings/dotnet/src/Graphics/Color.cs b/bindings/dotnet/src/Graphics/Color.cs deleted file mode 100644 index 9f783ee1c..000000000 --- a/bindings/dotnet/src/Graphics/Color.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Utility class for manipulating 32-bits RGBA colors - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct Color - { - //////////////////////////////////////////////////////////// - /// - /// Construct the color from its red, green and blue components - /// - /// Red component - /// Green component - /// Blue component - //////////////////////////////////////////////////////////// - public Color(byte red, byte green, byte blue) : - this(red, green, blue, 255) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the color from its red, green, blue and alpha components - /// - /// Red component - /// Green component - /// Blue component - /// Alpha (transparency) component - //////////////////////////////////////////////////////////// - public Color(byte red, byte green, byte blue, byte alpha) - { - R = red; - G = green; - B = blue; - A = alpha; - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the color from another - /// - /// Color to copy - //////////////////////////////////////////////////////////// - public Color(Color color) : - this(color.R, color.G, color.B, color.A) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Color]" + - " R(" + R + ")" + - " G(" + G + ")" + - " B(" + B + ")" + - " A(" + A + ")"; - } - - /// Red component of the color - public byte R; - - /// Green component of the color - public byte G; - - /// Blue component of the color - public byte B; - - /// Alpha (transparent) component of the color - public byte A; - - - /// Predefined black color - public static readonly Color Black = new Color(0, 0, 0); - - /// Predefined white color - public static readonly Color White = new Color(255, 255, 255); - - /// Predefined red color - public static readonly Color Red = new Color(255, 0, 0); - - /// Predefined green color - public static readonly Color Green = new Color(0, 255, 0); - - /// Predefined blue color - public static readonly Color Blue = new Color(0, 0, 255); - - /// Predefined yellow color - public static readonly Color Yellow = new Color(255, 255, 0); - - /// Predefined magenta color - public static readonly Color Magenta = new Color(255, 0, 255); - - /// Predefined cyan color - public static readonly Color Cyan = new Color(0, 255, 255); - } - } -} diff --git a/bindings/dotnet/src/Graphics/Context.cs b/bindings/dotnet/src/Graphics/Context.cs deleted file mode 100644 index ad3dab93d..000000000 --- a/bindings/dotnet/src/Graphics/Context.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using System.Runtime.ConstrainedExecution; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// This class defines - /// - //////////////////////////////////////////////////////////// - internal class Context : CriticalFinalizerObject - { - //////////////////////////////////////////////////////////// - /// - /// Default constructor - /// - //////////////////////////////////////////////////////////// - public Context() - { - myThis = sfContext_Create(); - } - - //////////////////////////////////////////////////////////// - /// - /// Finalizer - /// - //////////////////////////////////////////////////////////// - ~Context() - { - sfContext_Destroy(myThis); - } - - //////////////////////////////////////////////////////////// - /// - /// Activate or deactivate the context - /// - /// True to activate, false to deactivate - //////////////////////////////////////////////////////////// - public void SetActive(bool active) - { - sfContext_SetActive(myThis, active); - } - - //////////////////////////////////////////////////////////// - /// - /// Global helper context - /// - //////////////////////////////////////////////////////////// - public static Context Global - { - get - { - if (ourGlobalContext == null) - ourGlobalContext = new Context(); - - return ourGlobalContext; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Context]"; - } - - private static Context ourGlobalContext = null; - - private IntPtr myThis = IntPtr.Zero; - - #region Imports - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfContext_Create(); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfContext_Destroy(IntPtr View); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfContext_SetActive(IntPtr View, bool Active); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/Drawable.cs b/bindings/dotnet/src/Graphics/Drawable.cs deleted file mode 100644 index 09e11a5ef..000000000 --- a/bindings/dotnet/src/Graphics/Drawable.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Enumerate the blending modes available for drawable objects - /// - //////////////////////////////////////////////////////////// - public enum BlendMode - { - /// Pixel = Src * a + Dest * (1 - a) - Alpha, - - /// Pixel = Src + Dest - Add, - - /// Pixel = Src * Dest - Multiply, - - /// No blending - None - } - - //////////////////////////////////////////////////////////// - /// - /// Abstract base class for every object that can be drawn - /// into a render window - /// - //////////////////////////////////////////////////////////// - public abstract class Drawable : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Position of the object on screen - /// - //////////////////////////////////////////////////////////// - public abstract Vector2f Position { get; set; } - - //////////////////////////////////////////////////////////// - /// - /// Rotation of the object, defined in degrees - /// - //////////////////////////////////////////////////////////// - public abstract float Rotation {get; set;} - - //////////////////////////////////////////////////////////// - /// - /// Vertical and horizontal scale of the object - /// - //////////////////////////////////////////////////////////// - public abstract Vector2f Scale { get; set; } - - //////////////////////////////////////////////////////////// - /// - /// Origin of the transformation of the object - /// (center of translation, rotation and scale) - /// - //////////////////////////////////////////////////////////// - public abstract Vector2f Origin { get; set; } - - //////////////////////////////////////////////////////////// - /// - /// Global color of the object - /// - //////////////////////////////////////////////////////////// - public abstract Color Color {get; set;} - - //////////////////////////////////////////////////////////// - /// - /// Blending mode of the object - /// - //////////////////////////////////////////////////////////// - public abstract BlendMode BlendMode {get; set;} - - //////////////////////////////////////////////////////////// - /// - /// Transform a point from global coordinates into local coordinates - /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) - /// - /// Point to transform - /// Transformed point - //////////////////////////////////////////////////////////// - public abstract Vector2f TransformToLocal(Vector2f point); - - //////////////////////////////////////////////////////////// - /// - /// Transform a point from local coordinates into global coordinates - /// (ie it applies the object's origin, translation, rotation and scale to the point) - /// - /// Point to transform - /// Transformed point - //////////////////////////////////////////////////////////// - public abstract Vector2f TransformToGlobal(Vector2f point); - - //////////////////////////////////////////////////////////// - /// - /// Render the object into the given render window - /// - /// Target render window - /// Shader to apply - //////////////////////////////////////////////////////////// - internal abstract void Render(RenderWindow target, Shader shader); - - //////////////////////////////////////////////////////////// - /// - /// Render the object into the given render image - /// - /// Target render image - /// Shader to apply - //////////////////////////////////////////////////////////// - internal abstract void Render(RenderImage target, Shader shader); - - //////////////////////////////////////////////////////////// - /// - /// Internal constructor, for derived classes - /// - /// Pointer to the object in C library - //////////////////////////////////////////////////////////// - protected Drawable(IntPtr thisPtr) : - base(thisPtr) - { - } - } - } -} diff --git a/bindings/dotnet/src/Graphics/Font.cs b/bindings/dotnet/src/Graphics/Font.cs deleted file mode 100644 index 300205d62..000000000 --- a/bindings/dotnet/src/Graphics/Font.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Security; -using System.IO; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Structure describing a glyph (a visual character) - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct Glyph - { - /// Offset to move horizontically to the next character - public int Advance; - - /// Bounding rectangle of the glyph, in coordinates relative to the baseline - public IntRect Rectangle; - - /// Texture coordinates of the glyph inside the font's image - public FloatRect TexCoords; - } - - //////////////////////////////////////////////////////////// - /// - /// Font is the low-level class for loading and - /// manipulating character fonts. This class is meant to - /// be used by String2D - /// - //////////////////////////////////////////////////////////// - public class Font : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Construct the font from a file - /// - /// Font file to load - /// - //////////////////////////////////////////////////////////// - public Font(string filename) : - base(sfFont_CreateFromFile(filename)) - { - if (This == IntPtr.Zero) - throw new LoadingFailedException("font", filename); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the font from a file in a stream - /// - /// Stream containing the file contents - /// - //////////////////////////////////////////////////////////// - public Font(Stream stream) : - base(IntPtr.Zero) - { - unsafe - { - stream.Position = 0; - byte[] StreamData = new byte[stream.Length]; - uint Read = (uint)stream.Read(StreamData, 0, StreamData.Length); - fixed (byte* dataPtr = StreamData) - { - SetThis(sfFont_CreateFromMemory((char*)dataPtr, Read)); - } - } - - if (This == IntPtr.Zero) - throw new LoadingFailedException("font"); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the font from another font - /// - /// Font to copy - //////////////////////////////////////////////////////////// - public Font(Font copy) : - base(sfFont_Copy(copy.This)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Get a glyph in the font - /// - /// Unicode code point of the character to get - /// Character size - /// Retrieve the bold version or the regular one? - /// The glyph corresponding to the character - //////////////////////////////////////////////////////////// - public Glyph GetGlyph(uint codePoint, uint characterSize, bool bold) - { - return sfFont_GetGlyph(This, codePoint, characterSize, bold); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the kerning offset between two glyphs - /// - /// Unicode code point of the first character - /// Unicode code point of the second character - /// Character size - /// Kerning offset, in pixels - //////////////////////////////////////////////////////////// - public int GetKerning(uint first, uint second, uint characterSize) - { - return sfFont_GetKerning(This, first, second, characterSize); - } - - //////////////////////////////////////////////////////////// - /// - /// Get spacing between two consecutive lines - /// - /// Character size - /// Line spacing, in pixels - //////////////////////////////////////////////////////////// - public int GetLineSpacing(uint characterSize) - { - return sfFont_GetLineSpacing(This, characterSize); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the image containing the glyphs of a given size - /// - /// Character size - /// Image storing the glyphs for the given size - //////////////////////////////////////////////////////////// - public Image GetImage(uint characterSize) - { - myImages[characterSize] = new Image(sfFont_GetImage(This, characterSize)); - return myImages[characterSize]; - } - - //////////////////////////////////////////////////////////// - /// - /// Default built-in font - /// - //////////////////////////////////////////////////////////// - public static Font DefaultFont - { - get - { - if (ourDefaultFont == null) - ourDefaultFont = new Font(sfFont_GetDefaultFont()); - - return ourDefaultFont; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Font]"; - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - if (this != ourDefaultFont) - { - if (!disposing) - Context.Global.SetActive(true); - - sfFont_Destroy(This); - - if (disposing) - { - foreach (Image image in myImages.Values) - image.Dispose(); - } - - if (!disposing) - Context.Global.SetActive(false); - } - } - - //////////////////////////////////////////////////////////// - /// - /// Internal constructor - /// - /// Pointer to the object in C library - //////////////////////////////////////////////////////////// - private Font(IntPtr thisPtr) : - base(thisPtr) - { - } - - private Dictionary myImages = new Dictionary(); - private static Font ourDefaultFont = null; - - #region Imports - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfFont_CreateFromFile(string Filename); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern IntPtr sfFont_CreateFromMemory(char* Data, uint SizeInBytes); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfFont_Copy(IntPtr Font); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfFont_Destroy(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Glyph sfFont_GetGlyph(IntPtr This, uint codePoint, uint characterSize, bool bold); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern int sfFont_GetKerning(IntPtr This, uint first, uint second, uint characterSize); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern int sfFont_GetLineSpacing(IntPtr This, uint characterSize); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfFont_GetImage(IntPtr This, uint characterSize); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfFont_GetDefaultFont(); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/Image.cs b/bindings/dotnet/src/Graphics/Image.cs deleted file mode 100644 index 1d16320ea..000000000 --- a/bindings/dotnet/src/Graphics/Image.cs +++ /dev/null @@ -1,462 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using System.IO; -using System.Runtime.ConstrainedExecution; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Image is the low-level class for loading and - /// manipulating images - /// - //////////////////////////////////////////////////////////// - public class Image : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Construct the image with black color - /// - /// Image width - /// Image height - /// - //////////////////////////////////////////////////////////// - public Image(uint width, uint height) : - this(width, height, Color.Black) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the image from a single color - /// - /// Image width - /// Image height - /// Color to fill the image with - /// - //////////////////////////////////////////////////////////// - public Image(uint width, uint height, Color color) : - base(sfImage_CreateFromColor(width, height, color)) - { - if (This == IntPtr.Zero) - throw new LoadingFailedException("image"); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the image from a file - /// - /// Path of the image file to load - /// - //////////////////////////////////////////////////////////// - public Image(string filename) : - base(sfImage_CreateFromFile(filename)) - { - if (This == IntPtr.Zero) - throw new LoadingFailedException("image", filename); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the image from a file in a stream - /// - /// Stream containing the file contents - /// - //////////////////////////////////////////////////////////// - public Image(Stream stream) : - base(IntPtr.Zero) - { - stream.Position = 0; - byte[] StreamData = new byte[stream.Length]; - uint Read = (uint)stream.Read(StreamData, 0, StreamData.Length); - unsafe - { - fixed (byte* dataPtr = StreamData) - { - SetThis(sfImage_CreateFromMemory((char*)dataPtr, Read)); - } - } - if (This == IntPtr.Zero) - throw new LoadingFailedException("image"); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the image directly from an array of pixels - /// - /// 2 dimensions array containing the pixels - /// - //////////////////////////////////////////////////////////// - public Image(Color[,] pixels) : - base(IntPtr.Zero) - { - unsafe - { - fixed (Color* PixelsPtr = pixels) - { - uint Width = (uint)pixels.GetLength(0); - uint Height = (uint)pixels.GetLength(1); - SetThis(sfImage_CreateFromPixels(Width, Height, (byte*)PixelsPtr)); - } - } - - if (This == IntPtr.Zero) - throw new LoadingFailedException("image"); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the image directly from an array of pixels - /// - /// Image width - /// Image height - /// array containing the pixels - /// - //////////////////////////////////////////////////////////// - public Image(uint width, uint height, byte[] pixels) : - base(IntPtr.Zero) - { - unsafe - { - fixed (byte* PixelsPtr = pixels) - { - SetThis(sfImage_CreateFromPixels(width, height, PixelsPtr)); - } - } - - if (This == IntPtr.Zero) - throw new LoadingFailedException("image"); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the image from another image - /// - /// Image to copy - //////////////////////////////////////////////////////////// - public Image(Image copy) : - base(sfImage_Copy(copy.This)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Save the contents of the image to a file - /// - /// Path of the file to save (overwritten if already exist) - /// True if saving was successful - //////////////////////////////////////////////////////////// - public bool SaveToFile(string filename) - { - return sfImage_SaveToFile(This, filename); - } - - //////////////////////////////////////////////////////////// - /// - /// Create a transparency mask from a specified colorkey - /// - /// Color to become transparent - //////////////////////////////////////////////////////////// - public void CreateMaskFromColor(Color color) - { - CreateMaskFromColor(color, 0); - } - - //////////////////////////////////////////////////////////// - /// - /// Create a transparency mask from a specified colorkey - /// - /// Color to become transparent - /// Alpha value to use for transparent pixels - //////////////////////////////////////////////////////////// - public void CreateMaskFromColor(Color color, byte alpha) - { - sfImage_CreateMaskFromColor(This, color, alpha); - } - - //////////////////////////////////////////////////////////// - /// - /// Copy pixels from another image onto this one. - /// This function does a slow pixel copy and should only - /// be used at initialization time - /// - /// Source image to copy - /// X coordinate of the destination position - /// Y coordinate of the destination position - //////////////////////////////////////////////////////////// - public void Copy(Image source, uint destX, uint destY) - { - Copy(source, destX, destY, new IntRect(0, 0, 0, 0)); - } - - //////////////////////////////////////////////////////////// - /// - /// Copy pixels from another image onto this one. - /// This function does a slow pixel copy and should only - /// be used at initialization time - /// - /// Source image to copy - /// X coordinate of the destination position - /// Y coordinate of the destination position - /// Sub-rectangle of the source image to copy - //////////////////////////////////////////////////////////// - public void Copy(Image source, uint destX, uint destY, IntRect sourceRect) - { - sfImage_CopyImage(This, source.This, destX, destY, sourceRect); - } - - //////////////////////////////////////////////////////////// - /// - /// Create the image from the current contents of the - /// given window - /// - /// Window to capture - /// True if copy has been successful - //////////////////////////////////////////////////////////// - public bool CopyScreen(RenderWindow window) - { - return CopyScreen(window, new IntRect(0, 0, 0, 0)); - } - - //////////////////////////////////////////////////////////// - /// - /// Create the image from the current contents of the - /// given window - /// - /// Window to capture - /// Sub-rectangle of the screen to copy - /// True if copy has been successful - //////////////////////////////////////////////////////////// - public bool CopyScreen(RenderWindow window, IntRect sourceRect) - { - return sfImage_CopyScreen(This, window.This, sourceRect); - } - - //////////////////////////////////////////////////////////// - /// - /// Get a pixel from the image - /// - /// X coordinate of pixel in the image - /// Y coordinate of pixel in the image - /// Color of pixel (x, y) - //////////////////////////////////////////////////////////// - public Color GetPixel(uint x, uint y) - { - return sfImage_GetPixel(This, x, y); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the color of a pixel - /// - /// X coordinate of pixel in the image - /// Y coordinate of pixel in the image - /// New color for pixel (x, y) - //////////////////////////////////////////////////////////// - public void SetPixel(uint x, uint y, Color color) - { - sfImage_SetPixel(This, x, y, color); - } - - //////////////////////////////////////////////////////////// - /// - /// Get a copy of the array of pixels (RGBA 8 bits integers components) - /// Array size is Width x Height x 4 - /// - /// Array of pixels - //////////////////////////////////////////////////////////// - public byte[] Pixels - { - get - { - byte[] PixelsPtr = new byte[Width * Height * 4]; - Marshal.Copy(sfImage_GetPixelsPtr(This), PixelsPtr, 0, PixelsPtr.Length); - return PixelsPtr; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Update the pixels of the image - /// - /// 2 dimensions array containing the pixels - //////////////////////////////////////////////////////////// - public void UpdatePixels(Color[,] pixels) - { - UpdatePixels(pixels, 0, 0); - } - - //////////////////////////////////////////////////////////// - /// - /// Update the pixels of the image - /// - /// 2 dimensions array containing the pixels - /// X position of the rectangle to update - /// Y position of the rectangle to update - //////////////////////////////////////////////////////////// - public void UpdatePixels(Color[,] pixels, uint x, uint y) - { - unsafe - { - fixed (Color* PixelsPtr = pixels) - { - int Width = pixels.GetLength(0); - int Height = pixels.GetLength(1); - sfImage_UpdatePixels(This, PixelsPtr, new IntRect((int)x, (int)y, Width, Height)); - } - } - } - - //////////////////////////////////////////////////////////// - /// - /// Bind the image for rendering - /// - //////////////////////////////////////////////////////////// - public void Bind() - { - sfImage_Bind(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Control the smooth filter - /// - //////////////////////////////////////////////////////////// - public bool Smooth - { - get {return sfImage_IsSmooth(This);} - set {sfImage_SetSmooth(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Width of the image, in pixels - /// - //////////////////////////////////////////////////////////// - public uint Width - { - get {return sfImage_GetWidth(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Height of the image, in pixels - /// - //////////////////////////////////////////////////////////// - public uint Height - { - get {return sfImage_GetHeight(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Image]" + - " Width(" + Width + ")" + - " Height(" + Height + ")" + - " Smooth(" + Smooth + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Internal constructor - /// - /// Pointer to the object in C library - //////////////////////////////////////////////////////////// - internal Image(IntPtr thisPtr) : - base(thisPtr) - { - myExternal = true; - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - if (!myExternal) - { - if (!disposing) - Context.Global.SetActive(true); - - sfImage_Destroy(This); - - if (!disposing) - Context.Global.SetActive(false); - } - } - - bool myExternal = false; - - #region Imports - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfImage_CreateFromColor(uint Width, uint Height, Color Col); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern IntPtr sfImage_CreateFromPixels(uint Width, uint Height, byte* Pixels); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfImage_CreateFromFile(string Filename); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfImage_Copy(IntPtr Image); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern IntPtr sfImage_CreateFromMemory(char* Data, uint Size); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfImage_Destroy(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfImage_SaveToFile(IntPtr This, string Filename); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfImage_CreateMaskFromColor(IntPtr This, Color Col, byte Alpha); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfImage_CopyScreen(IntPtr This, IntPtr Window, IntRect SourceRect); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfImage_CopyImage(IntPtr This, IntPtr Source, uint DestX, uint DestY, IntRect SourceRect); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfImage_SetPixel(IntPtr This, uint X, uint Y, Color Col); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Color sfImage_GetPixel(IntPtr This, uint X, uint Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfImage_GetPixelsPtr(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern void sfImage_UpdatePixels(IntPtr This, Color* Pixels, IntRect Rectangle); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfImage_Bind(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfImage_SetSmooth(IntPtr This, bool Smooth); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfImage_GetWidth(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfImage_GetHeight(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfImage_IsSmooth(IntPtr This); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/Rect.cs b/bindings/dotnet/src/Graphics/Rect.cs deleted file mode 100644 index 41d05c882..000000000 --- a/bindings/dotnet/src/Graphics/Rect.cs +++ /dev/null @@ -1,247 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// IntRect is an utility class for manipulating 2D rectangles - /// with integer coordinates - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct IntRect - { - //////////////////////////////////////////////////////////// - /// - /// Construct the rectangle from its coordinates - /// - /// Left coordinate of the rectangle - /// Top coordinate of the rectangle - /// Width of the rectangle - /// Height of the rectangle - //////////////////////////////////////////////////////////// - public IntRect(int left, int top, int width, int height) - { - Left = left; - Top = top; - Width = width; - Height = height; - } - - //////////////////////////////////////////////////////////// - /// - /// Check if a point is inside the rectangle's area - /// - /// X coordinate of the point to test - /// Y coordinate of the point to test - /// True if the point is inside - //////////////////////////////////////////////////////////// - public bool Contains(int x, int y) - { - return (x >= Left) && (x < Left + Width) && (y >= Top) && (y < Top + Height); - } - - //////////////////////////////////////////////////////////// - /// - /// Check intersection between two rectangles - /// - /// Rectangle to test - /// True if rectangles overlap - //////////////////////////////////////////////////////////// - public bool Intersects(IntRect rect) - { - // Compute the intersection boundaries - int left = Math.Max(Left, rect.Left); - int top = Math.Max(Top, rect.Top); - int right = Math.Min(Left + Width, rect.Left + rect.Width); - int bottom = Math.Min(Top + Height, rect.Top + rect.Height); - - return (left < right) && (top < bottom); - } - - //////////////////////////////////////////////////////////// - /// - /// Check intersection between two rectangles - /// - /// Rectangle to test - /// Rectangle to be filled with overlapping rect - /// True if rectangles overlap - //////////////////////////////////////////////////////////// - public bool Intersects(IntRect rect, out IntRect overlap) - { - // Compute the intersection boundaries - int left = Math.Max(Left, rect.Left); - int top = Math.Max(Top, rect.Top); - int right = Math.Min(Left + Width, rect.Left + rect.Width); - int bottom = Math.Min(Top + Height, rect.Top + rect.Height); - - // If the intersection is valid (positive non zero area), then there is an intersection - if ((left < right) && (top < bottom)) - { - overlap.Left = left; - overlap.Top = top; - overlap.Width = right - left; - overlap.Height = bottom - top; - return true; - } - else - { - overlap.Left = 0; - overlap.Top = 0; - overlap.Width = 0; - overlap.Height = 0; - return false; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[IntRect]" + - " Left(" + Left + ")" + - " Top(" + Top + ")" + - " Width(" + Width + ")" + - " Height(" + Height + ")"; - } - - /// Left coordinate of the rectangle - public int Left; - - /// Top coordinate of the rectangle - public int Top; - - /// Width of the rectangle - public int Width; - - /// Height of the rectangle - public int Height; - } - //////////////////////////////////////////////////////////// - /// - /// IntRect is an utility class for manipulating 2D rectangles - /// with float coordinates - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct FloatRect - { - //////////////////////////////////////////////////////////// - /// - /// Construct the rectangle from its coordinates - /// - /// Left coordinate of the rectangle - /// Top coordinate of the rectangle - /// Width of the rectangle - /// Height of the rectangle - //////////////////////////////////////////////////////////// - public FloatRect(float left, float top, float width, float height) - { - Left = left; - Top = top; - Width = width; - Height = height; - } - - //////////////////////////////////////////////////////////// - /// - /// Check if a point is inside the rectangle's area - /// - /// X coordinate of the point to test - /// Y coordinate of the point to test - /// True if the point is inside - //////////////////////////////////////////////////////////// - public bool Contains(float x, float y) - { - return (x >= Left) && (x < Left + Width) && (y >= Top) && (y < Top + Height); - } - - //////////////////////////////////////////////////////////// - /// - /// Check intersection between two rectangles - /// - /// Rectangle to test - /// True if rectangles overlap - //////////////////////////////////////////////////////////// - public bool Intersects(FloatRect rect) - { - // Compute the intersection boundaries - float left = Math.Max(Left, rect.Left); - float top = Math.Max(Top, rect.Top); - float right = Math.Min(Left + Width, rect.Left + rect.Width); - float bottom = Math.Min(Top + Height, rect.Top + rect.Height); - - return (left < right) && (top < bottom); - } - - //////////////////////////////////////////////////////////// - /// - /// Check intersection between two rectangles - /// - /// Rectangle to test - /// Rectangle to be filled with overlapping rect - /// True if rectangles overlap - //////////////////////////////////////////////////////////// - public bool Intersects(FloatRect rect, out FloatRect overlap) - { - // Compute the intersection boundaries - float left = Math.Max(Left, rect.Left); - float top = Math.Max(Top, rect.Top); - float right = Math.Min(Left + Width, rect.Left + rect.Width); - float bottom = Math.Min(Top + Height, rect.Top + rect.Height); - - // If the intersection is valid (positive non zero area), then there is an intersection - if ((left < right) && (top < bottom)) - { - overlap.Left = left; - overlap.Top = top; - overlap.Width = right - left; - overlap.Height = bottom - top; - return true; - } - else - { - overlap.Left = 0; - overlap.Top = 0; - overlap.Width = 0; - overlap.Height = 0; - return false; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[FloatRect]" + - " Left(" + Left + ")" + - " Top(" + Top + ")" + - " Width(" + Width + ")" + - " Height(" + Height + ")"; - } - - /// Left coordinate of the rectangle - public float Left; - - /// Top coordinate of the rectangle - public float Top; - - /// Width of the rectangle - public float Width; - - /// Height of the rectangle - public float Height; - } - } -} diff --git a/bindings/dotnet/src/Graphics/RenderImage.cs b/bindings/dotnet/src/Graphics/RenderImage.cs deleted file mode 100644 index 28bcde2ce..000000000 --- a/bindings/dotnet/src/Graphics/RenderImage.cs +++ /dev/null @@ -1,336 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Collections; -using System.Collections.Generic; -using System.Security; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Simple wrapper for Window that allows easy - /// 2D rendering - /// - //////////////////////////////////////////////////////////// - public class RenderImage : ObjectBase, RenderTarget - { - //////////////////////////////////////////////////////////// - /// - /// Create the render image with the given dimensions - /// - /// Width of the render image - /// Height of the render image - //////////////////////////////////////////////////////////// - public RenderImage(uint width, uint height) : - this(width, height, false) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Create the render image with the given dimensions and - /// an optional depth-buffer attached - /// - /// Width of the render image - /// Height of the render image - /// Do you want a depth-buffer attached? - //////////////////////////////////////////////////////////// - public RenderImage(uint width, uint height, bool depthBuffer) : - base(sfRenderImage_Create(width, height, depthBuffer)) - { - myDefaultView = new View(sfRenderImage_GetDefaultView(This)); - myImage = new Image(sfRenderImage_GetImage(This)); - GC.SuppressFinalize(myDefaultView); - GC.SuppressFinalize(myImage); - } - - //////////////////////////////////////////////////////////// - /// - /// Width of the rendering region of the image - /// - //////////////////////////////////////////////////////////// - public uint Width - { - get {return sfRenderImage_GetWidth(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Height of the rendering region of the image - /// - //////////////////////////////////////////////////////////// - public uint Height - { - get {return sfRenderImage_GetHeight(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Activate of deactivate the render image as the current target - /// for rendering - /// - /// True to activate, false to deactivate (true by default) - /// True if operation was successful, false otherwise - //////////////////////////////////////////////////////////// - public bool SetActive(bool active) - { - return sfRenderImage_SetActive(This, active); - } - - //////////////////////////////////////////////////////////// - /// - /// Default view of the render image - /// - //////////////////////////////////////////////////////////// - public View DefaultView - { - get {return myDefaultView;} - } - - //////////////////////////////////////////////////////////// - /// - /// Return the current active view - /// - /// The current view - //////////////////////////////////////////////////////////// - public View GetView() - { - return new View(sfRenderImage_GetView(This)); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the current active view - /// - /// New view - //////////////////////////////////////////////////////////// - public void SetView(View view) - { - sfRenderImage_SetView(This, view.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the viewport of a view applied to this target - /// - /// Target view - /// Viewport rectangle, expressed in pixels in the current target - //////////////////////////////////////////////////////////// - public IntRect GetViewport(View view) - { - return sfRenderImage_GetViewport(This, view.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Convert a point in target coordinates into view coordinates - /// This version uses the current view of the window - /// - /// X coordinate of the point to convert, relative to the target - /// Y coordinate of the point to convert, relative to the target - /// Converted point - /// - //////////////////////////////////////////////////////////// - public Vector2f ConvertCoords(uint x, uint y) - { - return ConvertCoords(x, y, GetView()); - } - - //////////////////////////////////////////////////////////// - /// - /// Convert a point in target coordinates into view coordinates - /// This version uses the given view - /// - /// X coordinate of the point to convert, relative to the target - /// Y coordinate of the point to convert, relative to the target - /// Target view to convert the point to - /// Converted point - /// - //////////////////////////////////////////////////////////// - public Vector2f ConvertCoords(uint x, uint y, View view) - { - Vector2f point; - sfRenderImage_ConvertCoords(This, x, y, out point.X, out point.Y, view.This); - - return point; - } - - //////////////////////////////////////////////////////////// - /// - /// Clear the entire render image with black color - /// - //////////////////////////////////////////////////////////// - public void Clear() - { - sfRenderImage_Clear(This, Color.Black); - } - - //////////////////////////////////////////////////////////// - /// - /// Clear the entire render image with a single color - /// - /// Color to use to clear the image - //////////////////////////////////////////////////////////// - public void Clear(Color color) - { - sfRenderImage_Clear(This, color); - } - - //////////////////////////////////////////////////////////// - /// - /// Draw something into the render image - /// - /// Object to draw - //////////////////////////////////////////////////////////// - public void Draw(Drawable objectToDraw) - { - objectToDraw.Render(this, null); - } - - //////////////////////////////////////////////////////////// - /// - /// Draw something into the render image with a shader - /// - /// Object to draw - /// Shader to apply - //////////////////////////////////////////////////////////// - public void Draw(Drawable objectToDraw, Shader shader) - { - objectToDraw.Render(this, shader); - } - - //////////////////////////////////////////////////////////// - /// - /// Save the current OpenGL render states and matrices - /// - //////////////////////////////////////////////////////////// - public void SaveGLStates() - { - sfRenderImage_SaveGLStates(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Restore the previously saved OpenGL render states and matrices - /// - //////////////////////////////////////////////////////////// - public void RestoreGLStates() - { - sfRenderImage_RestoreGLStates(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Update the contents of the target image - /// - //////////////////////////////////////////////////////////// - public void Display() - { - sfRenderImage_Display(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Target image of the render image - /// - //////////////////////////////////////////////////////////// - public Image Image - { - get {return myImage;} - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[RenderImage]" + - " Width(" + Width + ")" + - " Height(" + Height + ")" + - " Image(" + Image + ")" + - " DefaultView(" + DefaultView + ")" + - " View(" + GetView() + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - if (!disposing) - Context.Global.SetActive(true); - - sfRenderImage_Destroy(This); - - if (disposing) - { - myDefaultView.Dispose(); - myImage.Dispose(); - } - - if (!disposing) - Context.Global.SetActive(false); - } - - private View myDefaultView = null; - private Image myImage = null; - - #region Imports - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderImage_Create(uint Width, uint Height, bool DepthBuffer); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_Destroy(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_Clear(IntPtr This, Color ClearColor); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfRenderImage_GetWidth(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfRenderImage_GetHeight(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderImage_SetActive(IntPtr This, bool Active); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderImage_SaveGLStates(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderImage_RestoreGLStates(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderImage_Display(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_SetView(IntPtr This, IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderImage_GetView(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderImage_GetDefaultView(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntRect sfRenderImage_GetViewport(IntPtr This, IntPtr TargetView); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_ConvertCoords(IntPtr This, uint WindowX, uint WindowY, out float ViewX, out float ViewY, IntPtr TargetView); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderImage_GetImage(IntPtr This); - - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/RenderTarget.cs b/bindings/dotnet/src/Graphics/RenderTarget.cs deleted file mode 100644 index 6319850da..000000000 --- a/bindings/dotnet/src/Graphics/RenderTarget.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Abstract base class for render targets (renderwindow, renderimage) - /// - //////////////////////////////////////////////////////////// - public interface RenderTarget - { - //////////////////////////////////////////////////////////// - /// - /// Width of the rendering region of the window - /// - //////////////////////////////////////////////////////////// - uint Width {get;} - - //////////////////////////////////////////////////////////// - /// - /// Height of the rendering region of the window - /// - //////////////////////////////////////////////////////////// - uint Height {get;} - - //////////////////////////////////////////////////////////// - /// - /// Default view of the window - /// - //////////////////////////////////////////////////////////// - View DefaultView {get;} - - //////////////////////////////////////////////////////////// - /// - /// Return the current active view - /// - /// The current view - //////////////////////////////////////////////////////////// - View GetView(); - - //////////////////////////////////////////////////////////// - /// - /// Change the current active view - /// - /// New view - //////////////////////////////////////////////////////////// - void SetView(View view); - - //////////////////////////////////////////////////////////// - /// - /// Get the viewport of a view applied to this target - /// - /// Target view - /// Viewport rectangle, expressed in pixels in the current target - //////////////////////////////////////////////////////////// - IntRect GetViewport(View view); - - //////////////////////////////////////////////////////////// - /// - /// Convert a point in target coordinates into view coordinates - /// This version uses the current view of the window - /// - /// X coordinate of the point to convert, relative to the target - /// Y coordinate of the point to convert, relative to the target - /// Converted point - //////////////////////////////////////////////////////////// - Vector2f ConvertCoords(uint x, uint y); - - //////////////////////////////////////////////////////////// - /// - /// Convert a point in target coordinates into view coordinates - /// This version uses the given view - /// - /// X coordinate of the point to convert, relative to the target - /// Y coordinate of the point to convert, relative to the target - /// Target view to convert the point to - /// Converted point - //////////////////////////////////////////////////////////// - Vector2f ConvertCoords(uint x, uint y, View view); - - //////////////////////////////////////////////////////////// - /// - /// Clear the entire window with black color - /// - //////////////////////////////////////////////////////////// - void Clear(); - - //////////////////////////////////////////////////////////// - /// - /// Clear the entire window with a single color - /// - /// Color to use to clear the window - //////////////////////////////////////////////////////////// - void Clear(Color color); - - //////////////////////////////////////////////////////////// - /// - /// Draw something into the window - /// - /// Object to draw - //////////////////////////////////////////////////////////// - void Draw(Drawable objectToDraw); - - //////////////////////////////////////////////////////////// - /// - /// Draw something into the render image with a shader - /// - /// Object to draw - /// Shader to apply - //////////////////////////////////////////////////////////// - void Draw(Drawable objectToDraw, Shader shader); - - //////////////////////////////////////////////////////////// - /// - /// Save the current OpenGL render states and matrices - /// - //////////////////////////////////////////////////////////// - void SaveGLStates(); - - //////////////////////////////////////////////////////////// - /// - /// Restore the previously saved OpenGL render states and matrices - /// - //////////////////////////////////////////////////////////// - void RestoreGLStates(); - } - } -} diff --git a/bindings/dotnet/src/Graphics/RenderWindow.cs b/bindings/dotnet/src/Graphics/RenderWindow.cs deleted file mode 100644 index ff757a2a2..000000000 --- a/bindings/dotnet/src/Graphics/RenderWindow.cs +++ /dev/null @@ -1,630 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Collections; -using System.Collections.Generic; -using System.Security; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Simple wrapper for Window that allows easy - /// 2D rendering - /// - //////////////////////////////////////////////////////////// - public class RenderWindow : SFML.Window.Window, RenderTarget - { - //////////////////////////////////////////////////////////// - /// - /// Create the window with default style and creation settings - /// - /// Video mode to use - /// Title of the window - //////////////////////////////////////////////////////////// - public RenderWindow(VideoMode mode, string title) : - this(mode, title, Styles.Default, new ContextSettings(0, 0)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Create the window with default creation settings - /// - /// Video mode to use - /// Title of the window - /// Window style (Resize | Close by default) - //////////////////////////////////////////////////////////// - public RenderWindow(VideoMode mode, string title, Styles style) : - this(mode, title, style, new ContextSettings(0, 0)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Create the window - /// - /// Video mode to use - /// Title of the window - /// Window style (Resize | Close by default) - /// Creation parameters - //////////////////////////////////////////////////////////// - public RenderWindow(VideoMode mode, string title, Styles style, ContextSettings settings) : - base(sfRenderWindow_Create(mode, title, style, ref settings), 0) - { - Initialize(); - } - - //////////////////////////////////////////////////////////// - /// - /// Create the window from an existing control with default creation settings - /// - /// Platform-specific handle of the control - //////////////////////////////////////////////////////////// - public RenderWindow(IntPtr handle) : - this(handle, new ContextSettings(0, 0)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Create the window from an existing control - /// - /// Platform-specific handle of the control - /// Creation parameters - //////////////////////////////////////////////////////////// - public RenderWindow(IntPtr handle, ContextSettings settings) : - base(sfRenderWindow_CreateFromHandle(handle, ref settings), 0) - { - Initialize(); - } - - //////////////////////////////////////////////////////////// - /// - /// Tell whether or not the window is opened (ie. has been created). - /// Note that a hidden window (Show(false)) - /// will still return true - /// - /// True if the window is opened - //////////////////////////////////////////////////////////// - public override bool IsOpened() - { - return sfRenderWindow_IsOpened(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Close (destroy) the window. - /// The Window instance remains valid and you can call - /// Create to recreate the window - /// - //////////////////////////////////////////////////////////// - public override void Close() - { - sfRenderWindow_Close(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Display the window on screen - /// - //////////////////////////////////////////////////////////// - public override void Display() - { - sfRenderWindow_Display(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Width of the rendering region of the window - /// - //////////////////////////////////////////////////////////// - public override uint Width - { - get {return sfRenderWindow_GetWidth(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Height of the rendering region of the window - /// - //////////////////////////////////////////////////////////// - public override uint Height - { - get {return sfRenderWindow_GetHeight(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Creation settings of the window - /// - //////////////////////////////////////////////////////////// - public override ContextSettings Settings - { - get {return sfRenderWindow_GetSettings(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Enable / disable vertical synchronization - /// - /// True to enable v-sync, false to deactivate - //////////////////////////////////////////////////////////// - public override void EnableVerticalSync(bool enable) - { - sfRenderWindow_EnableVerticalSync(This, enable); - } - - //////////////////////////////////////////////////////////// - /// - /// Show or hide the mouse cursor - /// - /// True to show, false to hide - //////////////////////////////////////////////////////////// - public override void ShowMouseCursor(bool show) - { - sfRenderWindow_ShowMouseCursor(This, show); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the position of the mouse cursor - /// - /// Left coordinate of the cursor, relative to the window - /// Top coordinate of the cursor, relative to the window - //////////////////////////////////////////////////////////// - public override void SetCursorPosition(uint x, uint y) - { - sfRenderWindow_SetCursorPosition(This, x, y); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the position of the window on screen. - /// Only works for top-level windows - /// - /// Left position - /// Top position - //////////////////////////////////////////////////////////// - public override void SetPosition(int x, int y) - { - sfRenderWindow_SetPosition(This, x, y); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the size of the rendering region of the window - /// - /// New width - /// New height - //////////////////////////////////////////////////////////// - public override void SetSize(uint width, uint height) - { - sfRenderWindow_SetSize(This, width, height); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the title of the window - /// - /// New title - //////////////////////////////////////////////////////////// - public override void SetTitle(string title) - { - sfRenderWindow_SetTitle(This, title); - } - - //////////////////////////////////////////////////////////// - /// - /// Show or hide the window - /// - /// True to show, false to hide - //////////////////////////////////////////////////////////// - public override void Show(bool show) - { - sfRenderWindow_Show(This, show); - } - - //////////////////////////////////////////////////////////// - /// - /// Enable or disable automatic key-repeat. - /// Automatic key-repeat is enabled by default - /// - /// True to enable, false to disable - //////////////////////////////////////////////////////////// - public override void EnableKeyRepeat(bool enable) - { - sfRenderWindow_EnableKeyRepeat(This, enable); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the window's icon - /// - /// Icon's width, in pixels - /// Icon's height, in pixels - /// Array of pixels, format must be RGBA 32 bits - //////////////////////////////////////////////////////////// - public override void SetIcon(uint width, uint height, byte[] pixels) - { - unsafe - { - fixed (byte* PixelsPtr = pixels) - { - sfRenderWindow_SetIcon(This, width, height, PixelsPtr); - } - } - } - - //////////////////////////////////////////////////////////// - /// - /// Activate of deactivate the window as the current target - /// for rendering - /// - /// True to activate, false to deactivate (true by default) - /// True if operation was successful, false otherwise - //////////////////////////////////////////////////////////// - public override bool SetActive(bool active) - { - return sfRenderWindow_SetActive(This, active); - } - - //////////////////////////////////////////////////////////// - /// - /// Limit the framerate to a maximum fixed frequency - /// - /// Framerate limit, in frames per seconds (use 0 to disable limit) - //////////////////////////////////////////////////////////// - public override void SetFramerateLimit(uint limit) - { - sfRenderWindow_SetFramerateLimit(This, limit); - } - - //////////////////////////////////////////////////////////// - /// - /// Get time elapsed since last frame - /// - /// Time elapsed, in seconds - //////////////////////////////////////////////////////////// - public override uint GetFrameTime() - { - return sfRenderWindow_GetFrameTime(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the joystick threshold, ie. the value below which - /// no move event will be generated - /// - /// New threshold, in range [0, 100] - //////////////////////////////////////////////////////////// - public override void SetJoystickThreshold(float threshold) - { - sfRenderWindow_SetJoystickThreshold(This, threshold); - } - - //////////////////////////////////////////////////////////// - /// - /// OS-specific handle of the window - /// - //////////////////////////////////////////////////////////// - public override IntPtr SystemHandle - { - get {return sfRenderWindow_GetSystemHandle(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Default view of the window - /// - //////////////////////////////////////////////////////////// - public View DefaultView - { - get {return myDefaultView;} - } - - //////////////////////////////////////////////////////////// - /// - /// Return the current active view - /// - /// The current view - //////////////////////////////////////////////////////////// - public View GetView() - { - return new View(sfRenderWindow_GetView(This)); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the current active view - /// - /// New view - //////////////////////////////////////////////////////////// - public void SetView(View view) - { - sfRenderWindow_SetView(This, view.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the viewport of a view applied to this target - /// - /// Target view - /// Viewport rectangle, expressed in pixels in the current target - //////////////////////////////////////////////////////////// - public IntRect GetViewport(View view) - { - return sfRenderWindow_GetViewport(This, view.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Convert a point in target coordinates into view coordinates - /// This version uses the current view of the window - /// - /// X coordinate of the point to convert, relative to the target - /// Y coordinate of the point to convert, relative to the target - /// Converted point - /// - //////////////////////////////////////////////////////////// - public Vector2f ConvertCoords(uint x, uint y) - { - return ConvertCoords(x, y, GetView()); - } - - //////////////////////////////////////////////////////////// - /// - /// Convert a point in target coordinates into view coordinates - /// This version uses the given view - /// - /// X coordinate of the point to convert, relative to the target - /// Y coordinate of the point to convert, relative to the target - /// Target view to convert the point to - /// Converted point - /// - //////////////////////////////////////////////////////////// - public Vector2f ConvertCoords(uint x, uint y, View view) - { - Vector2f point; - sfRenderWindow_ConvertCoords(This, x, y, out point.X, out point.Y, view.This); - - return point; - } - - //////////////////////////////////////////////////////////// - /// - /// Clear the entire window with black color - /// - //////////////////////////////////////////////////////////// - public void Clear() - { - sfRenderWindow_Clear(This, Color.Black); - } - - //////////////////////////////////////////////////////////// - /// - /// Clear the entire window with a single color - /// - /// Color to use to clear the window - //////////////////////////////////////////////////////////// - public void Clear(Color color) - { - sfRenderWindow_Clear(This, color); - } - - //////////////////////////////////////////////////////////// - /// - /// Draw something into the window - /// - /// Object to draw - //////////////////////////////////////////////////////////// - public void Draw(Drawable objectToDraw) - { - objectToDraw.Render(this, null); - } - - //////////////////////////////////////////////////////////// - /// - /// Draw something into the window with a shader - /// - /// Object to draw - /// Shader to apply - //////////////////////////////////////////////////////////// - public void Draw(Drawable objectToDraw, Shader shader) - { - objectToDraw.Render(this, shader); - } - - //////////////////////////////////////////////////////////// - /// - /// Save the current OpenGL render states and matrices - /// - //////////////////////////////////////////////////////////// - public void SaveGLStates() - { - sfRenderWindow_SaveGLStates(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Restore the previously saved OpenGL render states and matrices - /// - //////////////////////////////////////////////////////////// - public void RestoreGLStates() - { - sfRenderWindow_RestoreGLStates(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[RenderWindow]" + - " Width(" + Width + ")" + - " Height(" + Height + ")" + - " Settings(" + Settings + ")" + - " DefaultView(" + DefaultView + ")" + - " View(" + GetView() + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Internal function to get the next event - /// - /// Variable to fill with the raw pointer to the event structure - /// True if there was an event, false otherwise - //////////////////////////////////////////////////////////// - protected override bool PollEvent(out Event eventToFill) - { - return sfRenderWindow_PollEvent(This, out eventToFill); - } - - //////////////////////////////////////////////////////////// - /// - /// Internal function to get the next event (blocking) - /// - /// Variable to fill with the raw pointer to the event structure - /// False if any error occured - //////////////////////////////////////////////////////////// - protected override bool WaitEvent(out Event eventToFill) - { - return sfRenderWindow_WaitEvent(This, out eventToFill); - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfRenderWindow_Destroy(This); - - if (disposing) - myDefaultView.Dispose(); - } - - //////////////////////////////////////////////////////////// - /// - /// Do common initializations - /// - //////////////////////////////////////////////////////////// - private void Initialize() - { - myDefaultView = new View(sfRenderWindow_GetDefaultView(This)); - GC.SuppressFinalize(myDefaultView); - } - - private View myDefaultView = null; - - #region Imports - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderWindow_Create(VideoMode Mode, string Title, Styles Style, ref ContextSettings Params); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderWindow_CreateFromHandle(IntPtr Handle, ref ContextSettings Params); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_Destroy(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderWindow_IsOpened(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_Close(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderWindow_PollEvent(IntPtr This, out Event Evt); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderWindow_WaitEvent(IntPtr This, out Event Evt); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_Clear(IntPtr This, Color ClearColor); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_Display(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfRenderWindow_GetWidth(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfRenderWindow_GetHeight(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern ContextSettings sfRenderWindow_GetSettings(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_EnableVerticalSync(IntPtr This, bool Enable); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_ShowMouseCursor(IntPtr This, bool Show); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_SetCursorPosition(IntPtr This, uint X, uint Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_SetPosition(IntPtr This, int X, int Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_SetSize(IntPtr This, uint Width, uint Height); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_SetTitle(IntPtr This, string title); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_Show(IntPtr This, bool Show); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_EnableKeyRepeat(IntPtr This, bool Enable); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern void sfRenderWindow_SetIcon(IntPtr This, uint Width, uint Height, byte* Pixels); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderWindow_SetActive(IntPtr This, bool Active); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderWindow_SaveGLStates(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderWindow_RestoreGLStates(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_SetFramerateLimit(IntPtr This, uint Limit); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfRenderWindow_GetFrameTime(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_SetJoystickThreshold(IntPtr This, float Threshold); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_SetView(IntPtr This, IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderWindow_GetView(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderWindow_GetDefaultView(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntRect sfRenderWindow_GetViewport(IntPtr This, IntPtr TargetView); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_ConvertCoords(IntPtr This, uint WindowX, uint WindowY, out float ViewX, out float ViewY, IntPtr TargetView); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfRenderWindow_GetSystemHandle(IntPtr This); - - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/Shader.cs b/bindings/dotnet/src/Graphics/Shader.cs deleted file mode 100644 index 7efb2782b..000000000 --- a/bindings/dotnet/src/Graphics/Shader.cs +++ /dev/null @@ -1,267 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using System.Collections.Generic; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Wrapper for pixel shaders - /// - //////////////////////////////////////////////////////////// - public class Shader : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Load the shader from a file - /// - /// Path of the shader file to load - /// - //////////////////////////////////////////////////////////// - public Shader(string filename) : - base(sfShader_CreateFromFile(filename)) - { - if (This == IntPtr.Zero) - throw new LoadingFailedException("shader", filename); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the shader from another shader - /// - /// Shader to copy - //////////////////////////////////////////////////////////// - public Shader(Shader copy) : - base(sfShader_Copy(copy.This)) - { - foreach (KeyValuePair pair in copy.myTextures) - myTextures[pair.Key] = copy.myTextures[pair.Key]; - } - - //////////////////////////////////////////////////////////// - /// - /// Create a new shader from a text in memory - /// - /// String containing the shader code - /// - //////////////////////////////////////////////////////////// - public static Shader FromString(string shader) - { - IntPtr ptr = sfShader_CreateFromMemory(shader); - if (ptr == IntPtr.Zero) - throw new LoadingFailedException("shader"); - - return new Shader(ptr); - } - - //////////////////////////////////////////////////////////// - /// - /// Change a vector2 parameter of the shader - /// - /// Name of the parameter in the shader - /// Value of the parameter - //////////////////////////////////////////////////////////// - public void SetParameter(string name, Vector2f v) - { - SetParameter(name, v.X, v.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Change a 1-component parameter of the shader - /// - /// Name of the parameter in the shader - /// Value of the parameter - //////////////////////////////////////////////////////////// - public void SetParameter(string name, float x) - { - sfShader_SetParameter1(This, name, x); - } - - //////////////////////////////////////////////////////////// - /// - /// Change a 2-component parameter of the shader - /// - /// Name of the parameter in the shader - /// X component of the value - /// Y component of the value - //////////////////////////////////////////////////////////// - public void SetParameter(string name, float x, float y) - { - sfShader_SetParameter2(This, name, x, y); - } - - //////////////////////////////////////////////////////////// - /// - /// Change a 3-component parameter of the shader - /// - /// Name of the parameter in the shader - /// X component of the value - /// Y component of the value - /// Z component of the value - //////////////////////////////////////////////////////////// - public void SetParameter(string name, float x, float y, float z) - { - sfShader_SetParameter3(This, name, x, y, z); - } - - //////////////////////////////////////////////////////////// - /// - /// Change a 4-component parameter of the shader - /// - /// Name of the parameter in the shader - /// X component of the value - /// Y component of the value - /// Z component of the value - /// W component of the value - //////////////////////////////////////////////////////////// - public void SetParameter(string name, float x, float y, float z, float w) - { - sfShader_SetParameter4(This, name, x, y, z, w); - } - - //////////////////////////////////////////////////////////// - /// - /// Set a texture parameter - /// - /// Name of the texture in the shader - /// Image to set - //////////////////////////////////////////////////////////// - public void SetTexture(string name, Image texture) - { - myTextures[name] = texture; - sfShader_SetTexture(This, name, texture.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Set the current texture parameter - /// - /// Name of the texture in the shader - //////////////////////////////////////////////////////////// - public void SetCurrentTexture(string name) - { - sfShader_SetCurrentTexture(This, name); - } - - //////////////////////////////////////////////////////////// - /// - /// Bind the shader for rendering - /// - //////////////////////////////////////////////////////////// - public void Bind() - { - sfShader_Bind(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Unbind the shader - /// - //////////////////////////////////////////////////////////// - public void Unbind() - { - sfShader_Unbind(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Tell whether or not the system supports shaders - /// - //////////////////////////////////////////////////////////// - public static bool IsAvailable - { - get {return sfShader_IsAvailable();} - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Shader]"; - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - if (!disposing) - Context.Global.SetActive(true); - - myTextures.Clear(); - sfShader_Destroy(This); - - if (!disposing) - Context.Global.SetActive(false); - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the shader from a pointer - /// - /// Pointer to the shader instance - //////////////////////////////////////////////////////////// - public Shader(IntPtr ptr) : - base(ptr) - { - } - - Dictionary myTextures = new Dictionary(); - - #region Imports - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfShader_CreateFromFile(string Filename); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfShader_CreateFromMemory(string Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfShader_Copy(IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_Destroy(IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_SetParameter1(IntPtr Shader, string Name, float X); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_SetParameter2(IntPtr Shader, string Name, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_SetParameter3(IntPtr Shader, string Name, float X, float Y, float Z); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_SetParameter4(IntPtr Shader, string Name, float X, float Y, float Z, float W); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_SetTexture(IntPtr Shader, string Name, IntPtr Texture); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_SetCurrentTexture(IntPtr Shader, string Name); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_Bind(IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShader_Unbind(IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfShader_IsAvailable(); - - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/Shape.cs b/bindings/dotnet/src/Graphics/Shape.cs deleted file mode 100644 index 79e52418e..000000000 --- a/bindings/dotnet/src/Graphics/Shape.cs +++ /dev/null @@ -1,565 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// Shape defines a drawable convex shape ; it also defines - /// helper functions to draw simple shapes like - /// lines, rectangles, circles, etc. - /// - //////////////////////////////////////////////////////////// - public class Shape : Drawable - { - //////////////////////////////////////////////////////////// - /// - /// Default constructor - /// - //////////////////////////////////////////////////////////// - public Shape() : - base(sfShape_Create()) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the shape from another shape - /// - /// Shape to copy - //////////////////////////////////////////////////////////// - public Shape(Shape copy) : - base(sfShape_Copy(copy.This)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Position of the object on screen - /// - //////////////////////////////////////////////////////////// - public override Vector2f Position - { - get { return new Vector2f(sfShape_GetX(This), sfShape_GetY(This)); } - set { sfShape_SetPosition(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Rotation of the object, defined in degrees - /// - //////////////////////////////////////////////////////////// - public override float Rotation - { - get { return sfShape_GetRotation(This); } - set { sfShape_SetRotation(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Vertical and horizontal scale of the object - /// - //////////////////////////////////////////////////////////// - public override Vector2f Scale - { - get { return new Vector2f(sfShape_GetScaleX(This), sfShape_GetScaleY(This)); } - set { sfShape_SetScale(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Origin of the transformation of the object - /// (center of translation, rotation and scale) - /// - //////////////////////////////////////////////////////////// - public override Vector2f Origin - { - get { return new Vector2f(sfShape_GetOriginX(This), sfShape_GetOriginY(This)); } - set { sfShape_SetOrigin(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Global color of the object - /// - //////////////////////////////////////////////////////////// - public override Color Color - { - get { return sfShape_GetColor(This); } - set { sfShape_SetColor(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Blending mode of the object - /// - //////////////////////////////////////////////////////////// - public override BlendMode BlendMode - { - get { return sfShape_GetBlendMode(This); } - set { sfShape_SetBlendMode(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Transform a point from global coordinates into local coordinates - /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) - /// - /// Point to transform - /// Transformed point - //////////////////////////////////////////////////////////// - public override Vector2f TransformToLocal(Vector2f point) - { - Vector2f Transformed; - sfShape_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); - - return Transformed; - } - - //////////////////////////////////////////////////////////// - /// - /// Transform a point from local coordinates into global coordinates - /// (ie it applies the object's origin, translation, rotation and scale to the point) - /// - /// Point to transform - /// Transformed point - //////////////////////////////////////////////////////////// - public override Vector2f TransformToGlobal(Vector2f point) - { - Vector2f Transformed; - sfShape_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); - - return Transformed; - } - - //////////////////////////////////////////////////////////// - /// - /// Add a point to the shape - /// - /// Position of the point - /// Color of the point - //////////////////////////////////////////////////////////// - public void AddPoint(Vector2f position, Color color) - { - AddPoint(position, color, Color.Black); - } - - //////////////////////////////////////////////////////////// - /// - /// Add a point to the shape - /// - /// Position of the point - /// Color of the point - /// Outline color of the point - //////////////////////////////////////////////////////////// - public void AddPoint(Vector2f position, Color color, Color outlineColor) - { - sfShape_AddPoint(This, position.X, position.Y, color, outlineColor); - } - - //////////////////////////////////////////////////////////// - /// - /// Enable or disable filling the shape. - /// Fill is enabled by default - /// - /// True to enable, false to disable - //////////////////////////////////////////////////////////// - public void EnableFill(bool enable) - { - sfShape_EnableFill(This, enable); - } - - //////////////////////////////////////////////////////////// - /// - /// Enable or disable drawing the shape outline. - /// Outline is enabled by default - /// - /// True to enable, false to disable - //////////////////////////////////////////////////////////// - public void EnableOutline(bool enable) - { - sfShape_EnableOutline(This, enable); - } - - //////////////////////////////////////////////////////////// - /// - /// Thickness of the shape outline - /// - //////////////////////////////////////////////////////////// - public float OutlineThickness - { - get {return sfShape_GetOutlineThickness(This);} - set {sfShape_SetOutlineThickness(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Total number of points of the shape - /// - //////////////////////////////////////////////////////////// - public uint PointsCount - { - get {return sfShape_GetPointsCount(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Set the position of a point - /// - /// Index of the point, in range [0, NbPoints - 1] - /// New position of the index-th point - //////////////////////////////////////////////////////////// - public void SetPointPosition(uint index, Vector2f position) - { - sfShape_SetPointPosition(This, index, position.X, position.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the position of a point - /// - /// Index of the point, in range [0, NbPoints - 1] - /// Position of the index-th point - //////////////////////////////////////////////////////////// - public Vector2f GetPointPosition(uint index) - { - Vector2f Pos; - sfShape_GetPointPosition(This, index, out Pos.X, out Pos.Y); - - return Pos; - } - - //////////////////////////////////////////////////////////// - /// - /// Set the color of a point - /// - /// Index of the point, in range [0, NbPoints - 1] - /// New color of the index-th point - //////////////////////////////////////////////////////////// - public void SetPointColor(uint index, Color color) - { - sfShape_SetPointColor(This, index, color); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the color of a point - /// - /// Index of the point, in range [0, NbPoints - 1] - /// Color of the index-th point - //////////////////////////////////////////////////////////// - public Color GetPointColor(uint index) - { - return sfShape_GetPointColor(This, index); - } - - //////////////////////////////////////////////////////////// - /// - /// Set the outline color of a point - /// - /// Index of the point, in range [0, NbPoints - 1] - /// New outline color of the index-th point - //////////////////////////////////////////////////////////// - public void SetPointOutlineColor(uint index, Color color) - { - sfShape_SetPointOutlineColor(This, index, color); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the outline color of a point - /// - /// Index of the point, in range [0, NbPoints - 1] - /// Outline color of the index-th point - //////////////////////////////////////////////////////////// - public Color GetPointOutlineColor(uint index) - { - return sfShape_GetPointOutlineColor(This, index); - } - - //////////////////////////////////////////////////////////// - /// - /// Create a shape made of a single line - /// - /// Position of the first point - /// Position of the second point - /// Line thickness - /// Color used to draw the line - /// New line shape built with the given parameters - //////////////////////////////////////////////////////////// - public static Shape Line(Vector2f p1, Vector2f p2, float thickness, Color color) - { - return Line(p1, p2, thickness, color, 0, Color.White); - } - - //////////////////////////////////////////////////////////// - /// - /// Create a shape made of a single line - /// - /// Position of the first point - /// Position of the second point - /// Line thickness - /// Color used to draw the line - /// Outline width - /// Color used to draw the outline - /// New line shape built with the given parameters - //////////////////////////////////////////////////////////// - public static Shape Line(Vector2f p1, Vector2f p2, float thickness, Color color, float outline, Color outlineColor) - { - return new Shape(sfShape_CreateLine(p1.X, p1.Y, p2.X, p2.Y, thickness, color, outline, outlineColor)); - } - - //////////////////////////////////////////////////////////// - /// - /// Create a shape made of a single rectangle - /// - /// Rectangle to create - /// Color used to fill the rectangle - /// New rectangle shape built with the given parameters - //////////////////////////////////////////////////////////// - public static Shape Rectangle(FloatRect rectangle, Color color) - { - return Rectangle(rectangle, color, 0, Color.White); - } - - //////////////////////////////////////////////////////////// - /// - /// Create a shape made of a single rectangle - /// - /// Rectangle to create - /// Color used to fill the rectangle - /// Outline width - /// Color used to draw the outline - /// New rectangle shape built with the given parameters - //////////////////////////////////////////////////////////// - public static Shape Rectangle(FloatRect rectangle, Color color, float outline, Color outlineColor) - { - return new Shape(sfShape_CreateRectangle(rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height, color, outline, outlineColor)); - } - - //////////////////////////////////////////////////////////// - /// - /// Create a shape made of a single circle - /// - /// Position of the center - /// Radius of the circle - /// Color used to fill the circle - /// New circle shape built with the given parameters - //////////////////////////////////////////////////////////// - public static Shape Circle(Vector2f center, float radius, Color color) - { - return Circle(center, radius, color, 0, Color.White); - } - - //////////////////////////////////////////////////////////// - /// - /// Create a shape made of a single circle - /// - /// Position of the center - /// Radius of the circle - /// Color used to fill the circle - /// Outline width - /// Color used to draw the outline - /// New circle shape built with the given parameters - //////////////////////////////////////////////////////////// - public static Shape Circle(Vector2f center, float radius, Color color, float outline, Color outlineColor) - { - return new Shape(sfShape_CreateCircle(center.X, center.Y, radius, color, outline, outlineColor)); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Shape]" + - " Position(" + Position + ")" + - " Rotation(" + Rotation + ")" + - " Scale(" + Scale + ")" + - " Origin(" + Origin + ")" + - " Color(" + Color + ")" + - " BlendMode(" + BlendMode + ")" + - " OutlineThickness(" + OutlineThickness + ")" + - " PointsCount(" + PointsCount + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Render the object into the given render window - /// - /// Target render window - /// Shader to apply - //////////////////////////////////////////////////////////// - internal override void Render(RenderWindow target, Shader shader) - { - if (shader == null) - sfRenderWindow_DrawShape(target.This, This); - else - sfRenderWindow_DrawShapeWithShader(target.This, This, shader.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Render the object into the given render image - /// - /// Target render image - /// Shader to apply - //////////////////////////////////////////////////////////// - internal override void Render(RenderImage target, Shader shader) - { - if (shader == null) - sfRenderImage_DrawShape(target.This, This); - else - sfRenderImage_DrawShapeWithShader(target.This, This, shader.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfShape_Destroy(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Internal constructor - /// - /// Pointer to the internal object in C library - //////////////////////////////////////////////////////////// - private Shape(IntPtr thisPtr) : - base(thisPtr) - { - } - - #region Imports - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfShape_Create(); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfShape_Copy(IntPtr Shape); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_Destroy(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetPosition(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfShape_GetX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfShape_GetY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetRotation(IntPtr This, float Rotation); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfShape_GetRotation(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetScale(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfShape_GetScaleX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfShape_GetScaleY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetOrigin(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfShape_GetOriginX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfShape_GetOriginY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetColor(IntPtr This, Color Color); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Color sfShape_GetColor(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetBlendMode(IntPtr This, BlendMode Mode); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern BlendMode sfShape_GetBlendMode(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_DrawShape(IntPtr This, IntPtr Shape); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_DrawShapeWithShader(IntPtr This, IntPtr Shape, IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_DrawShape(IntPtr This, IntPtr Shape); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_DrawShapeWithShader(IntPtr This, IntPtr Shape, IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfShape_CreateLine(float P1X, float P1Y, float P2X, float P2Y, float Thickness, Color Col, float Outline, Color OutlineCol); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfShape_CreateRectangle(float P1X, float P1Y, float P2X, float P2Y, Color Col, float Outline, Color OutlineCol); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfShape_CreateCircle(float X, float Y, float Radius, Color Col, float Outline, Color OutlineCol); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_AddPoint(IntPtr This, float X, float Y, Color Col, Color OutlineCol); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_EnableFill(IntPtr This, bool Enable); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_EnableOutline(IntPtr This, bool Enable); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetOutlineThickness(IntPtr This, float Thickness); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfShape_GetOutlineThickness(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfShape_GetPointsCount(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetPointPosition(IntPtr This, uint Index, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_GetPointPosition(IntPtr This, uint Index, out float X, out float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetPointColor(IntPtr This, uint Index, Color Col); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Color sfShape_GetPointColor(IntPtr This, uint Index); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfShape_SetPointOutlineColor(IntPtr This, uint Index, Color Col); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Color sfShape_GetPointOutlineColor(IntPtr This, uint Index); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/Sprite.cs b/bindings/dotnet/src/Graphics/Sprite.cs deleted file mode 100644 index 2ab1ee810..000000000 --- a/bindings/dotnet/src/Graphics/Sprite.cs +++ /dev/null @@ -1,397 +0,0 @@ -using System; -using System.Security; -using System.Runtime.InteropServices; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// This class defines a sprite : texture, transformations, - /// color, and draw on screen - /// - //////////////////////////////////////////////////////////// - public class Sprite : Drawable - { - //////////////////////////////////////////////////////////// - /// - /// Default constructor - /// - //////////////////////////////////////////////////////////// - public Sprite() : - base(sfSprite_Create()) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the sprite from a source image - /// - /// Source image to assign to the sprite - //////////////////////////////////////////////////////////// - public Sprite(Image image) : - base(sfSprite_Create()) - { - Image = image; - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the sprite from another sprite - /// - /// Sprite to copy - //////////////////////////////////////////////////////////// - public Sprite(Sprite copy) : - base(sfSprite_Copy(copy.This)) - { - Image = copy.Image; - } - - //////////////////////////////////////////////////////////// - /// - /// Position of the object on screen - /// - //////////////////////////////////////////////////////////// - public override Vector2f Position - { - get { return new Vector2f(sfSprite_GetX(This), sfSprite_GetY(This)); } - set { sfSprite_SetPosition(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Rotation of the object, defined in degrees - /// - //////////////////////////////////////////////////////////// - public override float Rotation - { - get { return sfSprite_GetRotation(This); } - set { sfSprite_SetRotation(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Vertical and horizontal scale of the object - /// - //////////////////////////////////////////////////////////// - public override Vector2f Scale - { - get { return new Vector2f(sfSprite_GetScaleX(This), sfSprite_GetScaleY(This)); } - set { sfSprite_SetScale(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Origin of the transformation of the object - /// (center of translation, rotation and scale) - /// - //////////////////////////////////////////////////////////// - public override Vector2f Origin - { - get { return new Vector2f(sfSprite_GetOriginX(This), sfSprite_GetOriginY(This)); } - set { sfSprite_SetOrigin(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Global color of the object - /// - //////////////////////////////////////////////////////////// - public override Color Color - { - get { return sfSprite_GetColor(This); } - set { sfSprite_SetColor(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Blending mode of the object - /// - //////////////////////////////////////////////////////////// - public override BlendMode BlendMode - { - get { return sfSprite_GetBlendMode(This); } - set { sfSprite_SetBlendMode(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Transform a point from global coordinates into local coordinates - /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) - /// - /// Point to transform - /// Transformed point - //////////////////////////////////////////////////////////// - public override Vector2f TransformToLocal(Vector2f point) - { - Vector2f Transformed; - sfSprite_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); - - return Transformed; - } - - //////////////////////////////////////////////////////////// - /// - /// Transform a point from local coordinates into global coordinates - /// (ie it applies the object's origin, translation, rotation and scale to the point) - /// - /// Point to transform - /// Transformed point - //////////////////////////////////////////////////////////// - public override Vector2f TransformToGlobal(Vector2f point) - { - Vector2f Transformed; - sfSprite_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); - - return Transformed; - } - - //////////////////////////////////////////////////////////// - /// - /// Width of the sprite - /// - //////////////////////////////////////////////////////////// - public float Width - { - get { return sfSprite_GetWidth(This); } - set { sfSprite_Resize(This, value, this.Height); } - } - - //////////////////////////////////////////////////////////// - /// - /// Height of the sprite - /// - //////////////////////////////////////////////////////////// - public float Height - { - get { return sfSprite_GetHeight(This); } - set { sfSprite_Resize(This, this.Width, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Source images displayed by the sprite - /// - //////////////////////////////////////////////////////////// - public Image Image - { - get { return myImage; } - set { myImage = value; sfSprite_SetImage(This, value != null ? value.This : IntPtr.Zero, false); } - } - - //////////////////////////////////////////////////////////// - /// - /// Sub-rectangle of the source image displayed by the sprite - /// - //////////////////////////////////////////////////////////// - public IntRect SubRect - { - get { return sfSprite_GetSubRect(This); } - set { sfSprite_SetSubRect(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Flip the sprite horizontically - /// - /// True to flip, false to canel flip - //////////////////////////////////////////////////////////// - public void FlipX(bool flipped) - { - sfSprite_FlipX(This, flipped); - } - - //////////////////////////////////////////////////////////// - /// - /// Flip the sprite vertically - /// - /// True to flip, false to canel flip - //////////////////////////////////////////////////////////// - public void FlipY(bool flipped) - { - sfSprite_FlipY(This, flipped); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the color of a given pixel in the sprite - /// (point is in local coordinates) - /// - /// X coordinate of the pixel to get - /// Y coordinate of the pixel to get - /// Color of pixel (x, y) - //////////////////////////////////////////////////////////// - public Color GetPixel(uint x, uint y) - { - return sfSprite_GetPixel(This, x, y); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Sprite]" + - " Position(" + Position + ")" + - " Rotation(" + Rotation + ")" + - " Scale(" + Scale + ")" + - " Origin(" + Origin + ")" + - " Color(" + Color + ")" + - " BlendMode(" + BlendMode + ")" + - " Width(" + Width + ")" + - " Height(" + Height + ")" + - " SubRect(" + SubRect + ")" + - " Image(" + Image + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Render the object into the given render window - /// - /// Target render window - /// Shader to apply - //////////////////////////////////////////////////////////// - internal override void Render(RenderWindow target, Shader shader) - { - if (shader == null) - sfRenderWindow_DrawSprite(target.This, This); - else - sfRenderWindow_DrawSpriteWithShader(target.This, This, shader.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Render the object into the given render image - /// - /// Target render image - /// Shader to apply - //////////////////////////////////////////////////////////// - internal override void Render(RenderImage target, Shader shader) - { - if (shader == null) - sfRenderImage_DrawSprite(target.This, This); - else - sfRenderImage_DrawSpriteWithShader(target.This, This, shader.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfSprite_Destroy(This); - } - - private Image myImage = null; - - #region Imports - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSprite_Create(); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfSprite_Copy(IntPtr Sprite); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_Destroy(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetPosition(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetRotation(IntPtr This, float Rotation); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetRotation(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetScale(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetScaleX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetScaleY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetOrigin(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetOriginX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetOriginY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetColor(IntPtr This, Color Color); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Color sfSprite_GetColor(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetBlendMode(IntPtr This, BlendMode Mode); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern BlendMode sfSprite_GetBlendMode(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Vector2f sfSprite_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Vector2f sfSprite_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_DrawSprite(IntPtr This, IntPtr Sprite); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_DrawSpriteWithShader(IntPtr This, IntPtr Sprite, IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_DrawSprite(IntPtr This, IntPtr Sprite); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_DrawSpriteWithShader(IntPtr This, IntPtr Sprite, IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_Resize(IntPtr This, float Width, float Height); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetWidth(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfSprite_GetHeight(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetImage(IntPtr This, IntPtr Image, bool AdjustToNewSize); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetSubRect(IntPtr This, IntRect Rect); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntRect sfSprite_GetSubRect(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_FlipX(IntPtr This, bool Flipped); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_FlipY(IntPtr This, bool Flipped); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Color sfSprite_GetPixel(IntPtr This, uint X, uint Y); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/Text.cs b/bindings/dotnet/src/Graphics/Text.cs deleted file mode 100644 index c0a6c816d..000000000 --- a/bindings/dotnet/src/Graphics/Text.cs +++ /dev/null @@ -1,465 +0,0 @@ -using System; -using System.Security; -using System.Runtime.InteropServices; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// This class defines a graphical 2D text, that can be drawn on screen - /// - //////////////////////////////////////////////////////////// - public class Text : Drawable - { - //////////////////////////////////////////////////////////// - /// - /// Enumerate the string drawing styles - /// - //////////////////////////////////////////////////////////// - [Flags] - public enum Styles - { - /// Regular characters, no style - Regular = 0, - - /// Characters are bold - Bold = 1 << 0, - - /// Characters are in italic - Italic = 1 << 1, - - /// Characters are underlined - Underlined = 1 << 2 - } - - //////////////////////////////////////////////////////////// - /// - /// Default constructor - /// - //////////////////////////////////////////////////////////// - public Text() : - this("") - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the text from a string - /// - /// String to display - //////////////////////////////////////////////////////////// - public Text(string str) : - this(str, Font.DefaultFont) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the text from a string and a font - /// - /// String to display - /// Font to use - //////////////////////////////////////////////////////////// - public Text(string str, Font font) : - this(str, font, 30) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the text from a string, font and size - /// - /// String to display - /// Font to use - /// Base characters size - //////////////////////////////////////////////////////////// - public Text(string str, Font font, uint characterSize) : - base(sfText_Create()) - { - DisplayedString = str; - Font = font; - CharacterSize = characterSize; - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the text from another text - /// - /// Text to copy - //////////////////////////////////////////////////////////// - public Text(Text copy) : - base(sfText_Copy(copy.This)) - { - Font = copy.Font; - } - - //////////////////////////////////////////////////////////// - /// - /// Position of the object on screen - /// - //////////////////////////////////////////////////////////// - public override Vector2f Position - { - get { return new Vector2f(sfText_GetX(This), sfText_GetY(This)); } - set { sfText_SetPosition(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Rotation of the object, defined in degrees - /// - //////////////////////////////////////////////////////////// - public override float Rotation - { - get { return sfText_GetRotation(This); } - set { sfText_SetRotation(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Vertical and horizontal scale of the object - /// - //////////////////////////////////////////////////////////// - public override Vector2f Scale - { - get { return new Vector2f(sfText_GetScaleX(This), sfText_GetScaleY(This)); } - set { sfText_SetScale(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Origin of the transformation of the object - /// (center of translation, rotation and scale) - /// - //////////////////////////////////////////////////////////// - public override Vector2f Origin - { - get { return new Vector2f(sfText_GetOriginX(This), sfText_GetOriginY(This)); } - set { sfText_SetOrigin(This, value.X, value.Y); } - } - - //////////////////////////////////////////////////////////// - /// - /// Global color of the object - /// - //////////////////////////////////////////////////////////// - public override Color Color - { - get { return sfText_GetColor(This); } - set { sfText_SetColor(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Blending mode of the object - /// - //////////////////////////////////////////////////////////// - public override BlendMode BlendMode - { - get { return sfText_GetBlendMode(This); } - set { sfText_SetBlendMode(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Transform a point from global coordinates into local coordinates - /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) - /// - /// Point to transform - /// Transformed point - //////////////////////////////////////////////////////////// - public override Vector2f TransformToLocal(Vector2f point) - { - Vector2f Transformed; - sfText_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); - - return Transformed; - } - - //////////////////////////////////////////////////////////// - /// - /// Transform a point from local coordinates into global coordinates - /// (ie it applies the object's origin, translation, rotation and scale to the point) - /// - /// Point to transform - /// Transformed point - //////////////////////////////////////////////////////////// - public override Vector2f TransformToGlobal(Vector2f point) - { - Vector2f Transformed; - sfText_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); - - return Transformed; - } - - //////////////////////////////////////////////////////////// - /// - /// String which is displayed - /// - //////////////////////////////////////////////////////////// - public string DisplayedString - { - get - { - // Get the number of characters - // This is probably not the most optimized way; if anyone has a better solution... - int length = Marshal.PtrToStringAnsi(sfText_GetString(This)).Length; - - // Copy the characters - byte[] characters = new byte[length * 4]; - Marshal.Copy(sfText_GetUnicodeString(This), characters, 0, characters.Length); - - // Convert from UTF-32 to String (UTF-16) - return System.Text.Encoding.UTF32.GetString(characters); - } - - set - { - // Convert from String (UTF-16) to UTF-32 - int[] characters = new int[value.Length]; - for (int i = 0; i < value.Length; ++i) - characters[i] = Char.ConvertToUtf32(value, i); - - // Transform to raw and pass to the C API - GCHandle handle = GCHandle.Alloc(characters, GCHandleType.Pinned); - sfText_SetUnicodeString(This, handle.AddrOfPinnedObject()); - handle.Free(); - } - } - - //////////////////////////////////////////////////////////// - /// - /// Font used to display the text - /// - //////////////////////////////////////////////////////////// - public Font Font - { - get {return myFont;} - set {myFont = value; sfText_SetFont(This, value != null ? value.This : IntPtr.Zero);} - } - - //////////////////////////////////////////////////////////// - /// - /// Base size of characters - /// - //////////////////////////////////////////////////////////// - public uint CharacterSize - { - get {return sfText_GetCharacterSize(This);} - set {sfText_SetCharacterSize(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Style of the text (see Styles enum) - /// - //////////////////////////////////////////////////////////// - public Styles Style - { - get {return sfText_GetStyle(This);} - set {sfText_SetStyle(This, value);} - } - - //////////////////////////////////////////////////////////// - /// - /// Get the text rectangle on screen - /// - /// Text rectangle in global coordinates (doesn't include rotation) - //////////////////////////////////////////////////////////// - public FloatRect GetRect() - { - return sfText_GetRect(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Return the visual position of the Index-th character of the text, - /// in coordinates relative to the text - /// (note : translation, origin, rotation and scale are not applied) - /// - /// Index of the character - /// Position of the Index-th character (end of text if Index is out of range) - //////////////////////////////////////////////////////////// - public Vector2f GetCharacterPos(uint index) - { - Vector2f Pos; - sfText_GetCharacterPos(This, index, out Pos.X, out Pos.Y); - - return Pos; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Text]" + - " Position(" + Position + ")" + - " Rotation(" + Rotation + ")" + - " Scale(" + Scale + ")" + - " Origin(" + Origin + ")" + - " Color(" + Color + ")" + - " BlendMode(" + BlendMode + ")" + - " String(" + DisplayedString + ")" + - " Font(" + Font + ")" + - " CharacterSize(" + CharacterSize + ")" + - " Style(" + Style + ")" + - " Rectangle(" + GetRect() + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Render the object into the given render window - /// - /// Target render window - /// Shader to apply - //////////////////////////////////////////////////////////// - internal override void Render(RenderWindow target, Shader shader) - { - if (shader == null) - sfRenderWindow_DrawText(target.This, This); - else - sfRenderWindow_DrawTextWithShader(target.This, This, shader.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Render the object into the given render image - /// - /// Target render image - /// Shader to apply - //////////////////////////////////////////////////////////// - internal override void Render(RenderImage target, Shader shader) - { - if (shader == null) - sfRenderImage_DrawText(target.This, This); - else - sfRenderImage_DrawTextWithShader(target.This, This, shader.This); - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfText_Destroy(This); - } - - private Font myFont = Font.DefaultFont; - - #region Imports - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfText_Create(); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfText_Copy(IntPtr Text); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_Destroy(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetPosition(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfText_GetX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfText_GetY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetRotation(IntPtr This, float Rotation); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfText_GetRotation(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetScale(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfText_GetScaleX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfText_GetScaleY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetOrigin(IntPtr This, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfText_GetOriginX(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfText_GetOriginY(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetColor(IntPtr This, Color Color); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Color sfText_GetColor(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetBlendMode(IntPtr This, BlendMode Mode); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern BlendMode sfText_GetBlendMode(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Vector2f sfText_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Vector2f sfText_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_DrawText(IntPtr This, IntPtr String); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_DrawTextWithShader(IntPtr This, IntPtr String, IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_DrawText(IntPtr This, IntPtr String); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_DrawTextWithShader(IntPtr This, IntPtr String, IntPtr Shader); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetUnicodeString(IntPtr This, IntPtr Text); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetFont(IntPtr This, IntPtr Font); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetCharacterSize(IntPtr This, uint Size); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_SetStyle(IntPtr This, Styles Style); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfText_GetString(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfText_GetUnicodeString(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfText_GetCharacterSize(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern Styles sfText_GetStyle(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern FloatRect sfText_GetRect(IntPtr This); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfText_GetCharacterPos(IntPtr This, uint Index, out float X, out float Y); - - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/View.cs b/bindings/dotnet/src/Graphics/View.cs deleted file mode 100644 index 5968aead8..000000000 --- a/bindings/dotnet/src/Graphics/View.cs +++ /dev/null @@ -1,251 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using SFML.Window; - -namespace SFML -{ - namespace Graphics - { - //////////////////////////////////////////////////////////// - /// - /// This class defines a view (position, size, etc.) ; - /// you can consider it as a 2D camera - /// - //////////////////////////////////////////////////////////// - public class View : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Create a default view (1000x1000) - /// - //////////////////////////////////////////////////////////// - public View() : - base(sfView_Create()) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the view from a rectangle - /// - /// Rectangle defining the position and size of the view - //////////////////////////////////////////////////////////// - public View(FloatRect viewRect) : - base(sfView_CreateFromRect(viewRect)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the view from its center and size - /// - /// Center of the view - /// Size of the view - //////////////////////////////////////////////////////////// - public View(Vector2f center, Vector2f size) : - base(sfView_Create()) - { - this.Center = center; - this.Size = size; - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the view from another view - /// - /// View to copy - //////////////////////////////////////////////////////////// - public View(View copy) : - base(sfView_Copy(copy.This)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Center of the view - /// - //////////////////////////////////////////////////////////// - public Vector2f Center - { - get {return new Vector2f(sfView_GetCenterX(This), sfView_GetCenterY(This));} - set {sfView_SetCenter(This, value.X, value.Y);} - } - - //////////////////////////////////////////////////////////// - /// - /// Half-size of the view - /// - //////////////////////////////////////////////////////////// - public Vector2f Size - { - get {return new Vector2f(sfView_GetWidth(This), sfView_GetHeight(This));} - set {sfView_SetSize(This, value.X, value.Y);} - } - - //////////////////////////////////////////////////////////// - /// - /// Rotation of the view, in degrees - /// - //////////////////////////////////////////////////////////// - public float Rotation - { - get { return sfView_GetRotation(This); } - set { sfView_SetRotation(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Target viewport of the view, defined as a factor of the - /// size of the target to which the view is applied - /// - //////////////////////////////////////////////////////////// - public FloatRect Viewport - { - get { return sfView_GetViewport(This); } - set { sfView_SetViewport(This, value); } - } - - //////////////////////////////////////////////////////////// - /// - /// Rebuild the view from a rectangle - /// - /// Rectangle defining the position and size of the view - //////////////////////////////////////////////////////////// - public void Reset(FloatRect rectangle) - { - sfView_Reset(This, rectangle); - } - - //////////////////////////////////////////////////////////// - /// - /// Move the view - /// - /// Offset to move the view - //////////////////////////////////////////////////////////// - public void Move(Vector2f offset) - { - sfView_Move(This, offset.X, offset.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Rotate the view - /// - /// Angle of rotation, in degrees - //////////////////////////////////////////////////////////// - public void Rotate(float angle) - { - sfView_Rotate(This, angle); - } - - //////////////////////////////////////////////////////////// - /// - /// Resize the view rectangle to simulate a zoom / unzoom effect - /// - /// Zoom factor to apply, relative to the current zoom - //////////////////////////////////////////////////////////// - public void Zoom(float factor) - { - sfView_Zoom(This, factor); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[View]" + - " Center(" + Center + ")" + - " Size(" + Size + ")" + - " Rotation(" + Rotation + ")" + - " Viewport(" + Viewport + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Internal constructor for other classes which need to manipulate raw views - /// - /// Direct pointer to the view object in the C library - //////////////////////////////////////////////////////////// - internal View(IntPtr thisPtr) : - base(thisPtr) - { - myExternal = true; - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - if (!myExternal) - sfView_Destroy(This); - } - - private bool myExternal = false; - #region Imports - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfView_Create(); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfView_CreateFromRect(FloatRect Rect); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfView_Copy(IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_Destroy(IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_SetCenter(IntPtr View, float X, float Y); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_SetSize(IntPtr View, float Width, float Height); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_SetRotation(IntPtr View, float Angle); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_SetViewport(IntPtr View, FloatRect Viewport); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_Reset(IntPtr View, FloatRect Rectangle); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfView_GetCenterX(IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfView_GetCenterY(IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfView_GetWidth(IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfView_GetHeight(IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfView_GetRotation(IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern FloatRect sfView_GetViewport(IntPtr View); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_Move(IntPtr View, float OffsetX, float OffsetY); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_Rotate(IntPtr View, float Angle); - - [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfView_Zoom(IntPtr View, float Factor); - - #endregion - } - } -} diff --git a/bindings/dotnet/src/Graphics/sfml-graphics.csproj b/bindings/dotnet/src/Graphics/sfml-graphics.csproj deleted file mode 100644 index 41fae5c1e..000000000 --- a/bindings/dotnet/src/Graphics/sfml-graphics.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {46786269-57B9-48E7-AA4F-8F4D84609FE6} - Library - Properties - SFML.Graphics - sfmlnet-graphics-2 - - - - - 2.0 - - - - - true - ..\..\lib\x86\ - DEBUG;TRACE - true - ..\..\doc\build\graphics-doc.xml - full - x86 - prompt - - - ..\..\lib\x86\ - TRACE - true - ..\..\doc\build\graphics-doc.xml - true - pdbonly - x86 - prompt - - - true - ..\..\lib\x64\ - DEBUG;TRACE - true - ..\..\doc\build\graphics-doc.xml - full - x64 - prompt - - - ..\..\lib\x64\ - TRACE - true - ..\..\doc\build\graphics-doc.xml - true - pdbonly - x64 - prompt - - - - - - - - - - - - - - - - - - - - - - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} - sfml-window - - - - - - - - - \ No newline at end of file diff --git a/bindings/dotnet/src/Window/ContextSettings.cs b/bindings/dotnet/src/Window/ContextSettings.cs deleted file mode 100644 index 5512229f9..000000000 --- a/bindings/dotnet/src/Window/ContextSettings.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// Structure defining the creation settings of OpenGL contexts - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct ContextSettings - { - //////////////////////////////////////////////////////////// - /// - /// Construct the settings from depth / stencil bits - /// - /// Depth buffer bits - /// Stencil buffer bits - //////////////////////////////////////////////////////////// - public ContextSettings(uint depthBits, uint stencilBits) : - this(depthBits, stencilBits, 0) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the settings from depth / stencil bits and antialiasing level - /// - /// Depth buffer bits - /// Stencil buffer bits - /// Antialiasing level - //////////////////////////////////////////////////////////// - public ContextSettings(uint depthBits, uint stencilBits, uint antialiasingLevel) : - this(depthBits, stencilBits, antialiasingLevel, 2, 0) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the settings from depth / stencil bits and antialiasing level - /// - /// Depth buffer bits - /// Stencil buffer bits - /// Antialiasing level - /// Major number of the context version - /// Minor number of the context version - //////////////////////////////////////////////////////////// - public ContextSettings(uint depthBits, uint stencilBits, uint antialiasingLevel, uint majorVersion, uint minorVersion) - { - DepthBits = depthBits; - StencilBits = stencilBits; - AntialiasingLevel = antialiasingLevel; - MajorVersion = majorVersion; - MinorVersion = minorVersion; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[ContextSettings]" + - " DepthBits(" + DepthBits + ")" + - " StencilBits(" + StencilBits + ")" + - " AntialiasingLevel(" + AntialiasingLevel + ")" + - " MajorVersion(" + MajorVersion + ")" + - " MinorVersion(" + MinorVersion + ")"; - } - - /// Depth buffer bits (0 is disabled) - public uint DepthBits; - - /// Stencil buffer bits (0 is disabled) - public uint StencilBits; - - /// Antialiasing level (0 is disabled) - public uint AntialiasingLevel; - - /// Major number of the context version - public uint MajorVersion; - - /// Minor number of the context version - public uint MinorVersion; - } - } -} diff --git a/bindings/dotnet/src/Window/Event.cs b/bindings/dotnet/src/Window/Event.cs deleted file mode 100644 index 0408c4ac8..000000000 --- a/bindings/dotnet/src/Window/Event.cs +++ /dev/null @@ -1,266 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// Enumeration of the different types of events - /// - //////////////////////////////////////////////////////////// - public enum EventType - { - /// Event triggered when a window is manually closed - Closed, - - /// Event triggered when a window is resized - Resized, - - /// Event triggered when a window loses the focus - LostFocus, - - /// Event triggered when a window gains the focus - GainedFocus, - - /// Event triggered when a valid character is entered - TextEntered, - - /// Event triggered when a keyboard key is pressed - KeyPressed, - - /// Event triggered when a keyboard key is released - KeyReleased, - - /// Event triggered when the mouse wheel is scrolled - MouseWheelMoved, - - /// Event triggered when a mouse button is pressed - MouseButtonPressed, - - /// Event triggered when a mouse button is released - MouseButtonReleased, - - /// Event triggered when the mouse moves within the area of a window - MouseMoved, - - /// Event triggered when the mouse enters the area of a window - MouseEntered, - - /// Event triggered when the mouse leaves the area of a window - MouseLeft, - - /// Event triggered when a joystick button is pressed - JoystickButtonPressed, - - /// Event triggered when a joystick button is released - JoystickButtonReleased, - - /// Event triggered when a joystick axis moves - JoystickMoved, - - /// Event triggered when a joystick is connected - JoystickConnected, - - /// Event triggered when a joystick is disconnected - JoystickDisconnected - } - - //////////////////////////////////////////////////////////// - /// - /// Keyboard event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct KeyEvent - { - /// Code of the key (see KeyCode enum) - public Keyboard.Key Code; - - /// Is the Alt modifier pressed? - public int Alt; - - /// Is the Control modifier pressed? - public int Control; - - /// Is the Shift modifier pressed? - public int Shift; - - /// Is the System modifier pressed? - public int System; - } - - //////////////////////////////////////////////////////////// - /// - /// Text event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct TextEvent - { - /// UTF-32 value of the character - public uint Unicode; - } - - //////////////////////////////////////////////////////////// - /// - /// Mouse move event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct MouseMoveEvent - { - /// X coordinate of the mouse cursor - public int X; - - /// Y coordinate of the mouse cursor - public int Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Mouse buttons event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct MouseButtonEvent - { - /// Code of the button (see MouseButton enum) - public Mouse.Button Button; - - /// X coordinate of the mouse cursor - public int X; - - /// Y coordinate of the mouse cursor - public int Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Mouse wheel event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct MouseWheelEvent - { - /// Scroll amount - public int Delta; - - /// X coordinate of the mouse cursor - public int X; - - /// Y coordinate of the mouse cursor - public int Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Joystick axis move event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct JoystickMoveEvent - { - /// Index of the joystick which triggered the event - public uint JoystickId; - - /// Joystick axis (see JoyAxis enum) - public Joystick.Axis Axis; - - /// Current position of the axis - public float Position; - } - - //////////////////////////////////////////////////////////// - /// - /// Joystick buttons event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct JoystickButtonEvent - { - /// Index of the joystick which triggered the event - public uint JoystickId; - - /// Index of the button - public uint Button; - } - - //////////////////////////////////////////////////////////// - /// - /// Joystick connect event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct JoystickConnectEvent - { - /// Index of the joystick which triggered the event - public uint JoystickId; - } - - //////////////////////////////////////////////////////////// - /// - /// Size event parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct SizeEvent - { - /// New width of the window - public uint Width; - - /// New height of the window - public uint Height; - } - - //////////////////////////////////////////////////////////// - /// - /// Event defines a system event and its parameters - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Explicit, Size = 20)] - public struct Event - { - /// Type of event (see EventType enum) - [FieldOffset(0)] - public EventType Type; - - /// Arguments for size events (Resized) - [FieldOffset(4)] - public SizeEvent Size; - - /// Arguments for key events (KeyPressed, KeyReleased) - [FieldOffset(4)] - public KeyEvent Key; - - /// Arguments for text events (TextEntered) - [FieldOffset(4)] - public TextEvent Text; - - /// Arguments for mouse move events (MouseMoved) - [FieldOffset(4)] - public MouseMoveEvent MouseMove; - - /// Arguments for mouse button events (MouseButtonPressed, MouseButtonReleased) - [FieldOffset(4)] - public MouseButtonEvent MouseButton; - - /// Arguments for mouse wheel events (MouseWheelMoved) - [FieldOffset(4)] - public MouseWheelEvent MouseWheel; - - /// Arguments for joystick axis events (JoystickMoved) - [FieldOffset(4)] - public JoystickMoveEvent JoystickMove; - - /// Arguments for joystick button events (JoystickButtonPressed, JoystickButtonReleased) - [FieldOffset(4)] - public JoystickButtonEvent JoystickButton; - - /// Arguments for joystick connect events (JoystickConnected, JoystickDisconnected) - [FieldOffset(4)] - public JoystickConnectEvent JoystickConnect; - } - } -} diff --git a/bindings/dotnet/src/Window/EventArgs.cs b/bindings/dotnet/src/Window/EventArgs.cs deleted file mode 100644 index 8ecf8d3cd..000000000 --- a/bindings/dotnet/src/Window/EventArgs.cs +++ /dev/null @@ -1,378 +0,0 @@ -using System; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// Keyboard event parameters - /// - //////////////////////////////////////////////////////////// - public class KeyEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the key arguments from a key event - /// - /// Key event - //////////////////////////////////////////////////////////// - public KeyEventArgs(KeyEvent e) - { - Code = e.Code; - Alt = e.Alt != 0; - Control = e.Control != 0; - Shift = e.Shift != 0; - System = e.System != 0; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[KeyEventArgs]" + - " Code(" + Code + ")" + - " Alt(" + Alt + ")" + - " Control(" + Control + ")" + - " Shift(" + Shift + ")" + - " System(" + System + ")"; - } - - /// Code of the key (see KeyCode enum) - public Keyboard.Key Code; - - /// Is the Alt modifier pressed? - public bool Alt; - - /// Is the Control modifier pressed? - public bool Control; - - /// Is the Shift modifier pressed? - public bool Shift; - - /// Is the System modifier pressed? - public bool System; - } - - //////////////////////////////////////////////////////////// - /// - /// Text event parameters - /// - //////////////////////////////////////////////////////////// - public class TextEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the text arguments from a text event - /// - /// Text event - //////////////////////////////////////////////////////////// - public TextEventArgs(TextEvent e) - { - Unicode = Char.ConvertFromUtf32((int)e.Unicode); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[TextEventArgs]" + - " Unicode(" + Unicode + ")"; - } - - /// UTF-16 value of the character - public string Unicode; - } - - //////////////////////////////////////////////////////////// - /// - /// Mouse move event parameters - /// - //////////////////////////////////////////////////////////// - public class MouseMoveEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the mouse move arguments from a mouse move event - /// - /// Mouse move event - //////////////////////////////////////////////////////////// - public MouseMoveEventArgs(MouseMoveEvent e) - { - X = e.X; - Y = e.Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[MouseMoveEventArgs]" + - " X(" + X + ")" + - " Y(" + Y + ")"; - } - - /// X coordinate of the mouse cursor - public int X; - - /// Y coordinate of the mouse cursor - public int Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Mouse buttons event parameters - /// - //////////////////////////////////////////////////////////// - public class MouseButtonEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the mouse button arguments from a mouse button event - /// - /// Mouse button event - //////////////////////////////////////////////////////////// - public MouseButtonEventArgs(MouseButtonEvent e) - { - Button = e.Button; - X = e.X; - Y = e.Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[MouseButtonEventArgs]" + - " Button(" + Button + ")" + - " X(" + X + ")" + - " Y(" + Y + ")"; - } - - /// Code of the button (see MouseButton enum) - public Mouse.Button Button; - - /// X coordinate of the mouse cursor - public int X; - - /// Y coordinate of the mouse cursor - public int Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Mouse wheel event parameters - /// - //////////////////////////////////////////////////////////// - public class MouseWheelEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the mouse wheel arguments from a mouse wheel event - /// - /// Mouse wheel event - //////////////////////////////////////////////////////////// - public MouseWheelEventArgs(MouseWheelEvent e) - { - Delta = e.Delta; - X = e.X; - Y = e.Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[MouseWheelEventArgs]" + - " Delta(" + Delta + ")" + - " X(" + X + ")" + - " Y(" + Y + ")"; - } - - /// Scroll amount - public int Delta; - - /// X coordinate of the mouse cursor - public int X; - - /// Y coordinate of the mouse cursor - public int Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Joystick axis move event parameters - /// - //////////////////////////////////////////////////////////// - public class JoystickMoveEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the joystick move arguments from a joystick move event - /// - /// Joystick move event - //////////////////////////////////////////////////////////// - public JoystickMoveEventArgs(JoystickMoveEvent e) - { - JoystickId = e.JoystickId; - Axis = e.Axis; - Position = e.Position; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[JoystickMoveEventArgs]" + - " JoystickId(" + JoystickId + ")" + - " Axis(" + Axis + ")" + - " Position(" + Position + ")"; - } - - /// Index of the joystick which triggered the event - public uint JoystickId; - - /// Joystick axis (see JoyAxis enum) - public Joystick.Axis Axis; - - /// Current position of the axis - public float Position; - } - - //////////////////////////////////////////////////////////// - /// - /// Joystick buttons event parameters - /// - //////////////////////////////////////////////////////////// - public class JoystickButtonEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the joystick button arguments from a joystick button event - /// - /// Joystick button event - //////////////////////////////////////////////////////////// - public JoystickButtonEventArgs(JoystickButtonEvent e) - { - JoystickId = e.JoystickId; - Button = e.Button; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[JoystickButtonEventArgs]" + - " JoystickId(" + JoystickId + ")" + - " Button(" + Button + ")"; - } - - /// Index of the joystick which triggered the event - public uint JoystickId; - - /// Index of the button - public uint Button; - } - - //////////////////////////////////////////////////////////// - /// - /// Joystick connection/disconnection event parameters - /// - //////////////////////////////////////////////////////////// - public class JoystickConnectEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the joystick connect arguments from a joystick connect event - /// - /// Joystick button event - //////////////////////////////////////////////////////////// - public JoystickConnectEventArgs(JoystickConnectEvent e) - { - JoystickId = e.JoystickId; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[JoystickConnectEventArgs]" + - " JoystickId(" + JoystickId + ")"; - } - - /// Index of the joystick which triggered the event - public uint JoystickId; - } - - //////////////////////////////////////////////////////////// - /// - /// Size event parameters - /// - //////////////////////////////////////////////////////////// - public class SizeEventArgs : EventArgs - { - //////////////////////////////////////////////////////////// - /// - /// Construct the size arguments from a size event - /// - /// Size event - //////////////////////////////////////////////////////////// - public SizeEventArgs(SizeEvent e) - { - Width = e.Width; - Height = e.Height; - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[SizeEventArgs]" + - " Width(" + Width + ")" + - " Height(" + Height + ")"; - } - - /// New width of the window - public uint Width; - - /// New height of the window - public uint Height; - } - } -} diff --git a/bindings/dotnet/src/Window/Joystick.cs b/bindings/dotnet/src/Window/Joystick.cs deleted file mode 100644 index 6b1555664..000000000 --- a/bindings/dotnet/src/Window/Joystick.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// Give access to the real-time state of the joysticks - /// - //////////////////////////////////////////////////////////// - public class Joystick - { - /// Maximum number of supported joysticks - public static readonly uint Count = 8; - - /// Maximum number of supported buttons - public static readonly uint ButtonCount = 32; - - /// Maximum number of supported axes - public static readonly uint AxisCount = 8; - - //////////////////////////////////////////////////////////// - /// - /// Axes supported by SFML joysticks - /// - //////////////////////////////////////////////////////////// - public enum Axis - { - /// The X axis - X, - - /// The Y axis - Y, - - /// The Z axis - Z, - - /// The R axis - R, - - /// The U axis - U, - - /// The V axis - V, - - /// The X axis of the point-of-view hat - PovX, - - /// TheY axis of the point-of-view hat - PovY - }; - - //////////////////////////////////////////////////////////// - /// - /// Check if a joystick is connected - /// - /// Index of the joystick to check - /// True if the joystick is connected, false otherwise - //////////////////////////////////////////////////////////// - public static bool IsConnected(uint joystick) - { - return sfJoystick_IsConnected(joystick); - } - - //////////////////////////////////////////////////////////// - /// - /// Return the number of buttons supported by a joystick - /// - /// If the joystick is not connected, this function returns 0. - /// Index of the joystick - /// Number of buttons supported by the joystick - //////////////////////////////////////////////////////////// - public static uint GetButtonCount(uint joystick) - { - return sfJoystick_GetButtonCount(joystick); - } - - //////////////////////////////////////////////////////////// - /// - /// Check if a joystick supports a given axis - /// - /// If the joystick is not connected, this function returns false. - /// Index of the joystick - /// Axis to check - /// True if the joystick supports the axis, false otherwise - //////////////////////////////////////////////////////////// - public static bool HasAxis(uint joystick, Axis axis) - { - return sfJoystick_HasAxis(joystick, axis); - } - - //////////////////////////////////////////////////////////// - /// - /// Check if a joystick button is pressed - /// - /// If the joystick is not connected, this function returns false. - /// Index of the joystick - /// Button to check - /// True if the button is pressed, false otherwise - //////////////////////////////////////////////////////////// - public static bool IsButtonPressed(uint joystick, uint button) - { - return sfJoystick_IsButtonPressed(joystick, button); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the current position of a joystick axis - /// - /// If the joystick is not connected, this function returns 0. - /// Index of the joystick - /// Axis to check - /// Current position of the axis, in range [-100 .. 100] - //////////////////////////////////////////////////////////// - public static float GetAxisPosition(uint joystick, Axis axis) - { - return sfJoystick_GetAxisPosition(joystick, axis); - } - - //////////////////////////////////////////////////////////// - /// - /// Update the states of all joysticks - /// - /// This function is used internally by SFML, so you normally - /// don't have to call it explicitely. However, you may need to - /// call it if you have no window yet (or no window at all): - /// in this case the joysticks states are not updated automatically. - //////////////////////////////////////////////////////////// - public static void Update() - { - sfJoystick_Update(); - } - - #region Imports - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfJoystick_IsConnected(uint joystick); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfJoystick_GetButtonCount(uint joystick); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfJoystick_HasAxis(uint joystick, Axis axis); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfJoystick_IsButtonPressed(uint joystick, uint button); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern float sfJoystick_GetAxisPosition(uint joystick, Axis axis); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfJoystick_Update(); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Window/Keyboard.cs b/bindings/dotnet/src/Window/Keyboard.cs deleted file mode 100644 index 3f36cf0e7..000000000 --- a/bindings/dotnet/src/Window/Keyboard.cs +++ /dev/null @@ -1,146 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// Give access to the real-time state of the keyboard - /// - //////////////////////////////////////////////////////////// - public class Keyboard - { - //////////////////////////////////////////////////////////// - /// - /// Key codes - /// - //////////////////////////////////////////////////////////// - public enum Key - { - A, // The A key - B, // The B key - C, // The C key - D, // The D key - E, // The E key - F, // The F key - G, // The G key - H, // The H key - I, // The I key - J, // The J key - K, // The K key - L, // The L key - M, // The M key - N, // The N key - O, // The O key - P, // The P key - Q, // The Q key - R, // The R key - S, // The S key - T, // The T key - U, // The U key - V, // The V key - W, // The W key - X, // The X key - Y, // The Y key - Z, // The Z key - Num0, // The 0 key - Num1, // The 1 key - Num2, // The 2 key - Num3, // The 3 key - Num4, // The 4 key - Num5, // The 5 key - Num6, // The 6 key - Num7, // The 7 key - Num8, // The 8 key - Num9, // The 9 key - Escape, // The Escape key - LControl, // The left Control key - LShift, // The left Shift key - LAlt, // The left Alt key - LSystem, // The left OS specific key: window (Windows and Linux), apple (MacOS X), ... - RControl, // The right Control key - RShift, // The right Shift key - RAlt, // The right Alt key - RSystem, // The right OS specific key: window (Windows and Linux), apple (MacOS X), ... - Menu, // The Menu key - LBracket, // The [ key - RBracket, // The ] key - SemiColon, // The ; key - Comma, // The , key - Period, // The . key - Quote, // The ' key - Slash, // The / key - BackSlash, // The \ key - Tilde, // The ~ key - Equal, // The = key - Dash, // The - key - Space, // The Space key - Return, // The Return key - Back, // The Backspace key - Tab, // The Tabulation key - PageUp, // The Page up key - PageDown, // The Page down key - End, // The End key - Home, // The Home key - Insert, // The Insert key - Delete, // The Delete key - Add, // + - Subtract, // - - Multiply, // * - Divide, // / - Left, // Left arrow - Right, // Right arrow - Up, // Up arrow - Down, // Down arrow - Numpad0, // The numpad 0 key - Numpad1, // The numpad 1 key - Numpad2, // The numpad 2 key - Numpad3, // The numpad 3 key - Numpad4, // The numpad 4 key - Numpad5, // The numpad 5 key - Numpad6, // The numpad 6 key - Numpad7, // The numpad 7 key - Numpad8, // The numpad 8 key - Numpad9, // The numpad 9 key - F1, // The F1 key - F2, // The F2 key - F3, // The F3 key - F4, // The F4 key - F5, // The F5 key - F6, // The F6 key - F7, // The F7 key - F8, // The F8 key - F9, // The F8 key - F10, // The F10 key - F11, // The F11 key - F12, // The F12 key - F13, // The F13 key - F14, // The F14 key - F15, // The F15 key - Pause, // The Pause key - - KeyCount // Keep last -- the total number of keyboard keys - }; - - //////////////////////////////////////////////////////////// - /// - /// Check if a key is pressed - /// - /// Key to check - /// True if the key is pressed, false otherwise - //////////////////////////////////////////////////////////// - public static bool IsKeyDown(Key key) - { - return sfKeyboard_IsKeyDown(key); - } - - #region Imports - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfKeyboard_IsKeyDown(Key Key); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Window/LoadingFailedException.cs b/bindings/dotnet/src/Window/LoadingFailedException.cs deleted file mode 100644 index cea37d279..000000000 --- a/bindings/dotnet/src/Window/LoadingFailedException.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace SFML -{ - //////////////////////////////////////////////////////////// - /// - /// Exception thrown by SFML whenever loading a resource fails - /// - //////////////////////////////////////////////////////////// - [Serializable] - public class LoadingFailedException : Exception - { - //////////////////////////////////////////////////////////// - /// - /// Default constructor (unknown error) - /// - //////////////////////////////////////////////////////////// - public LoadingFailedException() : - base("Failed to load a resource") - { - } - - //////////////////////////////////////////////////////////// - /// - /// Failure to load a resource from memory - /// - /// Name of the resource - //////////////////////////////////////////////////////////// - public LoadingFailedException(string resourceName) : - base("Failed to load " + resourceName + " from memory") - { - } - - //////////////////////////////////////////////////////////// - /// - /// Failure to load a resource from memory - /// - /// Name of the resource - /// Exception which is the cause ofthe current exception - //////////////////////////////////////////////////////////// - public LoadingFailedException(string resourceName, Exception innerException) : - base("Failed to load " + resourceName + " from memory", innerException) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Failure to load a resource from a file - /// - /// Name of the resource - /// Path of the file - //////////////////////////////////////////////////////////// - public LoadingFailedException(string resourceName, string filename) : - base("Failed to load " + resourceName + " from file " + filename) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Failure to load a resource from a file - /// - /// Name of the resource - /// Path of the file - /// Exception which is the cause ofthe current exception - //////////////////////////////////////////////////////////// - public LoadingFailedException(string resourceName, string filename, Exception innerException) : - base("Failed to load " + resourceName + " from file " + filename, innerException) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Initialize an instance of the exception with serialized data - /// - /// Serialized data - /// Contextual informations - //////////////////////////////////////////////////////////// - public LoadingFailedException(SerializationInfo info, StreamingContext context) : - base(info, context) - { - } - } -} diff --git a/bindings/dotnet/src/Window/Mouse.cs b/bindings/dotnet/src/Window/Mouse.cs deleted file mode 100644 index 3a79725d3..000000000 --- a/bindings/dotnet/src/Window/Mouse.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// Give access to the real-time state of the mouse - /// - //////////////////////////////////////////////////////////// - public class Mouse - { - //////////////////////////////////////////////////////////// - /// - /// Mouse buttons - /// - //////////////////////////////////////////////////////////// - public enum Button - { - /// The left mouse button - Left, - - /// The right mouse button - Right, - - /// The middle (wheel) mouse button - Middle, - - /// The first extra mouse button - XButton1, - - /// The second extra mouse button - XButton2, - - /// Keep last -- the total number of mouse buttons - ButtonCount - }; - - //////////////////////////////////////////////////////////// - /// - /// Check if a mouse button is pressed - /// - /// Button to check - /// True if the button is pressed, false otherwise - //////////////////////////////////////////////////////////// - public static bool IsButtonPressed(Button button) - { - return sfMouse_IsButtonPressed(button); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the current position of the mouse - /// - /// This function returns the current position of the mouse - /// cursor. - /// If the cursor is over a SFML window, the returned position - /// is relative to this window. Otherwise, the returned position - /// is in desktop coordinates. - /// Current position of the mouse - //////////////////////////////////////////////////////////// - public static Vector2i GetPosition() - { - Vector2i position; - sfMouse_GetPosition(out position.X, out position.Y); - return position; - } - - #region Imports - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfMouse_IsButtonPressed(Button button); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfMouse_GetPosition(out int x, out int y); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Window/ObjectBase.cs b/bindings/dotnet/src/Window/ObjectBase.cs deleted file mode 100644 index 6c3b08b51..000000000 --- a/bindings/dotnet/src/Window/ObjectBase.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace SFML -{ - //////////////////////////////////////////////////////////// - /// - /// The ObjectBase class is an abstract base for every - /// SFML object. It's meant for internal use only - /// - //////////////////////////////////////////////////////////// - public abstract class ObjectBase : IDisposable - { - //////////////////////////////////////////////////////////// - /// - /// Construct the object from a pointer to the C library object - /// - /// Internal pointer to the object in the C libraries - //////////////////////////////////////////////////////////// - public ObjectBase(IntPtr thisPtr) - { - myThis = thisPtr; - } - - //////////////////////////////////////////////////////////// - /// - /// Dispose the object - /// - //////////////////////////////////////////////////////////// - ~ObjectBase() - { - Dispose(false); - } - - //////////////////////////////////////////////////////////// - /// - /// Access to the internal pointer of the object. - /// For internal use only - /// - //////////////////////////////////////////////////////////// - public IntPtr This - { - get {return myThis;} - } - - //////////////////////////////////////////////////////////// - /// - /// Explicitely dispose the object - /// - //////////////////////////////////////////////////////////// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - //////////////////////////////////////////////////////////// - /// - /// Destroy the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - private void Dispose(bool disposing) - { - if (myThis != IntPtr.Zero) - { - Destroy(disposing); - myThis = IntPtr.Zero; - } - } - - //////////////////////////////////////////////////////////// - /// - /// Destroy the object (implementation is left to each derived class) - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected abstract void Destroy(bool disposing); - - //////////////////////////////////////////////////////////// - /// - /// Set the pointer to the internal object. For internal use only - /// - /// Pointer to the internal object in C library - //////////////////////////////////////////////////////////// - protected void SetThis(IntPtr thisPtr) - { - myThis = thisPtr; - } - - private IntPtr myThis = IntPtr.Zero; - } -} diff --git a/bindings/dotnet/src/Window/Vector2.cs b/bindings/dotnet/src/Window/Vector2.cs deleted file mode 100644 index 8a07669ac..000000000 --- a/bindings/dotnet/src/Window/Vector2.cs +++ /dev/null @@ -1,246 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// Vector2f is an utility class for manipulating 2 dimensional - /// vectors with float components - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct Vector2f - { - //////////////////////////////////////////////////////////// - /// - /// Construct the vector from its coordinates - /// - /// X coordinate - /// Y coordinate - //////////////////////////////////////////////////////////// - public Vector2f(float x, float y) - { - X = x; - Y = y; - } - - //////////////////////////////////////////////////////////// - /// - /// Operator - overload ; returns the opposite of a vector - /// - /// Vector to negate - /// -v - //////////////////////////////////////////////////////////// - public static Vector2f operator -(Vector2f v) - { - return new Vector2f(-v.X, -v.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator - overload ; subtracts two vectors - /// - /// First vector - /// Second vector - /// v1 - v2 - //////////////////////////////////////////////////////////// - public static Vector2f operator -(Vector2f v1, Vector2f v2) - { - return new Vector2f(v1.X - v2.X, v1.Y - v2.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator + overload ; add two vectors - /// - /// First vector - /// Second vector - /// v1 + v2 - //////////////////////////////////////////////////////////// - public static Vector2f operator +(Vector2f v1, Vector2f v2) - { - return new Vector2f(v1.X + v2.X, v1.Y + v2.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator * overload ; multiply a vector by a scalar value - /// - /// Vector - /// Scalar value - /// v * x - //////////////////////////////////////////////////////////// - public static Vector2f operator *(Vector2f v, float x) - { - return new Vector2f(v.X * x, v.Y * x); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator * overload ; multiply a scalar value by a vector - /// - /// Scalar value - /// Vector - /// x * v - //////////////////////////////////////////////////////////// - public static Vector2f operator *(float x, Vector2f v) - { - return new Vector2f(v.X * x, v.Y * x); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator / overload ; divide a vector by a scalar value - /// - /// Vector - /// Scalar value - /// v / x - //////////////////////////////////////////////////////////// - public static Vector2f operator /(Vector2f v, float x) - { - return new Vector2f(v.X / x, v.Y / x); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Vector2f]" + - " X(" + X + ")" + - " Y(" + Y + ")"; - } - - /// X (horizontal) component of the vector - public float X; - - /// Y (vertical) component of the vector - public float Y; - } - - //////////////////////////////////////////////////////////// - /// - /// Vector2i is an utility class for manipulating 2 dimensional - /// vectors with integer components - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct Vector2i - { - //////////////////////////////////////////////////////////// - /// - /// Construct the vector from its coordinates - /// - /// X coordinate - /// Y coordinate - //////////////////////////////////////////////////////////// - public Vector2i(int x, int y) - { - X = x; - Y = y; - } - - //////////////////////////////////////////////////////////// - /// - /// Operator - overload ; returns the opposite of a vector - /// - /// Vector to negate - /// -v - //////////////////////////////////////////////////////////// - public static Vector2i operator -(Vector2i v) - { - return new Vector2i(-v.X, -v.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator - overload ; subtracts two vectors - /// - /// First vector - /// Second vector - /// v1 - v2 - //////////////////////////////////////////////////////////// - public static Vector2i operator -(Vector2i v1, Vector2i v2) - { - return new Vector2i(v1.X - v2.X, v1.Y - v2.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator + overload ; add two vectors - /// - /// First vector - /// Second vector - /// v1 + v2 - //////////////////////////////////////////////////////////// - public static Vector2i operator +(Vector2i v1, Vector2i v2) - { - return new Vector2i(v1.X + v2.X, v1.Y + v2.Y); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator * overload ; multiply a vector by a scalar value - /// - /// Vector - /// Scalar value - /// v * x - //////////////////////////////////////////////////////////// - public static Vector2i operator *(Vector2i v, int x) - { - return new Vector2i(v.X * x, v.Y * x); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator * overload ; multiply a scalar value by a vector - /// - /// Scalar value - /// Vector - /// x * v - //////////////////////////////////////////////////////////// - public static Vector2i operator *(int x, Vector2i v) - { - return new Vector2i(v.X * x, v.Y * x); - } - - //////////////////////////////////////////////////////////// - /// - /// Operator / overload ; divide a vector by a scalar value - /// - /// Vector - /// Scalar value - /// v / x - //////////////////////////////////////////////////////////// - public static Vector2i operator /(Vector2i v, int x) - { - return new Vector2i(v.X / x, v.Y / x); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Vector2i]" + - " X(" + X + ")" + - " Y(" + Y + ")"; - } - - /// X (horizontal) component of the vector - public int X; - - /// Y (vertical) component of the vector - public int Y; - } - } -} diff --git a/bindings/dotnet/src/Window/VideoMode.cs b/bindings/dotnet/src/Window/VideoMode.cs deleted file mode 100644 index 29d47d56c..000000000 --- a/bindings/dotnet/src/Window/VideoMode.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// VideoMode defines a video mode (width, height, bpp, frequency) - /// and provides static functions for getting modes supported - /// by the display device - /// - //////////////////////////////////////////////////////////// - [StructLayout(LayoutKind.Sequential)] - public struct VideoMode - { - //////////////////////////////////////////////////////////// - /// - /// Construct the video mode with its width and height - /// - /// Video mode width - /// Video mode height - //////////////////////////////////////////////////////////// - public VideoMode(uint width, uint height) : - this(width, height, 32) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Construct the video mode with its width, height and depth - /// - /// Video mode width - /// Video mode height - /// Video mode depth (bits per pixel) - //////////////////////////////////////////////////////////// - public VideoMode(uint width, uint height, uint bpp) - { - Width = width; - Height = height; - BitsPerPixel = bpp; - } - - //////////////////////////////////////////////////////////// - /// - /// Tell whether or not the video mode is supported - /// - /// True if the video mode is valid, false otherwise - //////////////////////////////////////////////////////////// - public bool IsValid() - { - return sfVideoMode_IsValid(this); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the list of all the supported fullscreen video modes - /// - //////////////////////////////////////////////////////////// - public static VideoMode[] FullscreenModes - { - get - { - unsafe - { - uint Count; - VideoMode* ModesPtr = sfVideoMode_GetFullscreenModes(out Count); - VideoMode[] Modes = new VideoMode[Count]; - for (uint i = 0; i < Count; ++i) - Modes[i] = ModesPtr[i]; - - return Modes; - } - } - } - - //////////////////////////////////////////////////////////// - /// - /// Get the current desktop video mode - /// - //////////////////////////////////////////////////////////// - public static VideoMode DesktopMode - { - get {return sfVideoMode_GetDesktopMode();} - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[VideoMode]" + - " Width(" + Width + ")" + - " Height(" + Height + ")" + - " BitsPerPixel(" + BitsPerPixel + ")"; - } - - /// Video mode width, in pixels - public uint Width; - - /// Video mode height, in pixels - public uint Height; - - /// Video mode depth, in bits per pixel - public uint BitsPerPixel; - - #region Imports - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern VideoMode sfVideoMode_GetDesktopMode(); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern VideoMode* sfVideoMode_GetFullscreenModes(out uint Count); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfVideoMode_IsValid(VideoMode Mode); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Window/Window.cs b/bindings/dotnet/src/Window/Window.cs deleted file mode 100644 index 1a99e017c..000000000 --- a/bindings/dotnet/src/Window/Window.cs +++ /dev/null @@ -1,690 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Collections.Generic; -using System.Security; - -namespace SFML -{ - namespace Window - { - //////////////////////////////////////////////////////////// - /// - /// Enumeration of window creation styles - /// - //////////////////////////////////////////////////////////// - [Flags] - public enum Styles - { - /// No border / title bar (this flag and all others are mutually exclusive) - None = 0, - - /// Title bar + fixed border - Titlebar = 1 << 0, - - /// Titlebar + resizable border + maximize button - Resize = 1 << 1, - - /// Titlebar + close button - Close = 1 << 2, - - /// Fullscreen mode (this flag and all others are mutually exclusive)) - Fullscreen = 1 << 3, - - /// Default window style (titlebar + resize + close) - Default = Titlebar | Resize | Close - } - - //////////////////////////////////////////////////////////// - /// - /// Window is a rendering window ; it can create a new window - /// or connect to an existing one - /// - //////////////////////////////////////////////////////////// - public class Window : ObjectBase - { - //////////////////////////////////////////////////////////// - /// - /// Create the window with default style and creation settings - /// - /// Video mode to use - /// Title of the window - //////////////////////////////////////////////////////////// - public Window(VideoMode mode, string title) : - this(mode, title, Styles.Default, new ContextSettings(0, 0)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Create the window with default creation settings - /// - /// Video mode to use - /// Title of the window - /// Window style (Resize | Close by default) - //////////////////////////////////////////////////////////// - public Window(VideoMode mode, string title, Styles style) : - this(mode, title, style, new ContextSettings(0, 0)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Create the window - /// - /// Video mode to use - /// Title of the window - /// Window style (Resize | Close by default) - /// Creation parameters - //////////////////////////////////////////////////////////// - public Window(VideoMode mode, string title, Styles style, ContextSettings settings) : - base(sfWindow_Create(mode, title, style, ref settings)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Create the window from an existing control with default creation settings - /// - /// Platform-specific handle of the control - //////////////////////////////////////////////////////////// - public Window(IntPtr handle) : - this(handle, new ContextSettings(0, 0)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Create the window from an existing control - /// - /// Platform-specific handle of the control - /// Creation parameters - //////////////////////////////////////////////////////////// - public Window(IntPtr Handle, ContextSettings settings) : - base(sfWindow_CreateFromHandle(Handle, ref settings)) - { - } - - //////////////////////////////////////////////////////////// - /// - /// Tell whether or not the window is opened (ie. has been created). - /// Note that a hidden window (Show(false)) - /// will still return true - /// - /// True if the window is opened - //////////////////////////////////////////////////////////// - public virtual bool IsOpened() - { - return sfWindow_IsOpened(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Close (destroy) the window. - /// The Window instance remains valid and you can call - /// Create to recreate the window - /// - //////////////////////////////////////////////////////////// - public virtual void Close() - { - sfWindow_Close(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Display the window on screen - /// - //////////////////////////////////////////////////////////// - public virtual void Display() - { - sfWindow_Display(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Width of the rendering region of the window - /// - //////////////////////////////////////////////////////////// - public virtual uint Width - { - get {return sfWindow_GetWidth(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Height of the rendering region of the window - /// - //////////////////////////////////////////////////////////// - public virtual uint Height - { - get {return sfWindow_GetHeight(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Creation settings of the window - /// - //////////////////////////////////////////////////////////// - public virtual ContextSettings Settings - { - get {return sfWindow_GetSettings(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Enable / disable vertical synchronization - /// - /// True to enable v-sync, false to deactivate - //////////////////////////////////////////////////////////// - public virtual void EnableVerticalSync(bool enable) - { - sfWindow_EnableVerticalSync(This, enable); - } - - //////////////////////////////////////////////////////////// - /// - /// Show or hide the mouse cursor - /// - /// True to show, false to hide - //////////////////////////////////////////////////////////// - public virtual void ShowMouseCursor(bool show) - { - sfWindow_ShowMouseCursor(This, show); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the position of the mouse cursor - /// - /// Left coordinate of the cursor, relative to the window - /// Top coordinate of the cursor, relative to the window - //////////////////////////////////////////////////////////// - public virtual void SetCursorPosition(uint x, uint y) - { - sfWindow_SetCursorPosition(This, x, y); - } - - //////////////////////////////////////////////////////////// - /// - /// Get the position of the mouse cursor - /// - /// The current position of the mouse cursor, relative to the window - //////////////////////////////////////////////////////////// - public virtual Vector2i GetCursorPosition() - { - Vector2i position; - sfWindow_GetCursorPosition(This, out position.X, out position.Y); - return position; - } - - //////////////////////////////////////////////////////////// - /// - /// Change the position of the window on screen. - /// Only works for top-level windows - /// - /// Left position - /// Top position - //////////////////////////////////////////////////////////// - public virtual void SetPosition(int x, int y) - { - sfWindow_SetPosition(This, x, y); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the size of the rendering region of the window - /// - /// New width - /// New height - //////////////////////////////////////////////////////////// - public virtual void SetSize(uint width, uint height) - { - sfWindow_SetSize(This, width, height); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the title of the window - /// - /// New title - //////////////////////////////////////////////////////////// - public virtual void SetTitle(string title) - { - sfWindow_SetTitle(This, title); - } - - //////////////////////////////////////////////////////////// - /// - /// Show or hide the window - /// - /// True to show, false to hide - //////////////////////////////////////////////////////////// - public virtual void Show(bool show) - { - sfWindow_Show(This, show); - } - - //////////////////////////////////////////////////////////// - /// - /// Enable or disable automatic key-repeat. - /// Automatic key-repeat is enabled by default - /// - /// True to enable, false to disable - //////////////////////////////////////////////////////////// - public virtual void EnableKeyRepeat(bool enable) - { - sfWindow_EnableKeyRepeat(This, enable); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the window's icon - /// - /// Icon's width, in pixels - /// Icon's height, in pixels - /// Array of pixels, format must be RGBA 32 bits - //////////////////////////////////////////////////////////// - public virtual void SetIcon(uint width, uint height, byte[] pixels) - { - unsafe - { - fixed (byte* PixelsPtr = pixels) - { - sfWindow_SetIcon(This, width, height, PixelsPtr); - } - } - } - - //////////////////////////////////////////////////////////// - /// - /// Activate the window as the current target - /// for rendering - /// - /// True if operation was successful, false otherwise - //////////////////////////////////////////////////////////// - public virtual bool SetActive() - { - return SetActive(true); - } - - //////////////////////////////////////////////////////////// - /// - /// Activate of deactivate the window as the current target - /// for rendering - /// - /// True to activate, false to deactivate (true by default) - /// True if operation was successful, false otherwise - //////////////////////////////////////////////////////////// - public virtual bool SetActive(bool active) - { - return sfWindow_SetActive(This, active); - } - - //////////////////////////////////////////////////////////// - /// - /// Limit the framerate to a maximum fixed frequency - /// - /// Framerate limit, in frames per seconds (use 0 to disable limit) - //////////////////////////////////////////////////////////// - public virtual void SetFramerateLimit(uint limit) - { - sfWindow_SetFramerateLimit(This, limit); - } - - //////////////////////////////////////////////////////////// - /// - /// Get time elapsed since last frame - /// - /// Time elapsed, in milliseconds - //////////////////////////////////////////////////////////// - public virtual uint GetFrameTime() - { - return sfWindow_GetFrameTime(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Change the joystick threshold, ie. the value below which - /// no move event will be generated - /// - /// New threshold, in range [0, 100] - //////////////////////////////////////////////////////////// - public virtual void SetJoystickThreshold(float threshold) - { - sfWindow_SetJoystickThreshold(This, threshold); - } - - //////////////////////////////////////////////////////////// - /// - /// OS-specific handle of the window - /// - //////////////////////////////////////////////////////////// - public virtual IntPtr SystemHandle - { - get {return sfWindow_GetSystemHandle(This);} - } - - //////////////////////////////////////////////////////////// - /// - /// Wait for a new event and dispatch it to the corresponding - /// event handler - /// - //////////////////////////////////////////////////////////// - public void WaitAndDispatchEvents() - { - Event e; - if (WaitEvent(out e)) - CallEventHandler(e); - } - - //////////////////////////////////////////////////////////// - /// - /// Call the event handlers for each pending event - /// - //////////////////////////////////////////////////////////// - public void DispatchEvents() - { - Event e; - while (PollEvent(out e)) - CallEventHandler(e); - } - - //////////////////////////////////////////////////////////// - /// - /// Provide a string describing the object - /// - /// String description of the object - //////////////////////////////////////////////////////////// - public override string ToString() - { - return "[Window]" + - " Width(" + Width + ")" + - " Height(" + Height + ")" + - " Settings(" + Settings + ")"; - } - - //////////////////////////////////////////////////////////// - /// - /// Constructor for derived classes - /// - /// Pointer to the internal object - /// Internal hack :) - //////////////////////////////////////////////////////////// - protected Window(IntPtr thisPtr, int dummy) : - base(thisPtr) - { - // TODO : find a cleaner way of separating this constructor from Window(IntPtr handle) - } - - //////////////////////////////////////////////////////////// - /// - /// Internal function to get the next event (non-blocking) - /// - /// Variable to fill with the raw pointer to the event structure - /// True if there was an event, false otherwise - //////////////////////////////////////////////////////////// - protected virtual bool PollEvent(out Event eventToFill) - { - return sfWindow_PollEvent(This, out eventToFill); - } - - //////////////////////////////////////////////////////////// - /// - /// Internal function to get the next event (blocking) - /// - /// Variable to fill with the raw pointer to the event structure - /// False if any error occured - //////////////////////////////////////////////////////////// - protected virtual bool WaitEvent(out Event eventToFill) - { - return sfWindow_WaitEvent(This, out eventToFill); - } - - //////////////////////////////////////////////////////////// - /// - /// Handle the destruction of the object - /// - /// Is the GC disposing the object, or is it an explicit call ? - //////////////////////////////////////////////////////////// - protected override void Destroy(bool disposing) - { - sfWindow_Destroy(This); - } - - //////////////////////////////////////////////////////////// - /// - /// Call the event handler for the given event - /// - /// Event to dispatch - //////////////////////////////////////////////////////////// - private void CallEventHandler(Event e) - { - switch (e.Type) - { - case EventType.Closed : - if (Closed != null) - Closed(this, EventArgs.Empty); - break; - - case EventType.GainedFocus : - if (GainedFocus != null) - GainedFocus(this, EventArgs.Empty); - break; - - case EventType.JoystickButtonPressed: - if (JoystickButtonPressed != null) - JoystickButtonPressed(this, new JoystickButtonEventArgs(e.JoystickButton)); - break; - - case EventType.JoystickButtonReleased : - if (JoystickButtonReleased != null) - JoystickButtonReleased(this, new JoystickButtonEventArgs(e.JoystickButton)); - break; - - case EventType.JoystickMoved : - if (JoystickMoved != null) - JoystickMoved(this, new JoystickMoveEventArgs(e.JoystickMove)); - break; - - case EventType.JoystickConnected: - if (JoystickConnected != null) - JoystickConnected(this, new JoystickConnectEventArgs(e.JoystickConnect)); - break; - - case EventType.JoystickDisconnected: - if (JoystickDisconnected != null) - JoystickDisconnected(this, new JoystickConnectEventArgs(e.JoystickConnect)); - break; - - case EventType.KeyPressed : - if (KeyPressed != null) - KeyPressed(this, new KeyEventArgs(e.Key)); - break; - - case EventType.KeyReleased : - if (KeyReleased != null) - KeyReleased(this, new KeyEventArgs(e.Key)); - break; - - case EventType.LostFocus : - if (LostFocus != null) - LostFocus(this, EventArgs.Empty); - break; - - case EventType.MouseButtonPressed : - if (MouseButtonPressed != null) - MouseButtonPressed(this, new MouseButtonEventArgs(e.MouseButton)); - break; - - case EventType.MouseButtonReleased : - if (MouseButtonReleased != null) - MouseButtonReleased(this, new MouseButtonEventArgs(e.MouseButton)); - break; - - case EventType.MouseEntered : - if (MouseEntered != null) - MouseEntered(this, EventArgs.Empty); - break; - - case EventType.MouseLeft : - if (MouseLeft != null) - MouseLeft(this, EventArgs.Empty); - break; - - case EventType.MouseMoved : - if (MouseMoved != null) - MouseMoved(this, new MouseMoveEventArgs(e.MouseMove)); - break; - - case EventType.MouseWheelMoved : - if (MouseWheelMoved != null) - MouseWheelMoved(this, new MouseWheelEventArgs(e.MouseWheel)); - break; - - case EventType.Resized : - if (Resized != null) - Resized(this, new SizeEventArgs(e.Size)); - break; - - case EventType.TextEntered : - if (TextEntered != null) - TextEntered(this, new TextEventArgs(e.Text)); - break; - } - } - - /// Event handler for the Closed event - public event EventHandler Closed = null; - - /// Event handler for the Resized event - public event EventHandler Resized = null; - - /// Event handler for the LostFocus event - public event EventHandler LostFocus = null; - - /// Event handler for the GainedFocus event - public event EventHandler GainedFocus = null; - - /// Event handler for the TextEntered event - public event EventHandler TextEntered = null; - - /// Event handler for the KeyPressed event - public event EventHandler KeyPressed = null; - - /// Event handler for the KeyReleased event - public event EventHandler KeyReleased = null; - - /// Event handler for the MouseWheelMoved event - public event EventHandler MouseWheelMoved = null; - - /// Event handler for the MouseButtonPressed event - public event EventHandler MouseButtonPressed = null; - - /// Event handler for the MouseButtonReleased event - public event EventHandler MouseButtonReleased = null; - - /// Event handler for the MouseMoved event - public event EventHandler MouseMoved = null; - - /// Event handler for the MouseEntered event - public event EventHandler MouseEntered = null; - - /// Event handler for the MouseLeft event - public event EventHandler MouseLeft = null; - - /// Event handler for the JoystickButtonPressed event - public event EventHandler JoystickButtonPressed = null; - - /// Event handler for the JoystickButtonReleased event - public event EventHandler JoystickButtonReleased = null; - - /// Event handler for the JoystickMoved event - public event EventHandler JoystickMoved = null; - - /// Event handler for the JoystickConnected event - public event EventHandler JoystickConnected = null; - - /// Event handler for the JoystickDisconnected event - public event EventHandler JoystickDisconnected = null; - - #region Imports - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfWindow_Create(VideoMode Mode, string Title, Styles Style, ref ContextSettings Params); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfWindow_CreateFromHandle(IntPtr Handle, ref ContextSettings Params); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_Destroy(IntPtr This); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfWindow_IsOpened(IntPtr This); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_Close(IntPtr This); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfWindow_PollEvent(IntPtr This, out Event Evt); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfWindow_WaitEvent(IntPtr This, out Event Evt); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_Display(IntPtr This); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfWindow_GetWidth(IntPtr This); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfWindow_GetHeight(IntPtr This); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern ContextSettings sfWindow_GetSettings(IntPtr This); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_EnableVerticalSync(IntPtr This, bool Enable); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_ShowMouseCursor(IntPtr This, bool Show); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_SetCursorPosition(IntPtr This, uint X, uint Y); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_GetCursorPosition(IntPtr This, out int X, out int Y); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_SetPosition(IntPtr This, int X, int Y); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_SetSize(IntPtr This, uint Width, uint Height); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_SetTitle(IntPtr This, string title); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_Show(IntPtr This, bool Show); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_EnableKeyRepeat(IntPtr This, bool Enable); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - unsafe static extern void sfWindow_SetIcon(IntPtr This, uint Width, uint Height, byte* Pixels); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern bool sfWindow_SetActive(IntPtr This, bool Active); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_SetFramerateLimit(IntPtr This, uint Limit); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern uint sfWindow_GetFrameTime(IntPtr This); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern void sfWindow_SetJoystickThreshold(IntPtr This, float Threshold); - - [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfWindow_GetSystemHandle(IntPtr This); - #endregion - } - } -} diff --git a/bindings/dotnet/src/Window/sfml-window.csproj b/bindings/dotnet/src/Window/sfml-window.csproj deleted file mode 100644 index 6a2ead758..000000000 --- a/bindings/dotnet/src/Window/sfml-window.csproj +++ /dev/null @@ -1,85 +0,0 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} - Library - Properties - SFML.Window - sfmlnet-window-2 - - - - - 2.0 - - - - - true - ..\..\lib\x86\ - DEBUG;TRACE - true - ..\..\doc\build\window-doc.xml - full - x86 - prompt - - - ..\..\lib\x86\ - TRACE - true - ..\..\doc\build\window-doc.xml - true - pdbonly - x86 - prompt - - - true - ..\..\lib\x64\ - DEBUG;TRACE - true - ..\..\doc\build\window-doc.xml - full - x64 - prompt - - - ..\..\lib\x64\ - TRACE - true - ..\..\doc\build\window-doc.xml - true - pdbonly - x64 - prompt - - - - - - - - - - - - - - - - - - - - \ No newline at end of file