World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Lin.cpp
См. документацию.
1 #include "Engine/Point.h"
2 
3 #include <string>
4 #include <vector>
5 
6 #include <sys/time.h>
7 
8 void OS_MsgBox(const char *msg, const char *title) {
9  //MessageBoxA(nullptr, msg, title, 0);
10 }
11 
12 unsigned int OS_GetTime() {
13  struct timeval tv;
14  gettimeofday(&tv, 0);
15  return unsigned((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
16 }
17 
19  //return GetAsyncKeyState(VK_SHIFT);
20  return false;
21 }
22 
24  //return GetAsyncKeyState(VK_CONTROL);
25  return false;
26 }
27 
28 void OS_ShowCursor(bool show) {
29  //ShowCursor(show ? 1 : 0);
30 }
31 
33  //WaitMessage();
34 }
35 
36 void OS_Sleep(int ms) {
37  //Sleep(ms);
38 }
39 
41  //POINT pt;
42  //GetCursorPos(&pt);
43 
44  //SDL or XQueryPointer
45  return Point(0, 0);
46 }
47 
49  /*if (AllocConsole()) {
50  freopen("conin$", "r", stdin);
51  freopen("conout$", "w", stdout);
52  freopen("conout$", "w", stderr);
53 
54  return true;
55  }*/
56 
57  return false;
58 }
59 
60 std::vector<std::string> OS_FindFiles(const std::string& folder, const std::string& mask) {
61  std::vector<std::string> result;
62 
63  /*std::string path = folder + "\\" + mask;
64 
65  WIN32_FIND_DATAA ffd = { 0 };
66  HANDLE hFind = FindFirstFileA(path.c_str(), &ffd);
67  if (INVALID_HANDLE_VALUE == hFind) {
68  return result;
69  }
70 
71  do {
72  if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
73  result.push_back(ffd.cFileName);
74  }
75  } while (FindNextFileA(hFind, &ffd) != 0);
76 
77  FindClose(hFind);*/
78 
79  return result;
80 }
81 
82 
84 
85 bool OS_GetAppString(const char* path, char* out_string, int out_string_size) {
86  return false;
87 }
88 
89 int OS_GetAppInt(const char* pKey, int uDefValue) {
90  return 0;
91 }
92 
93 void OS_SetAppString(const char* pKey, const char* pString) {}
94 
95 void OS_GetAppString(const char* pKeyName, char* pOutString, int uBufLen,
96  const char* pDefaultValue) {}
97 
98 void OS_SetAppInt(const char* pKey, int val) {}
OS_SetAppInt
void OS_SetAppInt(const char *pKey, int val)
Definition: Lin.cpp:98
OS_IfCtrlPressed
bool OS_IfCtrlPressed()
Definition: Lin.cpp:23
mask
GLenum GLint GLuint mask
Definition: SDL_opengl_glext.h:660
OS_OpenConsole
bool OS_OpenConsole()
Definition: Lin.cpp:48
Point.h
OS_GetTime
unsigned int OS_GetTime()
Definition: Lin.cpp:12
path
GLsizei const GLchar *const * path
Definition: SDL_opengl_glext.h:3733
OS_SetAppString
void OS_SetAppString(const char *pKey, const char *pString)
Definition: Lin.cpp:93
OS_MsgBox
void OS_MsgBox(const char *msg, const char *title)
Definition: Lin.cpp:8
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
OS_ShowCursor
void OS_ShowCursor(bool show)
Definition: Lin.cpp:28
OS_GetAppString
bool OS_GetAppString(const char *path, char *out_string, int out_string_size)
Definition: Lin.cpp:85
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1495
OS_FindFiles
std::vector< std::string > OS_FindFiles(const std::string &folder, const std::string &mask)
Definition: Lin.cpp:60
OS_GetMouseCursorPos
Point OS_GetMouseCursorPos()
Definition: Lin.cpp:40
OS_WaitMessage
void OS_WaitMessage()
Definition: Lin.cpp:32
OS_IfShiftPressed
bool OS_IfShiftPressed()
Definition: Lin.cpp:18
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:691
Point
Definition: Point.h:3
OS_Sleep
void OS_Sleep(int ms)
Definition: Lin.cpp:36
OS_GetAppInt
int OS_GetAppInt(const char *pKey, int uDefValue)
Definition: Lin.cpp:89