mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 14:03:26 +02:00
fix outfit glitches, init combobox, move shaders, remove unused particles files, create timer utility
This commit is contained in:
@@ -48,20 +48,5 @@ private:
|
||||
|
||||
extern Clock g_clock;
|
||||
|
||||
class Timer
|
||||
{
|
||||
public:
|
||||
Timer() { restart(); }
|
||||
|
||||
void restart() { m_startTicks = g_clock.ticks(); }
|
||||
|
||||
ticks_t startTicks() { return m_startTicks; }
|
||||
ticks_t ticksElapsed() { return g_clock.ticks() - m_startTicks; }
|
||||
double timeElapsed() { return ticksElapsed()/1000.0; }
|
||||
|
||||
private:
|
||||
ticks_t m_startTicks;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -30,7 +30,6 @@ void EventDispatcher::flush()
|
||||
{
|
||||
poll();
|
||||
|
||||
m_eventList.clear();
|
||||
while(!m_scheduledEventList.empty())
|
||||
m_scheduledEventList.pop();
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
Logger g_logger;
|
||||
|
||||
Logger::Logger() : m_terminated(false)
|
||||
Logger::Logger()
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -48,7 +48,6 @@ public:
|
||||
private:
|
||||
std::list<LogMessage> m_logMessages;
|
||||
OnLogCallback m_onLog;
|
||||
bool m_terminated;
|
||||
};
|
||||
|
||||
extern Logger g_logger;
|
||||
|
@@ -48,14 +48,14 @@ void Module::discover(const OTMLNodePtr& moduleNode)
|
||||
|
||||
// set onLoad callback
|
||||
if(OTMLNodePtr node = moduleNode->get("onLoad")) {
|
||||
g_lua.loadFunction(node->value<std::string>(), "@" + node->source() + "[" + node->tag() + "]");
|
||||
g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
|
||||
g_lua.useValue();
|
||||
m_loadCallback = g_lua.polymorphicPop<BooleanCallback>();
|
||||
}
|
||||
|
||||
// set onUnload callback
|
||||
if(OTMLNodePtr node = moduleNode->get("onUnload")) {
|
||||
g_lua.loadFunction(node->value<std::string>(), "@" + node->source() + "[" + node->tag() + "]");
|
||||
g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
|
||||
g_lua.useValue();
|
||||
m_unloadCallback = g_lua.polymorphicPop<SimpleCallback>();
|
||||
}
|
||||
|
35
src/framework/core/timer.cpp
Normal file
35
src/framework/core/timer.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2010-2011 OTClient <https://github.com/edubart/otclient>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "timer.h"
|
||||
#include "clock.h"
|
||||
|
||||
void Timer::restart()
|
||||
{
|
||||
m_startTicks = g_clock.ticks();
|
||||
}
|
||||
|
||||
ticks_t Timer::ticksElapsed()
|
||||
{
|
||||
return g_clock.ticks() - m_startTicks;
|
||||
}
|
43
src/framework/core/timer.h
Normal file
43
src/framework/core/timer.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2010-2011 OTClient <https://github.com/edubart/otclient>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef TIMER_H
|
||||
#define TIMER_H
|
||||
|
||||
#include <framework/util/types.h>
|
||||
|
||||
class Timer
|
||||
{
|
||||
public:
|
||||
Timer() { restart(); }
|
||||
|
||||
void restart();
|
||||
|
||||
ticks_t startTicks() { return m_startTicks; }
|
||||
ticks_t ticksElapsed();
|
||||
double timeElapsed() { return ticksElapsed()/1000.0; }
|
||||
|
||||
private:
|
||||
ticks_t m_startTicks;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user