Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
laurentgom 2009-01-28 16:18:34 +00:00
commit 2f524481c1
974 changed files with 295448 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

View file

@ -0,0 +1,16 @@
texture framebuffer
float offset
effect
{
vec2 offx = vec2(offset, 0.0);
vec2 offy = vec2(0.0, offset);
vec4 c0 = framebuffer(_in);
vec4 c1 = framebuffer(_in - offy);
vec4 c2 = framebuffer(_in + offy);
vec4 c3 = framebuffer(_in - offx);
vec4 c4 = framebuffer(_in + offx);
_out = c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2;
}

Binary file not shown.

View file

@ -0,0 +1,10 @@
texture framebuffer
vec3 color
effect
{
vec4 pixel = framebuffer(_in);
float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11;
_out = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4;
}

View file

@ -0,0 +1,12 @@
texture framebuffer
vec2 mouse
effect
{
float len = distance(_in, mouse) * 7.0;
if (len < 1.0)
_out = framebuffer(_in + (_in - mouse) * len);
else
_out = framebuffer(_in);
}

View file

@ -0,0 +1,6 @@
texture framebuffer
effect
{
_out = framebuffer(_in);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View file

@ -0,0 +1,12 @@
texture framebuffer
texture wave
vec2 offset
effect
{
vec2 texoffset = wave(_in * offset).xy;
texoffset -= vec2(0.5, 0.5);
texoffset *= 0.05;
_out = framebuffer(_in + texoffset);
}

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,161 @@
using System;
using SFML;
using SFML.Graphics;
using SFML.Window;
using Tao.OpenGl;
namespace sample_opengl
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
// Create main window
RenderWindow App = new RenderWindow(new VideoMode(800, 600), "SFML.Net OpenGL");
App.PreserveOpenGLStates(true);
// Setup event handlers
App.Closed += new EventHandler(OnClosed);
App.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
App.Resized += new EventHandler<SizeEventArgs>(OnResized);
// Create a sprite for the background
Image BackgroundImage = new Image("datas/opengl/background.jpg");
Sprite Background = new Sprite(BackgroundImage);
// Create a text to display
String2D Text = new String2D("This is a rotating cube");
Text.Position = new Vector2(250.0F, 300.0F);
Text.Color = new Color(128, 0, 128);
// 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 TempImage = new Image("datas/opengl/texture.jpg"))
{
Gl.glGenTextures(1, out Texture);
Gl.glBindTexture(Gl.GL_TEXTURE_2D, Texture);
Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_RGBA, (int)TempImage.Width, (int)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);
}
// 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 (App.IsOpened())
{
// Process events
App.DispatchEvents();
// Clear the window
App.Clear();
// Draw background
App.Draw(Background);
// Clear depth buffer
Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT);
// Apply some transformations
Time += App.GetFrameTime();
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.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F);
Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F, -50.0F);
Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, 50.0F, -50.0F);
Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, -50.0F);
Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, 50.0F);
Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F, 50.0F);
Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, 50.0F, 50.0F);
Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, 50.0F);
Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F);
Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F, -50.0F);
Gl.glTexCoord2f(1, 1); Gl.glVertex3f(-50.0F, 50.0F, 50.0F);
Gl.glTexCoord2f(1, 0); Gl.glVertex3f(-50.0F, -50.0F, 50.0F);
Gl.glTexCoord2f(0, 0); Gl.glVertex3f(50.0F, -50.0F, -50.0F);
Gl.glTexCoord2f(0, 1); Gl.glVertex3f(50.0F, 50.0F, -50.0F);
Gl.glTexCoord2f(1, 1); Gl.glVertex3f(50.0F, 50.0F, 50.0F);
Gl.glTexCoord2f(1, 0); Gl.glVertex3f(50.0F, -50.0F, 50.0F);
Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, -50.0F, 50.0F);
Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F);
Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, -50.0F);
Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, -50.0F, 50.0F);
Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F, 50.0F);
Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, 50.0F, -50.0F);
Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, 50.0F, -50.0F);
Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, 50.0F, 50.0F);
Gl.glEnd();
// Draw some text on top of our OpenGL object
App.Draw(Text);
// Finally, display the rendered frame on screen
App.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 == KeyCode.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);
}
}
}

View file

