Skip to content

Commit

Permalink
[FIX] Fixed HelloWorldOgre and HelloWorldOgreAdvanced
Browse files Browse the repository at this point in the history
The window did not close when clicking on the [x] button of the window. Now it works
  • Loading branch information
LAGNEAU Romain committed Jan 10, 2025
1 parent f832dbc commit 6059bcf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/ar/include/visp3/ar/vpAROgre.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ class VISP_EXPORT vpAROgre : public Ogre::FrameListener,
mWindow->reposition(static_cast<int>(win_x), static_cast<int>(win_y));
}

virtual void windowClosed(Ogre::RenderWindow *rw);
virtual bool windowClosing(Ogre::RenderWindow *rw) VP_OVERRIDE;

virtual void windowClosed(Ogre::RenderWindow *rw) VP_OVERRIDE;

protected:
virtual void init(bool bufferedKeys = false, bool hidden = false);
Expand Down
16 changes: 16 additions & 0 deletions modules/ar/src/ogre-simulator/vpAROgre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ void vpAROgre::init(bool

// Register as a Window listener
OgreWindowEventUtilities::addWindowEventListener(mWindow, this);
OgreWindowEventUtilities::_addRenderWindow(mWindow);

#ifdef VISP_HAVE_OIS
// Initialise OIS
Expand Down Expand Up @@ -714,6 +715,21 @@ bool vpAROgre::customframeStarted(const Ogre::FrameEvent & /*evt*/)
*/
bool vpAROgre::customframeEnded(const Ogre::FrameEvent & /*evt*/) { return true; }

/**
* \brief Check if the window that is currently closing is the one attached to the object.
*
* \param[in] rw The RenderWindow that is closing.
* \return true It corresponds to the vpAROgre object.
* \return false It is another window that is closing.
*/
bool vpAROgre::windowClosing(Ogre::RenderWindow *rw)
{
if (rw == mWindow) {
keepOn = false;
}
return !keepOn;
}

/*!
Unattach OIS (Object-oriented Input System library) before window shutdown
Expand Down

0 comments on commit 6059bcf

Please sign in to comment.