Sorry if I don't have responded earlier, but the method of update has just been improved. For the moment, it is just an overlay of the current public interface, and the performances are lower than before. If you approve the new system, I will adapt the code to no longer use the Events class, and the performances should return to the normal. Here are the changes :
////////////////////////////////////////////////////////////
/// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <iostream>
#include <Zeven/sfZeven/sfZeven.hpp>
void Hello()
{
std::cout << "Hello world" << std::endl;
}
////////////////////////////////////////////////////////////
/// Entry point of the application
////////////////////////////////////////////////////////////
int main()
{
// Creation and settings of the SFML rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Zeven sample");
// Limitation of the framerate
App.SetFramerateLimit(40);
// Creation of the area
sf::FloatRect area(0, 0, 100, 100);
// Creation of a shape which represent the area
sf::Shape::Rectangle rectangle(area.Left, area.Top, area.Width, area.Height, sf::Color::Red);
// Get the event handler
zin::sfEventHandler<zin::sfListener>& EventHandler = zin::sfEventHandler::GetInstance();
// Creation of the mouse over listener
zin::sfMouseOverListener mouseOver(area);
// Connection to the function Hello
mouseOver.ConnectTo(sigc::ptr_fun(&Hello));
// Register the listener
EventHandler.Register(mouseOver);
// Main process loop
while( App.IsOpened() )
{
// Rest of the processor
sf::Sleep(0.02);
// Create an empty event
sf::Event Event;
// Event loop
while( App.GetEvent(Event) )
{
// Send an SFML event to the event handler
EventHandler.Recept(Event);
// Close window to exit the program
if( Event.Type == sf::Event::Closed )
App.Close();
// Esc to exit the program
if( Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Escape )
App.Close();
}
// Send the mouse position
EventHandler.Recept(App.ConvertCoords(App.GetInput().GetMouseX(), App.GetInput().GetMouseY()));
// Update the event handler
EventHandler.Update();
// Clear the screen
App.Clear();
// Add drawable in the stack
App.Draw(rectangle);
// Displaying in the rendering window
App.Display();
}
return EXIT_SUCCESS;
}