Posts

Showing posts with the label SDL

Embedding SDL widget in GTK application

  Here's an updated version of Embedding SDL widget in GTK application using SDL2 and GTK 3.0. embed.c #include <stdio.h> #include <gtk/gtkx.h> #include <SDL.h> #include <stdbool.h> static SDL_Window *sdl_window; static SDL_Renderer *sdl_renderer; static GtkWindow *gtk_window; static GtkWidget *gtk_da; static void *gdk_window; static void *window_id; static gboolean idle(void *ud) {     if(!sdl_window) {         printf("creating SDL window for window id %p\n", window_id);         sdl_window = SDL_CreateWindowFrom(window_id);         printf("sdl_window=%p\n", sdl_window);         if(!sdl_window) {             printf("%s\n", SDL_GetError());         }         sdl_renderer = SDL_Creat...