tb_system_win.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // ================================================================================
  2. // == This file is a part of Turbo Badger. (C) 2011-2014, Emil Segerås ==
  3. // == See tb_core.h for more information. ==
  4. // ================================================================================
  5. #include "tb_system.h"
  6. #ifdef TB_SYSTEM_WINDOWS
  7. #include <Windows.h>
  8. #include <mmsystem.h>
  9. #include <stdio.h>
  10. #ifdef TB_RUNTIME_DEBUG_INFO
  11. void TBDebugOut(const char *str)
  12. {
  13. OutputDebugString(str);
  14. }
  15. #endif // TB_RUNTIME_DEBUG_INFO
  16. namespace tb {
  17. // == TBSystem ========================================
  18. double TBSystem::GetTimeMS()
  19. {
  20. return timeGetTime();
  21. }
  22. // Implementation currently done in port_glut.cpp.
  23. // Windows timer suck. Glut timers suck too (can't be canceled) but that will do for now.
  24. //void TBSystem::RescheduleTimer(double fire_time)
  25. //{
  26. //}
  27. int TBSystem::GetLongClickDelayMS()
  28. {
  29. return 500;
  30. }
  31. int TBSystem::GetPanThreshold()
  32. {
  33. return 5 * GetDPI() / 96;
  34. }
  35. int TBSystem::GetPixelsPerLine()
  36. {
  37. return 40 * GetDPI() / 96;
  38. }
  39. int TBSystem::GetDPI()
  40. {
  41. return 96;
  42. /*
  43. HDC hdc = GetDC(nullptr);
  44. int DPI_x = GetDeviceCaps(hdc, LOGPIXELSX);
  45. ReleaseDC(nullptr, hdc);
  46. #if 0 // TEST CODE!
  47. DPI_x *= 2;
  48. #endif
  49. return DPI_x;
  50. */
  51. }
  52. }; // namespace tb
  53. #endif // TB_SYSTEM_WINDOWS