This repository has been archived on 2022-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
glyphs-juke/common.h

27 lines
442 B
C
Raw Normal View History

2021-08-21 08:29:58 +00:00
#pragma once
#include <codecvt>
#include <cstdlib>
#include <sstream>
#include <string>
#include <windows.h>
namespace gj {
2021-08-23 05:22:56 +00:00
static inline std::wstring ConvertUtf8ToUtf16(const std::string& str) {
2021-08-21 08:29:58 +00:00
std::wostringstream conv;
2021-08-23 05:22:56 +00:00
conv << str.c_str();
return conv.str();
}
2021-08-21 08:29:58 +00:00
2021-08-23 05:22:56 +00:00
[[noreturn]]
static inline void Abort(const std::string& msg) {
MessageBox(NULL, ConvertUtf8ToUtf16(msg).c_str(), L"PROGRAM ABORTED", MB_OK);
2021-08-21 08:29:58 +00:00
std::exit(1);
}
}