Mes programmes OpenSource
Pour une offre professionnelle, consultez mon site http://www.execute.re.Kylix - Sources Borland Kylix (Linux)
Kylix 1 DirectX MD2 MD2T KCyber OpenGL DCal3D
DirectX Utilisation de l'API XWindow
Voici un exemple de programme Kylix qui utilise directement les API XWindow.
program DirectX; { Kylix project - Direct X(Window) implementation (C)2001 - By Paul TOTH <tothpaulfree.fr> http://tothpaul.free.fr } // from "Anatomy of the most basic XLib program" // http://www.tronche.com/gui/x/xlib_tutorial/2nd-program-anaotmy.html uses Xlib, // Every XLib program must include this Libc; // for Sleep() {$R *.res} var dpy:PDisplay; clBlack:integer; clWhite:integer; win:Window; gc:TGC; e:XEvent; begin dpy:=XOpenDisplay(nil); if dpy=nil then halt; // The only "colors" that X guarantees are black and white... clBlack:=XBlackPixel(dpy,XDefaultScreen(dpy)); clWhite:=XWhitePixel(dpy,XDefaultScreen(dpy)); // Create the window win:=XCreateSimpleWindow(dpy,XDefaultRootWindow(dpy),0,0,200,100,0,clBlack,clBlack); // We want to get MapNotify Events XSelectInput(dpy,win,StructureNotifyMask); // "Map" the windows (that is, make it appear on the screen) XMapWindow(dpy,win); // Create a "Graphics Context" gc:=XCreateGC(dpy,win,0,nil); // Tell the cG we draw the white color XSetForeground(dpy,gc,clWhite); // Wait for the MapNotify event repeat XNextEvent(dpy,@e); until e.XType=MapNotify; // Draw the line XDrawLine(dpy,win,gc,10,60,180,20); // Send the "DrawLine" request to the server XFlush(dpy); // Wait for 10 seconds Sleep(10); end. |
Résultat sous Mandrake 7.2 |