Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit -- moved from https://github.com/LaurentGomila/SFML (b…

…indings/dotnet)
  • Loading branch information...
commit a03db64015805afd9a860b24d914f8df1337455e 0 parents
@LaurentGomila LaurentGomila authored
Showing with 10,788 additions and 0 deletions.
  1. +96 −0 build/vc2008/SFML.net.sln
  2. +71 −0 doc/build/MainPage.html
  3. +38 −0 doc/build/SFML.ndoc
  4. +174 −0 examples/opengl/OpenGL.cs
  5. +80 −0 examples/opengl/opengl.csproj
  6. BIN  examples/opengl/resources/background.jpg
  7. BIN  examples/opengl/resources/texture.jpg
  8. +247 −0 examples/shader/Shader.cs
  9. BIN  examples/shader/resources/arial.ttf
  10. BIN  examples/shader/resources/background.jpg
  11. +16 −0 examples/shader/resources/blur.sfx
  12. +11 −0 examples/shader/resources/colorize.sfx
  13. +13 −0 examples/shader/resources/fisheye.sfx
  14. +6 −0 examples/shader/resources/nothing.sfx
  15. +10 −0 examples/shader/resources/pixelate.sfx
  16. BIN  examples/shader/resources/sprite.png
  17. BIN  examples/shader/resources/wave.jpg
  18. +12 −0 examples/shader/resources/wave.sfx
  19. +75 −0 examples/shader/shader.csproj
  20. +82 −0 examples/sound/Sound.cs
  21. BIN  examples/sound/resources/canary.wav
  22. BIN  examples/sound/resources/orchestral.ogg
  23. +75 −0 examples/sound/sound.csproj
  24. +83 −0 examples/sound_capture/SoundCapture.cs
  25. +75 −0 examples/sound_capture/sound_capture.csproj
  26. +13 −0 examples/visualbasic/My Project/Application.Designer.vb
  27. +10 −0 examples/visualbasic/My Project/Application.myapp
  28. +35 −0 examples/visualbasic/My Project/AssemblyInfo.vb
  29. +63 −0 examples/visualbasic/My Project/Resources.Designer.vb
  30. +117 −0 examples/visualbasic/My Project/Resources.resx
  31. +73 −0 examples/visualbasic/My Project/Settings.Designer.vb
  32. +7 −0 examples/visualbasic/My Project/Settings.settings
  33. +161 −0 examples/visualbasic/OpenGL.vb
  34. BIN  examples/visualbasic/resources/background.jpg
  35. BIN  examples/visualbasic/resources/texture.jpg
  36. +26 −0 examples/visualbasic/visualbasic.sln
  37. +159 −0 examples/visualbasic/visualbasic.vbproj
  38. +134 −0 examples/window/Window.cs
  39. +75 −0 examples/window/window.csproj
  40. BIN  extlibs/x64/csfml-audio-2.dll
  41. BIN  extlibs/x64/csfml-graphics-2.dll
  42. BIN  extlibs/x64/csfml-window-2.dll
  43. BIN  extlibs/x64/libsndfile-1.dll
  44. BIN  extlibs/x64/openal32.dll
  45. BIN  extlibs/x86/csfml-audio-2.dll
  46. BIN  extlibs/x86/csfml-graphics-2.dll
  47. BIN  extlibs/x86/csfml-window-2.dll
  48. BIN  extlibs/x86/libsndfile-1.dll
  49. BIN  extlibs/x86/openal32.dll
  50. +31 −0 license.txt
  51. +36 −0 readme.txt
  52. +72 −0 src/Audio/Listener.cs
  53. +333 −0 src/Audio/Music.cs
  54. +325 −0 src/Audio/Sound.cs
  55. +209 −0 src/Audio/SoundBuffer.cs
  56. +83 −0 src/Audio/SoundBufferRecorder.cs
  57. +192 −0 src/Audio/SoundRecorder.cs
  58. +386 −0 src/Audio/SoundStream.cs
  59. +133 −0 src/Audio/Vector3.cs
  60. +88 −0 src/Audio/sfml-audio.csproj
  61. +110 −0 src/Graphics/Color.cs
  62. +91 −0 src/Graphics/Context.cs
  63. +130 −0 src/Graphics/Drawable.cs
  64. +238 −0 src/Graphics/Font.cs
  65. +462 −0 src/Graphics/Image.cs
  66. +247 −0 src/Graphics/Rect.cs
  67. +336 −0 src/Graphics/RenderImage.cs
  68. +133 −0 src/Graphics/RenderTarget.cs
  69. +630 −0 src/Graphics/RenderWindow.cs
  70. +267 −0 src/Graphics/Shader.cs
  71. +565 −0 src/Graphics/Shape.cs
  72. +397 −0 src/Graphics/Sprite.cs
  73. +465 −0 src/Graphics/Text.cs
  74. +251 −0 src/Graphics/View.cs
  75. +97 −0 src/Graphics/sfml-graphics.csproj
  76. +92 −0 src/Window/ContextSettings.cs
  77. +266 −0 src/Window/Event.cs
  78. +378 −0 src/Window/EventArgs.cs
  79. +159 −0 src/Window/Joystick.cs
  80. +146 −0 src/Window/Keyboard.cs
  81. +84 −0 src/Window/LoadingFailedException.cs
  82. +81 −0 src/Window/Mouse.cs
  83. +93 −0 src/Window/ObjectBase.cs
  84. +246 −0 src/Window/Vector2.cs
  85. +124 −0 src/Window/VideoMode.cs
  86. +690 −0 src/Window/Window.cs
  87. +85 −0 src/Window/sfml-window.csproj
