Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Topics - lightstar

Pages: [1]
1
DotNet / Tutorial for 1.6 uses GetEvent, method is protected in API
« on: March 26, 2012, 04:51:47 pm »
I've been looking at some of the examples, and putting together a skeleton application. I'm using version 1.6 of the .NET bindings.

In this page: http://www.sfml-dev.org/tutorials/1.6/window-events.php the events are handled with GetEvent in the loop:
sf::Event Event;
while (App.GetEvent(Event))
{
    // Window closed
    if (Event.Type == sf::Event::Closed)
        Running = false;
}

but the sample code, see https://github.com/SFML/SFML.Net/blob/master/examples/window/Window.cs uses DispatchEvents as GetEvent is protected now.

Is the tutorial just out of date? What is the recommended method?

Also, the event handlers such as:

       
static void OnClosed(object sender, EventArgs e)
{
    Window window = (Window)sender;
    window.Close();
}
 

require a cast on the sender. Is there no way to avoid this side-stepping the type system?


Pages: [1]
anything