tb_system_linux.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_LINUX
  7. #include <sys/time.h>
  8. #include <stdio.h>
  9. #ifdef TB_RUNTIME_DEBUG_INFO
  10. void TBDebugOut(const char *str)
  11. {
  12. printf("%s", str);
  13. }
  14. #endif // TB_RUNTIME_DEBUG_INFO
  15. namespace tb {
  16. // == TBSystem ========================================
  17. double TBSystem::GetTimeMS()
  18. {
  19. struct timeval now;
  20. gettimeofday( &now, NULL );
  21. return now.tv_usec/1000 + now.tv_sec*1000;
  22. }
  23. // Implementation currently done in port_glut.cpp.
  24. // FIX: Implement here for linux-desktop/android/macos?
  25. //void TBSystem::RescheduleTimer(double fire_time)
  26. //{
  27. //}
  28. int TBSystem::GetLongClickDelayMS()
  29. {
  30. return 500;
  31. }
  32. int TBSystem::GetPanThreshold()
  33. {
  34. return 5 * GetDPI() / 96;
  35. }
  36. int TBSystem::GetPixelsPerLine()
  37. {
  38. return 40 * GetDPI() / 96;
  39. }
  40. int TBSystem::GetDPI()
  41. {
  42. // FIX: Implement!
  43. return 96;
  44. }
  45. }; // namespace tb
  46. #endif // TB_SYSTEM_LINUX