@ -0,0 +1,66 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{160AE11E-138A-4B77-9642-EA74F9A79B4D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>sample_opengl</RootNamespace>
<AssemblyName>opengl</AssemblyName>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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" />
</ItemGroup>
<ItemGroup>
<Reference Include="Tao.FreeGlut, Version=2.4.0.2, Culture=neutral, PublicKeyToken=6e602a6ad6c0d06d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Bibliothèques\TaoFramework\bin\Tao.FreeGlut.dll</HintPath>
</Reference>
<Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Bibliothèques\TaoFramework\bin\Tao.OpenGl.dll</HintPath>
</Reference>
</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>

View file

@ -0,0 +1,168 @@
using System;
using System.Collections.Generic;
using SFML;
using SFML.Graphics;
using SFML.Window;
namespace sample_postfx
{
static class Program
{
private static Dictionary<string, PostFx> Effects;
private static Dictionary<string, PostFx>.Enumerator CurrentEffect;
private static String2D CurFXStr;
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
// Create the main window
RenderWindow App = new RenderWindow(new VideoMode(800, 600), "SFML.Net PostFX");
// Setup event handlers
App.Closed += new EventHandler(OnClosed);
App.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
// Check that the system can use post effects
if (PostFx.CanUsePostFX == false)
{
DisplayError(App);
return;
}
// Load a cute background image to display :)
Sprite Background = new Sprite(new Image("datas/post-fx/background.jpg"));
// Load the text font
Font Cheeseburger = new Font("datas/post-fx/cheeseburger.ttf");
// Load the image needed for the wave effect
Image WaveImage = new Image("datas/post-fx/wave.jpg");
// Load all effects
Effects = new Dictionary<string, PostFx>();
Effects["nothing"] = new PostFx("datas/post-fx/nothing.sfx");
Effects["blur"] = new PostFx("datas/post-fx/blur.sfx");
Effects["colorize"] = new PostFx("datas/post-fx/colorize.sfx");
Effects["fisheye"] = new PostFx("datas/post-fx/fisheye.sfx");
Effects["wave"] = new PostFx("datas/post-fx/wave.sfx");
CurrentEffect = Effects.GetEnumerator();
CurrentEffect.MoveNext();
// Do specific initializations
Effects["nothing"].SetTexture("framebuffer", null);
Effects["blur"].SetTexture("framebuffer", null);
Effects["blur"].SetParameter("offset", 0.0F);
Effects["colorize"].SetTexture("framebuffer", null);
Effects["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F);
Effects["fisheye"].SetTexture("framebuffer", null);
Effects["wave"].SetTexture("framebuffer", null);
Effects["wave"].SetTexture("wave", WaveImage);
// Define a string for displaying current effect description
CurFXStr = new String2D();
CurFXStr.Text = "Current effect is \"" + CurrentEffect.Current.Key + "\"";
CurFXStr.Font = Cheeseburger;
CurFXStr.Position = new Vector2(20.0F, 0.0F);
// Define a string for displaying help
String2D InfoStr = new String2D();
InfoStr.Text = "Move your mouse to change the effect parameters\nPress numpad + to change effect\nWarning : some effects may not work\ndepending on your graphics card";
InfoStr.Font = Cheeseburger;
InfoStr.Position = new Vector2(20.0F, 460.0F);
InfoStr.Color = new Color(200, 100, 150);
// Start the game loop
while (App.IsOpened())
{
// Process events
App.DispatchEvents();
// Get the mouse position in the range [0, 1]
float X = App.Input.GetMouseX() / (float)App.Width;
float Y = App.Input.GetMouseY() / (float)App.Height;
// Update the current effect
if (CurrentEffect.Current.Key == "blur") CurrentEffect.Current.Value.SetParameter("offset", X * Y * 0.1f);
else if (CurrentEffect.Current.Key == "colorize") CurrentEffect.Current.Value.SetParameter("color", 0.3f, X, Y);
else if (CurrentEffect.Current.Key == "fisheye") CurrentEffect.Current.Value.SetParameter("mouse", X, 1.0F - Y);
else if (CurrentEffect.Current.Key == "wave") CurrentEffect.Current.Value.SetParameter("offset", X, Y);
// Clear the window
App.Clear();
// Draw background and apply the post-fx
App.Draw(Background);
App.Draw(CurrentEffect.Current.Value);
// Draw interface strings
App.Draw(CurFXStr);
App.Draw(InfoStr);
// Finally, display the rendered frame on screen
App.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 App)
{
// Define a string for displaying the error message
String2D ErrorStr = new String2D("Sorry, your system doesn't support post-effects");
ErrorStr.Position = new Vector2(100.0F, 250.0F);
ErrorStr.Color = new Color(200, 100, 150);
// Start the game loop
while (App.IsOpened())
{
// Process events
App.DispatchEvents();
// Clear the window
App.Clear();
// Draw the error message
App.Draw(ErrorStr);
// Finally, display the rendered frame on screen
App.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;
if (e.Code == KeyCode.Escape)
{
// Close the window
window.Close();
}
else if (e.Code == KeyCode.Add)
{
// Advance to the next effect
if (CurrentEffect.MoveNext() == false)
{
CurrentEffect = Effects.GetEnumerator();
CurrentEffect.MoveNext();
}
CurFXStr.Text = "Current effect is \"" + CurrentEffect.Current.Key + "\"";
}
}
}
}

View file

@ -0,0 +1,54 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9D4738F7-34EA-433A-A765-AF85A52A174D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>sample_postfx</RootNamespace>
<AssemblyName>post-fx</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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="PostFx.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>

View file

@ -0,0 +1,82 @@
using System;
using System.Threading;
using SFML;
using SFML.Audio;
namespace sample_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("datas/sound/footsteps.wav");
// Display sound informations
Console.WriteLine("footsteps.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("datas/sound/lepidoptera.ogg");
// Display music informations
Console.WriteLine("lepidoptera.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);
}
}
}
}

View file

@ -0,0 +1,56 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{16E177F3-A0FF-4091-8521-562E0EBAA3AB}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>sample_sound</RootNamespace>
<AssemblyName>sound</AssemblyName>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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>

View file

@ -0,0 +1,83 @@
using System;
using System.Threading;
using SFML;
using SFML.Audio;
namespace sample_soundcapture
{
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.CanCapture == 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 !");
}
}
}

