]> git.tdb.fi Git - libs/demoscene.git/blob - source/beatcounter.cpp
Put everything in namespace Msp::DemoScene
[libs/demoscene.git] / source / beatcounter.cpp
1 #include <msp/strings/format.h>
2 #include "beatcounter.h"
3
4 namespace Msp {
5 namespace DemoScene {
6
7 BeatCounter::BeatCounter(Resources &resources):
8         text(resources.get_ui_font(), &resources.get_ui_text_technique()),
9         instance(text)
10 {
11         text.set_alignment(GL::Text::CENTER);
12         instance.set_matrix(GL::Matrix::scaling(0.02f));
13 }
14
15 void BeatCounter::beat(int b)
16 {
17         text.set_text(format("%d / %d", b/4, b%4));
18 }
19
20 void BeatCounter::render(GL::Renderer &renderer, const GL::Tag &tag) const
21 {
22         instance.render(renderer, tag);
23 }
24
25 } // namespace DemoScene
26 } // namespace Msp