Bonjour,
Je voudrais afficher une surface SDL dans une fenêtre GTK. Mon code est le suivant :
Je me base sur la solution proposée ici.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 procedure TfrmMain.FormCreate(Sender : TObject); var Screen: PSDL_Surface; Rect: PSDL_Rect; begin SDL_putenv(PChar('SDL_WINDOWID='+IntToStr(frmMain.Handle))); SDL_Init(SDL_INIT_VIDEO); Screen := SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE or SDL_DOUBLEBUF); Rect^.h := 50; Rect^.w := 50; Rect^.x := 50; Rect^.h := 50; SDL_FillRect(Screen, Rect, SDL_MapRGB(Screen^.format, 0, 255, 0)); end;
J'obtiens l'erreur suivante :
J'utilise Free Pascal 2.6.4.The program 'test02' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 53 error_code 3 request_code 3 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Partager