BsPlatformUtility.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "Prerequisites/BsPlatformDefines.h"
  5. #include "String/BsString.h"
  6. #include "Prerequisites/BsTypes.h"
  7. namespace bs
  8. {
  9. /** @addtogroup General
  10. * @{
  11. */
  12. struct MACAddress;
  13. /** Possible type of platform file dialogs. */
  14. enum class FileDialogType
  15. {
  16. OpenFile = 0x0,
  17. OpenFolder = 0x1,
  18. Save = 0x2,
  19. Multiselect = 0x10000,
  20. TypeMask = 0xFFFF
  21. };
  22. /** Contains information about available GPUs on the system. */
  23. struct GPUInfo
  24. {
  25. String names[5];
  26. UINT32 numGPUs;
  27. };
  28. /** Contains information about the system hardware and operating system. */
  29. struct SystemInfo
  30. {
  31. String cpuManufacturer;
  32. String cpuModel;
  33. UINT32 cpuClockSpeedMhz;
  34. UINT32 cpuNumCores;
  35. UINT32 memoryAmountMb;
  36. String osName;
  37. bool osIs64Bit;
  38. GPUInfo gpuInfo;
  39. };
  40. /** Provides access to various operating system specific utility functions. */
  41. class BS_UTILITY_EXPORT PlatformUtility
  42. {
  43. public:
  44. /**
  45. * Terminates the current process.
  46. *
  47. * @param[in] force True if the process should be forcefully terminated with no cleanup.
  48. */
  49. static void terminate(bool force = false);
  50. /** Returns information about the underlying hardware. */
  51. static SystemInfo getSystemInfo();
  52. /** Creates a new universally unique identifier and returns it as a string. */
  53. static String generateUUID();
  54. /**
  55. * Opens the provided file or folder using the default application for that file type, as specified by the operating
  56. * system.
  57. *
  58. * @param[in] path Absolute path to the file or folder to open.
  59. */
  60. static void open(const Path& path);
  61. /** @name Internal
  62. * @{
  63. */
  64. /**
  65. * Assigns information about GPU hardware. This data will be returned by getSystemInfo() when requested. This is
  66. * expeced to be called by the render API backend when initialized.
  67. */
  68. static void _setGPUInfo(GPUInfo gpuInfo) { sGPUInfo = gpuInfo; }
  69. /** @} */
  70. private:
  71. static GPUInfo sGPUInfo;
  72. };
  73. /** @} */
  74. }