So I cobbled up an integration to wxWidgets from various internet sources, the end result is only partially successful and I'm at loss what's missing.
My custom class inherits sf::RenderWindow:
class foondabar : public wxWindow, public sf::RenderWindow
its constructor looks like this:
foondabar::foondabar(wxFrame* parent, wxString text) :
wxWindow(parent, wxID_ANY)
{
SetMinSize( wxSize(320, 240) );
#ifdef __WXGTK__
//on linux, so this part gets executed
gtk_widget_realize(m_wxwindow);
gtk_widget_set_double_buffered(m_wxwindow, false);
GdkWindow* Win = gtk_widget_get_window(m_wxwindow);
XFlush(GDK_WINDOW_XDISPLAY(Win));
sf::RenderWindow::create(GDK_WINDOW_XWINDOW(Win));
#else
// Tested under Windows XP only (should work with X11
// and other Windows versions - no idea about MacOS)
sf::RenderWindow::Create(GetHandle());
#endif
}
and finally, paint and render function:
void foondabar::render(wxDC& dc)
{
clear(sf::Color(0,0,0,2));
sf::RectangleShape sheip(sf::Vector2f(3000, 3000));
sheip.setFillColor(sf::Color(250, 250, 50));
sheip.setPosition(-1000,-1000);
draw(sheip);
// Let the derived class do its specific stuff
OnUpdate();
draw(sheip);
// Display on screen
display();
}
And the end result looks like this:
What is missing? Why isn't the whole area being drawn in, despite being cleared in the background colour?
I've tried all kinds of variations in the constructor, including this->create(GDK_WINDOW_XWINDOW(Win));, setting size and position and creating with video mode, and many many combinations of those; in the case of a video mode a separate window is created, which I don't want; otherwise it either doesn't show any canvas, just a blank window, or there's no visible difference to the screenshot above.