Skip to content

Commit

Permalink
GRAPHICS: Add time handling to subscene quads
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius committed Nov 24, 2017
1 parent cc0cf9b commit 84ddc0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/graphics/aurora/subscenequad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "src/graphics/aurora/subscenequad.h"

#include "src/events/events.h"

namespace Graphics {

namespace Aurora {
Expand Down Expand Up @@ -70,7 +72,12 @@ void SubSceneQuad::render(RenderPass pass) {

glClear(GL_COLOR_BUFFER_BIT);

uint32 now = EventMan.getTimestamp();
float elapsedTime = (now - _lastSampled) / 1000.0f;
_lastSampled = now;

for (unsigned int i = 0; i < _renderables.size(); ++i) {
_renderables[i]->advanceTime(elapsedTime);
_renderables[i]->render(pass);
}

Expand Down
2 changes: 2 additions & 0 deletions src/graphics/aurora/subscenequad.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class SubSceneQuad : public GUIElement {
Common::Matrix4x4 _projection;
Common::Matrix4x4 _transformation;

uint32 _lastSampled;

int _x, _y;
int _width, _height;
};
Expand Down

0 comments on commit 84ddc0e

Please sign in to comment.