96 build/vc2008/SFML.net.sln
@@ -0,0 +1,96 @@
+
+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
71 doc/build/MainPage.html
@@ -0,0 +1,71 @@
+<h2>Welcome</h2>
+<p>
+Welcome to the official SFML.Net documentation. Here you will find a detailed
+description of all the SFML.Net classes. <br/>
+If you are looking for tutorials, help or whatever, you can visit the official website
+at <a href="http://www.sfml-dev.org/">www.sfml-dev.org</a>.
+</p>
+
+<h2>Short example</h2>
+<p>
+Here is a short example in C#, to show you how simple it is to use SFML.Net :
+</p>
+
+<pre style="background-color:#F0F0F0">
+<span style="color:blue">using</span> System;
+<span style="color:blue">using</span> SFML.Audio;
+<span style="color:blue">using</span> SFML.Window;
+<span style="color:blue">using</span> SFML.Graphics;
+
+<span style="color:blue">namespace</span> Example
+{
+ <span style="color:blue">class</span> <span style="color:#2B91AF">Program</span>
+ {
+ <span style="color:blue">static void</span> OnClose(<span style="color:blue">object</span> sender, <span style="color:#2B91AF">EventArgs</span> e)
+ {
+ <span style="color:#008000">// Close the window when OnClose event is received</span>
+ <span style="color:#2B91AF">RenderWindow</span> window = (<span style="color:#2B91AF">RenderWindow</span>)sender;
+ window.Close();
+ }
+
+ <span style="color:blue">static void</span> Main(<span style="color:blue">string</span>[] args)
+ {
+ <span style="color:#008000">// Create the main window</span>
+ <span style="color:#2B91AF">RenderWindow</span> window = <span style="color:blue">new</span> <span style="color:#2B91AF">RenderWindow</span>(<span style="color:blue">new</span> <span style="color:#2B91AF">VideoMode</span>(800, 600), <span style="color:#A31515">"SFML window"</span>);
+ window.Closed += <span style="color:blue">new</span> <span style="color:#2B91AF">EventHandler</span>(OnClose);
+
+ <span style="color:#008000">// Load a sprite to display</span>
+ <span style="color:#2B91AF">Image</span> image = <span style="color:blue">new</span> <span style="color:#2B91AF">Image</span>(<span style="color:#A31515">"cute_image.jpg"</span>);
+ <span style="color:#2B91AF">Sprite</span> sprite = <span style="color:blue">new</span> <span style="color:#2B91AF">Sprite</span>(image);
+
+ <span style="color:#008000">// Create a graphical string to display</span>
+ <span style="color:#2B91AF">Font</span> font = <span style="color:blue">new</span> <span style="color:#2B91AF">Font</span>(<span style="color:#A31515">"arial.ttf"</span>);
+ <span style="color:#2B91AF">Text</span> text = <span style="color:blue">new</span> <span style="color:#2B91AF">Text</span>(<span style="color:#A31515">"Hello SFML.Net"</span>, font);
+
+ <span style="color:#008000">// Load a music to play</span>
+ <span style="color:#2B91AF">Music</span> music = <span style="color:blue">new</span> Music(<span style="color:#A31515">"nice_music.ogg"</span>);
+ music.Play();
+
+ <span style="color:#008000">// Start the game loop</span>
+ <span style="color:blue">while</span> (window.IsOpened())
+ {
+ <span style="color:#008000">// Process events</span>
+ window.DispatchEvents();
+
+ <span style="color:#008000">// Clear screen</span>
+ window.Clear();
+
+ <span style="color:#008000">// Draw the sprite</span>
+ window.Draw(sprite);
+
+ <span style="color:#008000">// Draw the string</span>
+ window.Draw(text);
+
+ <span style="color:#008000">// Update the window</span>
+ window.Display();
+ }
+ }
+ }
+}
+</pre>
+
38 doc/build/SFML.ndoc
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<project SchemaVersion="2.0">
+ <assemblies>
+ <assembly location="..\..\lib\sfmlnet-audio.dll" documentation=".\audio-doc.xml" />
+ <assembly location="..\..\lib\sfmlnet-graphics.dll" documentation=".\graphics-doc.xml" />
+ <assembly location="..\..\lib\sfmlnet-window.dll" documentation=".\window-doc.xml" />
+ </assemblies>
+ <documenters>
+ <documenter name="MSDN-Help2">
+ <property name="PlugInNamespace" value="ms.vscc" />
+ <property name="OutputDirectory" value="..\html\" />
+ <property name="HtmlHelpName" value="SFML.Net" />
+ <property name="Title" value="SFML.Net documentation" />
+ </documenter>
+ <documenter name="XML">
+ <property name="OutputFile" value=".\doc\doc.xml" />
+ </documenter>
+ <documenter name="Intellisense">
+ <property name="OutputDirectory" value="..\intellisense\" />
+ <property name="DocumentProtected" value="False" />
+ </documenter>
+ <documenter name="MSDN-CHM">
+ <property name="RootPageFileName" value=".\MainPage.html" />
+ <property name="OutputDirectory" value="..\" />
+ <property name="HtmlHelpName" value="SFML.Net" />
+ <property name="Title" value="SFML.Net documentation" />
+ <property name="IncrementalBuild" value="True" />
+ <property name="DocumentExplicitInterfaceImplementations" value="True" />
+ <property name="DocumentProtected" value="False" />
+ <property name="CleanIntermediates" value="True" />
+ </documenter>
+ <documenter name="MSDN-Web">
+ <property name="OutputDirectory" value="..\msdn\" />
+ <property name="HtmlHelpName" value="SFML.Net" />
+ <property name="Title" value="SFML.Net documentation" />
+ </documenter>
+ </documenters>
+</project>
174 examples/opengl/OpenGL.cs
@@ -0,0 +1,174 @@
+using System;
+using SFML;
+using SFML.Graphics;
+using SFML.Window;
+using Tao.OpenGl;
+
+namespace opengl
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ 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<KeyEventArgs>(OnKeyPressed);
+ window.Resized += new EventHandler<SizeEventArgs>(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);
+ }
+
+ /// <summary>
+ /// Function called when the window is closed
+ /// </summary>
+ static void OnClosed(object sender, EventArgs e)
+ {
+ RenderWindow window = (RenderWindow)sender;
+ window.Close();
+ }
+
+ /// <summary>
+ /// Function called when a key is pressed
+ /// </summary>
+ static void OnKeyPressed(object sender, KeyEventArgs e)
+ {
+ RenderWindow window = (RenderWindow)sender;
+ if (e.Code == Keyboard.Key.Escape)
+ window.Close();
+ }
+
+ /// <summary>
+ /// Function called when the window is resized
+ /// </summary>
+ static void OnResized(object sender, SizeEventArgs e)
+ {
+ Gl.glViewport(0, 0, (int)e.Width, (int)e.Height);
+ }
+ }
+}
80 examples/opengl/opengl.csproj
@@ -0,0 +1,80 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{160AE11E-138A-4B77-9642-EA74F9A79B4D}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>opengl</RootNamespace>
+ <AssemblyName>opengl</AssemblyName>
+ <StartupObject>opengl.Program</StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\Graphics\sfml-graphics.csproj">
+ <Project>{46786269-57B9-48E7-AA4F-8F4D84609FE6}</Project>
+ <Name>sfml-graphics</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\src\Window\sfml-window.csproj">
+ <Project>{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}</Project>
+ <Name>sfml-window</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="OpenGL.cs">
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="Tao.FreeGlut, Version=2.4.0.2, Culture=neutral, PublicKeyToken=6e602a6ad6c0d06d, processorArchitecture=MSIL" />
+ <Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef, processorArchitecture=MSIL" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
BIN  examples/opengl/resources/background.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  examples/opengl/resources/texture.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
247 examples/shader/Shader.cs
@@ -0,0 +1,247 @@
+using System;
+using System.Collections.Generic;
+using SFML;
+using SFML.Graphics;
+using SFML.Window;
+
+namespace shader
+{
+ /// <summary>
+ /// A class to simplify shader selection
+ /// </summary>
+ class ShaderSelector
+ {
+ // Constructor
+ public ShaderSelector(Dictionary<string, Shader> 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<string, Shader> myOwner;
+ private Dictionary<string, Shader>.Enumerator myIterator;
+ };
+
+ static class Program
+ {
+ private static Dictionary<string, Shader> shaders;
+ private static ShaderSelector backgroundShader;
+ private static ShaderSelector entityShader;
+ private static ShaderSelector globalShader;
+ private static Text shaderText;
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ 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<KeyEventArgs>(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<string, Shader>();
+ 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();
+ }
+ }
+
+ /// <summary>
+ /// Fonction called when the post-effects are not supported ;
+ /// Display an error message and wait until the user exits
+ /// </summary>
+ 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();
+ }
+ }
+
+ /// <summary>
+ /// Function called when the window is closed
+ /// </summary>
+ static void OnClosed(object sender, EventArgs e)
+ {
+ RenderWindow window = (RenderWindow)sender;
+ window.Close();
+ }
+
+ /// <summary>
+ /// Function called when a key is pressed
+ /// </summary>
+ 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";
+ }
+ }
+}
BIN  examples/shader/resources/arial.ttf
Binary file not shown
BIN  examples/shader/resources/background.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 examples/shader/resources/blur.sfx
@@ -0,0 +1,16 @@
+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);
+}
11 examples/shader/resources/colorize.sfx
@@ -0,0 +1,11 @@
+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;
+}
13 examples/shader/resources/fisheye.sfx
@@ -0,0 +1,13 @@
+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;
+}
6 examples/shader/resources/nothing.sfx
@@ -0,0 +1,6 @@
+uniform sampler2D texture;
+
+void main()
+{
+ gl_FragColor = texture2D(texture, gl_TexCoord[0].xy) * gl_Color;
+}
10 examples/shader/resources/pixelate.sfx
@@ -0,0 +1,10 @@
+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;
+}
BIN  examples/shader/resources/sprite.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  examples/shader/resources/wave.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 examples/shader/resources/wave.sfx
@@ -0,0 +1,12 @@
+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;
+}
75 examples/shader/shader.csproj
@@ -0,0 +1,75 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9D4738F7-34EA-433A-A765-AF85A52A174D}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>shader</RootNamespace>
+ <AssemblyName>shader</AssemblyName>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <StartupObject>shader.Program</StartupObject>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\Graphics\sfml-graphics.csproj">
+ <Project>{46786269-57B9-48E7-AA4F-8F4D84609FE6}</Project>
+ <Name>sfml-graphics</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\src\Window\sfml-window.csproj">
+ <Project>{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}</Project>
+ <Name>sfml-window</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Shader.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
82 examples/sound/Sound.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Threading;
+using SFML;
+using SFML.Audio;
+
+namespace sound
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ static void Main(string[] args)
+ {
+ // Play a sound
+ PlaySound();
+ Console.Clear();
+
+ // Play a music
+ PlayMusic();
+ }
+
+ /// <summary>
+ /// Play a sound
+ /// </summary>
+ 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);
+ }
+ }
+
+ /// <summary>
+ /// Play a music
+ /// </summary>
+ 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);
+ }
+ }
+ }
+}
BIN  examples/sound/resources/canary.wav
Binary file not shown
BIN  examples/sound/resources/orchestral.ogg
Binary file not shown
75 examples/sound/sound.csproj
@@ -0,0 +1,75 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{16E177F3-A0FF-4091-8521-562E0EBAA3AB}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>sound</RootNamespace>
+ <AssemblyName>sound</AssemblyName>
+ <StartupObject>sound.Program</StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\Audio\sfml-audio.csproj">
+ <Project>{0B202C4D-A457-47FE-84A3-031DD878C6BE}</Project>
+ <Name>sfml-audio</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\src\Window\sfml-window.csproj">
+ <Project>{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}</Project>
+ <Name>sfml-window</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Sound.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
83 examples/sound_capture/SoundCapture.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Threading;
+using SFML;
+using SFML.Audio;
+
+namespace sound_capture
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ 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 !");
+ }
+ }
+}
75 examples/sound_capture/sound_capture.csproj
@@ -0,0 +1,75 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{F2F48990-F81E-41BA-AD01-168F6178C807}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>sound_capture</RootNamespace>
+ <AssemblyName>sound_capture</AssemblyName>
+ <StartupObject>sound_capture.Program</StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\Audio\sfml-audio.csproj">
+ <Project>{0B202C4D-A457-47FE-84A3-031DD878C6BE}</Project>
+ <Name>sfml-audio</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\src\Window\sfml-window.csproj">
+ <Project>{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}</Project>
+ <Name>sfml-window</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SoundCapture.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
13 examples/visualbasic/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' 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.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
10 examples/visualbasic/My Project/Application.myapp
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <MySubMain>false</MySubMain>
+ <SingleInstance>false</SingleInstance>
+ <ShutdownMode>0</ShutdownMode>
+ <EnableVisualStyles>true</EnableVisualStyles>
+ <AuthenticationMode>0</AuthenticationMode>
+ <ApplicationType>2</ApplicationType>
+ <SaveMySettingsOnExit>true</SaveMySettingsOnExit>
+</MyApplicationData>
35 examples/visualbasic/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+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
+
+<Assembly: AssemblyTitle("visualbasic")>
+<Assembly: AssemblyDescription("")>
+<Assembly: AssemblyCompany("Wam")>
+<Assembly: AssemblyProduct("visualbasic")>
+<Assembly: AssemblyCopyright("Copyright © Wam 2008")>
+<Assembly: AssemblyTrademark("")>
+
+<Assembly: ComVisible(False)>
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+<Assembly: Guid("6694830f-34ec-4c32-b1c8-895dbbf41593")>
+
+' 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:
+' <Assembly: AssemblyVersion("1.0.*")>
+
+<Assembly: AssemblyVersion("1.0.0.0")>
+<Assembly: AssemblyFileVersion("1.0.0.0")>
63 examples/visualbasic/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' 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.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+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.
+ '''<summary>
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''</summary>
+ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''<summary>
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ 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
+
+ '''<summary>
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
117 examples/visualbasic/My Project/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
73 examples/visualbasic/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' 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.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0"), _
+ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ 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
+
+ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ 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
+
+ <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
+ Friend Module MySettingsProperty
+
+ <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
+ Friend ReadOnly Property Settings() As Global.visualbasic.My.MySettings
+ Get
+ Return Global.visualbasic.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
7 examples/visualbasic/My Project/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
161 examples/visualbasic/OpenGL.vb
@@ -0,0 +1,161 @@
+Imports SFML
+Imports SFML.Window
+Imports SFML.Graphics
+Imports Tao.OpenGl
+Imports Tao.FreeGlut
+
+
+Module OpenGL
+
+ Dim WithEvents window As RenderWindow
+
+ ''' <summary>
+ ''' Entry point of application
+ ''' </summary>
+ 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
+
+ ''' <summary>
+ ''' Function called when the window is closed
+ ''' </summary>
+ Sub App_Closed(ByVal sender As Object, ByVal e As EventArgs) Handles window.Closed
+ Dim window = CType(sender, RenderWindow)
+ window.Close()
+ End Sub
+
+ ''' <summary>
+ ''' Function called when a key is pressed
+ ''' </summary>
+ 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
+
+ ''' <summary>
+ ''' Function called when the window is resized
+ ''' </summary>
+ 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
BIN  examples/visualbasic/resources/background.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  examples/visualbasic/resources/texture.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 examples/visualbasic/visualbasic.sln
@@ -0,0 +1,26 @@
+
+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
159 examples/visualbasic/visualbasic.vbproj
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{98552080-F688-46B4-A2FF-1AC7C50ECBE8}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <StartupObject>visualbasic.OpenGL</StartupObject>
+ <RootNamespace>visualbasic</RootNamespace>
+ <AssemblyName>visualbasic</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <MyType>WindowsFormsWithCustomSubMain</MyType>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <OptionExplicit>On</OptionExplicit>
+ <OptionCompare>Binary</OptionCompare>
+ <OptionStrict>Off</OptionStrict>
+ <OptionInfer>On</OptionInfer>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>.\</OutputPath>
+ <DocumentationFile>visualbasic.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <DefineDebug>false</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DocumentationFile>visualbasic.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>.\</OutputPath>
+ <DocumentationFile>visualbasic.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>bin\x64\Release\</OutputPath>
+ <DocumentationFile>visualbasic.xml</DocumentationFile>
+ <Optimize>true</Optimize>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>.\</OutputPath>
+ <DocumentationFile>visualbasic.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>bin\x86\Release\</OutputPath>
+ <DocumentationFile>visualbasic.xml</DocumentationFile>
+ <Optimize>true</Optimize>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="sfmlnet2-graphics, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\sfmlnet2-graphics.dll</HintPath>
+ </Reference>
+ <Reference Include="sfmlnet2-window, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\sfmlnet2-window.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="Tao.FreeGlut, Version=2.4.0.2, Culture=neutral, PublicKeyToken=6e602a6ad6c0d06d, processorArchitecture=MSIL" />
+ <Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef, processorArchitecture=MSIL" />
+ </ItemGroup>
+ <ItemGroup>
+ <Import Include="Microsoft.VisualBasic" />
+ <Import Include="System" />
+ <Import Include="System.Collections" />
+ <Import Include="System.Collections.Generic" />
+ <Import Include="System.Data" />
+ <Import Include="System.Diagnostics" />
+ <Import Include="System.Linq" />
+ <Import Include="System.Xml.Linq" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="OpenGL.vb" />
+ <Compile Include="My Project\AssemblyInfo.vb" />
+ <Compile Include="My Project\Application.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Application.myapp</DependentUpon>
+ </Compile>
+ <Compile Include="My Project\Resources.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="My Project\Settings.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="My Project\Resources.resx">
+ <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.vb</LastGenOutput>
+ <CustomToolNamespace>My.Resources</CustomToolNamespace>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="My Project\Application.myapp">
+ <Generator>MyApplicationCodeGenerator</Generator>
+ <LastGenOutput>Application.Designer.vb</LastGenOutput>
+ </None>
+ <None Include="My Project\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <CustomToolNamespace>My</CustomToolNamespace>
+ <LastGenOutput>Settings.Designer.vb</LastGenOutput>
+ </None>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
134 examples/window/Window.cs
@@ -0,0 +1,134 @@
+using System;
+using SFML;
+using SFML.Window;
+using Tao.OpenGl;
+
+namespace window
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ 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<KeyEventArgs>(OnKeyPressed);
+ window.Resized += new EventHandler<SizeEventArgs>(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();
+ }
+ }
+
+ /// <summary>
+ /// Function called when the window is closed
+ /// </summary>
+ static void OnClosed(object sender, EventArgs e)
+ {
+ Window window = (Window)sender;
+ window.Close();
+ }
+
+ /// <summary>
+ /// Function called when a key is pressed
+ /// </summary>
+ static void OnKeyPressed(object sender, KeyEventArgs e)
+ {
+ Window window = (Window)sender;
+ if (e.Code == Keyboard.Key.Escape)
+ window.Close();
+ }
+
+ /// <summary>
+ /// Function called when the window is resized
+ /// </summary>
+ static void OnResized(object sender, SizeEventArgs e)
+ {
+ Gl.glViewport(0, 0, (int)e.Width, (int)e.Height);
+ }
+ }
+}
75 examples/window/window.csproj
@@ -0,0 +1,75 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>window</RootNamespace>
+ <AssemblyName>window</AssemblyName>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <StartupObject>window.Program</StartupObject>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>.\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\Window\sfml-window.csproj">
+ <Project>{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}</Project>
+ <Name>sfml-window</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Window.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="Tao.FreeGlut, Version=2.4.0.2, Culture=neutral, PublicKeyToken=6e602a6ad6c0d06d, processorArchitecture=MSIL" />
+ <Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef, processorArchitecture=MSIL" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
BIN  extlibs/x64/csfml-audio-2.dll
Binary file not shown
BIN  extlibs/x64/csfml-graphics-2.dll
Binary file not shown
BIN  extlibs/x64/csfml-window-2.dll
Binary file not shown
BIN  extlibs/x64/libsndfile-1.dll
Binary file not shown
BIN  extlibs/x64/openal32.dll
Binary file not shown
BIN  extlibs/x86/csfml-audio-2.dll
Binary file not shown
BIN  extlibs/x86/csfml-graphics-2.dll
Binary file not shown
BIN  extlibs/x86/csfml-window-2.dll
Binary file not shown
BIN  extlibs/x86/libsndfile-1.dll
Binary file not shown
BIN  extlibs/x86/openal32.dll
Binary file not shown
31 license.txt
@@ -0,0 +1,31 @@
+SFML.Net
+--------
+
+SFML.Net - Copyright (c) 2007-2011 Laurent Gomila - laurent.gom@gmail.com
+
+This software is provided 'as-is', without any express or
+implied warranty. In no event will the authors be held
+liable for any damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute
+it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented;
+ you must not claim that you wrote the original software.
+ If you use this software in a product, an acknowledgment
+ in the product documentation would be appreciated but
+ is not required.
+
+2. Altered source versions must be plainly marked as such,
+ and must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any
+ source distribution.
+
+
+
+External libraries used by SFML.Net
+-----------------------------------
+
+* SFML is under the zlib/png license
36 readme.txt
@@ -0,0 +1,36 @@
+SFML.Net - Simple and Fast Multimedia Library for .Net
+======================================================
+
+SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics,
+audio and network.
+It is originally written in C++, and this project is its official binding for .Net languages (C#, VB, ...).
+
+Authors
+-------
+
+Laurent Gomila - main developer (laurent.gom@gmail.com)
+
+Download
+--------
+
+You can get the latest official release on SFML website (http://www.sfml-dev.org/download.php).
+You can also get the current development version from the git repository (https://github.com/LaurentGomila/SFML.Net).
+
+Learn
+-----