]> git.tdb.fi Git - libs/demoscene.git/blob - source/beatcounter.cpp
Initial files lifted from the Skrolliparty 2 demo
[libs/demoscene.git] / source / beatcounter.cpp
1 #include <msp/strings/format.h>
2 #include "beatcounter.h"
3
4 using namespace Msp;
5
6 BeatCounter::BeatCounter(DataFile::Collection &resources):
7         text(resources.get<GL::Font>("ikarius-48.font"), &resources.get<GL::Technique>("basic_text.tech")),
8         instance(text)
9 {
10         text.set_alignment(GL::Text::CENTER);
11         instance.set_matrix(GL::Matrix::scaling(0.02f));
12 }
13
14 void BeatCounter::beat(int b)
15 {
16         text.set_text(format("%d / %d", b/4, b%4));
17 }
18
19 void BeatCounter::render(GL::Renderer &renderer, const GL::Tag &tag) const
20 {
21         instance.render(renderer, tag);
22 }