Otclient
14/8/2020
consoleapplication.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010-2013 OTClient <https://github.com/edubart/otclient>
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a copy
5
* of this software and associated documentation files (the "Software"), to deal
6
* in the Software without restriction, including without limitation the rights
7
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
* copies of the Software, and to permit persons to whom the Software is
9
* furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
13
*
14
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
* THE SOFTWARE.
21
*/
22
23
24
#include "
consoleapplication.h
"
25
#include <
framework/core/clock.h
>
26
#include <
framework/luaengine/luainterface.h
>
27
28
#ifdef FW_NET
29
#include <
framework/net/connection.h
>
30
#endif
31
32
ConsoleApplication
g_app
;
33
34
void
ConsoleApplication::run
()
35
{
36
m_running
=
true
;
37
38
// run the first poll
39
poll
();
40
41
// first clock update
42
g_clock
.
update
();
43
44
g_lua
.
callGlobalField
(
"g_app"
,
"onRun"
);
45
46
while
(!
m_stopping
) {
47
poll
();
48
stdext::millisleep
(1);
49
g_clock
.
update
();
50
m_frameCounter
.
update
();
51
}
52
53
m_stopping
=
false
;
54
m_running
=
false
;
55
}
ConsoleApplication::m_frameCounter
AdaptativeFrameCounter m_frameCounter
Definition:
consoleapplication.h:37
LuaInterface::callGlobalField
void callGlobalField(const std::string &global, const std::string &field, const T &... args)
Definition:
luainterface.h:445
AdaptativeFrameCounter::update
bool update()
Definition:
adaptativeframecounter.cpp:63
Application::m_running
stdext::boolean< false > m_running
Definition:
application.h:73
luainterface.h
stdext::millisleep
void millisleep(size_t ms)
Definition:
time.cpp:45
clock.h
Application::poll
virtual void poll()
Definition:
application.cpp:146
g_lua
LuaInterface g_lua
Definition:
luainterface.cpp:31
ConsoleApplication::run
void run()
Definition:
consoleapplication.cpp:34
Clock::update
void update()
Definition:
clock.cpp:34
g_app
ConsoleApplication g_app
Definition:
consoleapplication.cpp:32
connection.h
Application::m_stopping
stdext::boolean< false > m_stopping
Definition:
application.h:74
consoleapplication.h
g_clock
Clock g_clock
Definition:
clock.cpp:25
ConsoleApplication
Definition:
consoleapplication.h:29
src
framework
core
consoleapplication.cpp
Generated by
1.8.17
For more information visit
https://forum.opentibia.dev/