sdlgraph.pp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  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. {$define sdlgraph}
  109. {$i graph.inc}
  110. var
  111. screen: PSDL_Surface; //Global becouse its value is needed by some functions
  112. procedure CloseGraph;
  113. begin
  114. If not isgraphmode then
  115. begin
  116. _graphresult := grnoinitgraph;
  117. exit;
  118. end;
  119. isgraphmode := false;
  120. SDL_Quit();
  121. //Halt(0); TODO: check, if it close application wich calls sdlgraph
  122. end;
  123. procedure Slock;
  124. begin
  125. if SDL_MUSTLOCK(screen) then
  126. if SDL_LockSurface(screen) < 0 then
  127. begin
  128. Log.LogError( Format( 'Cant lock screen: : %s', [SDL_GetError]), 'Slock' );
  129. CloseGraph;
  130. end;
  131. end;
  132. function timer_flip(flip_interval:Uint32; flip_callback_param:Pointer):Uint32;
  133. begin
  134. SDL_Flip(screen);
  135. timer_flip:=flip_interval;
  136. exit;
  137. end;
  138. {
  139. procedure Slock;
  140. begin
  141. if SDL_MUSTLOCK(screen) then
  142. if SDL_LockSurface(screen) < 0 then
  143. begin
  144. Log.LogError( Format( 'Cant lock screen: : %s', [SDL_GetError]), 'Slock' );
  145. CloseGraph;
  146. end;
  147. end;
  148. procedure Sulock; //Unlock and flip the surface
  149. begin
  150. if SDL_MUSTLOCK(screen) then
  151. SDL_UnlockSurface(screen);
  152. SDL_Flip(screen);
  153. end;
  154. }
  155. {PutPixel and GetPixel use SDL_* functions from sdlutils unit.}
  156. procedure sdlgraph_PutPixel(X,Y:smallint; color: Word);
  157. begin
  158. X:= X + StartXViewPort;
  159. Y:= Y + StartYViewPort;
  160. { convert to absolute coordinates and then verify clipping...}
  161. if ClipPixels then
  162. begin
  163. if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
  164. exit;
  165. if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
  166. exit;
  167. end;
  168. SDL_PutPixel(screen,x,y,255);
  169. exit;
  170. end;
  171. function sdlgraph_GetPixel(X,Y:smallint):Word;
  172. var
  173. temp:word;
  174. begin
  175. X:= X + StartXViewPort;
  176. Y:= Y + StartYViewPort;
  177. temp:=word(SDL_GetPixel(screen,x,y));
  178. sdlgraph_GetPixel:=temp;
  179. exit;
  180. end;
  181. procedure sdlgraph_DirectPutPixel(X,Y: smallint);
  182. var
  183. Color: word;
  184. begin
  185. case CurrentWriteMode of
  186. XORPut:
  187. begin
  188. { getpixel wants local/relative coordinates }
  189. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  190. Color := CurrentColor Xor Color;
  191. end;
  192. OrPut:
  193. begin
  194. { getpixel wants local/relative coordinates }
  195. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  196. Color := CurrentColor Or Color;
  197. end;
  198. AndPut:
  199. begin
  200. { getpixel wants local/relative coordinates }
  201. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  202. Color := CurrentColor And Color;
  203. end;
  204. NotPut:
  205. begin
  206. Color := (Not CurrentColor) and 15;
  207. end
  208. else
  209. Color := CurrentColor;
  210. end;
  211. sdlgraph_PutPixel(X,Y,Color);
  212. exit;
  213. end;
  214. {
  215. procedure nonBuf_DirectPutPixel(X,Y: smallint); // for HLine and other such hooks. It doesn't use buffering (SLock & Sulock routines).
  216. begin
  217. CurrentColor:=255;
  218. SDL_PutPixel(screen,x,y,CurrentColor);
  219. exit;
  220. end;
  221. procedure sdlgraph_HLine(x,x2,y: smallint);
  222. var
  223. temp:DefPixelProc;
  224. begin
  225. HLineDefault(x,x2,y);
  226. //SDL_DrawLine(screen,X,y,x2,y,255);
  227. end;
  228. procedure sdlgraph_VLine(x,y,y2:smallint);
  229. var
  230. temp:DefPixelProc;
  231. begin
  232. VLineDefault(x,y,y2);
  233. end;
  234. procedure sdlgraph_line(X1, Y1, X2, Y2: smallint);
  235. var
  236. temp:DefPixelProc;
  237. begin
  238. LineDefault(X1, Y1, X2, Y2);
  239. //SDL_DrawLine(screen,X1,y1,x2,y2,255);
  240. end;
  241. }
  242. {
  243. procedure nonBuf_HLine(x,x2,y: smallint);
  244. var
  245. temp:DefPixelProc;
  246. begin
  247. temp:=DirectPutPixel;
  248. DirectPutPixel:=@nonBuf_DirectPutPixel;
  249. HLineDefault(x,x2,y);
  250. DirectPutPixel:=temp;
  251. end;
  252. procedure nonBuf_VLine(x,y,y2:smallint);
  253. var
  254. temp:DefPixelProc;
  255. begin
  256. temp:=DirectPutPixel;
  257. DirectPutPixel:=@nonBuf_DirectPutPixel;
  258. VLineDefault(x,y,y2);
  259. DirectPutPixel:=temp;
  260. end;
  261. }
  262. {
  263. procedure nonBuf_line(X1, Y1, X2, Y2: smallint);
  264. var
  265. temp:DefPixelProc;
  266. begin
  267. temp:=DirectPutPixel;
  268. DirectPutPixel:=@nonBuf_DirectPutPixel;
  269. LineDefault(X1, Y1, X2, Y2);
  270. DirectPutPixel:=temp;
  271. end;
  272. }
  273. {
  274. procedure sdlgraph_InternalEllipse(X,Y: smallint;XRadius: word;
  275. YRadius:word; stAngle,EndAngle: word; pl: PatternLineProc);
  276. var
  277. temp:PutPixelProc;
  278. begin
  279. InternalEllipseDefault(X,Y,XRadius,YRadius,stAngle,EndAngle,pl);
  280. end;
  281. }
  282. procedure InitSDLgraph(Width,Height,BPP:Integer);
  283. var
  284. videoflags : Uint32;
  285. videoInfo : PSDL_VideoInfo;
  286. flip_callback_param:Pointer;
  287. flip_timer_id:PSDL_TimerID;
  288. begin
  289. if ( SDL_Init( SDL_INIT_TIMER or SDL_INIT_VIDEO ) < 0 ) then
  290. begin
  291. Log.LogError( Format( 'Could not initialize SDL : %s', [SDL_GetError] ), 'InitSDLgraph' );
  292. exit;
  293. end;
  294. // Fetch the video info
  295. videoInfo := SDL_GetVideoInfo;
  296. if ( videoInfo = nil ) then
  297. begin
  298. Log.LogError( Format( 'Video query failed : %s', [SDL_GetError] ), 'InitSDLgraph' );
  299. CloseGraph;
  300. exit;
  301. end;
  302. // the flags to pass to SDL_SetVideoMode
  303. videoFlags := SDL_DOUBLEBUF; // Enable double buffering
  304. videoFlags := videoFlags or SDL_HWPALETTE; // Store the palette in hardware
  305. // This checks to see if surfaces can be stored in memory
  306. if videoInfo^.hw_available <> 0 then
  307. videoFlags := videoFlags or SDL_HWSURFACE
  308. else
  309. videoFlags := videoFlags or SDL_SWSURFACE;
  310. // This checks if hardware blits can be done * /
  311. if videoInfo^.blit_hw <> 0 then
  312. videoFlags := videoFlags or SDL_HWACCEL;
  313. videoflags := videoFlags or SDL_RESIZABLE; // Enable window resizing TODO: Do we want to have it in graph module?
  314. if (SDL_VideoModeOK(Width,Height,BPP,videoFlags) = 0) then
  315. begin
  316. //TODO: create 1 string from parametres!
  317. //Log.LogError('InitSDLgraph: ',Width,'x',Height,'x',BPP,' - no such mode (also you may check videoflags in the sdlgraph unit (procedure InitSDLgraph)');
  318. exit;
  319. end;
  320. screen := SDL_SetVideoMode(Width, Height, BPP, SDL_SWSURFACE ); // TODO: use videoflags but not SDL_SWSURFACE!
  321. //It doesn't work yet!
  322. {if ( surface = nil ) then
  323. begin
  324. Log.LogError( Format( 'Unable to SetVideMode : %s', [SDL_GetError]), 'InitSDLgraph' );
  325. InitSDLgraph:=false;
  326. exit;
  327. CloseGraph;
  328. end;}
  329. flip_timer_id := SDL_AddTimer(100,TSDL_NewTimerCallback( @timer_flip ), nil ); //TODO: time interval must be the same as monitor vertical refresh
  330. end;
  331. procedure sdlgraph_Init1280x1024x64k;
  332. begin
  333. InitSDLgraph(1280,1024,16);
  334. end;
  335. procedure sdlgraph_Init1280x1024x32k;
  336. begin
  337. InitSDLgraph(1280,1024,15); //TODO: maybe to set 16 bit??? It's about all 15bpp modes.
  338. end;
  339. procedure sdlgraph_Init1280x1024x256;
  340. begin
  341. InitSDLgraph(1280,1024,8);
  342. end;
  343. procedure sdlgraph_Init1280x1024x16;
  344. begin
  345. InitSDLgraph(1280,1024,4);
  346. end;
  347. procedure sdlgraph_Init1024x768x64k;
  348. begin
  349. InitSDLgraph(1024,768,16);
  350. end;
  351. procedure sdlgraph_Init640x480x32k;
  352. begin
  353. InitSDLgraph(640,480,15);
  354. end;
  355. procedure sdlgraph_Init1024x768x256;
  356. begin
  357. InitSDLgraph(1024,768,8);
  358. end;
  359. procedure sdlgraph_Init1024x768x16;
  360. begin
  361. InitSDLgraph(1024,768,4);
  362. end;
  363. procedure sdlgraph_Init800x600x64k;
  364. begin
  365. InitSDLgraph(800,600,16);
  366. end;
  367. procedure sdlgraph_Init800x600x32k;
  368. begin
  369. InitSDLgraph(800,600,15);
  370. end;
  371. procedure sdlgraph_Init800x600x256;
  372. begin
  373. InitSDLgraph(800,600,8);
  374. end;
  375. procedure sdlgraph_Init800x600x16;
  376. begin
  377. InitSDLgraph(800,600,4);
  378. end;
  379. procedure sdlgraph_Init640x480x64k;
  380. begin
  381. InitSDLgraph(640,480,16);
  382. end;
  383. procedure sdlgraph_Init1024x768x32k;
  384. begin
  385. InitSDLgraph(1024,768,15);
  386. end;
  387. procedure sdlgraph_Init640x480x256;
  388. begin
  389. InitSDLgraph(640,480,8);
  390. end;
  391. procedure sdlgraph_Init640x400x256;
  392. begin
  393. InitSDLgraph(640,400,8);
  394. end;
  395. procedure sdlgraph_Init320x200x64k;
  396. begin
  397. InitSDLgraph(320,200,16);
  398. end;
  399. procedure sdlgraph_Init320x200x32k;
  400. begin
  401. InitSDLgraph(320,200,15);
  402. end;
  403. procedure sdlgraph_Init640x480x16;
  404. begin
  405. InitSDLgraph(640,480,4);
  406. end;
  407. procedure sdlgraph_Init640x350x16;
  408. begin
  409. InitSDLgraph(640,350,4);
  410. end;
  411. procedure sdlgraph_Init640x200x16;
  412. begin
  413. InitSDLgraph(640,200,4);
  414. end;
  415. procedure sdlgraph_InitModeX;
  416. begin
  417. InitSDLgraph(320,200,8);
  418. end;
  419. procedure sdlgraph_Init320;
  420. begin
  421. InitSDLgraph(320,200,8);
  422. end;
  423. //TODO Check what does it do and if it is needed
  424. //BEGIN TODO
  425. procedure savestate;
  426. begin
  427. end;
  428. procedure restorestate;
  429. begin
  430. end;
  431. procedure sdlgraph_SetRGBpalette(ColorNum, RedValue, GreenValue, BlueValue: smallint);
  432. begin
  433. end;
  434. procedure sdlgraph_GetRGBpalette(ColorNum: smallint; var RedValue, GreenValue, BlueValue: smallint);
  435. begin
  436. end;
  437. //END TODO
  438. function QueryAdapterInfo:PModeInfo;
  439. var
  440. mode: TModeInfo;
  441. procedure setupSDLgraphDefaults;
  442. begin
  443. mode.DirectPutPixel:={$ifdef fpc}@{$endif}sdlgraph_DirectPutPixel;
  444. mode.PutPixel:={$ifdef fpc}@{$endif}sdlgraph_PutPixel;
  445. mode.GetPixel:={$ifdef fpc}@{$endif}sdlgraph_GetPixel;
  446. mode.SetRGBPalette := {$ifdef fpc}@{$endif}sdlgraph_SetRGBpalette;
  447. mode.GetRGBPalette := {$ifdef fpc}@{$endif}sdlgraph_GetRGBpalette;
  448. //mode.InternalEllipse := {$ifdef fpc}@{$endif}sdlgraph_InternalEllipse;
  449. if ((mode.MaxX+1)*35=(mode.MaxY+1)*64) then
  450. mode.XAspect:=7750
  451. else if ((mode.MaxX+1)*20=(mode.MaxY+1)*64) then
  452. mode.XAspect:=4500
  453. else if ((mode.MaxX+1)*40=(mode.MaxY+1)*64) then
  454. mode.XAspect:=8333
  455. else { assume 4:3 }
  456. mode.XAspect:=10000;
  457. //mode.HLine:={$ifdef fpc}@{$endif}sdlgraph_HLine;
  458. //mode.VLine:={$ifdef fpc}@{$endif}sdlgraph_VLine;
  459. //mode.Line:={$ifdef fpc}@{$endif}sdlgraph_line;
  460. end;
  461. begin
  462. QueryAdapterInfo := ModeList;
  463. { If the mode listing already exists... }
  464. { simply return it, without changing }
  465. { anything... }
  466. if assigned(ModeList) then
  467. exit;
  468. SaveVideoState:={$ifdef fpc}@{$endif}savestate;
  469. RestoreVideoState:={$ifdef fpc}@{$endif}restorestate;
  470. // =======================================================MODES FROM *GO32*=====================================================================
  471. // ==============================================================================================================================================
  472. InitMode(mode);
  473. { now add all standard VGA modes... }
  474. mode.DriverNumber:= LowRes;
  475. mode.HardwarePages:= 0;
  476. mode.ModeNumber:=0;
  477. mode.ModeName:='320 x 200 VGA';
  478. mode.MaxColor := 256;
  479. mode.PaletteSize := mode.MaxColor;
  480. mode.DirectColor := FALSE;
  481. mode.MaxX := 319;
  482. mode.MaxY := 199;
  483. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init320;
  484. setupSDLgraphDefaults;
  485. AddMode(mode);
  486. { now add all standard VGA modes... }
  487. InitMode(mode);
  488. mode.DriverNumber:= LowRes;
  489. mode.ModeNumber:=1;
  490. mode.HardwarePages := 3; { 0..3 }
  491. mode.ModeName:='320 x 200 ModeX';
  492. mode.MaxColor := 256;
  493. mode.DirectColor := FALSE;
  494. mode.PaletteSize := mode.MaxColor;
  495. mode.MaxX := 319;
  496. mode.MaxY := 199;
  497. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_InitModeX;
  498. setupSDLgraphDefaults;
  499. AddMode(mode);
  500. InitMode(mode);
  501. mode.ModeNumber:=VGALo;
  502. mode.DriverNumber := VGA;
  503. mode.ModeName:='640 x 200 VGA';
  504. mode.MaxColor := 16;
  505. mode.HardwarePages := 2;
  506. mode.DirectColor := FALSE;
  507. mode.PaletteSize := mode.MaxColor;
  508. mode.MaxX := 639;
  509. mode.MaxY := 199;
  510. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x200x16;
  511. setupSDLgraphDefaults;
  512. AddMode(mode);
  513. InitMode(mode);
  514. mode.ModeNumber:=VGAMed;
  515. mode.DriverNumber := VGA;
  516. mode.ModeName:='640 x 350 VGA';
  517. mode.HardwarePages := 1;
  518. mode.MaxColor := 16;
  519. mode.DirectColor := FALSE;
  520. mode.PaletteSize := mode.MaxColor;
  521. mode.MaxX := 639;
  522. mode.MaxY := 349;
  523. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x350x16;
  524. setupSDLgraphDefaults;
  525. AddMode(mode);
  526. InitMode(mode);
  527. mode.ModeNumber:=VGAHi;
  528. mode.DriverNumber := VGA;
  529. mode.HardwarePages := 0;
  530. mode.ModeName:='640 x 480 VGA';
  531. mode.MaxColor := 16;
  532. mode.DirectColor := FALSE;
  533. mode.PaletteSize := mode.MaxColor;
  534. mode.MaxX := 639;
  535. mode.MaxY := 479;
  536. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x480x16;
  537. setupSDLgraphDefaults;
  538. AddMode(mode);
  539. InitMode(mode);
  540. mode.ModeNumber:=m320x200x32k;
  541. mode.DriverNumber := VESA;
  542. mode.ModeName:='320 x 200 VESA';
  543. mode.MaxColor := 32768;
  544. mode.PaletteSize := mode.MaxColor;
  545. mode.DirectColor := TRUE;
  546. mode.MaxX := 319;
  547. mode.MaxY := 199;
  548. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init320x200x32k;
  549. setupSDLgraphDefaults;
  550. AddMode(mode);
  551. InitMode(mode);
  552. mode.ModeNumber:=m320x200x64k;
  553. mode.DriverNumber := VESA;
  554. mode.ModeName:='320 x 200 VESA';
  555. mode.MaxColor := 65536;
  556. mode.HardwarePages := 2;
  557. mode.PaletteSize := mode.MaxColor;
  558. mode.DirectColor := TRUE;
  559. mode.MaxX := 319;
  560. mode.MaxY := 199;
  561. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init320x200x64k;
  562. setupSDLgraphDefaults;
  563. AddMode(mode);
  564. InitMode(mode);
  565. mode.ModeNumber:=m640x400x256;
  566. mode.DriverNumber := VESA;
  567. mode.ModeName:='640 x 400 VESA';
  568. mode.MaxColor := 256;
  569. mode.HardwarePages := 2;
  570. mode.PaletteSize := mode.MaxColor;
  571. mode.DirectColor := FALSE;
  572. mode.MaxX := 639;
  573. mode.MaxY := 399;
  574. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x400x256;
  575. setupSDLgraphDefaults;
  576. AddMode(mode);
  577. InitMode(mode);
  578. mode.ModeNumber:=m640x480x256;
  579. mode.DriverNumber := VESA;
  580. mode.ModeName:='640 x 480 VESA';
  581. mode.MaxColor := 256;
  582. mode.HardwarePages := 2;
  583. mode.PaletteSize := mode.MaxColor;
  584. mode.MaxX := 639;
  585. mode.MaxY := 479;
  586. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x480x256;
  587. setupSDLgraphDefaults;
  588. AddMode(mode);
  589. InitMode(mode);
  590. mode.ModeNumber:=m640x480x32k;
  591. mode.DriverNumber := VESA;
  592. mode.ModeName:='640 x 480 VESA';
  593. mode.MaxColor := 32768;
  594. mode.HardwarePages := 2;
  595. mode.PaletteSize := mode.MaxColor;
  596. mode.DirectColor := TRUE;
  597. mode.MaxX := 639;
  598. mode.MaxY := 479;
  599. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x480x32k;
  600. setupSDLgraphDefaults;
  601. AddMode(mode);
  602. InitMode(mode);
  603. mode.ModeNumber:=m640x480x64k;
  604. mode.DriverNumber := VESA;
  605. mode.ModeName:='640 x 480 VESA';
  606. mode.MaxColor := 65536;
  607. mode.HardwarePages := 2;
  608. mode.PaletteSize := mode.MaxColor;
  609. mode.DirectColor := TRUE;
  610. mode.MaxX := 639;
  611. mode.MaxY := 479;
  612. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init640x480x64k;
  613. setupSDLgraphDefaults;
  614. AddMode(mode);
  615. InitMode(mode);
  616. mode.ModeNumber:=m800x600x16;
  617. mode.DriverNumber := VESA;
  618. mode.ModeName:='800 x 600 VESA';
  619. mode.MaxColor := 16;
  620. mode.HardwarePages := 2;
  621. mode.DirectColor := FALSE;
  622. mode.PaletteSize := mode.MaxColor;
  623. mode.MaxX := 799;
  624. mode.MaxY := 599;
  625. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init800x600x16;
  626. setupSDLgraphDefaults;
  627. AddMode(mode);
  628. InitMode(mode);
  629. mode.ModeNumber:=m800x600x256;
  630. mode.DriverNumber := VESA;
  631. mode.ModeName:='800 x 600 VESA';
  632. mode.MaxColor := 256;
  633. mode.HardwarePages := 2;
  634. mode.PaletteSize := mode.MaxColor;
  635. mode.DirectColor := FALSE;
  636. mode.MaxX := 799;
  637. mode.MaxY := 599;
  638. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init800x600x256;
  639. setupSDLgraphDefaults;
  640. AddMode(mode);
  641. InitMode(mode);
  642. mode.ModeNumber:=m800x600x32k;
  643. mode.DriverNumber := VESA;
  644. mode.ModeName:='800 x 600 VESA';
  645. mode.MaxColor := 32768;
  646. mode.HardwarePages := 2;
  647. mode.PaletteSize := mode.MaxColor;
  648. mode.DirectColor := TRUE;
  649. mode.MaxX := 799;
  650. mode.MaxY := 599;
  651. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init800x600x32k;
  652. setupSDLgraphDefaults;
  653. AddMode(mode);
  654. InitMode(mode);
  655. mode.ModeNumber:=m800x600x64k;
  656. mode.DriverNumber := VESA;
  657. mode.ModeName:='800 x 600 VESA';
  658. mode.MaxColor := 65536;
  659. mode.HardwarePages := 2;
  660. mode.PaletteSize := mode.MaxColor;
  661. mode.DirectColor := TRUE;
  662. mode.MaxX := 799;
  663. mode.MaxY := 599;
  664. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init800x600x64k;
  665. setupSDLgraphDefaults;
  666. AddMode(mode);
  667. InitMode(mode);
  668. mode.ModeNumber:=m1024x768x16;
  669. mode.DriverNumber := VESA;
  670. mode.ModeName:='1024 x 768 VESA';
  671. mode.MaxColor := 16;
  672. mode.HardwarePages := 2;
  673. mode.PaletteSize := mode.MaxColor;
  674. mode.DirectColor := FALSE;
  675. mode.MaxX := 1023;
  676. mode.MaxY := 767;
  677. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1024x768x16;
  678. setupSDLgraphDefaults;
  679. AddMode(mode);
  680. InitMode(mode);
  681. mode.ModeNumber:=m1024x768x256;
  682. mode.DriverNumber := VESA;
  683. mode.ModeName:='1024 x 768 VESA';
  684. mode.MaxColor := 256;
  685. mode.HardwarePages := 2;
  686. mode.PaletteSize := mode.MaxColor;
  687. mode.DirectColor := FALSE;
  688. mode.MaxX := 1023;
  689. mode.MaxY := 767;
  690. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1024x768x256;
  691. setupSDLgraphDefaults;
  692. AddMode(mode);
  693. InitMode(mode);
  694. mode.ModeNumber:=m1024x768x32k;
  695. mode.DriverNumber := VESA;
  696. mode.ModeName:='1024 x 768 VESA';
  697. mode.MaxColor := 32768;
  698. mode.HardwarePages := 2;
  699. mode.PaletteSize := mode.MaxColor;
  700. mode.DirectColor := TRUE;
  701. mode.MaxX := 1023;
  702. mode.MaxY := 767;
  703. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1024x768x32k;
  704. setupSDLgraphDefaults;
  705. AddMode(mode);
  706. InitMode(mode);
  707. mode.ModeNumber:=m1024x768x64k;
  708. mode.DriverNumber := VESA;
  709. mode.ModeName:='1024 x 768 VESA';
  710. mode.MaxColor := 65536;
  711. mode.DirectColor := TRUE;
  712. mode.HardwarePages := 2;
  713. mode.PaletteSize := mode.MaxColor;
  714. mode.MaxX := 1023;
  715. mode.MaxY := 767;
  716. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1024x768x64k;
  717. setupSDLgraphDefaults;
  718. AddMode(mode);
  719. InitMode(mode);
  720. mode.ModeNumber:=m1280x1024x16;
  721. mode.DriverNumber := VESA;
  722. mode.ModeName:='1280 x 1024 VESA';
  723. mode.MaxColor := 16;
  724. mode.HardwarePages := 2;
  725. mode.DirectColor := FALSE;
  726. mode.PaletteSize := mode.MaxColor;
  727. mode.MaxX := 1279;
  728. mode.MaxY := 1023;
  729. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1280x1024x16;
  730. setupSDLgraphDefaults;
  731. AddMode(mode);
  732. InitMode(mode);
  733. mode.ModeNumber:=m1280x1024x256;
  734. mode.DriverNumber := VESA;
  735. mode.ModeName:='1280 x 1024 VESA';
  736. mode.MaxColor := 256;
  737. mode.HardwarePages := 2;
  738. mode.DirectColor := FALSE;
  739. mode.PaletteSize := mode.MaxColor;
  740. mode.MaxX := 1279;
  741. mode.MaxY := 1023;
  742. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1280x1024x256;
  743. setupSDLgraphDefaults;
  744. AddMode(mode);
  745. InitMode(mode);
  746. mode.ModeNumber:=m1280x1024x32k;
  747. mode.DriverNumber := VESA;
  748. mode.ModeName:='1280 x 1024 VESA';
  749. mode.MaxColor := 32768;
  750. mode.HardwarePages := 2;
  751. mode.DirectColor := TRUE;
  752. mode.PaletteSize := mode.MaxColor;
  753. mode.MaxX := 1279;
  754. mode.MaxY := 1023;
  755. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1280x1024x32k;
  756. setupSDLgraphDefaults;
  757. AddMode(mode);
  758. InitMode(mode);
  759. mode.ModeNumber:=m1280x1024x64k;
  760. mode.DriverNumber := VESA;
  761. mode.ModeName:='1280 x 1024 VESA';
  762. mode.MaxColor := 65536;
  763. mode.HardwarePages := 2;
  764. mode.DirectColor := TRUE;
  765. mode.PaletteSize := mode.MaxColor;
  766. mode.MaxX := 1279;
  767. mode.MaxY := 1023;
  768. mode.InitMode := {$ifdef fpc}@{$endif}sdlgraph_Init1280x1024x64k;
  769. setupSDLgraphDefaults;
  770. AddMode(mode);
  771. end;
  772. begin
  773. InitializeGraph;
  774. end.