sdlgraph.pp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946
  1. {**************************************************************************
  2. Copyright : (c) 2007 Evgeniy Ivanov
  3. email : [email protected]
  4. http : Not yet
  5. ****************************************************************************/
  6. This file implements the sdl support for the graph unit
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. ****************************************************************************}
  13. {Important TODO list
  14. TODO: color conversion. from pascal color constant to color (pixel) from SDL_putpixel. At this moment you may gent another colors than you're waiting for. The worsest thing is it may be black on the black
  15. TODO: check all mode.HardwarePages and find true value for each mode!
  16. TODO: check initgraph(0,0,' ') and work with modes to set up best SDL mode.
  17. Maybe to hook internDetectGraph and detectGraph. I thing they are not needed for sdlgraph
  18. TODO: check VESA modes ModeNumber (if they needed)
  19. }
  20. { Programming Notes
  21. TODO: (it's a linux note, I haven't yet tested it on other systems) When SDL window is activated from the terminal readln does'n work!!! And when from KDE it autocloses without waiting readln input. I think that there must be a hook for readln while sdlgraph is active
  22. TODO: setcaption for the programme. There is no such procedure in Graph unit so we should add it or use setcaption with default (prograamme's name)
  23. TODO: to not forget about rgb_from_color's RGB values. Now they are just for testing!!!
  24. TODO: configure refresh (flip) time. SDL_AddTimer(100...: time interval must be the same as monitor vertical refresh.
  25. }
  26. unit sdlgraph;
  27. {$ifdef darwin}
  28. {$linkframework Cocoa}
  29. {$linklib SDLmain}
  30. {$linklib gcc}
  31. {$endif}
  32. interface
  33. //procedure sdlgraph_bar3D(x1, y1, x2, y2 : smallint;depth : word;top : boolean);
  34. {$i graphh.inc}
  35. const
  36. {==================================================================================================================================================
  37. Graphics Drivers Constants. Needed to support turbo pascale code TODO: is it needed???
  38. It's highly recommended to use Detect (0 constant) for grDriver and grmode: initGraph(0,0,' ') to allow SDL to configure app for the best perfomance
  39. ====================================================================================================================================================
  40. }
  41. //Detect =0; is in the graphh.inc
  42. CGA =1;
  43. MCGA =2;
  44. EGA =3;
  45. EGA64 =4;
  46. EGAMono =5;
  47. IBM8514 =6;
  48. //HercMono =7; is in the graphh.inc
  49. ATT400 =8;
  50. //VGA =9; is in graphh.inc
  51. PC3270 =10;
  52. {Graphics Modes for Each Driver}
  53. CGAC0 =0;
  54. CGAC =1;
  55. CGAC2 =2;
  56. CGAC3 =3;
  57. CGAHi =4;
  58. MCGAC0 =0;
  59. MCGAC =1;
  60. MCGAC2 =2;
  61. MCGAC3 =3;
  62. MCGAMed =4;
  63. MCGAHi =5;
  64. EGAMonoHi =3;
  65. //HercMonoHi =0; is in the graphh.inc
  66. //VGALo =0; is in the graphh.inc
  67. //VGAMed =1; is in the graphh.inc
  68. //VGAHi =2; is in the graphh.inc
  69. EGALo =0;
  70. EGAHi =1;
  71. EGA64Lo =0;
  72. EGA64Hi =1;
  73. ATT400C0 =0;
  74. ATT400C1 =1;
  75. ATT400C2 =2;
  76. ATT400C3 =3;
  77. ATT400CMed =4;
  78. ATT400Hi =5;
  79. IBM8514Lo =0;
  80. IBM8514Hi =1;
  81. PC3270Hi =0;
  82. { From *Go32* VESA Specific video modes. }
  83. m320x200x32k = $10D;
  84. m320x200x64k = $10E;
  85. m640x400x256 = $100;
  86. m640x480x256 = $101;
  87. m640x480x32k = $110;
  88. m640x480x64k = $111;
  89. m800x600x16 = $102;
  90. m800x600x256 = $103;
  91. m800x600x32k = $113;
  92. m800x600x64k = $114;
  93. m1024x768x16 = $104;
  94. m1024x768x256 = $105;
  95. m1024x768x32k = $116;
  96. m1024x768x64k = $117;
  97. m1280x1024x16 = $106;
  98. m1280x1024x256 = $107;
  99. m1280x1024x32k = $119;
  100. m1280x1024x64k = $11A;
  101. implementation
  102. uses {$ifdef unix}cthreads,{$endif}
  103. sdl,sdlutils,
  104. logger,
  105. SysUtils;
  106. const
  107. InternalDriverName = 'SDL';
  108. {$i graph.inc}
  109. var
  110. screen: PSDL_Surface; //Global becouse its value is needed by some functions
  111. procedure CloseGraph;
  112. begin
  113. If not isgraphmode then
  114. begin
  115. _graphresult := grnoinitgraph;
  116. exit;
  117. end;
  118. isgraphmode := false;
  119. SDL_Quit();
  120. //Halt(0); TODO: check, if it close application wich calls sdlgraph
  121. end;
  122. procedure Slock;
  123. begin
  124. if SDL_MUSTLOCK(screen) then
  125. if SDL_LockSurface(screen) < 0 then
  126. begin
  127. Log.LogError( Format( 'Cant lock screen: : %s', [SDL_GetError]), 'Slock' );
  128. CloseGraph;
  129. end;
  130. end;
  131. function timer_flip(flip_interval:Uint32; flip_callback_param:Pointer):Uint32;
  132. begin
  133. SDL_Flip(screen);
  134. timer_flip:=flip_interval;
  135. exit;
  136. end;
  137. {
  138. procedure Slock;
  139. begin
  140. if SDL_MUSTLOCK(screen) then
  141. if SDL_LockSurface(screen) < 0 then
  142. begin
  143. Log.LogError( Format( 'Cant lock screen: : %s', [SDL_GetError]), 'Slock' );
  144. CloseGraph;
  145. end;
  146. end;
  147. procedure Sulock; //Unlock and flip the surface
  148. begin
  149. if SDL_MUSTLOCK(screen) then
  150. SDL_UnlockSurface(screen);
  151. SDL_Flip(screen);
  152. end;
  153. }
  154. {PutPixel and GetPixel use SDL_* functions from sdlutils unit.}
  155. procedure sdlgraph_PutPixel(X,Y:smallint; color: Word);
  156. begin
  157. X:= X + StartXViewPort;
  158. Y:= Y + StartYViewPort;
  159. { convert to absolute coordinates and then verify clipping...}
  160. if ClipPixels then
  161. begin
  162. if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
  163. exit;
  164. if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
  165. exit;
  166. end;
  167. SDL_PutPixel(screen,x,y,255);
  168. exit;
  169. end;
  170. function sdlgraph_GetPixel(X,Y:smallint):Word;
  171. var
  172. temp:word;
  173. begin
  174. X:= X + StartXViewPort;
  175. Y:= Y + StartYViewPort;
  176. temp:=word(SDL_GetPixel(screen,x,y));
  177. sdlgraph_GetPixel:=temp;
  178. exit;
  179. end;
  180. procedure sdlgraph_DirectPutPixel(X,Y: smallint);
  181. var
  182. Color: word;
  183. begin
  184. case CurrentWriteMode of
  185. XORPut:
  186. begin
  187. { getpixel wants local/relative coordinates }
  188. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  189. Color := CurrentColor Xor Color;
  190. end;
  191. OrPut:
  192. begin
  193. { getpixel wants local/relative coordinates }
  194. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  195. Color := CurrentColor Or Color;
  196. end;
  197. AndPut:
  198. begin
  199. { getpixel wants local/relative coordinates }
  200. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  201. Color := CurrentColor And Color;
  202. end;
  203. NotPut:
  204. begin
  205. Color := (Not CurrentColor) and 15;
  206. end
  207. else
  208. Color := CurrentColor;
  209. end;
  210. sdlgraph_PutPixel(X,Y,Color);
  211. exit;
  212. end;
  213. {
  214. procedure nonBuf_DirectPutPixel(X,Y: smallint); // for HLine and other such hooks. It doesn't use buffering (SLock & Sulock routines).
  215. begin
  216. CurrentColor:=255;
  217. SDL_PutPixel(screen,x,y,CurrentColor);
  218. exit;
  219. end;
  220. procedure sdlgraph_HLine(x,x2,y: smallint);
  221. var
  222. temp:DefPixelProc;
  223. begin
  224. HLineDefault(x,x2,y);
  225. //SDL_DrawLine(screen,X,y,x2,y,255);
  226. end;
  227. procedure sdlgraph_VLine(x,y,y2:smallint);
  228. var
  229. temp:DefPixelProc;
  230. begin
  231. VLineDefault(x,y,y2);
  232. end;
  233. procedure sdlgraph_line(X1, Y1, X2, Y2: smallint);
  234. var
  235. temp:DefPixelProc;
  236. begin
  237. LineDefault(X1, Y1, X2, Y2);
  238. //SDL_DrawLine(screen,X1,y1,x2,y2,255);
  239. end;
  240. }
  241. {
  242. procedure nonBuf_HLine(x,x2,y: smallint);
  243. var
  244. temp:DefPixelProc;
  245. begin
  246. temp:=DirectPutPixel;
  247. DirectPutPixel:=@nonBuf_DirectPutPixel;
  248. HLineDefault(x,x2,y);
  249. DirectPutPixel:=temp;
  250. end;
  251. procedure nonBuf_VLine(x,y,y2:smallint);
  252. var
  253. temp:DefPixelProc;
  254. begin
  255. temp:=DirectPutPixel;
  256. DirectPutPixel:=@nonBuf_DirectPutPixel;
  257. VLineDefault(x,y,y2);
  258. DirectPutPixel:=temp;
  259. end;
  260. }
  261. {
  262. procedure nonBuf_line(X1, Y1, X2, Y2: smallint);
  263. var
  264. temp:DefPixelProc;
  265. begin
  266. temp:=DirectPutPixel;
  267. DirectPutPixel:=@nonBuf_DirectPutPixel;
  268. LineDefault(X1, Y1, X2, Y2);
  269. DirectPutPixel:=temp;
  270. end;
  271. }
  272. {
  273. procedure sdlgraph_InternalEllipse(X,Y: smallint;XRadius: word;
  274. YRadius:word; stAngle,EndAngle: word; pl: PatternLineProc);
  275. var
  276. temp:PutPixelProc;
  277. begin
  278. InternalEllipseDefault(X,Y,XRadius,YRadius,stAngle,EndAngle,pl);
  279. end;
  280. }
  281. procedure InitSDLgraph(Width,Height,BPP:Integer);
  282. var
  283. videoflags : Uint32;
  284. videoInfo : PSDL_VideoInfo;
  285. flip_callback_param:Pointer;
  286. flip_timer_id:PSDL_TimerID;
  287. begin
  288. if ( SDL_Init( SDL_INIT_TIMER or SDL_INIT_VIDEO ) < 0 ) then
  289. begin
  290. Log.LogError( Format( 'Could not initialize SDL : %s', [SDL_GetError] ), 'InitSDLgraph' );
  291. exit;
  292. end;
  293. // Fetch the video info
  294. videoInfo := SDL_GetVideoInfo;
  295. if ( videoInfo = nil ) then
  296. begin
  297. Log.LogError( Format( 'Video query failed : %s', [SDL_GetError] ), 'InitSDLgraph' );
  298. CloseGraph;
  299. exit;
  300. end;
  301. // the flags to pass to SDL_SetVideoMode
  302. videoFlags := SDL_DOUBLEBUF; // Enable double buffering
  303. videoFlags := videoFlags or SDL_HWPALETTE; // Store the palette in hardware
  304. // This checks to see if surfaces can be stored in memory
  305. if videoInfo^.hw_available <> 0 then
  306. videoFlags := videoFlags or SDL_HWSURFACE
  307. else
  308. videoFlags := videoFlags or SDL_SWSURFACE;
  309. // This checks if hardware blits can be done * /
  310. if videoInfo^.blit_hw <> 0 then
  311. videoFlags := videoFlags or SDL_HWACCEL;
  312. videoflags := videoFlags or SDL_RESIZABLE; // Enable window resizing TODO: Do we want to have it in graph module?
  313. if (SDL_VideoModeOK(Width,Height,BPP,videoFlags) = 0) then
  314. begin
  315. //TODO: create 1 string from parametres!
  316. //Log.LogError('InitSDLgraph: ',Width,'x',Height,'x',BPP,' - no such mode (also you may check videoflags in the sdlgraph unit (procedure InitSDLgraph)');
  317. exit;
  318. end;
  319. screen := SDL_SetVideoMode(Width, Height, BPP, SDL_SWSURFACE ); // TODO: use videoflags but not SDL_SWSURFACE!
  320. //It doesn't work yet!
  321. {if ( surface = nil ) then
  322. begin
  323. Log.LogError( Format( 'Unable to SetVideMode : %s', [SDL_GetError]), 'InitSDLgraph' );
  324. InitSDLgraph:=false;
  325. exit;
  326. CloseGraph;
  327. end;}
  328. flip_timer_id := SDL_AddTimer(100,TSDL_NewTimerCallback( @timer_flip ), nil ); //TODO: time interval must be the same as monitor vertical refresh
  329. end;
  330. procedure sdlgraph_Init1280x1024x64k;
  331. begin
  332. InitSDLgraph(1280,1024,16);
  333. end;
  334. procedure sdlgraph_Init1280x1024x32k;
  335. begin
  336. InitSDLgraph(1280,1024,15); //TODO: maybe to set 16 bit??? It's about all 15bpp modes.
  337. end;
  338. procedure sdlgraph_Init1280x1024x256;
  339. begin
  340. InitSDLgraph(1280,1024,8);
  341. end;
  342. procedure sdlgraph_Init1280x1024x16;
  343. begin
  344. InitSDLgraph(1280,1024,4);
  345. end;
  346. procedure sdlgraph_Init1024x768x64k;
  347. begin
  348. InitSDLgraph(1024,768,16);
  349. end;
  350. procedure sdlgraph_Init640x480x32k;
  351. begin
  352. InitSDLgraph(640,480,15);
  353. end;
  354. procedure sdlgraph_Init1024x768x256;
  355. begin
  356. InitSDLgraph(1024,768,8);
  357. end;
  358. procedure sdlgraph_Init1024x768x16;
  359. begin
  360. InitSDLgraph(1024,768,4);
  361. end;
  362. procedure sdlgraph_Init800x600x64k;
  363. begin
  364. InitSDLgraph(800,600,16);
  365. end;
  366. procedure sdlgraph_Init800x600x32k;
  367. begin
  368. InitSDLgraph(800,600,15);
  369. end;
  370. procedure sdlgraph_Init800x600x256;
  371. begin
  372. InitSDLgraph(800,600,8);
  373. end;
  374. procedure sdlgraph_Init800x600x16;
  375. begin
  376. InitSDLgraph(800,600,4);
  377. end;
  378. procedure sdlgraph_Init640x480x64k;
  379. begin
  380. InitSDLgraph(640,480,16);
  381. end;
  382. procedure sdlgraph_Init1024x768x32k;
  383. begin
  384. InitSDLgraph(1024,768,15);
  385. end;
  386. procedure sdlgraph_Init640x480x256;
  387. begin
  388. InitSDLgraph(640,480,8);
  389. end;
  390. procedure sdlgraph_Init640x400x256;
  391. begin
  392. InitSDLgraph(640,400,8);
  393. end;
  394. procedure sdlgraph_Init320x200x64k;
  395. begin
  396. InitSDLgraph(320,200,16);
  397. end;
  398. procedure sdlgraph_Init320x200x32k;
  399. begin
  400. InitSDLgraph(320,200,15);
  401. end;
  402. procedure sdlgraph_Init640x480x16;
  403. begin
  404. InitSDLgraph(640,480,4);
  405. end;
  406. procedure sdlgraph_Init640x350x16;
  407. begin
  408. InitSDLgraph(640,350,4);
  409. end;
  410. procedure sdlgraph_Init640x200x16;
  411. begin
  412. InitSDLgraph(640,200,4);
  413. end;
  414. procedure sdlgraph_InitModeX;
  415. begin
  416. InitSDLgraph(320,200,8);
  417. end;
  418. procedure sdlgraph_Init320;
  419. begin
  420. InitSDLgraph(320,200,8);
  421. end;
  422. //TODO Check what does it do and if it is needed
  423. //BEGIN TODO
  424. procedure savestate;
  425. begin
  426. end;
  427. procedure restorestate;
  428. begin
  429. end;
  430. procedure sdlgraph_SetRGBpalette(ColorNum, RedValue, GreenValue, BlueValue: smallint);
  431. begin
  432. end;
  433. procedure sdlgraph_GetRGBpalette(ColorNum: smallint; var RedValue, GreenValue, BlueValue: smallint);
  434. begin
  435. end;
  436. //END TODO
  437. function QueryAdapterInfo:PModeInfo;
  438. var
  439. mode: TModeInfo;
  440. procedure setupSDLgraphDefaults;
  441. begin
  442. mode.DirectPutPixel:={$ifdef fpc}@{$endif}sdlgraph_DirectPutPixel;
  443. mode.PutPixel:={$ifdef fpc}@{$endif}sdlgraph_PutPixel;
  444. mode.GetPixel:={$ifdef fpc}@{$endif}sdlgraph_GetPixel;
  445. mode.SetRGBPalette := {$ifdef fpc}@{$endif}sdlgraph_SetRGBpalette;
  446. mode.GetRGBPalette := {$ifdef fpc}@{$endif}sdlgraph_GetRGBpalette;
  447. //mode.InternalEllipse := {$ifdef fpc}@{$endif}sdlgraph_InternalEllipse;
  448. mode.XAspect := 10000;
  449. mode.YAspect := 10000;
  450. //mode.HLine:={$ifdef fpc}@{$endif}sdlgraph_HLine;
  451. //mode.VLine:={$ifdef fpc}@{$endif}sdlgraph_VLine;
  452. //mode.Line:={$ifdef fpc}@{$endif}sdlgraph_line;
  453. end;
  454. begin
  455. QueryAdapterInfo := ModeList;
  456. { If the mode listing already exists... }
  457. { simply return it, without changing }
  458. { anything... }
  459. if assigned(ModeList) then
  460. exit;
  461. SaveVideoState:={$ifdef fpc}@{$endif}savestate;
  462. RestoreVideoState:={$ifdef fpc}@{$endif}restorestate;
  463. // =======================================================MODES FROM *GO32*=====================================================================
  464. // ==============================================================================================================================================
  465. InitMode(mode);
  466. { now add all standard VGA modes... }
  467. mode.DriverNumber:= LowRes;
  468. mode.HardwarePages:= 0;
  469. mode.ModeNumber:=0;
  470. mode.ModeName:='320 x 200 VGA';
  471. mode.MaxColor := 256;
  472. mode.PaletteSize := mode.MaxColor;
  473. mode.DirectColor := FALSE;
  474. mode.MaxX := 319;
  475. mode.MaxY := 199;
  476. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init320;
  477. setupSDLgraphDefaults;
  478. AddMode(mode);
  479. { now add all standard VGA modes... }
  480. InitMode(mode);
  481. mode.DriverNumber:= LowRes;
  482. mode.ModeNumber:=1;
  483. mode.HardwarePages := 3; { 0..3 }
  484. mode.ModeName:='320 x 200 ModeX';
  485. mode.MaxColor := 256;
  486. mode.DirectColor := FALSE;
  487. mode.PaletteSize := mode.MaxColor;
  488. mode.MaxX := 319;
  489. mode.MaxY := 199;
  490. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_InitModeX;
  491. setupSDLgraphDefaults;
  492. AddMode(mode);
  493. InitMode(mode);
  494. mode.ModeNumber:=VGALo;
  495. mode.DriverNumber := VGA;
  496. mode.ModeName:='640 x 200 VGA';
  497. mode.MaxColor := 16;
  498. mode.HardwarePages := 2;
  499. mode.DirectColor := FALSE;
  500. mode.PaletteSize := mode.MaxColor;
  501. mode.MaxX := 639;
  502. mode.MaxY := 199;
  503. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x200x16;
  504. setupSDLgraphDefaults;
  505. AddMode(mode);
  506. InitMode(mode);
  507. mode.ModeNumber:=VGAMed;
  508. mode.DriverNumber := VGA;
  509. mode.ModeName:='640 x 350 VGA';
  510. mode.HardwarePages := 1;
  511. mode.MaxColor := 16;
  512. mode.DirectColor := FALSE;
  513. mode.PaletteSize := mode.MaxColor;
  514. mode.MaxX := 639;
  515. mode.MaxY := 349;
  516. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x350x16;
  517. setupSDLgraphDefaults;
  518. AddMode(mode);
  519. InitMode(mode);
  520. mode.ModeNumber:=VGAHi;
  521. mode.DriverNumber := VGA;
  522. mode.HardwarePages := 0;
  523. mode.ModeName:='640 x 480 VGA';
  524. mode.MaxColor := 16;
  525. mode.DirectColor := FALSE;
  526. mode.PaletteSize := mode.MaxColor;
  527. mode.MaxX := 639;
  528. mode.MaxY := 479;
  529. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x480x16;
  530. setupSDLgraphDefaults;
  531. AddMode(mode);
  532. InitMode(mode);
  533. mode.ModeNumber:=m320x200x32k;
  534. mode.DriverNumber := VESA;
  535. mode.ModeName:='320 x 200 VESA';
  536. mode.MaxColor := 32768;
  537. mode.PaletteSize := mode.MaxColor;
  538. mode.DirectColor := TRUE;
  539. mode.MaxX := 319;
  540. mode.MaxY := 199;
  541. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init320x200x32k;
  542. setupSDLgraphDefaults;
  543. AddMode(mode);
  544. InitMode(mode);
  545. mode.ModeNumber:=m320x200x64k;
  546. mode.DriverNumber := VESA;
  547. mode.ModeName:='320 x 200 VESA';
  548. mode.MaxColor := 65536;
  549. mode.HardwarePages := 2;
  550. mode.PaletteSize := mode.MaxColor;
  551. mode.DirectColor := TRUE;
  552. mode.MaxX := 319;
  553. mode.MaxY := 199;
  554. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init320x200x64k;
  555. setupSDLgraphDefaults;
  556. AddMode(mode);
  557. InitMode(mode);
  558. mode.ModeNumber:=m640x400x256;
  559. mode.DriverNumber := VESA;
  560. mode.ModeName:='640 x 400 VESA';
  561. mode.MaxColor := 256;
  562. mode.HardwarePages := 2;
  563. mode.PaletteSize := mode.MaxColor;
  564. mode.DirectColor := FALSE;
  565. mode.MaxX := 639;
  566. mode.MaxY := 399;
  567. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x400x256;
  568. setupSDLgraphDefaults;
  569. AddMode(mode);
  570. InitMode(mode);
  571. mode.ModeNumber:=m640x480x256;
  572. mode.DriverNumber := VESA;
  573. mode.ModeName:='640 x 480 VESA';
  574. mode.MaxColor := 256;
  575. mode.HardwarePages := 2;
  576. mode.PaletteSize := mode.MaxColor;
  577. mode.MaxX := 639;
  578. mode.MaxY := 479;
  579. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x480x256;
  580. setupSDLgraphDefaults;
  581. AddMode(mode);
  582. InitMode(mode);
  583. mode.ModeNumber:=m640x480x32k;
  584. mode.DriverNumber := VESA;
  585. mode.ModeName:='640 x 480 VESA';
  586. mode.MaxColor := 32768;
  587. mode.HardwarePages := 2;
  588. mode.PaletteSize := mode.MaxColor;
  589. mode.DirectColor := TRUE;
  590. mode.MaxX := 639;
  591. mode.MaxY := 479;
  592. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x480x32k;
  593. setupSDLgraphDefaults;
  594. AddMode(mode);
  595. InitMode(mode);
  596. mode.ModeNumber:=m640x480x64k;
  597. mode.DriverNumber := VESA;
  598. mode.ModeName:='640 x 480 VESA';
  599. mode.MaxColor := 65536;
  600. mode.HardwarePages := 2;
  601. mode.PaletteSize := mode.MaxColor;
  602. mode.DirectColor := TRUE;
  603. mode.MaxX := 639;
  604. mode.MaxY := 479;
  605. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x480x64k;
  606. setupSDLgraphDefaults;
  607. AddMode(mode);
  608. InitMode(mode);
  609. mode.ModeNumber:=m800x600x16;
  610. mode.DriverNumber := VESA;
  611. mode.ModeName:='800 x 600 VESA';
  612. mode.MaxColor := 16;
  613. mode.HardwarePages := 2;
  614. mode.DirectColor := FALSE;
  615. mode.PaletteSize := mode.MaxColor;
  616. mode.MaxX := 799;
  617. mode.MaxY := 599;
  618. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init800x600x16;
  619. setupSDLgraphDefaults;
  620. AddMode(mode);
  621. InitMode(mode);
  622. mode.ModeNumber:=m800x600x256;
  623. mode.DriverNumber := VESA;
  624. mode.ModeName:='800 x 600 VESA';
  625. mode.MaxColor := 256;
  626. mode.HardwarePages := 2;
  627. mode.PaletteSize := mode.MaxColor;
  628. mode.DirectColor := FALSE;
  629. mode.MaxX := 799;
  630. mode.MaxY := 599;
  631. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init800x600x256;
  632. setupSDLgraphDefaults;
  633. AddMode(mode);
  634. InitMode(mode);
  635. mode.ModeNumber:=m800x600x32k;
  636. mode.DriverNumber := VESA;
  637. mode.ModeName:='800 x 600 VESA';
  638. mode.MaxColor := 32768;
  639. mode.HardwarePages := 2;
  640. mode.PaletteSize := mode.MaxColor;
  641. mode.DirectColor := TRUE;
  642. mode.MaxX := 799;
  643. mode.MaxY := 599;
  644. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init800x600x32k;
  645. setupSDLgraphDefaults;
  646. AddMode(mode);
  647. InitMode(mode);
  648. mode.ModeNumber:=m800x600x64k;
  649. mode.DriverNumber := VESA;
  650. mode.ModeName:='800 x 600 VESA';
  651. mode.MaxColor := 65536;
  652. mode.HardwarePages := 2;
  653. mode.PaletteSize := mode.MaxColor;
  654. mode.DirectColor := TRUE;
  655. mode.MaxX := 799;
  656. mode.MaxY := 599;
  657. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init800x600x64k;
  658. setupSDLgraphDefaults;
  659. AddMode(mode);
  660. InitMode(mode);
  661. mode.ModeNumber:=m1024x768x16;
  662. mode.DriverNumber := VESA;
  663. mode.ModeName:='1024 x 768 VESA';
  664. mode.MaxColor := 16;
  665. mode.HardwarePages := 2;
  666. mode.PaletteSize := mode.MaxColor;
  667. mode.DirectColor := FALSE;
  668. mode.MaxX := 1023;
  669. mode.MaxY := 767;
  670. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1024x768x16;
  671. setupSDLgraphDefaults;
  672. AddMode(mode);
  673. InitMode(mode);
  674. mode.ModeNumber:=m1024x768x256;
  675. mode.DriverNumber := VESA;
  676. mode.ModeName:='1024 x 768 VESA';
  677. mode.MaxColor := 256;
  678. mode.HardwarePages := 2;
  679. mode.PaletteSize := mode.MaxColor;
  680. mode.DirectColor := FALSE;
  681. mode.MaxX := 1023;
  682. mode.MaxY := 767;
  683. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1024x768x256;
  684. setupSDLgraphDefaults;
  685. AddMode(mode);
  686. InitMode(mode);
  687. mode.ModeNumber:=m1024x768x32k;
  688. mode.DriverNumber := VESA;
  689. mode.ModeName:='1024 x 768 VESA';
  690. mode.MaxColor := 32768;
  691. mode.HardwarePages := 2;
  692. mode.PaletteSize := mode.MaxColor;
  693. mode.DirectColor := TRUE;
  694. mode.MaxX := 1023;
  695. mode.MaxY := 767;
  696. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1024x768x32k;
  697. setupSDLgraphDefaults;
  698. AddMode(mode);
  699. InitMode(mode);
  700. mode.ModeNumber:=m1024x768x64k;
  701. mode.DriverNumber := VESA;
  702. mode.ModeName:='1024 x 768 VESA';
  703. mode.MaxColor := 65536;
  704. mode.DirectColor := TRUE;
  705. mode.HardwarePages := 2;
  706. mode.PaletteSize := mode.MaxColor;
  707. mode.MaxX := 1023;
  708. mode.MaxY := 767;
  709. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1024x768x64k;
  710. setupSDLgraphDefaults;
  711. AddMode(mode);
  712. InitMode(mode);
  713. mode.ModeNumber:=m1280x1024x16;
  714. mode.DriverNumber := VESA;
  715. mode.ModeName:='1280 x 1024 VESA';
  716. mode.MaxColor := 16;
  717. mode.HardwarePages := 2;
  718. mode.DirectColor := FALSE;
  719. mode.PaletteSize := mode.MaxColor;
  720. mode.MaxX := 1279;
  721. mode.MaxY := 1023;
  722. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1280x1024x16;
  723. setupSDLgraphDefaults;
  724. AddMode(mode);
  725. InitMode(mode);
  726. mode.ModeNumber:=m1280x1024x256;
  727. mode.DriverNumber := VESA;
  728. mode.ModeName:='1280 x 1024 VESA';
  729. mode.MaxColor := 256;
  730. mode.HardwarePages := 2;
  731. mode.DirectColor := FALSE;
  732. mode.PaletteSize := mode.MaxColor;
  733. mode.MaxX := 1279;
  734. mode.MaxY := 1023;
  735. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1280x1024x256;
  736. setupSDLgraphDefaults;
  737. AddMode(mode);
  738. InitMode(mode);
  739. mode.ModeNumber:=m1280x1024x32k;
  740. mode.DriverNumber := VESA;
  741. mode.ModeName:='1280 x 1024 VESA';
  742. mode.MaxColor := 32768;
  743. mode.HardwarePages := 2;
  744. mode.DirectColor := TRUE;
  745. mode.PaletteSize := mode.MaxColor;
  746. mode.MaxX := 1279;
  747. mode.MaxY := 1023;
  748. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1280x1024x32k;
  749. setupSDLgraphDefaults;
  750. AddMode(mode);
  751. InitMode(mode);
  752. mode.ModeNumber:=m1280x1024x64k;
  753. mode.DriverNumber := VESA;
  754. mode.ModeName:='1280 x 1024 VESA';
  755. mode.MaxColor := 65536;
  756. mode.HardwarePages := 2;
  757. mode.DirectColor := TRUE;
  758. mode.PaletteSize := mode.MaxColor;
  759. mode.MaxX := 1279;
  760. mode.MaxY := 1023;
  761. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1280x1024x64k;
  762. setupSDLgraphDefaults;
  763. AddMode(mode);
  764. end;
  765. begin
  766. InitializeGraph;
  767. end.