| @@ -52,18 +52,18 @@ mat4 const &Camera::GetProjMatrix() | |||||
| return m_proj_matrix; | return m_proj_matrix; | ||||
| } | } | ||||
| void Camera::TickGame(float deltams) | |||||
| void Camera::TickGame(float seconds) | |||||
| { | { | ||||
| WorldEntity::TickGame(deltams); | |||||
| WorldEntity::TickGame(seconds); | |||||
| m_view_matrix = mat4::lookat(m_position, m_target, m_up); | m_view_matrix = mat4::lookat(m_position, m_target, m_up); | ||||
| m_proj_matrix = mat4::perspective(45.0f, 640.0f, 480.0f, 1.f, 1000.0f); | m_proj_matrix = mat4::perspective(45.0f, 640.0f, 480.0f, 1.f, 1000.0f); | ||||
| //m_proj_matrix = mat4::ortho(-160, 160, -120, 120, .1f, 2000.0f); | //m_proj_matrix = mat4::ortho(-160, 160, -120, 120, .1f, 2000.0f); | ||||
| } | } | ||||
| void Camera::TickDraw(float deltams) | |||||
| void Camera::TickDraw(float seconds) | |||||
| { | { | ||||
| WorldEntity::TickDraw(deltams); | |||||
| WorldEntity::TickDraw(seconds); | |||||
| } | } | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -35,8 +35,8 @@ public: | |||||
| mat4 const &GetProjMatrix(); | mat4 const &GetProjMatrix(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| mat4 m_view_matrix, m_proj_matrix; | mat4 m_view_matrix, m_proj_matrix; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -55,9 +55,9 @@ DebugFps::DebugFps(int x, int y) | |||||
| #endif | #endif | ||||
| } | } | ||||
| void DebugFps::TickGame(float deltams) | |||||
| void DebugFps::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| char buf[1024]; | char buf[1024]; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -30,7 +30,7 @@ public: | |||||
| virtual ~DebugFps(); | virtual ~DebugFps(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| private: | private: | ||||
| DebugFpsData *data; | DebugFpsData *data; | ||||
| @@ -96,11 +96,11 @@ private: | |||||
| float x = 0.0f; | float x = 0.0f; | ||||
| for (npoints = 0; npoints < SINE_SIZE && x <= 1.0f; npoints++) | for (npoints = 0; npoints < SINE_SIZE && x <= 1.0f; npoints++) | ||||
| { | { | ||||
| float y = 0.5f + 0.5f * lol_sin(x * 2.0f * M_PI + time * 5e-3f); | |||||
| float y = 0.5f + 0.5f * lol_sin(x * 2.0f * M_PI + time * 5.f); | |||||
| points[npoints * 2] = aa.x + (bb.x - aa.x) * x; | points[npoints * 2] = aa.x + (bb.x - aa.x) * x; | ||||
| points[npoints * 2 + 1] = aa.y + (bb.y - aa.y) * y; | points[npoints * 2 + 1] = aa.y + (bb.y - aa.y) * y; | ||||
| float dy = M_PI * lol_cos(x * 2.0f * M_PI + time * 5e-3f); | |||||
| float dy = M_PI * lol_cos(x * 2.0f * M_PI + time * 5.f); | |||||
| float dx = SINE_SPACE / sqrtf(1.0f + dy * dy); | float dx = SINE_SPACE / sqrtf(1.0f + dy * dy); | ||||
| x += dx; | x += dx; | ||||
| } | } | ||||
| @@ -119,7 +119,7 @@ DebugQuad::DebugQuad() | |||||
| : data(new DebugQuadData()) | : data(new DebugQuadData()) | ||||
| { | { | ||||
| data->initialised = 0; | data->initialised = 0; | ||||
| data->time = RandF(10000.0f); | |||||
| data->time = RandF(10.0f); | |||||
| m_drawgroup = DRAWGROUP_HUD; | m_drawgroup = DRAWGROUP_HUD; | ||||
| } | } | ||||
| @@ -142,16 +142,16 @@ void DebugQuad::Advance() | |||||
| } | } | ||||
| } | } | ||||
| void DebugQuad::TickGame(float deltams) | |||||
| void DebugQuad::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| data->time += deltams; | |||||
| data->time += seconds; | |||||
| } | } | ||||
| void DebugQuad::TickDraw(float deltams) | |||||
| void DebugQuad::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| if (!data->initialised && !IsDestroying()) | if (!data->initialised && !IsDestroying()) | ||||
| { | { | ||||
| @@ -213,7 +213,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
| GLfloat texcoords[12]; | GLfloat texcoords[12]; | ||||
| mat4 t1 = mat4::translate(0.5f, 0.5f, 0.0f) | mat4 t1 = mat4::translate(0.5f, 0.5f, 0.0f) | ||||
| * mat4::rotate(0.0254f * data->time, 0.0f, 0.0f, 1.0f) | |||||
| * mat4::rotate(25.4f * data->time, 0.0f, 0.0f, 1.0f) | |||||
| * mat4::translate(-0.5f, -0.5f, 0.0f); | * mat4::translate(-0.5f, -0.5f, 0.0f); | ||||
| for (int i = 0; i < 6; i++) | for (int i = 0; i < 6; i++) | ||||
| { | { | ||||
| @@ -224,9 +224,9 @@ void DebugQuad::TickDraw(float deltams) | |||||
| GLfloat colors[18]; | GLfloat colors[18]; | ||||
| mat4 t2 = mat4::translate(0.5f, 0.5f, 0.5f) | mat4 t2 = mat4::translate(0.5f, 0.5f, 0.5f) | ||||
| * mat4::rotate(0.0154f * data->time, 0.0f, 0.0f, 1.0f) | |||||
| * mat4::rotate(0.0211f * data->time, 0.0f, 1.0f, 0.0f) | |||||
| * mat4::rotate(0.0267f * data->time, 1.0f, 0.0f, 0.0f) | |||||
| * mat4::rotate(15.4f * data->time, 0.0f, 0.0f, 1.0f) | |||||
| * mat4::rotate(21.1f * data->time, 0.0f, 1.0f, 0.0f) | |||||
| * mat4::rotate(26.7f * data->time, 1.0f, 0.0f, 0.0f) | |||||
| * mat4::translate(-0.5f, -0.5f, 0.0f); | * mat4::translate(-0.5f, -0.5f, 0.0f); | ||||
| for (int i = 0; i < 6; i++) | for (int i = 0; i < 6; i++) | ||||
| { | { | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -30,8 +30,8 @@ public: | |||||
| virtual ~DebugQuad(); | virtual ~DebugQuad(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| void ResetState(); | void ResetState(); | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -62,14 +62,14 @@ DebugRecord::DebugRecord(char const *path, float fps) | |||||
| m_drawgroup = DRAWGROUP_CAPTURE; | m_drawgroup = DRAWGROUP_CAPTURE; | ||||
| } | } | ||||
| void DebugRecord::TickGame(float deltams) | |||||
| void DebugRecord::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| } | } | ||||
| void DebugRecord::TickDraw(float deltams) | |||||
| void DebugRecord::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| ivec2 size = Video::GetSize(); | ivec2 size = Video::GetSize(); | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -30,8 +30,8 @@ public: | |||||
| virtual ~DebugRecord(); | virtual ~DebugRecord(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| DebugRecordData *data; | DebugRecordData *data; | ||||
| @@ -121,18 +121,18 @@ DebugSphere::DebugSphere() | |||||
| data->initialised = 0; | data->initialised = 0; | ||||
| } | } | ||||
| void DebugSphere::TickGame(float deltams) | |||||
| void DebugSphere::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| data->time += 0.003f * deltams; | |||||
| data->time += 3.f * seconds; | |||||
| while (data->time > 6.0 * M_PI) | while (data->time > 6.0 * M_PI) | ||||
| data->time -= 6.0 * M_PI; | data->time -= 6.0 * M_PI; | ||||
| } | } | ||||
| void DebugSphere::TickDraw(float deltams) | |||||
| void DebugSphere::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| if (IsDestroying()) | if (IsDestroying()) | ||||
| { | { | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -30,8 +30,8 @@ public: | |||||
| virtual ~DebugSphere(); | virtual ~DebugSphere(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| DebugSphereData *data; | DebugSphereData *data; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -46,9 +46,9 @@ DebugStats::DebugStats(char const *path) | |||||
| m_gamegroup = GAMEGROUP_AFTER; | m_gamegroup = GAMEGROUP_AFTER; | ||||
| } | } | ||||
| void DebugStats::TickGame(float deltams) | |||||
| void DebugStats::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| fprintf(data->fp, "%i %f %f %f %f\n", | fprintf(data->fp, "%i %f %f %f %f\n", | ||||
| Ticker::GetFrameNum(), | Ticker::GetFrameNum(), | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -30,7 +30,7 @@ public: | |||||
| virtual ~DebugStats(); | virtual ~DebugStats(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| private: | private: | ||||
| DebugStatsData *data; | DebugStatsData *data; | ||||
| @@ -50,13 +50,13 @@ Emitter::Emitter(TileSet *tileset, vec3 gravity) | |||||
| data->nparticles = 0; | data->nparticles = 0; | ||||
| } | } | ||||
| void Emitter::TickGame(float deltams) | |||||
| void Emitter::TickGame(float seconds) | |||||
| { | { | ||||
| for (int i = 0; i < data->nparticles; i++) | for (int i = 0; i < data->nparticles; i++) | ||||
| { | { | ||||
| vec3 oldvelocity = data->velocities[i]; | vec3 oldvelocity = data->velocities[i]; | ||||
| data->velocities[i] += deltams * data->gravity; | |||||
| data->positions[i] += deltams * 0.5f | |||||
| data->velocities[i] += seconds * data->gravity; | |||||
| data->positions[i] += seconds * 0.5f | |||||
| * (oldvelocity + data->velocities[i]); | * (oldvelocity + data->velocities[i]); | ||||
| if (data->positions[i].y < -100) | if (data->positions[i].y < -100) | ||||
| { | { | ||||
| @@ -67,12 +67,12 @@ void Emitter::TickGame(float deltams) | |||||
| } | } | ||||
| } | } | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| } | } | ||||
| void Emitter::TickDraw(float deltams) | |||||
| void Emitter::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| for (int i = 0; i < data->nparticles; i++) | for (int i = 0; i < data->nparticles; i++) | ||||
| Scene::GetDefault()->AddTile(data->tileset, data->particles[i], | Scene::GetDefault()->AddTile(data->tileset, data->particles[i], | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -33,8 +33,8 @@ public: | |||||
| void AddParticle(int id, vec3 pos, vec3 vel); | void AddParticle(int id, vec3 pos, vec3 vel); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| EmitterData *data; | EmitterData *data; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -50,7 +50,7 @@ char const *Entity::GetName() | |||||
| return "<entity>"; | return "<entity>"; | ||||
| } | } | ||||
| void Entity::TickGame(float deltams) | |||||
| void Entity::TickGame(float seconds) | |||||
| { | { | ||||
| #if !LOL_RELEASE | #if !LOL_RELEASE | ||||
| if (m_tickstate != STATE_PRETICK_GAME) | if (m_tickstate != STATE_PRETICK_GAME) | ||||
| @@ -59,7 +59,7 @@ void Entity::TickGame(float deltams) | |||||
| #endif | #endif | ||||
| } | } | ||||
| void Entity::TickDraw(float deltams) | |||||
| void Entity::TickDraw(float seconds) | |||||
| { | { | ||||
| #if !LOL_RELEASE | #if !LOL_RELEASE | ||||
| if (m_tickstate != STATE_PRETICK_DRAW) | if (m_tickstate != STATE_PRETICK_DRAW) | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -38,8 +38,8 @@ protected: | |||||
| virtual char const *GetName(); | virtual char const *GetName(); | ||||
| inline int IsDestroying() { return m_destroy; } | inline int IsDestroying() { return m_destroy; } | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| enum | enum | ||||
| { | { | ||||
| @@ -59,9 +59,9 @@ Font::~Font() | |||||
| delete data; | delete data; | ||||
| } | } | ||||
| void Font::TickDraw(float deltams) | |||||
| void Font::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| } | } | ||||
| char const *Font::GetName() | char const *Font::GetName() | ||||
| @@ -32,7 +32,7 @@ public: | |||||
| protected: | protected: | ||||
| /* Inherited from Entity */ | /* Inherited from Entity */ | ||||
| virtual char const *GetName(); | virtual char const *GetName(); | ||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickDraw(float seconds); | |||||
| public: | public: | ||||
| /* New methods */ | /* New methods */ | ||||
| @@ -51,14 +51,14 @@ Gradient::Gradient(vec3 aa, vec3 bb) | |||||
| data->shader = NULL; | data->shader = NULL; | ||||
| } | } | ||||
| void Gradient::TickGame(float deltams) | |||||
| void Gradient::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| } | } | ||||
| void Gradient::TickDraw(float deltams) | |||||
| void Gradient::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| float const vertex[] = { 0.0f, 0.0f, 0.0f, | float const vertex[] = { 0.0f, 0.0f, 0.0f, | ||||
| 640.0f, 0.0f, 0.0f, | 640.0f, 0.0f, 0.0f, | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -32,8 +32,8 @@ public: | |||||
| char const *GetName() { return "<gradient>"; } | char const *GetName() { return "<gradient>"; } | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| GradientData *data; | GradientData *data; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -30,7 +30,7 @@ public: | |||||
| static vec2 GetAxis(int axis); | static vec2 GetAxis(int axis); | ||||
| static ivec2 GetMousePos(); | static ivec2 GetMousePos(); | ||||
| static ivec3 GetMouseButtons(); | static ivec3 GetMouseButtons(); | ||||
| //BH : Added this, is a v0.1 Alpha version. | |||||
| //BH : Added this, is a v0.1 Alpha version. | |||||
| static int GetButtonState(int button); | static int GetButtonState(int button); | ||||
| /* Entities can subscribe to events */ | /* Entities can subscribe to events */ | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -81,9 +81,9 @@ Ps3Input::Ps3Input() | |||||
| #endif | #endif | ||||
| } | } | ||||
| void Ps3Input::TickGame(float deltams) | |||||
| void Ps3Input::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| #if defined __CELLOS_LV2__ | #if defined __CELLOS_LV2__ | ||||
| CellPadInfo2 pad_info2; | CellPadInfo2 pad_info2; | ||||
| @@ -107,9 +107,9 @@ void Ps3Input::TickGame(float deltams) | |||||
| { | { | ||||
| int x = data->pad_data[i].button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X]; | int x = data->pad_data[i].button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X]; | ||||
| int y = data->pad_data[i].button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X + 1]; | int y = data->pad_data[i].button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X + 1]; | ||||
| vec2 delta(4e-3f * (abs(x - 127) < 16 ? 0 : x - 127), | |||||
| -4e-3f * (abs(y - 127) < 16 ? 0 : y - 127)); | |||||
| data->mousepos += delta * deltams; | |||||
| vec2 delta(4.f * (abs(x - 127) < 16 ? 0 : x - 127), | |||||
| -4.f * (abs(y - 127) < 16 ? 0 : y - 127)); | |||||
| data->mousepos += delta * seconds; | |||||
| Input::SetMousePos((ivec2)data->mousepos); | Input::SetMousePos((ivec2)data->mousepos); | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -30,7 +30,7 @@ public: | |||||
| virtual ~Ps3Input(); | virtual ~Ps3Input(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| private: | private: | ||||
| Ps3InputData *data; | Ps3InputData *data; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -31,7 +31,7 @@ class SdlInputData | |||||
| friend class SdlInput; | friend class SdlInput; | ||||
| private: | private: | ||||
| void Tick(float deltams); | |||||
| void Tick(float seconds); | |||||
| static ivec2 GetMousePos(); | static ivec2 GetMousePos(); | ||||
| }; | }; | ||||
| @@ -50,25 +50,25 @@ SdlInput::SdlInput() | |||||
| m_gamegroup = GAMEGROUP_BEFORE; | m_gamegroup = GAMEGROUP_BEFORE; | ||||
| } | } | ||||
| void SdlInput::TickGame(float deltams) | |||||
| void SdlInput::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| #if !defined _WIN32 | #if !defined _WIN32 | ||||
| data->Tick(deltams); | |||||
| data->Tick(seconds); | |||||
| #endif | #endif | ||||
| } | } | ||||
| void SdlInput::TickDraw(float deltams) | |||||
| void SdlInput::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| #if defined _WIN32 | #if defined _WIN32 | ||||
| data->Tick(deltams); | |||||
| data->Tick(seconds); | |||||
| #endif | #endif | ||||
| } | } | ||||
| void SdlInputData::Tick(float deltams) | |||||
| void SdlInputData::Tick(float seconds) | |||||
| { | { | ||||
| #if defined USE_SDL | #if defined USE_SDL | ||||
| /* Handle mouse input */ | /* Handle mouse input */ | ||||
| @@ -86,7 +86,7 @@ void SdlInputData::Tick(float deltams) | |||||
| break; | break; | ||||
| #if 0 | #if 0 | ||||
| case SDL_KEYDOWN: | case SDL_KEYDOWN: | ||||
| Input::KeyPressed(event.key.keysym.sym, deltams); | |||||
| Input::KeyPressed(event.key.keysym.sym, seconds); | |||||
| break; | break; | ||||
| #endif | #endif | ||||
| case SDL_MOUSEBUTTONDOWN: | case SDL_MOUSEBUTTONDOWN: | ||||
| @@ -109,7 +109,7 @@ void SdlInputData::Tick(float deltams) | |||||
| Uint8 *keystate = SDL_GetKeyState(NULL); | Uint8 *keystate = SDL_GetKeyState(NULL); | ||||
| for (int i = 0; i < 256; i++) | for (int i = 0; i < 256; i++) | ||||
| if (keystate[i]) | if (keystate[i]) | ||||
| Input::KeyPressed(i, deltams); | |||||
| Input::KeyPressed(i, seconds); | |||||
| #endif | #endif | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -30,8 +30,8 @@ public: | |||||
| virtual ~SdlInput(); | virtual ~SdlInput(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| SdlInputData *data; | SdlInputData *data; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -77,9 +77,9 @@ Sample::~Sample() | |||||
| delete data; | delete data; | ||||
| } | } | ||||
| void Sample::TickGame(float deltams) | |||||
| void Sample::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| } | } | ||||
| char const *Sample::GetName() | char const *Sample::GetName() | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -35,7 +35,7 @@ public: | |||||
| protected: | protected: | ||||
| /* Inherited from Entity */ | /* Inherited from Entity */ | ||||
| virtual char const *GetName(); | virtual char const *GetName(); | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| public: | public: | ||||
| /* New methods */ | /* New methods */ | ||||
| @@ -41,14 +41,14 @@ Sprite::Sprite(TileSet *tileset, int id) | |||||
| data->id = id; | data->id = id; | ||||
| } | } | ||||
| void Sprite::TickGame(float deltams) | |||||
| void Sprite::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| } | } | ||||
| void Sprite::TickDraw(float deltams) | |||||
| void Sprite::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| Scene::GetDefault()->AddTile(data->tileset, data->id, m_position, | Scene::GetDefault()->AddTile(data->tileset, data->id, m_position, | ||||
| 0, vec2(1.0f)); | 0, vec2(1.0f)); | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -31,8 +31,8 @@ public: | |||||
| virtual ~Sprite(); | virtual ~Sprite(); | ||||
| protected: | protected: | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| SpriteData *data; | SpriteData *data; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -80,9 +80,9 @@ void Text::SetAlign(int align) | |||||
| data->align = align; | data->align = align; | ||||
| } | } | ||||
| void Text::TickDraw(float deltams) | |||||
| void Text::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| if (data->text) | if (data->text) | ||||
| { | { | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -42,7 +42,7 @@ public: | |||||
| }; | }; | ||||
| protected: | protected: | ||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickDraw(float seconds); | |||||
| private: | private: | ||||
| TextData *data; | TextData *data; | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -32,7 +32,7 @@ public: | |||||
| TickerData() : | TickerData() : | ||||
| todolist(0), autolist(0), | todolist(0), autolist(0), | ||||
| nentities(0), | nentities(0), | ||||
| frame(0), recording(0), deltams(0), bias(0), fps(0), | |||||
| frame(0), recording(0), deltatime(0), bias(0), fps(0), | |||||
| quit(0), quitframe(0), quitdelay(20), panic(0) | quit(0), quitframe(0), quitdelay(20), panic(0) | ||||
| { | { | ||||
| for (int i = 0; i < Entity::ALLGROUP_END; i++) | for (int i = 0; i < Entity::ALLGROUP_END; i++) | ||||
| @@ -68,7 +68,7 @@ private: | |||||
| /* Fixed framerate management */ | /* Fixed framerate management */ | ||||
| int frame, recording; | int frame, recording; | ||||
| Timer timer; | Timer timer; | ||||
| float deltams, bias, fps; | |||||
| float deltatime, bias, fps; | |||||
| /* Background threads */ | /* Background threads */ | ||||
| static void *GameThreadMain(void *p); | static void *GameThreadMain(void *p); | ||||
| @@ -181,15 +181,15 @@ void *TickerData::GameThreadMain(void *p) | |||||
| data->frame++; | data->frame++; | ||||
| /* If recording with fixed framerate, set deltams to a fixed value */ | |||||
| /* If recording with fixed framerate, set deltatime to a fixed value */ | |||||
| if (data->recording && data->fps) | if (data->recording && data->fps) | ||||
| { | { | ||||
| data->deltams = 1000.0f / data->fps; | |||||
| data->deltatime = 1.f / data->fps; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| data->deltams = 1000.0f * data->timer.Get(); | |||||
| data->bias += data->deltams; | |||||
| data->deltatime = data->timer.Get(); | |||||
| data->bias += data->deltatime; | |||||
| } | } | ||||
| /* If shutdown is stuck, kick the first entity we meet and see | /* If shutdown is stuck, kick the first entity we meet and see | ||||
| @@ -278,7 +278,7 @@ void *TickerData::GameThreadMain(void *p) | |||||
| Log::Error("entity not idle for game tick\n"); | Log::Error("entity not idle for game tick\n"); | ||||
| e->m_tickstate = Entity::STATE_PRETICK_GAME; | e->m_tickstate = Entity::STATE_PRETICK_GAME; | ||||
| #endif | #endif | ||||
| e->TickGame(data->deltams); | |||||
| e->TickGame(data->deltatime); | |||||
| #if !LOL_RELEASE | #if !LOL_RELEASE | ||||
| if (e->m_tickstate != Entity::STATE_POSTTICK_GAME) | if (e->m_tickstate != Entity::STATE_POSTTICK_GAME) | ||||
| Log::Error("entity missed super game tick\n"); | Log::Error("entity missed super game tick\n"); | ||||
| @@ -368,7 +368,7 @@ void Ticker::TickDraw() | |||||
| Log::Error("entity not idle for draw tick\n"); | Log::Error("entity not idle for draw tick\n"); | ||||
| e->m_tickstate = Entity::STATE_PRETICK_DRAW; | e->m_tickstate = Entity::STATE_PRETICK_DRAW; | ||||
| #endif | #endif | ||||
| e->TickDraw(data->deltams); | |||||
| e->TickDraw(data->deltatime); | |||||
| #if !LOL_RELEASE | #if !LOL_RELEASE | ||||
| if (e->m_tickstate != Entity::STATE_POSTTICK_DRAW) | if (e->m_tickstate != Entity::STATE_POSTTICK_DRAW) | ||||
| Log::Error("entity missed super draw tick\n"); | Log::Error("entity missed super draw tick\n"); | ||||
| @@ -391,16 +391,16 @@ void Ticker::TickDraw() | |||||
| /* If framerate is fixed, force wait time to 1/FPS. Otherwise, set wait | /* If framerate is fixed, force wait time to 1/FPS. Otherwise, set wait | ||||
| * time to 0. */ | * time to 0. */ | ||||
| float framems = data->fps ? 1000.0f / data->fps : 0.0f; | |||||
| float frametime = data->fps ? 1.f / data->fps : 0.f; | |||||
| if (framems > data->bias + 200.0f) | |||||
| framems = data->bias + 200.0f; // Don't go below 5 fps | |||||
| if (framems > data->bias) | |||||
| data->timer.Wait(1e-3f * (framems - data->bias)); | |||||
| if (frametime > data->bias + .2f) | |||||
| frametime = data->bias + .2f; // Don't go below 5 fps | |||||
| if (frametime > data->bias) | |||||
| data->timer.Wait(frametime - data->bias); | |||||
| /* If recording, do not try to compensate for lag. */ | /* If recording, do not try to compensate for lag. */ | ||||
| if (!data->recording) | if (!data->recording) | ||||
| data->bias -= framems; | |||||
| data->bias -= frametime; | |||||
| } | } | ||||
| void Ticker::StartRecording() | void Ticker::StartRecording() | ||||
| @@ -111,9 +111,9 @@ TileSet::~TileSet() | |||||
| delete data; | delete data; | ||||
| } | } | ||||
| void TileSet::TickDraw(float deltams) | |||||
| void TileSet::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| if (IsDestroying()) | if (IsDestroying()) | ||||
| { | { | ||||
| @@ -37,7 +37,7 @@ public: | |||||
| protected: | protected: | ||||
| /* Inherited from Entity */ | /* Inherited from Entity */ | ||||
| virtual char const *GetName(); | virtual char const *GetName(); | ||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickDraw(float seconds); | |||||
| public: | public: | ||||
| /* New methods */ | /* New methods */ | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -56,14 +56,14 @@ char const *World::GetName() | |||||
| return "<world>"; | return "<world>"; | ||||
| } | } | ||||
| void World::TickGame(float deltams) | |||||
| void World::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| } | } | ||||
| void World::TickDraw(float deltams) | |||||
| void World::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| } | } | ||||
| int World::GetWidth() | int World::GetWidth() | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -32,8 +32,8 @@ public: | |||||
| protected: | protected: | ||||
| /* Inherited from Entity */ | /* Inherited from Entity */ | ||||
| virtual char const *GetName(); | virtual char const *GetName(); | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| public: | public: | ||||
| /* New methods */ | /* New methods */ | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -46,14 +46,14 @@ char const *WorldEntity::GetName() | |||||
| return "<worldentity>"; | return "<worldentity>"; | ||||
| } | } | ||||
| void WorldEntity::TickGame(float deltams) | |||||
| void WorldEntity::TickGame(float seconds) | |||||
| { | { | ||||
| Entity::TickGame(deltams); | |||||
| Entity::TickGame(seconds); | |||||
| } | } | ||||
| void WorldEntity::TickDraw(float deltams) | |||||
| void WorldEntity::TickDraw(float seconds) | |||||
| { | { | ||||
| Entity::TickDraw(deltams); | |||||
| Entity::TickDraw(seconds); | |||||
| } | } | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -39,8 +39,8 @@ protected: | |||||
| virtual char const *GetName(); | virtual char const *GetName(); | ||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickDraw(float seconds); | |||||
| }; | }; | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -42,9 +42,9 @@ public: | |||||
| m_ready = false; | m_ready = false; | ||||
| } | } | ||||
| virtual void TickDraw(float deltams) | |||||
| virtual void TickDraw(float seconds) | |||||
| { | { | ||||
| WorldEntity::TickDraw(deltams); | |||||
| WorldEntity::TickDraw(seconds); | |||||
| if (!m_ready) | if (!m_ready) | ||||
| { | { | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine - Cube tutorial | // Lol Engine - Cube tutorial | ||||
| // | // | ||||
| // Copyright: (c) 2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2011-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -61,11 +61,11 @@ public: | |||||
| m_ready = false; | m_ready = false; | ||||
| } | } | ||||
| virtual void TickGame(float deltams) | |||||
| virtual void TickGame(float seconds) | |||||
| { | { | ||||
| WorldEntity::TickGame(deltams); | |||||
| WorldEntity::TickGame(seconds); | |||||
| m_angle += deltams / 1000.0f * 45.0f; | |||||
| m_angle += seconds * 45.0f; | |||||
| mat4 anim = mat4::rotate(m_angle, vec3(0, 1, 0)); | mat4 anim = mat4::rotate(m_angle, vec3(0, 1, 0)); | ||||
| mat4 model = mat4::translate(vec3(0, 0, -4.5)); | mat4 model = mat4::translate(vec3(0, 0, -4.5)); | ||||
| @@ -75,9 +75,9 @@ public: | |||||
| m_matrix = proj * view * model * anim; | m_matrix = proj * view * model * anim; | ||||
| } | } | ||||
| virtual void TickDraw(float deltams) | |||||
| virtual void TickDraw(float seconds) | |||||
| { | { | ||||
| WorldEntity::TickDraw(deltams); | |||||
| WorldEntity::TickDraw(seconds); | |||||
| if (!m_ready) | if (!m_ready) | ||||
| { | { | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine - Fractal tutorial | // Lol Engine - Fractal tutorial | ||||
| // | // | ||||
| // Copyright: (c) 2011 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2011-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -100,7 +100,7 @@ public: | |||||
| //m_center = f64cmplx(-.22815528839841, -1.11514249704382); | //m_center = f64cmplx(-.22815528839841, -1.11514249704382); | ||||
| //m_center = f64cmplx(0.001643721971153, 0.822467633298876); | //m_center = f64cmplx(0.001643721971153, 0.822467633298876); | ||||
| m_center = f64cmplx(-0.65823419062254, 0.50221777363480); | m_center = f64cmplx(-0.65823419062254, 0.50221777363480); | ||||
| m_zoom_speed = -0.000025; | |||||
| m_zoom_speed = -0.025; | |||||
| #else | #else | ||||
| m_center = -0.75; | m_center = -0.75; | ||||
| m_zoom_speed = 0.0; | m_zoom_speed = 0.0; | ||||
| @@ -201,9 +201,9 @@ public: | |||||
| return m_radius * m_window2world * f64cmplx(dx, dy); | return m_radius * m_window2world * f64cmplx(dx, dy); | ||||
| } | } | ||||
| virtual void TickGame(float deltams) | |||||
| virtual void TickGame(float seconds) | |||||
| { | { | ||||
| WorldEntity::TickGame(deltams); | |||||
| WorldEntity::TickGame(seconds); | |||||
| int prev_frame = m_frame; | int prev_frame = m_frame; | ||||
| m_frame = (m_frame + 1) % 4; | m_frame = (m_frame + 1) % 4; | ||||
| @@ -234,7 +234,7 @@ public: | |||||
| m_drag = false; | m_drag = false; | ||||
| if (m_translate != 0.0) | if (m_translate != 0.0) | ||||
| { | { | ||||
| m_translate *= pow(2.0, -deltams * 0.005); | |||||
| m_translate *= pow(2.0, -seconds * 5.0); | |||||
| if (m_translate.norm() / m_radius < 1e-4) | if (m_translate.norm() / m_radius < 1e-4) | ||||
| m_translate = 0.0; | m_translate = 0.0; | ||||
| } | } | ||||
| @@ -242,14 +242,14 @@ public: | |||||
| if ((buttons[0] || buttons[2]) && m_mousepos.x != -1) | if ((buttons[0] || buttons[2]) && m_mousepos.x != -1) | ||||
| { | { | ||||
| double zoom = buttons[0] ? -0.0005 : 0.0005; | |||||
| m_zoom_speed += deltams * zoom; | |||||
| if (m_zoom_speed / zoom > 5) | |||||
| m_zoom_speed = 5 * zoom; | |||||
| double zoom = buttons[0] ? -0.5 : 0.5; | |||||
| m_zoom_speed += seconds * zoom; | |||||
| if (m_zoom_speed / zoom > 5e-3f) | |||||
| m_zoom_speed = 5e-3f * zoom; | |||||
| } | } | ||||
| else if (m_zoom_speed) | else if (m_zoom_speed) | ||||
| { | { | ||||
| m_zoom_speed *= pow(2.0, -deltams * 0.005); | |||||
| m_zoom_speed *= pow(2.0, -seconds * 5.0); | |||||
| if (abs(m_zoom_speed) < 1e-5 || m_drag) | if (abs(m_zoom_speed) < 1e-5 || m_drag) | ||||
| m_zoom_speed = 0.0; | m_zoom_speed = 0.0; | ||||
| } | } | ||||
| @@ -259,7 +259,7 @@ public: | |||||
| { | { | ||||
| f64cmplx oldcenter = m_center; | f64cmplx oldcenter = m_center; | ||||
| double oldradius = m_radius; | double oldradius = m_radius; | ||||
| double zoom = pow(2.0, deltams * m_zoom_speed); | |||||
| double zoom = pow(2.0, seconds * 1e3f * m_zoom_speed); | |||||
| if (m_radius * zoom > 8.0) | if (m_radius * zoom > 8.0) | ||||
| { | { | ||||
| m_zoom_speed *= -1.0; | m_zoom_speed *= -1.0; | ||||
| @@ -425,9 +425,9 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| virtual void TickDraw(float deltams) | |||||
| virtual void TickDraw(float seconds) | |||||
| { | { | ||||
| WorldEntity::TickDraw(deltams); | |||||
| WorldEntity::TickDraw(seconds); | |||||
| static float const vertices[] = | static float const vertices[] = | ||||
| { | { | ||||
| @@ -2,7 +2,7 @@ | |||||
| // Lol Engine - Xolotl algorithm test | // Lol Engine - Xolotl algorithm test | ||||
| // | // | ||||
| // Copyright: (c) 2011 Soren Renner | // Copyright: (c) 2011 Soren Renner | ||||
| // (c) 2011 Sam Hocevar <sam@hocevar.net> | |||||
| // (c) 2011-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -49,12 +49,12 @@ public: | |||||
| virtual char const *GetName() { return "Xolotl"; } | virtual char const *GetName() { return "Xolotl"; } | ||||
| virtual void TickGame(float deltams) | |||||
| virtual void TickGame(float seconds) | |||||
| { | { | ||||
| } | } | ||||
| virtual void TickDraw(float deltams) | |||||
| virtual void TickDraw(float seconds) | |||||
| { | { | ||||
| } | } | ||||