//-------------------------------------------------------------- void Surface::drawDevicePointSurface(ofRectangle& rect) { ofPushStyle(); ofSetColor(255,255,255,255); ofEnableAlphaBlending(); vector<Device*>::iterator itDevices = m_listDevices.begin(); ofVec2f posSurface; Device* pDevice=0; for (;itDevices!=m_listDevices.end();++itDevices) { pDevice = *itDevices; posSurface.set(rect.getX()+pDevice->m_pointSurface.x*rect.getWidth(), rect.getY()+pDevice->m_pointSurface.y*rect.getHeight()); if (GLOBALS->mp_deviceManager->getDeviceCurrent() == pDevice) { ofSetColor(255,255,255,255); } else ofSetColor(255,255,254,100); ofLine(posSurface.x,posSurface.y-40, posSurface.x, posSurface.y+40); ofLine(posSurface.x-40,posSurface.y, posSurface.x+40,posSurface.y); ofDrawBitmapString(pDevice->m_id, posSurface.x+4, posSurface.y-4); } ofPopStyle(); }
//-------------------------------------------------------------- void Surface::drawDevicePointSurface(ofRectangle& rect) { ofPushStyle(); ofSetColor(255,255,255,255); ofDisableAlphaBlending(); vector<Device*>::iterator itDevices = m_listDevices.begin(); ofVec2f posSurface; Device* pDevice=0; for (;itDevices!=m_listDevices.end();++itDevices) { pDevice = *itDevices; posSurface.set(rect.getX()+pDevice->m_pointSurface.x*rect.getWidth(), rect.getY()+pDevice->m_pointSurface.y*rect.getHeight()); ofLine(posSurface.x,rect.getY(), posSurface.x, rect.getY()+rect.getHeight()); ofLine(rect.getX(),posSurface.y, rect.getX()+rect.getWidth(),posSurface.y); } ofPopStyle(); }
void LaserGroup::normalize(const ofRectangle& boundingBox) { for(auto laser: m_lasers) { ofPoint pos = laser->getPosition(); pos.x = (pos.x - boundingBox.getX()) / boundingBox.getWidth(); pos.y = (pos.y - boundingBox.getY()) / boundingBox.getHeight(); pos.y = 1 - pos.y; laser->setPosition(pos); //ofLogNotice() <<"LaserGroup::normalize -> id " << getId()<< ", channel = " << getChannel() << ", x = " << laser->getPosition().x << ", y = " << laser->getPosition().y << ", z = " << laser->getPosition().z ; } }
void hlct::Helmet::setup(const ofRectangle& stageRect, const ofPixels& helmetPixels, const int& sectionIndex){ this->stageRect.set(stageRect); img.setFromPixels(helmetPixels); gravity = ofRandom(-5.f, -4.f); float sectionWidth = stageRect.getWidth() / HLCT_HELMET_SECTION_COUNT; float sectionX = ofClamp(ofRandom(0, sectionWidth), stageRect.getX() + img.getWidth() / 2, stageRect.getX() + stageRect.getWidth() - img.getWidth()); position.x = sectionX + sectionWidth * sectionIndex; alive = true; win = false; }