Re: SDL-2.0.4 / SDL_WindowFrom / SDL_CreateRenderer() Hanging

"IshtarUK" <[email protected]>
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
Dear Capehill

I cannot thank you enough. 

I was assuming (a rather silly thing to do) that ::GetHandler() was returning a native XID. It wasn't. For the benefit of anybody else trying to embed SDL2 into wxWidgets here is my example code.


Code:

GtkWidget* widget = panel->GetHandle();
gtk_widget_realize(widget);
Window XID = GDK_WINDOW_XWINDOW(widget->window);

    SDL_Window *sdl_window = SDL_CreateWindowFrom((void*) XID);

    if (sdl_window == NULL)
    {
        std::cerr << SDL_GetError();
    }

    SDL_Renderer* r = SDL_CreateRenderer(sdl_window, -1, SDL_RENDERER_SOFTWARE);

    if (r == NULL)
    {
        std::cerr << SDL_GetError();
    }





And then, in a separate thread loop with the usual SDL_Renderer functions


Code:

 while (true)
    {
        SDL_RenderClear(r);
        SDL_SetRenderDrawColor(r, 255, 0, 255, 255);
        SDL_RenderPresent(r);
    }




Once again, thank you Capehill :)

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.