]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/os.h
Use swap_control from MESA and EXT before SGI
[irrlicht.git] / source / Irrlicht / os.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __IRR_OS_H_INCLUDED__\r
6 #define __IRR_OS_H_INCLUDED__\r
7 \r
8 #include "IrrCompileConfig.h" // for endian check\r
9 #include "irrTypes.h"\r
10 #include "irrString.h"\r
11 #include "path.h"\r
12 #include "ILogger.h"\r
13 #include "ITimer.h"\r
14 \r
15 namespace irr\r
16 {\r
17 \r
18 namespace os\r
19 {\r
20         class Byteswap\r
21         {\r
22         public:\r
23                 static u16 byteswap(u16 num);\r
24                 static s16 byteswap(s16 num);\r
25                 static u32 byteswap(u32 num);\r
26                 static s32 byteswap(s32 num);\r
27                 static u64 byteswap(u64 num);\r
28                 static s64 byteswap(s64 num);\r
29                 static f32 byteswap(f32 num);\r
30                 // prevent accidental swapping of chars\r
31                 static u8  byteswap(u8  num);\r
32                 static c8  byteswap(c8  num);\r
33         };\r
34 \r
35         class Printer\r
36         {\r
37         public:\r
38                 // prints out a string to the console out stdout or debug log or whatever\r
39                 static void print(const c8* message, ELOG_LEVEL ll = ELL_INFORMATION);\r
40                 static void log(const c8* message, ELOG_LEVEL ll = ELL_INFORMATION);\r
41                 static void log(const wchar_t* message, ELOG_LEVEL ll = ELL_INFORMATION);\r
42                 static void log(const c8* message, const c8* hint, ELOG_LEVEL ll = ELL_INFORMATION);\r
43                 static void log(const c8* message, const io::path& hint, ELOG_LEVEL ll = ELL_INFORMATION);\r
44                 static ILogger* Logger;\r
45         };\r
46 \r
47         class Timer\r
48         {\r
49         public:\r
50 \r
51                 //! returns the current time in milliseconds\r
52                 static u32 getTime();\r
53 \r
54                 //! get current time and date in calendar form\r
55                 static ITimer::RealTimeDate getRealTimeAndDate();\r
56 \r
57                 //! initializes the real timer\r
58                 static void initTimer(bool usePerformanceTimer=true);\r
59 \r
60                 //! sets the current virtual (game) time\r
61                 static void setTime(u32 time);\r
62 \r
63                 //! stops the virtual (game) timer\r
64                 static void stopTimer();\r
65 \r
66                 //! starts the game timer\r
67                 static void startTimer();\r
68 \r
69                 //! sets the speed of the virtual timer\r
70                 static void setSpeed(f32 speed);\r
71 \r
72                 //! gets the speed of the virtual timer\r
73                 static f32 getSpeed();\r
74 \r
75                 //! returns if the timer currently is stopped\r
76                 static bool isStopped();\r
77 \r
78                 //! makes the virtual timer update the time value based on the real time\r
79                 static void tick();\r
80 \r
81                 //! returns the current real time in milliseconds\r
82                 static u32 getRealTime();\r
83 \r
84         private:\r
85 \r
86                 static void initVirtualTimer();\r
87 \r
88                 static f32 VirtualTimerSpeed;\r
89                 static s32 VirtualTimerStopCounter;\r
90                 static u32 StartRealTime;\r
91                 static u32 LastVirtualTime;\r
92                 static u32 StaticTime;\r
93         };\r
94 \r
95 } // end namespace os\r
96 } // end namespace irr\r
97 \r
98 \r
99 #endif\r
100 \r