SFML community forums

Help => General => Topic started by: krisando on April 15, 2011, 09:54:03 am

Title: wxWidgets and SFML2 Issues
Post by: krisando on April 15, 2011, 09:54:03 am
I'm trying to get the wrapper for a SFML control to draw on a window by wxWidgets, but there seems to be some issues with the implementation, I'm not sure if SFML works in a different way (read it should work) but still I am at a loss.

I have followed this guide: http://www.sfml-dev.org/tutorials/1.6/graphics-wxwidgets.php

Code: [Select]
//Errors: invalid conversion from 'void*' to 'HWND__*'|
sf::RenderWindow::Create(GetHandle());
//So I do a pointer cast
sf::RenderWindow::Create((HWND__*)GetHandle());


//Try run it again, I get this: ||warning: c:/mingw/.../libgdi32.a(Window.cpp.obj): local symbol `' has no section|

Libgdi seems to be the problem, but I don't have the faintest clue how to fix this issue.

Btw I'm using Windows currently, any help on this issue would be much appreciated.
Title: wxWidgets and SFML2 Issues
Post by: Laurent on April 15, 2011, 10:10:14 am
Quote
Try run it again, I get this: ||warning: c:/mingw/.../libgdi32.a(Window.cpp.obj): local symbol `' has no section|

This is just a warning, so what happens next?
Title: wxWidgets and SFML2 Issues
Post by: krisando on April 15, 2011, 10:30:32 am
Well nothing happens, was expecting the wxWidgets window to appear with the code provided by the tutorial.

It continuously says "It seems that this project has not been built yet. Do you want to build it now?".

The funny thing is, when I comment out some of the statements it compiles and runs, something about the code it doesn't like, and there's no mention of anything in the build log, other than that warning
Title: wxWidgets and SFML2 Issues
Post by: Laurent on April 15, 2011, 10:37:59 am
This is weird, maybe some configuration or libraries problem?

Is the SFML 1.6 wxWidgets sample working?
Title: wxWidgets and SFML2 Issues
Post by: krisando on April 15, 2011, 10:45:43 am
Quote from: "Laurent"
This is weird, maybe some configuration or libraries problem?

Is the SFML 1.6 wxWidgets sample working?

I just included the project into an empty wxWidgets project, only using the sample files. Same problem, it just can't seem to build properly. No messages apart from the warning.

Any chance it is this:
 ||warning: c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libgdi32.a(Window.cpp.obj): local symbol `' has no section|

Anybody which uses wxWidgets into their Codeblocks + GCC projects manage to it working?

--

Even if this were to work, there seems to be issues with the values passed to the constructor:
Code: [Select]

//Class constructor
    MyCanvas::MyCanvas(wxWindow*  Parent,
             wxWindowID Id,
             wxPoint&   Position,
             wxSize&    Size,
             long       Style = 0) :
    wxSFMLCanvas(Parent, Id, Position, Size, Style)
    {
        // Load an image and assign it to our sprite
        myImage.LoadFromFile("sprite.png");
        mySprite.SetImage(myImage);
    }

//Creation
new MyCanvas(this, wxID_ANY, wxPoint(50, 50), wxSize(700, 500));


The first two types are quite different to what it was expecting. =\
Title: wxWidgets and SFML2 Issues
Post by: krisando on June 10, 2011, 05:15:31 am
~Bump~

The example source is definitely broken with this version, I'm trying to get this working once again.

[Edit]
Oh nvm, I'll just use QT.
Title: wxWidgets and SFML2 Issues
Post by: Beliar on June 10, 2011, 09:04:29 am
What wxWidgets version where you using?
Title: wxWidgets and SFML2 Issues
Post by: krisando on June 24, 2011, 09:04:46 am
2.8 Strangely on another computer it worked, occasionally. Which is strange, most of the time it just opens and closes, bit unreliable.
Title: wxWidgets and SFML2 Issues
Post by: Beliar on June 24, 2011, 11:32:36 am
Hmm, then I don't know. I know that with 2.9 something changed with the handle or something - can't quite remember - so the code was not working any more.