ScummVM API documentation
low_level_system.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_LOWLEVELSYSTEM_H
29 #define HPL_LOWLEVELSYSTEM_H
30 
31 #include "hpl1/engine/libraries/angelscript/angelscript.h"
32 #include "hpl1/engine/system/MemoryManager.h"
33 #include "hpl1/engine/system/SystemTypes.h"
34 
35 class asIScriptEngine;
36 
37 namespace hpl {
38 
39 #ifdef UPDATE_TIMING_ENABLED
40 #define START_TIMING_EX(x, y) \
41  LogUpdate("Updating %s in file %s at line %d\n", x, __FILE__, __LINE__); \
42  unsigned int y##_lTime = GetApplicationTime();
43 #define START_TIMING(x) \
44  LogUpdate("Updating %s in file %s at line %d\n", #x, __FILE__, __LINE__); \
45  unsigned int x##_lTime = GetApplicationTime();
46 #define STOP_TIMING(x) LogUpdate(" Time spent: %d ms\n", GetApplicationTime() - x##_lTime);
47 #define START_TIMING_TAB(x) \
48  LogUpdate("\tUpdating %s in file %s at line %d\n", #x, __FILE__, __LINE__); \
49  unsigned int x##_lTime = GetApplicationTime();
50 #define STOP_TIMING_TAB(x) LogUpdate("\t Time spent: %d ms\n", GetApplicationTime() - x##_lTime);
51 #else
52 #define START_TIMING_EX(x, y)
53 #define START_TIMING(x)
54 #define STOP_TIMING(x)
55 #define START_TIMING_TAB(x)
56 #define STOP_TIMING_TAB(x)
57 #endif
58 
59 class iScript;
60 
61 extern void SetLogFile(const tWString &File);
62 extern void Error(const char *fmt, ...);
63 extern void Warning(const char *fmt, ...);
64 extern void Log(const char *fmt, ...);
65 
66 extern void SetUpdateLogActive(bool abX);
67 extern void LogUpdate(const char *fmt, ...);
68 
69 extern void CreateMessageBoxW(const wchar_t *caption, const wchar_t *fmt, ...);
70 extern void CreateMessageBoxW(eMsgBoxType eType, const wchar_t *caption, const wchar_t *fmt, ...);
71 
72 extern void OpenBrowserWindow(const tWString &URL);
73 
74 extern void CopyTextToClipboard(const tWString &text);
75 extern tWString LoadTextFromClipboard();
76 
77 extern tWString GetSystemSpecialPath(eSystemPath pathType);
78 
79 extern bool FileExists(const tWString &fileName);
80 extern void RemoveFile(const tWString &fileName);
81 extern bool CloneFile(const tWString &srcFileName, const tWString &destFileName,
82  bool failIfExists);
83 extern bool CreateFolder(const tWString &path);
84 extern bool FolderExists(const tWString &path);
85 extern bool IsFileLink(const tWString &path);
86 extern bool LinkFile(const tWString &pointsTo, const tWString &link);
87 extern bool RenameFile(const tWString &from, const tWString &to);
88 extern cDate FileModifiedDate(const tWString &filePath);
89 extern cDate FileCreationDate(const tWString &filePath);
90 
91 extern void SetWindowCaption(const tString &name);
92 
93 extern unsigned long GetApplicationTime();
94 
96 public:
98  ~LowLevelSystem();
99 
104  unsigned long getTime();
105 
109  cDate getDate();
110 
116  iScript *createScript(const tString &name);
117 
123  bool addScriptFunc(const tString &funcDecl, asGENFUNC_t func, int callConv);
124 
131  bool addScriptVar(const tString &varDecl, void *var);
132 
137  void sleep(const unsigned int millisecs);
138 
139 private:
140  asIScriptEngine *_scriptEngine;
141  int _handleCount;
142 };
143 
144 } // namespace hpl
145 
146 #endif // HPL_LOWLEVELSYSTEM_H
Definition: AI.h:36
Definition: Script.h:223
Definition: str.h:59
Definition: SystemTypes.h:154
void sleep(const unsigned int millisecs)
unsigned long getTime()
Definition: low_level_system.h:95
bool addScriptVar(const tString &varDecl, void *var)
Definition: angelscript.h:639
iScript * createScript(const tString &name)
bool addScriptFunc(const tString &funcDecl, asGENFUNC_t func, int callConv)