Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Selector.cpp 896B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*!
  2. * \file src/Selector.cpp
  3. * \brief Selector Window
  4. *
  5. * \author xythobuz
  6. */
  7. #include "imgui/imgui.h"
  8. #include "global.h"
  9. #include "Log.h"
  10. #include "Selector.h"
  11. bool Selector::visible = false;
  12. static unsigned int lastX = -1, lastY = -1;
  13. void Selector::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
  14. if ((button == leftmouseKey) && (!released)) {
  15. lastX = x;
  16. lastY = y;
  17. }
  18. }
  19. void Selector::display() {
  20. if (!visible)
  21. return;
  22. if (!ImGui::Begin("Object Selector", &visible, ImVec2(300, 300))) {
  23. ImGui::End();
  24. return;
  25. }
  26. ImGui::Text("Last Click (Screen): (%d %d)", lastX, lastY);
  27. if ((lastX < 0) || (lastY < 0)) {
  28. ImGui::Text("Last Click (World): (? ?)");
  29. } else {
  30. }
  31. if (ImGui::Button("Hide Selector")) {
  32. visible = false;
  33. }
  34. ImGui::End();
  35. }