devil_cpp_wrapper.hpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. #ifndef DEVIL_CPP_WRAPPER_HPP
  2. #define DEVIL_CPP_WRAPPER_HPP
  3. #include <IL/ilut.h> // Probably only have to #include this one
  4. class ilImage
  5. {
  6. public:
  7. ilImage();
  8. ilImage(ILconst_string);
  9. ilImage(const ilImage &);
  10. virtual ~ilImage();
  11. ILboolean Load(ILconst_string);
  12. ILboolean Load(ILconst_string, ILenum);
  13. ILboolean Save(ILconst_string);
  14. ILboolean Save(ILconst_string, ILenum);
  15. // ImageLib functions
  16. ILboolean ActiveImage(ILuint);
  17. ILboolean ActiveLayer(ILuint);
  18. ILboolean ActiveMipmap(ILuint);
  19. ILboolean Clear(void);
  20. void ClearColour(ILclampf, ILclampf, ILclampf, ILclampf);
  21. ILboolean Convert(ILenum);
  22. ILboolean Copy(ILuint);
  23. ILboolean Default(void);
  24. ILboolean Flip(void);
  25. ILboolean SwapColours(void);
  26. ILboolean Resize(ILuint, ILuint, ILuint);
  27. ILboolean TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, void*);
  28. // Image handling
  29. void Bind(void) const;
  30. void Bind(ILuint);
  31. void Close(void) { this->Delete(); }
  32. void Delete(void);
  33. void iGenBind();
  34. ILenum PaletteAlphaIndex();
  35. // Image characteristics
  36. ILuint Width(void);
  37. ILuint Height(void);
  38. ILuint Depth(void);
  39. ILubyte Bpp(void);
  40. ILubyte Bitpp(void);
  41. ILenum PaletteType(void);
  42. ILenum Format(void);
  43. ILenum Type(void);
  44. ILuint NumImages(void);
  45. ILuint NumMipmaps(void);
  46. ILuint GetId(void) const;
  47. ILenum GetOrigin(void);
  48. ILubyte *GetData(void);
  49. ILubyte *GetPalette(void);
  50. // Rendering
  51. ILuint BindImage(void);
  52. ILuint BindImage(ILenum);
  53. // Operators
  54. ilImage& operator = (ILuint);
  55. ilImage& operator = (const ilImage &);
  56. protected:
  57. ILuint Id;
  58. private:
  59. static int ilStartUp();
  60. static ILboolean ilStartedUp;
  61. };
  62. // ensure that init is called exactly once
  63. int ilImage::ilStartUp()
  64. {
  65. ilInit();
  66. iluInit();
  67. //ilutInit();
  68. return true;
  69. }
  70. ILboolean ilImage::ilStartedUp = ilStartUp();
  71. class ilFilters
  72. {
  73. public:
  74. static ILboolean Alienify(ilImage &);
  75. static ILboolean BlurAvg(ilImage &, ILuint Iter);
  76. static ILboolean BlurGaussian(ilImage &, ILuint Iter);
  77. static ILboolean Contrast(ilImage &, ILfloat Contrast);
  78. static ILboolean EdgeDetectE(ilImage &);
  79. static ILboolean EdgeDetectP(ilImage &);
  80. static ILboolean EdgeDetectS(ilImage &);
  81. static ILboolean Emboss(ilImage &);
  82. static ILboolean Gamma(ilImage &, ILfloat Gamma);
  83. static ILboolean Negative(ilImage &);
  84. static ILboolean Noisify(ilImage &, ILubyte Factor);
  85. static ILboolean Pixelize(ilImage &, ILuint PixSize);
  86. static ILboolean Saturate(ilImage &, ILfloat Saturation);
  87. static ILboolean Saturate(ilImage &, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
  88. static ILboolean ScaleColours(ilImage &, ILfloat r, ILfloat g, ILfloat b);
  89. static ILboolean Sharpen(ilImage &, ILfloat Factor, ILuint Iter);
  90. };
  91. #ifdef ILUT_USE_OPENGL
  92. class ilOgl
  93. {
  94. public:
  95. static void Init(void);
  96. static GLuint BindTex(ilImage &);
  97. static ILboolean Upload(ilImage &, ILuint);
  98. static GLuint Mipmap(ilImage &);
  99. static ILboolean Screen(void);
  100. static ILboolean Screenie(void);
  101. };
  102. #endif//ILUT_USE_OPENGL
  103. #ifdef ILUT_USE_ALLEGRO
  104. class ilAlleg
  105. {
  106. public:
  107. static void Init(void);
  108. static BITMAP *Convert(ilImage &);
  109. };
  110. #endif//ILUT_USE_ALLEGRO
  111. #ifdef ILUT_USE_WIN32
  112. class ilWin32
  113. {
  114. public:
  115. static void Init(void);
  116. static HBITMAP Convert(ilImage &);
  117. static ILboolean GetClipboard(ilImage &);
  118. static void GetInfo(ilImage &, BITMAPINFO *Info);
  119. static ILubyte *GetPadData(ilImage &);
  120. static HPALETTE GetPal(ilImage &);
  121. static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType);
  122. static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type);
  123. static ILboolean SetClipboard(ilImage &);
  124. };
  125. #endif//ILUT_USE_WIN32
  126. class ilValidate
  127. {
  128. public:
  129. static ILboolean Valid(ILenum, ILconst_string);
  130. static ILboolean Valid(ILenum, FILE *);
  131. static ILboolean Valid(ILenum, void *, ILuint);
  132. protected:
  133. private:
  134. };
  135. class ilState
  136. {
  137. public:
  138. static ILboolean Disable(ILenum);
  139. static ILboolean Enable(ILenum);
  140. static void Get(ILenum, ILboolean &);
  141. static void Get(ILenum, ILint &);
  142. static ILboolean GetBool(ILenum);
  143. static ILint GetInt(ILenum);
  144. static const char *GetString(ILenum);
  145. static ILboolean IsDisabled(ILenum);
  146. static ILboolean IsEnabled(ILenum);
  147. static ILboolean Origin(ILenum);
  148. static void Pop(void);
  149. static void Push(ILuint);
  150. protected:
  151. private:
  152. };
  153. class ilError
  154. {
  155. public:
  156. static void Check(void (*Callback)(const char*));
  157. static void Check(void (*Callback)(ILenum));
  158. static ILenum Get(void);
  159. static const char *String(void);
  160. static const char *String(ILenum);
  161. protected:
  162. private:
  163. };
  164. //
  165. // ILIMAGE
  166. //
  167. ilImage::ilImage()
  168. {
  169. this->Id = 0;
  170. //this->iStartUp(); // This was commented out, but it needs to be somewhere...
  171. this->iGenBind();
  172. return;
  173. }
  174. ilImage::ilImage(ILconst_string FileName)
  175. {
  176. this->Id = 0;
  177. //this->iStartUp(); // This was commented out, but it needs to be somewhere...
  178. this->iGenBind();
  179. ilLoadImage(FileName);
  180. return;
  181. }
  182. ilImage::ilImage(const ilImage &Image)
  183. {
  184. this->Id = 0;
  185. // this->iStartUp();
  186. this->iGenBind();
  187. *this = Image;
  188. return;
  189. }
  190. ilImage::~ilImage()
  191. {
  192. if (this->Id)
  193. ilDeleteImages(1, &this->Id);
  194. this->Id = 0;
  195. return;
  196. }
  197. ILboolean ilImage::Load(ILconst_string FileName)
  198. {
  199. this->iGenBind();
  200. return ilLoadImage(FileName);
  201. }
  202. ILboolean ilImage::Load(ILconst_string FileName, ILenum Type)
  203. {
  204. this->iGenBind();
  205. return ilLoad(Type, FileName);
  206. }
  207. ILboolean ilImage::Save(ILconst_string FileName)
  208. {
  209. this->iGenBind();
  210. return ilSaveImage(FileName);
  211. }
  212. ILboolean ilImage::Save(ILconst_string FileName, ILenum Type)
  213. {
  214. this->iGenBind();
  215. return ilSave(Type, FileName);
  216. }
  217. //
  218. // ImageLib functions
  219. //
  220. ILboolean ilImage::ActiveImage(ILuint Number)
  221. {
  222. if (this->Id) {
  223. this->Bind();
  224. return ilActiveImage(Number);
  225. }
  226. return IL_FALSE;
  227. }
  228. ILboolean ilImage::ActiveLayer(ILuint Number)
  229. {
  230. if (this->Id) {
  231. this->Bind();
  232. return ilActiveLayer(Number);
  233. }
  234. return IL_FALSE;
  235. }
  236. ILboolean ilImage::ActiveMipmap(ILuint Number)
  237. {
  238. if (this->Id) {
  239. this->Bind();
  240. return ilActiveMipmap(Number);
  241. }
  242. return IL_FALSE;
  243. }
  244. ILboolean ilImage::Clear()
  245. {
  246. if (this->Id) {
  247. this->Bind();
  248. return ilClearImage();
  249. }
  250. return IL_FALSE;
  251. }
  252. void ilImage::ClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha)
  253. {
  254. ilClearColour(Red, Green, Blue, Alpha);
  255. return;
  256. }
  257. ILboolean ilImage::Convert(ILenum NewFormat)
  258. {
  259. if (this->Id) {
  260. this->Bind();
  261. return ilConvertImage(NewFormat, IL_UNSIGNED_BYTE);
  262. }
  263. return IL_FALSE;
  264. }
  265. ILboolean ilImage::Copy(ILuint Src)
  266. {
  267. if (this->Id) {
  268. this->Bind();
  269. return ilCopyImage(Src);
  270. }
  271. return IL_FALSE;
  272. }
  273. ILboolean ilImage::Default()
  274. {
  275. if (this->Id) {
  276. this->Bind();
  277. return ilDefaultImage();
  278. }
  279. return IL_FALSE;
  280. }
  281. ILboolean ilImage::Flip()
  282. {
  283. if (this->Id) {
  284. this->Bind();
  285. return iluFlipImage();
  286. }
  287. return IL_FALSE;
  288. }
  289. ILboolean ilImage::SwapColours()
  290. {
  291. if (this->Id) {
  292. this->Bind();
  293. return iluSwapColours();
  294. }
  295. return IL_FALSE;
  296. }
  297. ILboolean ilImage::Resize(ILuint Width, ILuint Height, ILuint Depth)
  298. {
  299. if (this->Id) {
  300. this->Bind();
  301. return iluScale(Width, Height, Depth);
  302. }
  303. return IL_FALSE;
  304. }
  305. ILboolean ilImage::TexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data)
  306. {
  307. if (this->Id) {
  308. this->Bind();
  309. return ilTexImage(Width, Height, Depth, Bpp, Format, Type, Data);
  310. }
  311. return IL_FALSE;
  312. }
  313. //
  314. // Image handling
  315. //
  316. void ilImage::Bind() const
  317. {
  318. if (this->Id)
  319. ilBindImage(this->Id);
  320. return;
  321. }
  322. // Note: Behaviour may be changed!
  323. void ilImage::Bind(ILuint Image)
  324. {
  325. if (this->Id == Image)
  326. return;
  327. this->Delete(); // Should we delete it?
  328. this->Id = Image;
  329. ilBindImage(this->Id);
  330. return;
  331. }
  332. void ilImage::Delete()
  333. {
  334. if (this->Id == 0)
  335. return;
  336. ilDeleteImages(1, &this->Id);
  337. this->Id = 0;
  338. return;
  339. }
  340. //
  341. // Image characteristics
  342. //
  343. ILuint ilImage::Width()
  344. {
  345. if (this->Id) {
  346. this->Bind();
  347. return ilGetInteger(IL_IMAGE_WIDTH);
  348. }
  349. return 0;
  350. }
  351. ILuint ilImage::Height()
  352. {
  353. if (this->Id) {
  354. this->Bind();
  355. return ilGetInteger(IL_IMAGE_HEIGHT);
  356. }
  357. return 0;
  358. }
  359. ILuint ilImage::Depth()
  360. {
  361. if (this->Id) {
  362. this->Bind();
  363. return ilGetInteger(IL_IMAGE_DEPTH);
  364. }
  365. return 0;
  366. }
  367. ILubyte ilImage::Bpp()
  368. {
  369. if (this->Id) {
  370. this->Bind();
  371. return ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);
  372. }
  373. return 0;
  374. }
  375. ILubyte ilImage::Bitpp()
  376. {
  377. if (this->Id) {
  378. this->Bind();
  379. return ilGetInteger(IL_IMAGE_BITS_PER_PIXEL);
  380. }
  381. return 0;
  382. }
  383. ILenum ilImage::Format()
  384. {
  385. if (this->Id) {
  386. this->Bind();
  387. return ilGetInteger(IL_IMAGE_FORMAT);
  388. }
  389. return 0;
  390. }
  391. ILenum ilImage::PaletteType()
  392. {
  393. if (this->Id) {
  394. this->Bind();
  395. return ilGetInteger(IL_PALETTE_TYPE);
  396. }
  397. return 0;
  398. }
  399. ILenum ilImage::PaletteAlphaIndex()
  400. {
  401. if (this->Id) {
  402. this->Bind();
  403. return ilGetInteger(IL_PNG_ALPHA_INDEX);
  404. }
  405. return 0;
  406. }
  407. ILenum ilImage::Type()
  408. {
  409. if (this->Id) {
  410. this->Bind();
  411. return ilGetInteger(IL_IMAGE_TYPE);
  412. }
  413. return 0;
  414. }
  415. ILenum ilImage::NumImages()
  416. {
  417. if (this->Id) {
  418. this->Bind();
  419. return ilGetInteger(IL_NUM_IMAGES);
  420. }
  421. return 0;
  422. }
  423. ILenum ilImage::NumMipmaps()
  424. {
  425. if (this->Id) {
  426. this->Bind();
  427. return ilGetInteger(IL_NUM_MIPMAPS);
  428. }
  429. return 0;
  430. }
  431. ILuint ilImage::GetId() const
  432. {
  433. return this->Id;
  434. }
  435. ILenum ilImage::GetOrigin(void)
  436. {
  437. ILinfo Info;
  438. if (this->Id) {
  439. this->Bind();
  440. iluGetImageInfo(&Info);
  441. return Info.Origin;
  442. }
  443. return 0;
  444. }
  445. ILubyte* ilImage::GetData()
  446. {
  447. if (this->Id) {
  448. this->Bind();
  449. return ilGetData();
  450. }
  451. return 0;
  452. }
  453. ILubyte* ilImage::GetPalette()
  454. {
  455. if (this->Id) {
  456. this->Bind();
  457. return ilGetPalette();
  458. }
  459. return 0;
  460. }
  461. //
  462. // Private members
  463. //
  464. /*void ilImage::iStartUp()
  465. {
  466. ilInit();
  467. iluInit();
  468. ilutInit();
  469. return;
  470. }*/
  471. void ilImage::iGenBind()
  472. {
  473. if (this->Id == 0) {
  474. ilGenImages(1, &this->Id);
  475. }
  476. ilBindImage(this->Id);
  477. return;
  478. }
  479. //
  480. // Operators
  481. //
  482. ilImage& ilImage::operator = (ILuint Image)
  483. {
  484. if (this->Id == 0)
  485. this->Id = Image;
  486. else {
  487. this->Bind();
  488. ilCopyImage(Image);
  489. }
  490. return *this;
  491. }
  492. ilImage& ilImage::operator = (const ilImage &Image)
  493. {
  494. if (Id == 0)
  495. Id = Image.GetId();
  496. else {
  497. Bind();
  498. ilCopyImage(Image.GetId());
  499. }
  500. return *this;
  501. }
  502. //
  503. // ILFILTERS
  504. //
  505. ILboolean ilFilters::Alienify(ilImage &Image)
  506. {
  507. Image.Bind();
  508. return iluAlienify();
  509. }
  510. ILboolean ilFilters::BlurAvg(ilImage &Image, ILuint Iter)
  511. {
  512. Image.Bind();
  513. return iluBlurAvg(Iter);
  514. }
  515. ILboolean ilFilters::BlurGaussian(ilImage &Image, ILuint Iter)
  516. {
  517. Image.Bind();
  518. return iluBlurGaussian(Iter);
  519. }
  520. ILboolean ilFilters::Contrast(ilImage &Image, ILfloat Contrast)
  521. {
  522. Image.Bind();
  523. return iluContrast(Contrast);
  524. }
  525. ILboolean ilFilters::EdgeDetectE(ilImage &Image)
  526. {
  527. Image.Bind();
  528. return iluEdgeDetectP();
  529. }
  530. ILboolean ilFilters::EdgeDetectP(ilImage &Image)
  531. {
  532. Image.Bind();
  533. return iluEdgeDetectP();
  534. }
  535. ILboolean ilFilters::EdgeDetectS(ilImage &Image)
  536. {
  537. Image.Bind();
  538. return iluEdgeDetectS();
  539. }
  540. ILboolean ilFilters::Emboss(ilImage &Image)
  541. {
  542. Image.Bind();
  543. return iluEmboss();
  544. }
  545. ILboolean ilFilters::Gamma(ilImage &Image, ILfloat Gamma)
  546. {
  547. Image.Bind();
  548. return iluGammaCorrect(Gamma);
  549. }
  550. ILboolean ilFilters::Negative(ilImage &Image)
  551. {
  552. Image.Bind();
  553. return iluNegative();
  554. }
  555. ILboolean ilFilters::Noisify(ilImage &Image, ILubyte Factor)
  556. {
  557. Image.Bind();
  558. return iluNoisify(Factor);
  559. }
  560. ILboolean ilFilters::Pixelize(ilImage &Image, ILuint PixSize)
  561. {
  562. Image.Bind();
  563. return iluPixelize(PixSize);
  564. }
  565. ILboolean ilFilters::Saturate(ilImage &Image, ILfloat Saturation)
  566. {
  567. Image.Bind();
  568. return iluSaturate1f(Saturation);
  569. }
  570. ILboolean ilFilters::Saturate(ilImage &Image, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation)
  571. {
  572. Image.Bind();
  573. return iluSaturate4f(r, g, b, Saturation);
  574. }
  575. ILboolean ilFilters::ScaleColours(ilImage &Image, ILfloat r, ILfloat g, ILfloat b)
  576. {
  577. Image.Bind();
  578. return iluScaleColours(r, g, b);
  579. }
  580. ILboolean ilFilters::Sharpen(ilImage &Image, ILfloat Factor, ILuint Iter)
  581. {
  582. Image.Bind();
  583. return iluSharpen(Factor, Iter);
  584. }
  585. //
  586. // ILOPENGL
  587. //
  588. #ifdef ILUT_USE_OPENGL
  589. void ilOgl::Init()
  590. {
  591. ilutRenderer(ILUT_OPENGL);
  592. return;
  593. }
  594. GLuint ilOgl::BindTex(ilImage &Image)
  595. {
  596. Image.Bind();
  597. return ilutGLBindTexImage();
  598. }
  599. ILboolean ilOgl::Upload(ilImage &Image, ILuint Level)
  600. {
  601. Image.Bind();
  602. return ilutGLTexImage(Level);
  603. }
  604. GLuint ilOgl::Mipmap(ilImage &Image)
  605. {
  606. Image.Bind();
  607. return ilutGLBuildMipmaps();
  608. }
  609. ILboolean ilOgl::Screen()
  610. {
  611. return ilutGLScreen();
  612. }
  613. ILboolean ilOgl::Screenie()
  614. {
  615. return ilutGLScreenie();
  616. }
  617. #endif//ILUT_USE_OPENGL
  618. //
  619. // ILALLEGRO
  620. //
  621. #ifdef ILUT_USE_ALLEGRO
  622. void ilAlleg::Init()
  623. {
  624. ilutRenderer(IL_ALLEGRO);
  625. return;
  626. }
  627. BITMAP *ilAlleg::Convert(ilImage &Image, PALETTE Pal)
  628. {
  629. Image.Bind();
  630. return ilutConvertToAlleg(Pal);
  631. }
  632. #endif//ILUT_USE_ALLEGRO
  633. //
  634. // ILWIN32
  635. //
  636. #ifdef ILUT_USE_WIN32
  637. void ilWin32::Init()
  638. {
  639. ilutRenderer(ILUT_WIN32);
  640. return;
  641. }
  642. HBITMAP ilWin32::Convert(ilImage &Image)
  643. {
  644. Image.Bind();
  645. return ilutConvertToHBitmap(GetDC(NULL));
  646. }
  647. ILboolean ilWin32::GetClipboard(ilImage &Image)
  648. {
  649. Image.Bind();
  650. return ilutGetWinClipboard();
  651. }
  652. void ilWin32::GetInfo(ilImage &Image, BITMAPINFO *Info)
  653. {
  654. Image.Bind();
  655. ilutGetBmpInfo(Info);
  656. return;
  657. }
  658. ILubyte* ilWin32::GetPadData(ilImage &Image)
  659. {
  660. Image.Bind();
  661. return ilutGetPaddedData();
  662. }
  663. HPALETTE ilWin32::GetPal(ilImage &Image)
  664. {
  665. Image.Bind();
  666. return ilutGetHPal();
  667. }
  668. ILboolean ilWin32::GetResource(ilImage &Image, HINSTANCE hInst, ILint ID, char *ResourceType)
  669. {
  670. Image.Bind();
  671. return ilutLoadResource(hInst, ID, ResourceType, IL_TYPE_UNKNOWN);
  672. }
  673. ILboolean ilWin32::GetResource(ilImage &Image, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type)
  674. {
  675. Image.Bind();
  676. return ilutLoadResource(hInst, ID, ResourceType, Type);
  677. }
  678. ILboolean ilWin32::SetClipboard(ilImage &Image)
  679. {
  680. Image.Bind();
  681. return ilutSetWinClipboard();
  682. }
  683. #endif//ILUT_USE_WIN32
  684. //
  685. // ILVALIDATE
  686. //
  687. ILboolean ilValidate::Valid(ILenum Type, ILconst_string FileName)
  688. {
  689. return ilIsValid(Type, FileName);
  690. }
  691. ILboolean ilValidate::Valid(ILenum Type, FILE *File)
  692. {
  693. return ilIsValidF(Type, File);
  694. }
  695. ILboolean ilValidate::Valid(ILenum Type, void *Lump, ILuint Size)
  696. {
  697. return ilIsValidL(Type, Lump, Size);
  698. }
  699. //
  700. // ILSTATE
  701. //
  702. ILboolean ilState::Disable(ILenum State)
  703. {
  704. return ilDisable(State);
  705. }
  706. ILboolean ilState::Enable(ILenum State)
  707. {
  708. return ilEnable(State);
  709. }
  710. void ilState::Get(ILenum Mode, ILboolean &Param)
  711. {
  712. ilGetBooleanv(Mode, &Param);
  713. return;
  714. }
  715. void ilState::Get(ILenum Mode, ILint &Param)
  716. {
  717. ilGetIntegerv(Mode, &Param);
  718. return;
  719. }
  720. ILboolean ilState::GetBool(ILenum Mode)
  721. {
  722. return ilGetBoolean(Mode);
  723. }
  724. ILint ilState::GetInt(ILenum Mode)
  725. {
  726. return ilGetInteger(Mode);
  727. }
  728. const char *ilState::GetString(ILenum StringName)
  729. {
  730. return ilGetString(StringName);
  731. }
  732. ILboolean ilState::IsDisabled(ILenum Mode)
  733. {
  734. return ilIsDisabled(Mode);
  735. }
  736. ILboolean ilState::IsEnabled(ILenum Mode)
  737. {
  738. return ilIsEnabled(Mode);
  739. }
  740. ILboolean ilState::Origin(ILenum Mode)
  741. {
  742. return ilOriginFunc(Mode);
  743. }
  744. void ilState::Pop()
  745. {
  746. ilPopAttrib();
  747. return;
  748. }
  749. void ilState::Push(ILuint Bits = IL_ALL_ATTRIB_BITS)
  750. {
  751. ilPushAttrib(Bits);
  752. return;
  753. }
  754. //
  755. // ILERROR
  756. //
  757. void ilError::Check(void (*Callback)(const char*))
  758. {
  759. static ILenum Error;
  760. while ((Error = ilGetError()) != IL_NO_ERROR) {
  761. Callback(iluErrorString(Error));
  762. }
  763. return;
  764. }
  765. void ilError::Check(void (*Callback)(ILenum))
  766. {
  767. static ILenum Error;
  768. while ((Error = ilGetError()) != IL_NO_ERROR) {
  769. Callback(Error);
  770. }
  771. return;
  772. }
  773. ILenum ilError::Get()
  774. {
  775. return ilGetError();
  776. }
  777. const char *ilError::String()
  778. {
  779. return iluErrorString(ilGetError());
  780. }
  781. const char *ilError::String(ILenum Error)
  782. {
  783. return iluErrorString(Error);
  784. }
  785. #endif// DEVIL_CPP_WRAPPER_HPP