//-------------------------------------------------------------- void MagicMirrorApp::update(){ camGrabber->update(); // calls grabeframe function if ( camGrabber->isFrameNew() ){ // is there any new pixel data camBuffer = camGrabber->getPixels(); // load texture from camera pixel buffer backgroundTexture.loadData(camBuffer, CONF_CAM_W, CONF_CAM_H, GL_RGB); // find marker tracker->calc(camBuffer, &detMarker, &detMarkerCount); logFoundMarkerIDs(); // get current time in ms and handle the Content Elements related to the found marker unsigned long nowMs = Tools::getMicros() / 1000L; addElementForFoundMarker(nowMs); updateVisibleElements(nowMs); // ToDo ... vielleicht geht das noch schöner? So is irgendwie unelegant if (visibleElements.empty()) { if (lastTimeMarkerFound + CONF_INFO_SHOW_ANI_AFTER_MILSEC < nowMs) { infoAnimation->moveIn(); } } else { lastTimeMarkerFound = nowMs; infoAnimation->moveOut(); } } infoAnimation->update(); }
void Carousel::setSelectedElement(uint8_t index) { selectedElement = index; updateVisibleElements(); }