SHARE
TWEET

Untitled

a guest Dec 13th, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Timeline {
  2. private:
  3.     RectangleShape rect;
  4.     RectangleShape tLine;
  5.     float songBPM;
  6.     int songMS;
  7.     float songOffset;
  8.     int songDuration;
  9.     float songMultiplier;
  10.     int songSnapMultiplier;
  11.     float MSBB;
  12.  
  13. public:
  14.     Timeline(int positionX, int positionY, Vector2f size) {
  15.         rect.setPosition(positionX,positionY);
  16.         rect.setSize(size);
  17.         tLine.setPosition(0,positionY);
  18.         Vector2f v2fTest = Vector2f(1,size.y);
  19.         tLine.setSize(v2fTest);
  20.     }
  21.  
  22.     void updateTiming(float beatsPerMinute, int currentMS, float offset, int duration, float multiplier, int snapMultiplier) {
  23.         songBPM = beatsPerMinute;
  24.         songMS = currentMS;
  25.         songOffset = offset;
  26.         songDuration = duration;
  27.         songMultiplier = multiplier;
  28.         songSnapMultiplier = snapMultiplier;
  29.     }
  30.  
  31.     void draw(RenderWindow *renderWindow) {
  32.         renderWindow->draw(rect);
  33.  
  34.         MSBB = (60/songBPM)*1000;
  35.         songMS-=songOffset;
  36.         float increment = ((MSBB/songMultiplier)/songSnapMultiplier);
  37.         float move = songMS-songMultiplier;
  38.  
  39.         for(int draw = 0; draw < 1024; draw+=increment) {
  40.             tLine.setPosition(512+(draw-move),tLine.getPosition().y);
  41.             renderWindow->draw(tLine);
  42.         }
  43.     }
  44. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top