Sha256: 149ccd5cc1b6c3ae79c6c9dbdc66eba86d59ef65dc8ca0b588a762b17bbbe59f

Contents?: true

Size: 1.33 KB

Versions: 10

Compression:

Stored size: 1.33 KB

Contents

#include <pixlib/app.hpp>

namespace Pixlib {
  App::App() :
   scene()
  {  }

  App::~App() {
    for (LedCluster* i : led_clusters) {
      delete i;
    }
    led_clusters.clear();
  }

  void App::addFadeCandy(FadeCandy* fc) {
    LedCluster *lc = new LedCluster(fc);

    scene.addCluster(lc);
    led_clusters.push_back(lc);
  }

  float App::scene_fps() {
    return scene.getFps();
  }

  float App::scene_render_time() {
    return scene.get_render_time();
  }

  float App::led_render_time() {
    float total = 0;
    for (LedCluster* i : led_clusters) {
      total += i->render_time();
    }
    return total;
  }

  void App::ProcessMouseMovement(int xoffset, int yoffset) {
    camera.ProcessMouseMovement(xoffset, yoffset);
  }


  void App::ProcessMouseScroll(float x) {
    camera.ProcessMouseScroll(x);
  }

  void App::move_perspective_to_camera() {
    viewed_from.moveTowards(camera, scene.getTimeDelta()*0.8);
  }

  void App::tick(Pattern* pattern, float brightness, int width, int height) {
    frame_timer.end();
    frame_timer.start();
    if (frame_timer.duration() > 0) {
      float rotate_by = 5 * frame_timer.duration();
      camera.rotate(rotate_by);
    }

    for (LedCluster* led_cluster : led_clusters) {
      led_cluster->render(viewed_from, *pattern, brightness);
    }
    scene.render(camera, width, height);
  }
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pixo-0.4.3 ext/pixo/pixlib/src/app.cpp
pixo-0.4.2 ext/pixo/pixlib/src/app.cpp
pixo-0.4.1 ext/pixo/pixlib/src/app.cpp
pixo-0.4.0 ext/pixo/pixlib/src/app.cpp
pixo-0.3.2 ext/pixo/pixlib/src/app.cpp
pixo-0.3.1 ext/pixo/pixlib/src/app.cpp
pixo-0.3.0 ext/pixo/pixlib/src/app.cpp
pixo-0.2.6 ext/pixo/pixlib/src/app.cpp
pixo-0.2.5 ext/pixo/pixlib/src/app.cpp
pixo-0.2.4 ext/pixo/pixlib/src/app.cpp