]> git.tdb.fi Git - libs/demoscene.git/blob - source/beatcounter.cpp
Allow stages to define actions
[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 }
13
14 void BeatCounter::set_matrix(const GL::Matrix &m)
15 {
16         instance.set_matrix(m);
17 }
18
19 void BeatCounter::beat(int b)
20 {
21         text.set_text(format("%d / %d", b/4, b%4));
22 }
23
24 void BeatCounter::render(GL::Renderer &renderer, const GL::Tag &tag) const
25 {
26         instance.render(renderer, tag);
27 }
28
29 } // namespace DemoScene
30 } // namespace Msp