View file

@ -0,0 +1,56 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F2F48990-F81E-41BA-AD01-168F6178C807}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>sample_soundcapture</RootNamespace>
<AssemblyName>sound-capture</AssemblyName>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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>

View file

@ -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

View file

@ -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>

View file

@ -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")>

View file

@ -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

View file

@ -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>

View file

@ -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

View file

@ -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>

View file

@ -0,0 +1,177 @@
Imports SFML
Imports SFML.Window
Imports SFML.Graphics
Imports Tao.OpenGl
Imports Tao.FreeGlut
Module OpenGL
Dim WithEvents App As RenderWindow
''' <summary>
''' Entry point of application
''' </summary>
Sub Main()
' Create main window
App = New RenderWindow(New VideoMode(800, 600), "SFML.Net OpenGL (Visual Basic)")
App.PreserveOpenGLStates(True)
' Create a sprite for the background
Dim BackgroundImage = New Image("datas/opengl/background.jpg")
Dim Background = New Sprite(BackgroundImage)
' Create a text to display
Dim Text = New String2D("This is a rotating cube")
Text.Position = New Vector2(250.0F, 300.0F)
Text.Color = New Color(128, 0, 128)
' 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
Dim Texture = 0
Using TempImage = New Image("datas/opengl/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 (App.IsOpened())
' Process events
App.DispatchEvents()
' Draw background
App.Draw(Background)
' Clear depth buffer
Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT)
' Apply some transformations
Time += App.GetFrameTime()
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.glTexCoord2f(0, 0)
Gl.glVertex3f(-50.0F, -50.0F, -50.0F)
Gl.glTexCoord2f(0, 1)
Gl.glVertex3f(-50.0F, 50.0F, -50.0F)
Gl.glTexCoord2f(1, 1)
Gl.glVertex3f(50.0F, 50.0F, -50.0F)
Gl.glTexCoord2f(1, 0)
Gl.glVertex3f(50.0F, -50.0F, -50.0F)
Gl.glTexCoord2f(0, 0)
Gl.glVertex3f(-50.0F, -50.0F, 50.0F)
Gl.glTexCoord2f(0, 1)
Gl.glVertex3f(-50.0F, 50.0F, 50.0F)
Gl.glTexCoord2f(1, 1)
Gl.glVertex3f(50.0F, 50.0F, 50.0F)
Gl.glTexCoord2f(1, 0)
Gl.glVertex3f(50.0F, -50.0F, 50.0F)
Gl.glTexCoord2f(0, 0)
Gl.glVertex3f(-50.0F, -50.0F, -50.0F)
Gl.glTexCoord2f(0, 1)
Gl.glVertex3f(-50.0F, 50.0F, -50.0F)
Gl.glTexCoord2f(1, 1)
Gl.glVertex3f(-50.0F, 50.0F, 50.0F)
Gl.glTexCoord2f(1, 0)
Gl.glVertex3f(-50.0F, -50.0F, 50.0F)
Gl.glTexCoord2f(0, 0)
Gl.glVertex3f(50.0F, -50.0F, -50.0F)
Gl.glTexCoord2f(0, 1)
Gl.glVertex3f(50.0F, 50.0F, -50.0F)
Gl.glTexCoord2f(1, 1)
Gl.glVertex3f(50.0F, 50.0F, 50.0F)
Gl.glTexCoord2f(1, 0)
Gl.glVertex3f(50.0F, -50.0F, 50.0F)
Gl.glTexCoord2f(0, 1)
Gl.glVertex3f(-50.0F, -50.0F, 50.0F)
Gl.glTexCoord2f(0, 0)
Gl.glVertex3f(-50.0F, -50.0F, -50.0F)
Gl.glTexCoord2f(1, 0)
Gl.glVertex3f(50.0F, -50.0F, -50.0F)
Gl.glTexCoord2f(1, 1)
Gl.glVertex3f(50.0F, -50.0F, 50.0F)
Gl.glTexCoord2f(0, 1)
Gl.glVertex3f(-50.0F, 50.0F, 50.0F)
Gl.glTexCoord2f(0, 0)
Gl.glVertex3f(-50.0F, 50.0F, -50.0F)
Gl.glTexCoord2f(1, 0)
Gl.glVertex3f(50.0F, 50.0F, -50.0F)
Gl.glTexCoord2f(1, 1)
Gl.glVertex3f(50.0F, 50.0F, 50.0F)
Gl.glEnd()
' Draw some text on top of our OpenGL object
App.Draw(Text)
' Finally, display the rendered frame on screen
App.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 App.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 App.KeyPressed
Dim window = CType(sender, RenderWindow)
If e.Code = KeyCode.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 App.Resized
Gl.glViewport(0, 0, e.Width, e.Height)
End Sub
End Module

View file

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Basic Express 2008
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "visualbasic", "visualbasic.vbproj", "{98552080-F688-46B4-A2FF-1AC7C50ECBE8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,121 @@
<?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.30729</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>bin\Debug\</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>
<ItemGroup>
<Reference Include="sfmlnet-graphics, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\sfmlnet-graphics.dll</HintPath>
</Reference>
<Reference Include="sfmlnet-window, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\sfmlnet-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>

View file

@ -0,0 +1,134 @@
using System;
using SFML;
using SFML.Window;
using Tao.OpenGl;
namespace sample_window
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
// Create the main window
Window App = new Window(new VideoMode(640, 480, 32), "SFML.Net Window");
// Setup event handlers
App.Closed += new EventHandler(OnClosed);
App.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
App.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 (App.IsOpened())
{
// Process events
App.DispatchEvents();
// Set the active window before using OpenGL commands
// It's useless here because the active window is always the same,
// but don't forget it if you use multiple windows
App.SetActive();
// Clear color and depth buffer
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
// Apply some transformations
Time += App.GetFrameTime();
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
App.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 == KeyCode.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);
}
}
}

View file

@ -0,0 +1,60 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>sample_window</RootNamespace>
<AssemblyName>window</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Bibliothèques\TaoFramework\bin\Tao.FreeGlut.dll</HintPath>
</Reference>
<Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Bibliothèques\TaoFramework\bin\Tao.OpenGl.dll</HintPath>
</Reference>
</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>