Renamed Window::GetEvent to PollEvent

This commit is contained in:
Laurent Gomila 2011-04-11 18:20:21 +02:00
parent bacb698f1a
commit df6874273a
20 changed files with 32 additions and 32 deletions

View File

@ -121,7 +121,7 @@ CSFML_API sfContextSettings sfRenderWindow_GetSettings(const sfRenderWindow* ren
/// \return sfTrue if an event was returned, sfFalse if events stack was empty /// \return sfTrue if an event was returned, sfFalse if events stack was empty
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
CSFML_API sfBool sfRenderWindow_GetEvent(sfRenderWindow* renderWindow, sfEvent* event); CSFML_API sfBool sfRenderWindow_PollEvent(sfRenderWindow* renderWindow, sfEvent* event);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Wait for an event and return it /// Wait for an event and return it

View File

@ -146,7 +146,7 @@ CSFML_API sfContextSettings sfWindow_GetSettings(const sfWindow* window);
/// \return sfTrue if an event was returned, sfFalse if events stack was empty /// \return sfTrue if an event was returned, sfFalse if events stack was empty
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
CSFML_API sfBool sfWindow_GetEvent(sfWindow* window, sfEvent* event); CSFML_API sfBool sfWindow_PollEvent(sfWindow* window, sfEvent* event);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Wait for an event and return it /// Wait for an event and return it

View File

@ -158,14 +158,14 @@ sfContextSettings sfRenderWindow_GetSettings(const sfRenderWindow* renderWindow)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Get the event on top of events stack of a window, if any, and pop it /// Get the event on top of events stack of a window, if any, and pop it
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
sfBool sfRenderWindow_GetEvent(sfRenderWindow* renderWindow, sfEvent* event) sfBool sfRenderWindow_PollEvent(sfRenderWindow* renderWindow, sfEvent* event)
{ {
CSFML_CHECK_RETURN(renderWindow, sfFalse); CSFML_CHECK_RETURN(renderWindow, sfFalse);
CSFML_CHECK_RETURN(event, sfFalse); CSFML_CHECK_RETURN(event, sfFalse);
// Get the event // Get the event
sf::Event SFMLEvent; sf::Event SFMLEvent;
sfBool ret = renderWindow->This.GetEvent(SFMLEvent); sfBool ret = renderWindow->This.PollEvent(SFMLEvent);
// No event, return // No event, return
if (!ret) if (!ret)

View File

@ -150,14 +150,14 @@ sfContextSettings sfWindow_GetSettings(const sfWindow* window)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Get the event on top of events stack of a window, if any, and pop it /// Get the event on top of events stack of a window, if any, and pop it
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
sfBool sfWindow_GetEvent(sfWindow* window, sfEvent* event) sfBool sfWindow_PollEvent(sfWindow* window, sfEvent* event)
{ {
CSFML_CHECK_RETURN(window, sfFalse); CSFML_CHECK_RETURN(window, sfFalse);
CSFML_CHECK_RETURN(event, sfFalse); CSFML_CHECK_RETURN(event, sfFalse);
// Get the event // Get the event
sf::Event SFMLEvent; sf::Event SFMLEvent;
sfBool ret = window->This.GetEvent(SFMLEvent); sfBool ret = window->This.PollEvent(SFMLEvent);
// No event, return // No event, return
if (!ret) if (!ret)

View File

@ -480,9 +480,9 @@ namespace SFML
/// <param name="eventToFill">Variable to fill with the raw pointer to the event structure</param> /// <param name="eventToFill">Variable to fill with the raw pointer to the event structure</param>
/// <returns>True if there was an event, false otherwise</returns> /// <returns>True if there was an event, false otherwise</returns>
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
protected override bool GetEvent(out Event eventToFill) protected override bool PollEvent(out Event eventToFill)
{ {
return sfRenderWindow_GetEvent(This, out eventToFill); return sfRenderWindow_PollEvent(This, out eventToFill);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -545,7 +545,7 @@ namespace SFML
static extern void sfRenderWindow_Close(IntPtr This); static extern void sfRenderWindow_Close(IntPtr This);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfRenderWindow_GetEvent(IntPtr This, out Event Evt); static extern bool sfRenderWindow_PollEvent(IntPtr This, out Event Evt);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfRenderWindow_WaitEvent(IntPtr This, out Event Evt); static extern bool sfRenderWindow_WaitEvent(IntPtr This, out Event Evt);

View File

@ -383,7 +383,7 @@ namespace SFML
public void DispatchEvents() public void DispatchEvents()
{ {
Event e; Event e;
while (GetEvent(out e)) while (PollEvent(out e))
CallEventHandler(e); CallEventHandler(e);
} }
@ -421,9 +421,9 @@ namespace SFML
/// <param name="eventToFill">Variable to fill with the raw pointer to the event structure</param> /// <param name="eventToFill">Variable to fill with the raw pointer to the event structure</param>
/// <returns>True if there was an event, false otherwise</returns> /// <returns>True if there was an event, false otherwise</returns>
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
protected virtual bool GetEvent(out Event eventToFill) protected virtual bool PollEvent(out Event eventToFill)
{ {
return sfWindow_GetEvent(This, out eventToFill); return sfWindow_PollEvent(This, out eventToFill);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -611,7 +611,7 @@ namespace SFML
static extern void sfWindow_Close(IntPtr This); static extern void sfWindow_Close(IntPtr This);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfWindow_GetEvent(IntPtr This, out Event Evt); static extern bool sfWindow_PollEvent(IntPtr This, out Event Evt);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfWindow_WaitEvent(IntPtr This, out Event Evt); static extern bool sfWindow_WaitEvent(IntPtr This, out Event Evt);

View File

@ -61,7 +61,7 @@ int main()
{ {
// Process events // Process events
sf::Event event; sf::Event event;
while (window.GetEvent(event)) while (window.PollEvent(event))
{ {
// Close window : exit // Close window : exit
if (event.Type == sf::Event::Closed) if (event.Type == sf::Event::Closed)

View File

@ -81,7 +81,7 @@ int main()
{ {
// Handle events // Handle events
sf::Event event; sf::Event event;
while (window.GetEvent(event)) while (window.PollEvent(event))
{ {
// Window closed or escape key pressed : exit // Window closed or escape key pressed : exit
if ((event.Type == sf::Event::Closed) || if ((event.Type == sf::Event::Closed) ||

View File

@ -173,7 +173,7 @@ test.Create(800, 600);
{ {
// Process events // Process events
sf::Event event; sf::Event event;
while (window.GetEvent(event)) while (window.PollEvent(event))
{ {
// Close window : exit // Close window : exit
if (event.Type == sf::Event::Closed) if (event.Type == sf::Event::Closed)
@ -261,7 +261,7 @@ void DisplayError()
{ {
// Process events // Process events
sf::Event event; sf::Event event;
while (window.GetEvent(event)) while (window.PollEvent(event))
{ {
// Close window : exit // Close window : exit
if (event.Type == sf::Event::Closed) if (event.Type == sf::Event::Closed)

View File

@ -38,7 +38,7 @@ int main()
{ {
// Process events // Process events
sf::Event event; sf::Event event;
while (window.GetEvent(event)) while (window.PollEvent(event))
{ {
// Close window : exit // Close window : exit
if (event.Type == sf::Event::Closed) if (event.Type == sf::Event::Closed)

View File

@ -194,7 +194,7 @@ private :
/// { /// {
/// // Event processing /// // Event processing
/// sf::Event event; /// sf::Event event;
/// while (window.GetEvent(event)) /// while (window.PollEvent(event))
/// { /// {
/// // Request for closing the window /// // Request for closing the window
/// if (event.Type == sf::Event::Closed) /// if (event.Type == sf::Event::Closed)

View File

@ -347,7 +347,7 @@ public :
/// ///
/// sf::Event holds all the informations about a system event /// sf::Event holds all the informations about a system event
/// that just happened. Events are retrieved using the /// that just happened. Events are retrieved using the
/// sf::Window::GetEvent function. /// sf::Window::PollEvent and sf::Window::WaitEvent functions.
/// ///
/// A sf::Event instance contains the type of the event /// A sf::Event instance contains the type of the event
/// (mouse moved, key pressed, window closed, ...) as well /// (mouse moved, key pressed, window closed, ...) as well
@ -363,7 +363,7 @@ public :
/// Usage example: /// Usage example:
/// \code /// \code
/// sf::Event event; /// sf::Event event;
/// while (window.GetEvent(event)) /// while (window.PollEvent(event))
/// { /// {
/// // Request for closing the window /// // Request for closing the window
/// if (event.Type == sf::Event::Closed) /// if (event.Type == sf::Event::Closed)

View File

@ -144,7 +144,7 @@ public :
/// ///
/// After calling this function, the sf::Window instance remains /// After calling this function, the sf::Window instance remains
/// valid and you can call Create() to recreate the window. /// valid and you can call Create() to recreate the window.
/// All other functions such as GetEvent() or Display() will /// All other functions such as PollEvent() or Display() will
/// still work (i.e. you don't have to test IsOpened() every time), /// still work (i.e. you don't have to test IsOpened() every time),
/// and will have no effect on closed windows. /// and will have no effect on closed windows.
/// ///
@ -206,12 +206,12 @@ public :
/// ///
/// This function is not blocking: if there's no pending event then /// This function is not blocking: if there's no pending event then
/// it will return false and leave \a event unmodified. /// it will return false and leave \a event unmodified.
/// Note that more than event may be present in the events stack, /// Note that more than one event may be present in the events stack,
/// thus you should always call this function in a loop /// thus you should always call this function in a loop
/// to make sure that you process every pending event. /// to make sure that you process every pending event.
/// \code /// \code
/// sf::Event event; /// sf::Event event;
/// while (window.GetEvent(event)) /// while (window.PollEvent(event))
/// { /// {
/// // process event... /// // process event...
/// } /// }
@ -224,7 +224,7 @@ public :
/// \see WaitEvent /// \see WaitEvent
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool GetEvent(Event& event); bool PollEvent(Event& event);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Wait for an event and return it /// \brief Wait for an event and return it
@ -248,7 +248,7 @@ public :
/// ///
/// \return False if any error occured /// \return False if any error occured
/// ///
/// \see GetEvent /// \see PollEvent
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool WaitEvent(Event& event); bool WaitEvent(Event& event);
@ -472,7 +472,7 @@ private :
/// \brief Processes an event before it is sent to the user /// \brief Processes an event before it is sent to the user
/// ///
/// This function is called every time an event is received /// This function is called every time an event is received
/// from the internal window (through GetEvent or WaitEvent). /// from the internal window (through PollEvent or WaitEvent).
/// It filters out unwanted events, and performs whatever internal /// It filters out unwanted events, and performs whatever internal
/// stuff the window needs before the event is returned to the /// stuff the window needs before the event is returned to the
/// user. /// user.
@ -524,9 +524,9 @@ private :
/// ///
/// The sf::Window class provides a simple interface for manipulating /// The sf::Window class provides a simple interface for manipulating
/// the window: move, resize, show/hide, control mouse cursor, etc. /// the window: move, resize, show/hide, control mouse cursor, etc.
/// It also provides event handling through its GetEvent() function, /// It also provides event handling through its PollEvent() and WaitEvent()
/// and real-time state handling with its attached sf::Input object /// functions, and real-time state handling with its attached sf::Input
/// (see GetInput()). /// object (see GetInput()).
/// ///
/// Note that OpenGL experts can pass their own parameters (antialiasing /// Note that OpenGL experts can pass their own parameters (antialiasing
/// level, bits for the depth and stencil buffers, etc.) to the /// level, bits for the depth and stencil buffers, etc.) to the
@ -547,7 +547,7 @@ private :
/// { /// {
/// // Event processing /// // Event processing
/// sf::Event event; /// sf::Event event;
/// while (window.GetEvent(event)) /// while (window.PollEvent(event))
/// { /// {
/// // Request for closing the window /// // Request for closing the window
/// if (event.Type == sf::Event::Closed) /// if (event.Type == sf::Event::Closed)

View File

@ -204,7 +204,7 @@ const ContextSettings& Window::GetSettings() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Window::GetEvent(Event& event) bool Window::PollEvent(Event& event)
{ {
if (myWindow && myWindow->PopEvent(event, false)) if (myWindow && myWindow->PopEvent(event, false))
{ {