暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

olcPGE_Common.cpp 725B

123456789101112131415161718192021222324252627282930313233
  1. #include "olcPGE_Common.h"
  2. namespace olc {
  3. std::wstring ConvertS2W(std::string s)
  4. {
  5. #ifdef _WIN32
  6. int count = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, NULL, 0);
  7. wchar_t* buffer = new wchar_t[count];
  8. MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, buffer, count);
  9. std::wstring w(buffer);
  10. delete[] buffer;
  11. return w;
  12. #else
  13. return L"SVN FTW!";
  14. #endif
  15. }
  16. #ifdef _WIN32
  17. // Thanks @MaGetzUb for this, which allows sprites to be defined
  18. // at construction, by initialising the GDI subsystem
  19. static class GDIPlusStartup
  20. {
  21. public:
  22. GDIPlusStartup()
  23. {
  24. Gdiplus::GdiplusStartupInput startupInput;
  25. ULONG_PTR token;
  26. Gdiplus::GdiplusStartup(&token, &startupInput, NULL);
  27. };
  28. } gdistartup;
  29. #endif
  30. }