[Solved] 0.8.2 Crash with injectMousePosition and SFML2.0

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

Sark
Just popping in
Just popping in
Posts: 2
Joined: Tue Jul 23, 2013 00:50

[Solved] 0.8.2 Crash with injectMousePosition and SFML2.0

Postby Sark » Tue Jul 23, 2013 01:23

Code: Select all

22/07/2013 19:09:58 (Std)    ---- Version: 0.8.2 (Build: Jul 21 2013 Microsoft Windows MSVC++ 10.0 32 bit) ----
22/07/2013 19:09:58 (Std)    ---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module.  TextureTarget support enabled via FBO extension. ----
22/07/2013 19:09:58 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
22/07/2013 19:09:58 (Std)    ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
22/07/2013 19:09:58 (Std)    ---- Scripting module is: None ----


Like the title says I get a crash when using injectMousePosition with SFML2.0. I'm able to properly draw windows to the screen and I can manually set the Mouse position using getMouseCursor().setPosition. Here's the code just in case I'm missing something obvious:

Code: Select all

#include <CEGUI/RendererModules/OpenGL/GLRenderer.h>
#include <CEGUI/CEGUI.h>

#include <SFML/Graphics.hpp>

using namespace CEGUI;

int main( int argc, char ** argv )
{
   sf::RenderWindow window( sf::VideoMode(800, 600), "CEGUI Test" );

   OpenGLRenderer & renderer = OpenGLRenderer::bootstrapSystem();
   
   GUIContext & context = System::getSingleton().getDefaultGUIContext();
   
   DefaultResourceProvider * rp = static_cast<DefaultResourceProvider*>(
      System::getSingleton().getResourceProvider());
   rp->setResourceGroupDirectory("defRes", "../data/");
   rp->setDefaultResourceGroup("defRes");
      
   SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
   context.getMouseCursor().setDefaultImage("WindowsLook/MouseArrow");
    Font & defaultFont = CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-12.font");

   WindowManager & winMgr = WindowManager::getSingleton();
   DefaultWindow * root = (DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");

   context.setRootWindow( root );
   
    while (window.isOpen())
    {
        sf::Event evt;
        while (window.pollEvent(evt))
        {
            if (evt.type == sf::Event::Closed ||
             sf::Keyboard::isKeyPressed( sf::Keyboard::Escape ) )
                window.close();

         if( evt.type == sf::Event::MouseMoved )
            context.injectMousePosition( evt.mouseMove.x, evt.mouseMove.y );

        }

      window.clear();
      
      System::getSingleton().renderAllGUIContexts();

      window.display();
    }

   CEGUI::OpenGLRenderer::destroySystem();

   return 0;
}


Even this results in the same crash:

Code: Select all

   sf::RenderWindow window( sf::VideoMode(800, 600), "CEGUI Test" );
   OpenGLRenderer & renderer = OpenGLRenderer::bootstrapSystem();
   GUIContext & context = System::getSingleton().getDefaultGUIContext();
   
   context.injectMousePosition( 5, 5 );

   CEGUI::OpenGLRenderer::destroySystem();
   return 0;


I'm clueless about how to fix this so any help would be appreciated!
Last edited by Sark on Thu Jul 25, 2013 21:21, edited 1 time in total.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: 0.8.2 Crash with injectMousePosition and SFML2.0

Postby Kulik » Wed Jul 24, 2013 12:08

Please provide a backtrace.

Sark
Just popping in
Just popping in
Posts: 2
Joined: Tue Jul 23, 2013 00:50

Re: 0.8.2 Crash with injectMousePosition and SFML2.0

Postby Sark » Thu Jul 25, 2013 21:21

It was not a bug with CEGUI after all, I was dumb and was simply linking with an incorrect version of the library. It's working fine now, sorry to have wasted your time!


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 2 guests