Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Irrlicht
Include
irrOS.h
1
// Copyright (C) 2002-2012 Nikolaus Gebhardt
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5
#ifndef __IRR_OS_H_INCLUDED__
6
#define __IRR_OS_H_INCLUDED__
7
8
#include "IrrCompileConfig.h"
// for endian check
9
#include "irrTypes.h"
10
#include "irrString.h"
11
#include "path.h"
12
#include "ILogger.h"
13
#include "ITimer.h"
14
15
namespace
irr
16
{
17
18
namespace
os
19
{
20
class
IRRLICHT_API
Byteswap
21
{
22
public
:
23
static
u16
byteswap(
u16
num);
24
static
s16
byteswap(
s16
num);
25
static
u32
byteswap(
u32
num);
26
static
s32
byteswap(
s32
num);
27
static
f32
byteswap(
f32
num);
28
// prevent accidental swapping of chars
29
static
u8
byteswap(
u8
num);
30
static
c8
byteswap(
c8
num);
31
};
32
33
class
IRRLICHT_API
Printer
34
{
35
public
:
36
// prints out a string to the console out stdout or debug log or whatever
37
static
void
print(
const
c8
* message);
38
static
void
log(
const
c8
* message,
ELOG_LEVEL
ll =
ELL_INFORMATION
);
39
static
void
log(
const
wchar_t
* message,
ELOG_LEVEL
ll =
ELL_INFORMATION
);
40
static
void
log(
const
c8
* message,
const
c8
* hint,
ELOG_LEVEL
ll =
ELL_INFORMATION
);
41
static
void
log(
const
c8
* message,
const
io::path
& hint,
ELOG_LEVEL
ll =
ELL_INFORMATION
);
42
static
ILogger
* Logger;
43
};
44
45
46
// mixed linear congruential generator (MLCG)
47
// numbers chosen according to L'Ecuyer, Commun. ACM 31 (1988) 742
48
// period is somewhere around m-1
49
class
IRRLICHT_API
Randomizer
50
{
51
public
:
52
54
static
void
reset
(
s32
value=0x0f0f0f0f);
55
57
static
s32
rand
();
58
60
static
f32
frand
();
61
63
static
s32
randMax
();
64
65
private
:
66
67
static
s32
seed;
68
static
const
s32
m = 2147483399;
// a non-Mersenne prime
69
static
const
s32
a = 40692;
// another spectral success story
70
static
const
s32
q = m/a;
71
static
const
s32
r = m%a;
// again less than q
72
static
const
s32
rMax = m-1;
73
};
74
75
76
77
78
class
IRRLICHT_API
Timer
79
{
80
public
:
81
83
static
u32
getTime
();
84
86
static
ITimer::RealTimeDate
getRealTimeAndDate
();
87
89
static
void
initTimer
(
bool
usePerformanceTimer=
true
);
90
92
static
void
setTime
(
u32
time);
93
95
static
void
stopTimer
();
96
98
static
void
startTimer
();
99
101
static
void
setSpeed
(
f32
speed);
102
104
static
f32
getSpeed
();
105
107
static
bool
isStopped
();
108
110
static
void
tick
();
111
113
static
u32
getRealTime
();
114
115
private
:
116
117
static
void
initVirtualTimer();
118
119
static
f32
VirtualTimerSpeed;
120
static
s32
VirtualTimerStopCounter;
121
static
u32
StartRealTime;
122
static
u32
LastVirtualTime;
123
static
u32
StaticTime;
124
};
125
126
}
// end namespace os
127
}
// end namespace irr
128
129
130
#endif
131
irr::ILogger
Interface for logging messages, warnings and errors.
Definition
ILogger.h:39
irr::os::Byteswap
Definition
irrOS.h:21
irr::os::Printer
Definition
irrOS.h:34
irr::os::Randomizer
Definition
irrOS.h:50
irr::os::Randomizer::frand
static f32 frand()
generates a pseudo random number in the range 0..1
irr::os::Randomizer::randMax
static s32 randMax()
get maxmimum number generated by rand()
irr::os::Randomizer::reset
static void reset(s32 value=0x0f0f0f0f)
resets the randomizer
irr::os::Randomizer::rand
static s32 rand()
generates a pseudo random number in the range 0..randMax()
irr::os::Timer
Definition
irrOS.h:79
irr::os::Timer::tick
static void tick()
makes the virtual timer update the time value based on the real time
irr::os::Timer::startTimer
static void startTimer()
starts the game timer
irr::os::Timer::getSpeed
static f32 getSpeed()
gets the speed of the virtual timer
irr::os::Timer::getRealTime
static u32 getRealTime()
returns the current real time in milliseconds
irr::os::Timer::isStopped
static bool isStopped()
returns if the timer currently is stopped
irr::os::Timer::getRealTimeAndDate
static ITimer::RealTimeDate getRealTimeAndDate()
get current time and date in calendar form
irr::os::Timer::initTimer
static void initTimer(bool usePerformanceTimer=true)
initializes the real timer
irr::os::Timer::getTime
static u32 getTime()
returns the current time in milliseconds
irr::os::Timer::setTime
static void setTime(u32 time)
sets the current virtual (game) time
irr::os::Timer::setSpeed
static void setSpeed(f32 speed)
sets the speed of the virtual timer
irr::os::Timer::stopTimer
static void stopTimer()
stops the virtual (game) timer
irr::io::path
core::string< fschar_t > path
Type used for all file system related strings.
Definition
path.h:17
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition
Skylicht.h:33
irr::f32
float f32
32 bit floating point variable.
Definition
irrTypes.h:104
irr::u32
unsigned int u32
32 bit unsigned variable.
Definition
irrTypes.h:58
irr::s16
signed short s16
16 bit signed variable.
Definition
irrTypes.h:48
irr::u8
unsigned char u8
8 bit unsigned variable.
Definition
irrTypes.h:18
irr::c8
char c8
8 bit character variable.
Definition
irrTypes.h:31
irr::ELOG_LEVEL
ELOG_LEVEL
Definition
ILogger.h:18
irr::ELL_INFORMATION
@ ELL_INFORMATION
Useful information to print. For example hardware infos or something started/stopped.
Definition
ILogger.h:23
irr::s32
signed int s32
32 bit signed variable.
Definition
irrTypes.h:66
irr::u16
unsigned short u16
16 bit unsigned variable.
Definition
irrTypes.h:40
irr::ITimer::RealTimeDate
Definition
ITimer.h:36
Generated by
1.17.0