-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathsys_local.h
More file actions
70 lines (58 loc) · 1.58 KB
/
sys_local.h
File metadata and controls
70 lines (58 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// SimpleGraphic Engine
// (c) David Gowor, 2014
//
// System Local Header
// Platform: Windows
//
#include "common.h"
#include "system.h"
#ifdef _WIN32
#define _WIN32_WINNT _WIN32_WINNT_WIN7
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <shlobj.h>
#include <shellapi.h>
#include <mmsystem.h>
#endif
#include <chrono>
#include <vector>
// =======
// Classes
// =======
// System Main: sys_main.cpp
class sys_main_c: public sys_IMain {
public:
// Interface
int GetTime();
void Sleep(int msec);
bool IsKeyDown(byte key);
void ClipboardCopy(const char* str);
char* ClipboardPaste();
bool SetWorkDir(std::filesystem::path const& newCwd = {});
void SpawnProcess(std::filesystem::path cmdName, const char* argList);
int GetProcessCount(const std::vector<std::wstring>& imageNames);
std::optional<std::string> OpenURL(const char* url); // return value has failure reason
void Error(const char* fmt, ...);
void Exit(const char* msg = NULL);
void Restart();
// Encapsulated
sys_main_c();
bool Run(int argc, char** argv);
byte GlfwKeyToKey(int key, int scancode);
char GlfwKeyExtraChar(int key);
#ifdef _WIN32
HINSTANCE hinst = nullptr;
HICON icon = nullptr;
#endif
class core_IMain* core = nullptr;
bool initialised = false;
bool minimized = false;
volatile bool exitFlag = false;
volatile bool restartFlag = false;
char* exitMsg = nullptr;
char* threadError = nullptr;
bool errorRaised = false;
std::chrono::system_clock::time_point baseTime;
std::vector<uint8_t> heldKeyState;
};