main.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <iostream>
  2. #include <irrlicht.h>
  3. #include <sstream>
  4. #include "nier_test.h"
  5. int WinID = 0;
  6. int game_test_main();
  7. int main(int argc, char* argv[])
  8. {
  9. // parse the integer if it exists
  10. if (argc >= 1)
  11. {
  12. std::stringstream ss;
  13. ss << std::hex << argv[1];
  14. ss >> WinID;
  15. }
  16. printf("Initializing X11 to %d\n", WinID);
  17. return game_test_main ();
  18. }
  19. irr::IrrlichtDevice* device = nullptr;
  20. irr::video::IVideoDriver* driver = nullptr;
  21. irr::SIrrlichtCreationParameters _irr_params;
  22. int init_driver ()
  23. {
  24. // prepare basic configuration for irrlicht
  25. _irr_params.AntiAlias = 8;
  26. _irr_params.Bits = 16;
  27. // _irr_params.DeviceType = irr::EIDT_X11;
  28. _irr_params.DriverType = irr::video::EDT_OPENGL;
  29. _irr_params.Doublebuffer = true;
  30. _irr_params.EventReceiver = nullptr;
  31. _irr_params.Fullscreen = false;
  32. _irr_params.HandleSRGB = false;
  33. _irr_params.IgnoreInput = true;
  34. _irr_params.Stencilbuffer = true;
  35. _irr_params.UsePerformanceTimer = false;
  36. _irr_params.Vsync = false;
  37. _irr_params.WithAlphaChannel = false;
  38. _irr_params.ZBufferBits = 24;
  39. _irr_params.LoggingLevel = irr::ELL_DEBUG;
  40. _irr_params.WindowId = reinterpret_cast<void*> (WinID);
  41. device = irr::createDeviceEx (_irr_params);
  42. if (device == nullptr)
  43. {
  44. return 1;
  45. }
  46. device->setWindowCaption (L"Test game");
  47. driver = device->getVideoDriver();
  48. return 0;
  49. }
  50. int game_test_main ()
  51. {
  52. if (init_driver())
  53. {
  54. return 1;
  55. }
  56. nier_test ();
  57. return 0;
  58. }