Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Timeline {
- private:
- RectangleShape rect;
- RectangleShape tLine;
- float songBPM;
- int songMS;
- float songOffset;
- int songDuration;
- float songMultiplier;
- int songSnapMultiplier;
- float MSBB;
- public:
- Timeline(int positionX, int positionY, Vector2f size) {
- rect.setPosition(positionX,positionY);
- rect.setSize(size);
- tLine.setPosition(0,positionY);
- tLine.setSize(Vector2f(1,size.y));
- }
- void updateTiming(float beatsPerMinute, int currentMS, float offset, int duration, float multiplier, int snapMultiplier) {
- songBPM = beatsPerMinute;
- songMS = currentMS;
- songOffset = offset;
- songDuration = duration;
- songMultiplier = multiplier;
- songSnapMultiplier = snapMultiplier;
- }
- void draw(RenderWindow *renderWindow) {
- renderWindow->draw(rect);
- MSBB = (60/songBPM)*1000;
- songMS-=songOffset;
- float increment = ((MSBB/songMultiplier)/songSnapMultiplier);
- float move = songMS-songMultiplier;
- for(int draw = 0; draw < 1024; draw+=increment) {
- tLine.setPosition(512+(draw-move),tLine.getPosition().y);
- renderWindow->draw(tLine);
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement