diff --git a/src/camera.cpp b/src/camera.cpp index 3cf706da..5006f821 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -52,18 +52,18 @@ mat4 const &Camera::GetProjMatrix() 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_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); } -void Camera::TickDraw(float deltams) +void Camera::TickDraw(float seconds) { - WorldEntity::TickDraw(deltams); + WorldEntity::TickDraw(seconds); } } /* namespace lol */ diff --git a/src/camera.h b/src/camera.h index b9483af8..0e6bf68d 100644 --- a/src/camera.h +++ b/src/camera.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -35,8 +35,8 @@ public: mat4 const &GetProjMatrix(); protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); + virtual void TickGame(float seconds); + virtual void TickDraw(float seconds); private: mat4 m_view_matrix, m_proj_matrix; diff --git a/src/debug/fps.cpp b/src/debug/fps.cpp index 0e61b159..eaad10a7 100644 --- a/src/debug/fps.cpp +++ b/src/debug/fps.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -55,9 +55,9 @@ DebugFps::DebugFps(int x, int y) #endif } -void DebugFps::TickGame(float deltams) +void DebugFps::TickGame(float seconds) { - Entity::TickGame(deltams); + Entity::TickGame(seconds); char buf[1024]; diff --git a/src/debug/fps.h b/src/debug/fps.h index 98238f18..b4f13547 100644 --- a/src/debug/fps.h +++ b/src/debug/fps.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -30,7 +30,7 @@ public: virtual ~DebugFps(); protected: - virtual void TickGame(float deltams); + virtual void TickGame(float seconds); private: DebugFpsData *data; diff --git a/src/debug/quad.cpp b/src/debug/quad.cpp index b4c0024b..f334fa2d 100644 --- a/src/debug/quad.cpp +++ b/src/debug/quad.cpp @@ -96,11 +96,11 @@ private: float x = 0.0f; 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 + 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); x += dx; } @@ -119,7 +119,7 @@ DebugQuad::DebugQuad() : data(new DebugQuadData()) { data->initialised = 0; - data->time = RandF(10000.0f); + data->time = RandF(10.0f); 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()) { @@ -213,7 +213,7 @@ void DebugQuad::TickDraw(float deltams) GLfloat texcoords[12]; 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); for (int i = 0; i < 6; i++) { @@ -224,9 +224,9 @@ void DebugQuad::TickDraw(float deltams) GLfloat colors[18]; 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); for (int i = 0; i < 6; i++) { diff --git a/src/debug/quad.h b/src/debug/quad.h index 97bd14c8..3ce611ce 100644 --- a/src/debug/quad.h +++ b/src/debug/quad.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -30,8 +30,8 @@ public: virtual ~DebugQuad(); protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); + virtual void TickGame(float seconds); + virtual void TickDraw(float seconds); private: void ResetState(); diff --git a/src/debug/record.cpp b/src/debug/record.cpp index d7af2f1d..d767039e 100644 --- a/src/debug/record.cpp +++ b/src/debug/record.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // 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; } -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(); diff --git a/src/debug/record.h b/src/debug/record.h index d5ee9fe8..0c3e81ce 100644 --- a/src/debug/record.h +++ b/src/debug/record.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -30,8 +30,8 @@ public: virtual ~DebugRecord(); protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); + virtual void TickGame(float seconds); + virtual void TickDraw(float seconds); private: DebugRecordData *data; diff --git a/src/debug/sphere.cpp b/src/debug/sphere.cpp index c6a812a3..90a8368e 100644 --- a/src/debug/sphere.cpp +++ b/src/debug/sphere.cpp @@ -121,18 +121,18 @@ DebugSphere::DebugSphere() 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) data->time -= 6.0 * M_PI; } -void DebugSphere::TickDraw(float deltams) +void DebugSphere::TickDraw(float seconds) { - Entity::TickDraw(deltams); + Entity::TickDraw(seconds); if (IsDestroying()) { diff --git a/src/debug/sphere.h b/src/debug/sphere.h index 726ffec8..5790adfc 100644 --- a/src/debug/sphere.h +++ b/src/debug/sphere.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -30,8 +30,8 @@ public: virtual ~DebugSphere(); protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); + virtual void TickGame(float seconds); + virtual void TickDraw(float seconds); private: DebugSphereData *data; diff --git a/src/debug/stats.cpp b/src/debug/stats.cpp index c07e35ab..b08cbc70 100644 --- a/src/debug/stats.cpp +++ b/src/debug/stats.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -46,9 +46,9 @@ DebugStats::DebugStats(char const *path) 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", Ticker::GetFrameNum(), diff --git a/src/debug/stats.h b/src/debug/stats.h index 8512f126..14e544f2 100644 --- a/src/debug/stats.h +++ b/src/debug/stats.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -30,7 +30,7 @@ public: virtual ~DebugStats(); protected: - virtual void TickGame(float deltams); + virtual void TickGame(float seconds); private: DebugStatsData *data; diff --git a/src/emitter.cpp b/src/emitter.cpp index 40213707..dc52d5ca 100644 --- a/src/emitter.cpp +++ b/src/emitter.cpp @@ -50,13 +50,13 @@ Emitter::Emitter(TileSet *tileset, vec3 gravity) data->nparticles = 0; } -void Emitter::TickGame(float deltams) +void Emitter::TickGame(float seconds) { for (int i = 0; i < data->nparticles; 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]); 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++) Scene::GetDefault()->AddTile(data->tileset, data->particles[i], diff --git a/src/emitter.h b/src/emitter.h index 27a3061e..08fb3b56 100644 --- a/src/emitter.h +++ b/src/emitter.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -33,8 +33,8 @@ public: void AddParticle(int id, vec3 pos, vec3 vel); protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); + virtual void TickGame(float seconds); + virtual void TickDraw(float seconds); private: EmitterData *data; diff --git a/src/entity.cpp b/src/entity.cpp index 3f90c602..2498e36f 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -50,7 +50,7 @@ char const *Entity::GetName() return ""; } -void Entity::TickGame(float deltams) +void Entity::TickGame(float seconds) { #if !LOL_RELEASE if (m_tickstate != STATE_PRETICK_GAME) @@ -59,7 +59,7 @@ void Entity::TickGame(float deltams) #endif } -void Entity::TickDraw(float deltams) +void Entity::TickDraw(float seconds) { #if !LOL_RELEASE if (m_tickstate != STATE_PRETICK_DRAW) diff --git a/src/entity.h b/src/entity.h index c4722346..11c25997 100644 --- a/src/entity.h +++ b/src/entity.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -38,8 +38,8 @@ protected: virtual char const *GetName(); 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 { diff --git a/src/font.cpp b/src/font.cpp index d0be713b..5f9408af 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -59,9 +59,9 @@ Font::~Font() delete data; } -void Font::TickDraw(float deltams) +void Font::TickDraw(float seconds) { - Entity::TickDraw(deltams); + Entity::TickDraw(seconds); } char const *Font::GetName() diff --git a/src/font.h b/src/font.h index 596af59b..9cc4b307 100644 --- a/src/font.h +++ b/src/font.h @@ -32,7 +32,7 @@ public: protected: /* Inherited from Entity */ virtual char const *GetName(); - virtual void TickDraw(float deltams); + virtual void TickDraw(float seconds); public: /* New methods */ diff --git a/src/gradient.cpp b/src/gradient.cpp index bb5783e5..9970e22d 100644 --- a/src/gradient.cpp +++ b/src/gradient.cpp @@ -51,14 +51,14 @@ Gradient::Gradient(vec3 aa, vec3 bb) 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, 640.0f, 0.0f, 0.0f, diff --git a/src/gradient.h b/src/gradient.h index 6903315f..e1c3331f 100644 --- a/src/gradient.h +++ b/src/gradient.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -32,8 +32,8 @@ public: char const *GetName() { return ""; } protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); + virtual void TickGame(float seconds); + virtual void TickDraw(float seconds); private: GradientData *data; diff --git a/src/input.h b/src/input.h index 9cdea5d2..e728c921 100644 --- a/src/input.h +++ b/src/input.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -30,7 +30,7 @@ public: static vec2 GetAxis(int axis); static ivec2 GetMousePos(); 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); /* Entities can subscribe to events */ diff --git a/src/platform/ps3/ps3input.cpp b/src/platform/ps3/ps3input.cpp index faa941eb..56fe24a8 100644 --- a/src/platform/ps3/ps3input.cpp +++ b/src/platform/ps3/ps3input.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -81,9 +81,9 @@ Ps3Input::Ps3Input() #endif } -void Ps3Input::TickGame(float deltams) +void Ps3Input::TickGame(float seconds) { - Entity::TickGame(deltams); + Entity::TickGame(seconds); #if defined __CELLOS_LV2__ 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 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); } diff --git a/src/platform/ps3/ps3input.h b/src/platform/ps3/ps3input.h index d857fa5f..e1d368f2 100644 --- a/src/platform/ps3/ps3input.h +++ b/src/platform/ps3/ps3input.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -30,7 +30,7 @@ public: virtual ~Ps3Input(); protected: - virtual void TickGame(float deltams); + virtual void TickGame(float seconds); private: Ps3InputData *data; diff --git a/src/platform/sdl/sdlinput.cpp b/src/platform/sdl/sdlinput.cpp index facd93e4..9bd8ba2b 100644 --- a/src/platform/sdl/sdlinput.cpp +++ b/src/platform/sdl/sdlinput.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -31,7 +31,7 @@ class SdlInputData friend class SdlInput; private: - void Tick(float deltams); + void Tick(float seconds); static ivec2 GetMousePos(); }; @@ -50,25 +50,25 @@ SdlInput::SdlInput() m_gamegroup = GAMEGROUP_BEFORE; } -void SdlInput::TickGame(float deltams) +void SdlInput::TickGame(float seconds) { - Entity::TickGame(deltams); + Entity::TickGame(seconds); #if !defined _WIN32 - data->Tick(deltams); + data->Tick(seconds); #endif } -void SdlInput::TickDraw(float deltams) +void SdlInput::TickDraw(float seconds) { - Entity::TickDraw(deltams); + Entity::TickDraw(seconds); #if defined _WIN32 - data->Tick(deltams); + data->Tick(seconds); #endif } -void SdlInputData::Tick(float deltams) +void SdlInputData::Tick(float seconds) { #if defined USE_SDL /* Handle mouse input */ @@ -86,7 +86,7 @@ void SdlInputData::Tick(float deltams) break; #if 0 case SDL_KEYDOWN: - Input::KeyPressed(event.key.keysym.sym, deltams); + Input::KeyPressed(event.key.keysym.sym, seconds); break; #endif case SDL_MOUSEBUTTONDOWN: @@ -109,7 +109,7 @@ void SdlInputData::Tick(float deltams) Uint8 *keystate = SDL_GetKeyState(NULL); for (int i = 0; i < 256; i++) if (keystate[i]) - Input::KeyPressed(i, deltams); + Input::KeyPressed(i, seconds); #endif #endif } diff --git a/src/platform/sdl/sdlinput.h b/src/platform/sdl/sdlinput.h index 1c74f886..34b96922 100644 --- a/src/platform/sdl/sdlinput.h +++ b/src/platform/sdl/sdlinput.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -30,8 +30,8 @@ public: virtual ~SdlInput(); protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); + virtual void TickGame(float seconds); + virtual void TickDraw(float seconds); private: SdlInputData *data; diff --git a/src/sample.cpp b/src/sample.cpp index bb518181..1877fc5c 100644 --- a/src/sample.cpp +++ b/src/sample.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -77,9 +77,9 @@ Sample::~Sample() delete data; } -void Sample::TickGame(float deltams) +void Sample::TickGame(float seconds) { - Entity::TickGame(deltams); + Entity::TickGame(seconds); } char const *Sample::GetName() diff --git a/src/sample.h b/src/sample.h index 12eb4d9e..03fdf9bd 100644 --- a/src/sample.h +++ b/src/sample.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -35,7 +35,7 @@ public: protected: /* Inherited from Entity */ virtual char const *GetName(); - virtual void TickGame(float deltams); + virtual void TickGame(float seconds); public: /* New methods */ diff --git a/src/sprite.cpp b/src/sprite.cpp index 03340fa7..1606688a 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -41,14 +41,14 @@ Sprite::Sprite(TileSet *tileset, int 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, 0, vec2(1.0f)); diff --git a/src/sprite.h b/src/sprite.h index ae76c084..318e82c2 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -31,8 +31,8 @@ public: virtual ~Sprite(); protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); + virtual void TickGame(float seconds); + virtual void TickDraw(float seconds); private: SpriteData *data; diff --git a/src/text.cpp b/src/text.cpp index 2632a733..f4d93aee 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -80,9 +80,9 @@ void Text::SetAlign(int align) data->align = align; } -void Text::TickDraw(float deltams) +void Text::TickDraw(float seconds) { - Entity::TickDraw(deltams); + Entity::TickDraw(seconds); if (data->text) { diff --git a/src/text.h b/src/text.h index 10e8c237..c037efa8 100644 --- a/src/text.h +++ b/src/text.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -42,7 +42,7 @@ public: }; protected: - virtual void TickDraw(float deltams); + virtual void TickDraw(float seconds); private: TextData *data; diff --git a/src/ticker.cpp b/src/ticker.cpp index b78452ce..e0fae9f5 100644 --- a/src/ticker.cpp +++ b/src/ticker.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -32,7 +32,7 @@ public: TickerData() : todolist(0), autolist(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) { for (int i = 0; i < Entity::ALLGROUP_END; i++) @@ -68,7 +68,7 @@ private: /* Fixed framerate management */ int frame, recording; Timer timer; - float deltams, bias, fps; + float deltatime, bias, fps; /* Background threads */ static void *GameThreadMain(void *p); @@ -181,15 +181,15 @@ void *TickerData::GameThreadMain(void *p) 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) { - data->deltams = 1000.0f / data->fps; + data->deltatime = 1.f / data->fps; } 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 @@ -278,7 +278,7 @@ void *TickerData::GameThreadMain(void *p) Log::Error("entity not idle for game tick\n"); e->m_tickstate = Entity::STATE_PRETICK_GAME; #endif - e->TickGame(data->deltams); + e->TickGame(data->deltatime); #if !LOL_RELEASE if (e->m_tickstate != Entity::STATE_POSTTICK_GAME) Log::Error("entity missed super game tick\n"); @@ -368,7 +368,7 @@ void Ticker::TickDraw() Log::Error("entity not idle for draw tick\n"); e->m_tickstate = Entity::STATE_PRETICK_DRAW; #endif - e->TickDraw(data->deltams); + e->TickDraw(data->deltatime); #if !LOL_RELEASE if (e->m_tickstate != Entity::STATE_POSTTICK_DRAW) 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 * 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 (!data->recording) - data->bias -= framems; + data->bias -= frametime; } void Ticker::StartRecording() diff --git a/src/tileset.cpp b/src/tileset.cpp index a7c384e0..055b9d44 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -111,9 +111,9 @@ TileSet::~TileSet() delete data; } -void TileSet::TickDraw(float deltams) +void TileSet::TickDraw(float seconds) { - Entity::TickDraw(deltams); + Entity::TickDraw(seconds); if (IsDestroying()) { diff --git a/src/tileset.h b/src/tileset.h index f738872e..5214f64c 100644 --- a/src/tileset.h +++ b/src/tileset.h @@ -37,7 +37,7 @@ public: protected: /* Inherited from Entity */ virtual char const *GetName(); - virtual void TickDraw(float deltams); + virtual void TickDraw(float seconds); public: /* New methods */ diff --git a/src/world.cpp b/src/world.cpp index 0d44fe80..d726935f 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -56,14 +56,14 @@ char const *World::GetName() return ""; } -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() diff --git a/src/world.h b/src/world.h index 343ec072..51584d1c 100644 --- a/src/world.h +++ b/src/world.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -32,8 +32,8 @@ public: protected: /* Inherited from Entity */ 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: /* New methods */ diff --git a/src/worldentity.cpp b/src/worldentity.cpp index 614e95a9..37537675 100644 --- a/src/worldentity.cpp +++ b/src/worldentity.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -46,14 +46,14 @@ char const *WorldEntity::GetName() return ""; } -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 */ diff --git a/src/worldentity.h b/src/worldentity.h index cbd420d6..c63b0cf4 100644 --- a/src/worldentity.h +++ b/src/worldentity.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -39,8 +39,8 @@ protected: 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 */ diff --git a/test/tutorial/01_triangle.cpp b/test/tutorial/01_triangle.cpp index bb6e3bbe..f2b7efba 100644 --- a/test/tutorial/01_triangle.cpp +++ b/test/tutorial/01_triangle.cpp @@ -42,9 +42,9 @@ public: m_ready = false; } - virtual void TickDraw(float deltams) + virtual void TickDraw(float seconds) { - WorldEntity::TickDraw(deltams); + WorldEntity::TickDraw(seconds); if (!m_ready) { diff --git a/test/tutorial/02_cube.cpp b/test/tutorial/02_cube.cpp index 2c55bbd9..a1c81fbb 100644 --- a/test/tutorial/02_cube.cpp +++ b/test/tutorial/02_cube.cpp @@ -1,7 +1,7 @@ // // Lol Engine - Cube tutorial // -// Copyright: (c) 2011 Sam Hocevar +// Copyright: (c) 2011-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -61,11 +61,11 @@ public: 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 model = mat4::translate(vec3(0, 0, -4.5)); @@ -75,9 +75,9 @@ public: 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) { diff --git a/test/tutorial/03_fractal.cpp b/test/tutorial/03_fractal.cpp index 48cce01a..c8f3f3cd 100644 --- a/test/tutorial/03_fractal.cpp +++ b/test/tutorial/03_fractal.cpp @@ -1,7 +1,7 @@ // // Lol Engine - Fractal tutorial // -// Copyright: (c) 2011 Sam Hocevar +// Copyright: (c) 2011-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -100,7 +100,7 @@ public: //m_center = f64cmplx(-.22815528839841, -1.11514249704382); //m_center = f64cmplx(0.001643721971153, 0.822467633298876); m_center = f64cmplx(-0.65823419062254, 0.50221777363480); - m_zoom_speed = -0.000025; + m_zoom_speed = -0.025; #else m_center = -0.75; m_zoom_speed = 0.0; @@ -201,9 +201,9 @@ public: 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; m_frame = (m_frame + 1) % 4; @@ -234,7 +234,7 @@ public: m_drag = false; 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) m_translate = 0.0; } @@ -242,14 +242,14 @@ public: 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) { - 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) m_zoom_speed = 0.0; } @@ -259,7 +259,7 @@ public: { f64cmplx oldcenter = m_center; 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) { 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[] = { diff --git a/test/xolotl/xolotl.cpp b/test/xolotl/xolotl.cpp index 21dc092d..4c531177 100644 --- a/test/xolotl/xolotl.cpp +++ b/test/xolotl/xolotl.cpp @@ -2,7 +2,7 @@ // Lol Engine - Xolotl algorithm test // // Copyright: (c) 2011 Soren Renner -// (c) 2011 Sam Hocevar +// (c) 2011-2012 Sam Hocevar // 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 // Public License, Version 2, as published by Sam Hocevar. See @@ -49,12 +49,12 @@ public: 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) { }