BsOISPlugin.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsOISPrerequisites.h"
  4. #include "BsInputHandlerOIS.h"
  5. #include "BsRenderWindow.h"
  6. #include "BsInput.h"
  7. namespace BansheeEngine
  8. {
  9. /** Returns a name of the plugin. */
  10. extern "C" BS_OIS_EXPORT const char* getPluginName()
  11. {
  12. static const char* pluginName = "OISInput";
  13. return pluginName;
  14. }
  15. /** Entry point to the plugin. Called by the engine when the plugin is loaded. */
  16. extern "C" BS_OIS_EXPORT void* loadPlugin(void* primaryWindowPtr)
  17. {
  18. RenderWindow* primaryWindow = (RenderWindow*)primaryWindowPtr;
  19. if (primaryWindow == nullptr)
  20. assert(false && "Unable to get window handle. No active window exists!");
  21. UINT64 windowId = 0;
  22. primaryWindow->getCustomAttribute("WINDOW", &windowId);
  23. // TODO - Window handles in Windows are 64 bits when compiled as x64, but OIS only accepts a 32bit value. Is this okay?
  24. SPtr<RawInputHandler> inputHandler = bs_shared_ptr_new<InputHandlerOIS>((UINT32)windowId);
  25. gInput()._registerRawInputHandler(inputHandler);
  26. return nullptr;
  27. }
  28. }