mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Renamed / moved / updated the SFML.Net examples
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1557 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
186f679f85
commit
177c82a197
Binary file not shown.
Before Width: | Height: | Size: 140 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 52 KiB |
@ -1,16 +0,0 @@
|
||||
uniform sampler2D texture;
|
||||
uniform float offset;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 offx = vec2(offset, 0.0);
|
||||
vec2 offy = vec2(0.0, offset);
|
||||
|
||||
vec4 c0 = texture2D(texture, gl_TexCoord[0].xy);
|
||||
vec4 c1 = texture2D(texture, gl_TexCoord[0].xy - offy);
|
||||
vec4 c2 = texture2D(texture, gl_TexCoord[0].xy + offy);
|
||||
vec4 c3 = texture2D(texture, gl_TexCoord[0].xy - offx);
|
||||
vec4 c4 = texture2D(texture, gl_TexCoord[0].xy + offx);
|
||||
|
||||
gl_FragColor = gl_Color * (c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2);
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
uniform sampler2D texture;
|
||||
uniform vec3 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * gl_Color;
|
||||
float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11;
|
||||
|
||||
gl_FragColor = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4;
|
||||
gl_FragColor.a = pixel.a;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
uniform sampler2D texture;
|
||||
uniform vec2 mouse;
|
||||
|
||||
void main()
|
||||
{
|
||||
float len = distance(gl_TexCoord[0].xy, mouse) * 7.0;
|
||||
|
||||
vec2 coords = gl_TexCoord[0].xy;
|
||||
if (len < 1.0)
|
||||
coords += (gl_TexCoord[0].xy - mouse) * len;
|
||||
|
||||
gl_FragColor = texture2D(texture, coords) * gl_Color;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
uniform sampler2D texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(texture, gl_TexCoord[0].xy) * gl_Color;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
uniform sampler2D texture;
|
||||
uniform vec2 mouse;
|
||||
|
||||
void main()
|
||||
{
|
||||
float factor = 5 + 100 * length(mouse);
|
||||
vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor;
|
||||
|
||||
gl_FragColor = texture2D(texture, pos) * gl_Color;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
@ -1,12 +0,0 @@
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D wave;
|
||||
uniform vec2 offset;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texoffset = texture2D(wave, (gl_TexCoord[0].xy * offset).xy);
|
||||
texoffset -= vec2(0.5, 0.5);
|
||||
texoffset *= 0.05;
|
||||
|
||||
gl_FragColor = texture2D(texture, gl_TexCoord[0].xy + texoffset) * gl_Color;
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -1,174 +0,0 @@
|
||||
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 window = new RenderWindow(new VideoMode(800, 600), "SFML.Net OpenGL");
|
||||
|
||||
// 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("datas/opengl/background.jpg");
|
||||
Sprite background = new Sprite(backgroundImage);
|
||||
|
||||
// Create a text to display
|
||||
Text text = new Text("SFML / OpenGL demo");
|
||||
text.Position = new Vector2(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("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)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.Input.GetMouseX() * 200.0F / window.Width - 100.0F;
|
||||
float y = -window.Input.GetMouseY() * 200.0F / window.Height + 100.0F;
|
||||
|
||||
// Apply some transformations
|
||||
time += window.GetFrameTime();
|
||||
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 == 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
<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>sample_opengl</RootNamespace>
|
||||
<AssemblyName>opengl</AssemblyName>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</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">
|
||||
</Compile>
|
||||
</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>
|
@ -1,250 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SFML;
|
||||
using SFML.Graphics;
|
||||
using SFML.Window;
|
||||
|
||||
namespace sample_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("datas/shader/background.jpg"));
|
||||
background.Image.Smooth = false;
|
||||
|
||||
// Load a sprite which we'll move into the scene
|
||||
Sprite entity = new Sprite(new Image("datas/shader/sprite.png"));
|
||||
|
||||
// Load the text font
|
||||
Font font = new Font("datas/shader/arial.ttf");
|
||||
|
||||
// Load the image needed for the wave effect
|
||||
Image waveImage = new Image("datas/shader/wave.jpg");
|
||||
|
||||
// Load all effects
|
||||
shaders = new Dictionary<string, Shader>();
|
||||
shaders["nothing"] = new Shader("datas/shader/nothing.sfx");
|
||||
shaders["blur"] = new Shader("datas/shader/blur.sfx");
|
||||
shaders["colorize"] = new Shader("datas/shader/colorize.sfx");
|
||||
shaders["fisheye"] = new Shader("datas/shader/fisheye.sfx");
|
||||
shaders["wave"] = new Shader("datas/shader/wave.sfx");
|
||||
shaders["pixelate"] = new Shader("datas/shader/pixelate.sfx");
|
||||
backgroundShader = new ShaderSelector(shaders);
|
||||
entityShader = new ShaderSelector(shaders);
|
||||
globalShader = new ShaderSelector(shaders);
|
||||
|
||||
// Do specific initializations
|
||||
shaders["nothing"].SetTexture("texture", Shader.CurrentTexture);
|
||||
shaders["blur"].SetTexture("texture", Shader.CurrentTexture);
|
||||
shaders["blur"].SetParameter("offset", 0.0F);
|
||||
shaders["colorize"].SetTexture("texture", Shader.CurrentTexture);
|
||||
shaders["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F);
|
||||
shaders["fisheye"].SetTexture("texture", Shader.CurrentTexture);
|
||||
shaders["wave"].SetTexture("texture", Shader.CurrentTexture);
|
||||
shaders["wave"].SetTexture("wave", waveImage);
|
||||
shaders["pixelate"].SetTexture("texture", Shader.CurrentTexture);
|
||||
|
||||
// Define a string for displaying current effect description
|
||||
shaderText = new Text();
|
||||
shaderText.Font = font;
|
||||
shaderText.Size = 20;
|
||||
shaderText.Position = new Vector2(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.Size = 20;
|
||||
infoText.Position = new Vector2(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();
|
||||
|
||||
// TOFIX -- using window.Input together with image.Draw apparently causes a memory corruption
|
||||
// Get the mouse position in the range [0, 1]
|
||||
//float x = window.Input.GetMouseX() / (float)window.Width;
|
||||
//float y = window.Input.GetMouseY() / (float)window.Height;
|
||||
float x = (float)(Math.Cos(time * 1.3) + 1) * 0.5F;
|
||||
float y = (float)(Math.Sin(time * 0.8) + 1) * 0.5F;
|
||||
|
||||
// Update the shaders
|
||||
backgroundShader.Update(x, y);
|
||||
entityShader.Update(x, y);
|
||||
globalShader.Update(x, y);
|
||||
|
||||
// Animate the sprite
|
||||
time += window.GetFrameTime();
|
||||
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 Vector2(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 Vector2(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 == KeyCode.Escape)
|
||||
window.Close();
|
||||
|
||||
// Numpad : switch effect
|
||||
switch (e.Code)
|
||||
{
|
||||
case KeyCode.Numpad1 : backgroundShader.GotoNext(); break;
|
||||
case KeyCode.Numpad2 : entityShader.GotoNext(); break;
|
||||
case KeyCode.Numpad3 : globalShader.GotoNext(); break;
|
||||
}
|
||||
|
||||
// Update the text
|
||||
shaderText.DisplayedString = "Background shader: \"" + backgroundShader.Name + "\"\n" +
|
||||
"Flower shader: \"" + entityShader.Name + "\"\n" +
|
||||
"Global shader: \"" + globalShader.Name + "\"\n";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
<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>sample_shader</RootNamespace>
|
||||
<AssemblyName>shader</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<StartupObject>sample_shader.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</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="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>
|
@ -1,82 +0,0 @@
|
||||
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/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("datas/sound/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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
<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>sample_sound</RootNamespace>
|
||||
<AssemblyName>sound</AssemblyName>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</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>
|
@ -1,83 +0,0 @@
|
||||
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.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 !");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
<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>sample_soundcapture</RootNamespace>
|
||||
<AssemblyName>sound-capture</AssemblyName>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</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>
|
@ -1,13 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <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
|
||||
|
@ -1,10 +0,0 @@
|
||||
<?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>
|
@ -1,35 +0,0 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<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")>
|
@ -1,63 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <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
|
@ -1,117 +0,0 @@
|
||||
<?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>
|
@ -1,73 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <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
|
@ -1,7 +0,0 @@
|
||||
<?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>
|
@ -1,177 +0,0 @@
|
||||
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
|
@ -1,20 +0,0 @@
|
||||
|
||||
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
|
@ -1,121 +0,0 @@
|
||||
<?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>
|
@ -1,134 +0,0 @@
|
||||
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 window = new Window(new VideoMode(640, 480, 32), "SFML.Net Window");
|
||||
|
||||
// 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();
|
||||
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 == 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<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>sample_window</RootNamespace>
|
||||
<AssemblyName>window</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</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>
|
Loading…
Reference in New Issue
Block a user