main.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #include <iostream>
  2. #include <irrlicht/irrlicht.h>
  3. #include <sstream>
  4. #include <wallpaperengine/config.h>
  5. #include "nier_test.h"
  6. #include "wallpaperengine/irrlicht.h"
  7. int WinID = 0;
  8. int game_test_main();
  9. int main(int argc, char* argv[])
  10. {
  11. // parse the integer if it exists
  12. if (argc >= 1)
  13. {
  14. std::stringstream ss;
  15. ss << std::hex << argv[1];
  16. ss >> WinID;
  17. }
  18. printf("Initializing X11 to %d\n", WinID);
  19. return game_test_main ();
  20. }
  21. irr::SIrrlichtCreationParameters _irr_params;
  22. int init_irrlicht()
  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. wp::irrlicht::device = irr::createDeviceEx (_irr_params);
  42. if (wp::irrlicht::device == nullptr)
  43. {
  44. return 1;
  45. }
  46. wp::irrlicht::device->setWindowCaption (L"Test game");
  47. wp::irrlicht::driver = wp::irrlicht::device->getVideoDriver();
  48. return 0;
  49. }
  50. void preconfigure_wallpaper_engine ()
  51. {
  52. wp::config::path::base = wp::irrlicht::device->getFileSystem ()->getAbsolutePath ("../");
  53. wp::config::path::resources = wp::config::path::base + "/res";
  54. wp::config::path::shaders = wp::config::path::resources + "/shaders";
  55. }
  56. int game_test_main ()
  57. {
  58. if (init_irrlicht())
  59. {
  60. return 1;
  61. }
  62. preconfigure_wallpaper_engine ();
  63. nier_test ();
  64. return 0;
  65. }