2
0

CmOISPlugin.cpp 929 B

1234567891011121314151617181920212223242526272829303132
  1. #include "CmOISPrerequisites.h"
  2. #include "CmInputHandlerOIS.h"
  3. #include "CmRenderWindow.h"
  4. #include "CmApplication.h"
  5. #include "CmInput.h"
  6. namespace BansheeEngine
  7. {
  8. extern "C" CM_OIS_EXPORT const String& getPluginName()
  9. {
  10. static String pluginName = "OISInput";
  11. return pluginName;
  12. }
  13. extern "C" CM_OIS_EXPORT void* loadPlugin()
  14. {
  15. RenderWindowPtr primaryWindow = gApplication().getPrimaryWindow();
  16. if (primaryWindow == nullptr)
  17. assert(false && "Unable to get window handle. No active window exists!");
  18. UINT64 windowId = 0;
  19. primaryWindow->getCustomAttribute("WINDOW", &windowId);
  20. // TODO - Window handles in Windows are 64 bits when compiled as x64, but OIS only accepts a 32bit value. Is this okay?
  21. std::shared_ptr<RawInputHandler> inputHandler = cm_shared_ptr<InputHandlerOIS>((UINT32)windowId);
  22. gInput()._registerRawInputHandler(inputHandler);
  23. return nullptr;
  24. }
  25. }