1
DotNet / Crash on exit when using String2D
« on: December 05, 2010, 10:24:48 pm »
I just tried it out and it works fine. Thanks for the help!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
using System;
using SFML.Audio;
using SFML.Window;
using SFML.Graphics;
namespace Example
{
class Program
{
static void OnClose(object sender, EventArgs e)
{
// Close the window when OnClose event is received
RenderWindow window = (RenderWindow)sender;
window.Close();
}
static void Main(string[] args)
{
// Create the main window
RenderWindow app = new RenderWindow(new VideoMode(800, 600), "SFML window");
app.Closed += new EventHandler(OnClose);
// Create a graphical string to display
Font arial = new Font("arial.ttf");
String2D text = new String2D("Hello SFML.Net", arial);
// Start the game loop
while (app.IsOpened())
{
// Process events
app.DispatchEvents();
// Clear screen
app.Clear();;
// Draw the string
app.Draw(text);
// Update the window
app.Display();
}
}
}
}