I think I did it correctly but when I try to run this code:
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);
// Load a sprite to display
Image image = new Image("cute_image.jpg");
Sprite sprite = new Sprite(image);
// Create a graphical string to display
Font arial = new Font("arial.ttf");
String2D text = new String2D("Hello SFML.Net", arial);
// Load a music to play
Music music = new Music("nice_music.ogg");
music.Play();
// Start the game loop
while (app.IsOpened())
{
// Process events
app.DispatchEvents();
// Clear screen
app.Clear();
// Draw the sprite
app.Draw(sprite);
// Draw the string
app.Draw(text);
// Update the window
app.Display();
}
}
}
}
An empty console window comes up, but no SFML screen. Any ideas. I did remove the sprite and music portion though, and just left the text. Do I not have to use CMake to build the library like you do with the C++ version?