aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-07-31 11:52:53 +0800
committerchai <chaifix@163.com>2018-07-31 11:52:53 +0800
commitd2828a07043d7cddb982413703ae89477d9496ff (patch)
tree85a6b0e34f79f87a6317727dffa8683be39f97ee
parent727fbae9d16f531c47e2462c40d8a5065e4d9909 (diff)
*update
-rw-r--r--libjin/Core/Game.cpp6
-rw-r--r--libjin/Core/Game.h2
-rw-r--r--test/01HelloWorld/main.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/libjin/Core/Game.cpp b/libjin/Core/Game.cpp
index 929cc07..c5dd5a5 100644
--- a/libjin/Core/Game.cpp
+++ b/libjin/Core/Game.cpp
@@ -26,7 +26,7 @@ namespace core
_running = true;
Event e;
int previous = getMilliSecond();
- float dt = MS_PER_UPDATE / 1000.0f;
+ int dt = MS_PER_UPDATE;
while (_running)
{
while (jin::input::pollEvent(&e))
@@ -38,13 +38,13 @@ namespace core
SAFECALL(_onDraw);
wnd->swapBuffers();
const int current = getMilliSecond();
- dt = (current - previous) / 1000.0f;
+ dt = current - previous;
const int wait = MS_PER_UPDATE - (current - previous);
previous += MS_PER_UPDATE;
if (wait > 0)
{
sleep(wait);
- dt = MS_PER_UPDATE / 1000.0f;
+ dt = MS_PER_UPDATE;
}
else
previous = current;
diff --git a/libjin/Core/Game.h b/libjin/Core/Game.h
index 9359487..31f32d8 100644
--- a/libjin/Core/Game.h
+++ b/libjin/Core/Game.h
@@ -18,7 +18,7 @@ namespace core
typedef void(*onLoad)();
typedef void(*onEvent)(jin::input::Event* e);
- typedef void(*onUpdate)(float dt);
+ typedef void(*onUpdate)(int dt);
typedef void(*onDraw)();
struct Setting : SettingBase
diff --git a/test/01HelloWorld/main.cpp b/test/01HelloWorld/main.cpp
index cf6036b..a1b1a70 100644
--- a/test/01HelloWorld/main.cpp
+++ b/test/01HelloWorld/main.cpp
@@ -12,7 +12,7 @@ void onEvent(jin::input::Event* e)
game->stop();
}
-void onUpdate(float dt)
+void onUpdate(int dt)
{
}