Exemplo n.º 1
0
void CloudsHUDController::populateQuestion(const string& question, bool forceOn, bool animate){
//    cout << "setting text with current value " << question << " " << hudLabelMap["QuestionTextBox"]->getText() << endl;
    // EZ: Commented this out because populateQuestion should only be called when hover starts
    // Otherwise it wouldn't work if hovering over the same question twice.
//	if( ofToUpper(hudLabelMap["QuestionTextBox"]->getText()) == ofToUpper(question) ){
//		return;
//	}
//	else
    if(question == ""){
		animateOff( CLOUDS_HUD_QUESTION );
	}
	else{
        //JG HACK specific question
        //Is it possible to truly simulate reality?
        //What makes a satisfying interaction
        //How does the network accelerate creativity?
        
        //question = "Is it possible to truly simulate reality?";
        //JG END HACK
        
		hudLabelMap["QuestionTextBox"]->setText( question, forceOn );
		
		if( forceOn ){
			if(animate){
				animateOn( CLOUDS_HUD_QUESTION );
			}
			else{
				hudLabelMap["QuestionTextBox"]->instantIn();
			}
		}
	}
}
Exemplo n.º 2
0
void CloudsHUDController::populateMap(const string& leftBox, const string& rightBox, bool forceOn){
    hudLabelMap["TopicTextBoxLeft"]->setText( leftBox, forceOn );
    hudLabelMap["TopicTextBoxRight"]->setText( rightBox, forceOn );
    
    if( forceOn ){
        animateOn( CLOUDS_HUD_MAP );
    }
}
Exemplo n.º 3
0
void CloudsHUDController::playCued(){
    if (bLowerThirdCued) {
        // display the lower third if the cued clip is still running
        if (ofGetElapsedTimef() < cuedClipEndTime) {
            animateOn(CLOUDS_HUD_LOWER_THIRD);
        }
        bLowerThirdCued = false;
    }
}
Exemplo n.º 4
0
void MediaInterface::updateServer(const ds::UpdateParams& p){
	ds::ui::Sprite::updateServer(p);

	if(mIdling != isIdling()){
		mIdling = isIdling();
		if(mIdling){
			animateOff();
		} else {
			animateOn();
		}
	}
}
Exemplo n.º 5
0
//BIO
void CloudsHUDController::populateLowerThird(const string& firstName, const string& lastName, const string& title, const string& location, const string& textbox, bool forceOn) {
    
    CloudsHUDLabel* firstNameLabel  = hudLabelMap["BylineFirstNameTextBox_1_"];
    CloudsHUDLabel* lastNameLabel  = hudLabelMap["BylineLastNameTextBox"];
    
    firstNameLabel->setText( firstName, forceOn );
    lastNameLabel->setText( lastName, forceOn );
    
    int firstNameRight = firstNameLabel->getRightEdge();
    int lastNameRight = lastNameLabel->getRightEdge();
    int rightEdge = 0;
    
    if(firstNameRight > lastNameRight){
        rightEdge = firstNameRight;
    }
	else{
        rightEdge = lastNameRight;
	}

//    cout<< "right edge: " << rightEdge << endl;
    
    //move these over to float left of name
    CloudsHUDLabel* locationLabel = hudLabelMap["BylineTopicTextBoxTop"];
    CloudsHUDLabel* titleLabel = hudLabelMap["BylineTopicTextBoxBottom"];
    locationLabel->bounds.x = rightEdge + margin;
    titleLabel->bounds.x = rightEdge + margin;
    
    locationLabel->setText( location, forceOn );
    titleLabel->setText( title, forceOn );
    
    //description
    ////reset to default
    CloudsHUDLabel* descLabel = hudLabelMap["BylineBodyCopyTextBox"];
    descLabel->bounds = defaultBioBounds;
    descLabel->layout->setLineLength(defaultBioBounds.width);
    int descLeftEdge = descLabel->bounds.getLeft();
    
    if(locationLabel->getRightEdge() > titleLabel->getRightEdge())
        rightEdge = locationLabel->getRightEdge();
    else
        rightEdge = titleLabel->getRightEdge();
    
    if(rightEdge + margin >= descLeftEdge){
        descLabel->bounds.x = rightEdge+margin;
        descLabel->layout->setLineLength(defaultBioBounds.width - (descLabel->bounds.x - defaultBioBounds.x));
    }
    
    descLabel->setText( textbox, forceOn );
    
    if( forceOn ){
        animateOn( CLOUDS_HUD_LOWER_THIRD );
    }
}
Exemplo n.º 6
0
void StoryView::onAppEvent(const ds::Event& in_e){
	if(in_e.mWhat == IdleEndedEvent::WHAT()){
		const IdleEndedEvent& e((const IdleEndedEvent&)in_e);
		animateOn();
	} else if(in_e.mWhat == IdleStartedEvent::WHAT()){
		animateOff();
	}

	// If you have an event that is dispatched when new content is queryied, you could map that here.
	//if(in_e.mWhat == StoryContentUpdated::WHAT()){
	//	setData();
	//}
}
Exemplo n.º 7
0
StoryView::StoryView(Globals& g)
	: inherited(g.mEngine)
	, mGlobals(g)
	, mEventClient(g.mEngine.getNotifier(), [this](const ds::Event *m){ if(m) this->onAppEvent(*m); })
	, mMessage(nullptr)
{
	hide();
	setOpacity(0.0f);

	mMessage = mGlobals.getText("sample:config").create(mEngine, this);
	if(mMessage){
		mMessage->setText("Hello, whirled!");
	}

	// calls layout
	setData();
	animateOn();

}
Exemplo n.º 8
0
StoryView::StoryView(Globals& g)
	: inherited(g.mEngine)
	, mGlobals(g)
	, mEventClient(g.mEngine.getNotifier(), [this](const ds::Event *m){ if(m) this->onAppEvent(*m); })
	, mSourceText(nullptr)
{

	mSourceText = mGlobals.getText("sample:config").create(mEngine, this);
	if(mSourceText){
		// This is the sprite that can be dragged on to a target
		mSourceText->setText("Drag me"); 

		// The draggable sprite has got to be 
		mSourceText->enable(true);
		mSourceText->enableMultiTouch(ds::ui::MULTITOUCH_CAN_POSITION);
		mSourceText->setDragDestinationCallback([this](ds::ui::Sprite* destinationSprite, const ds::ui::DragDestinationInfo& di){
			if(di.mPhase == ds::ui::DragDestinationInfo::Entered){
				mDestinationText->setText("Drag entered");
			} else if(di.mPhase == ds::ui::DragDestinationInfo::Exited){
				mDestinationText->setText("Drag target");
			} else if(di.mPhase == ds::ui::DragDestinationInfo::Released){
				mDestinationText->setText("Drag released");
			}
		});
	}

	mDestinationText = mGlobals.getText("sample:config").create(mEngine, this);
	if(mDestinationText){
		// This is the sprite that is the target area. (The drop area of the drag and drop)
		// This doesn't need to be a text sprite, it can be any kind of sprite. 
		// We're using text here so we can clearly update the text with what's going on
		mDestinationText->setText("Drag target");

		// Any sprites that are a drag destination target need to be added to the drag destination list
		mEngine.addToDragDestinationList(mDestinationText);
	}

	// calls layout
	setData();
	animateOn();

}
Exemplo n.º 9
0
void TreeInspector::inspectTree(ds::ui::Sprite* sp) {
	clearTree();

	mTreeRoot = sp;

	// todo: make this an xml
	mLayout = new ds::ui::LayoutSprite(mEngine);
	mLayout->setSpriteName(L"This layout");
	mLayout->setLayoutType(ds::ui::LayoutSprite::kLayoutVFlow);
	mLayout->setSpacing(5.0f);
	mLayout->setShrinkToChildren(ds::ui::LayoutSprite::kShrinkBoth);
	mLayout->setTransparent(false);
	mLayout->setColor(ci::Color(0.2f, 0.2f, 0.2f));
	addChildPtr(mLayout);
	
	treeParseRecursive(sp, 0);

	layout();
	animateOn();
}
Exemplo n.º 10
0
void CloudsHUDController::respondToClip(CloudsClip* clip){
	
//	cout << "ID's on clip " << clip.name << " and fcp id? " << clip.fcpFileId << endl;
//	cout << "Clip is " <<  clip.getLinkName() << endl;
//	cout << "speaker: " << speaker.firstName << " " << speaker.lastName << endl;
	
#ifdef KINECT_INPUT
    // EZ: No lower third in Kinect version
	// JG: adding it back
//    return;
#endif
    
	//LOWER THIRD
    //update lower third, but only if the speaker has changed
    if(speaker.fcpID != CloudsSpeaker::speakers[ clip->person ].fcpID){
        speaker = CloudsSpeaker::speakers[ clip->person ];
        populateLowerThird(speaker.firstName, speaker.lastName, speaker.location2, speaker.title, speaker.byline1, false );
        
        if (bVisualSystemDisplayed) {
            // cue up the lower third until the visual system is done
            bLowerThirdCued = true;
            cuedClipEndTime = ofGetElapsedTimef() + clip->getDuration();
        }
        else {
            // display the lower third right away
            animateOn(CLOUDS_HUD_LOWER_THIRD);
        }
    }
    
// PROJECT EXAMPLE
#ifndef OCULUS_RIFT
	if(clip->hasProjectExample && clip->projectExample.exampleVideos.size() ){
		CloudsProjectExample example = clip->projectExample;
        string videoPath = example.exampleVideos[ (int)ofRandom(0, example.exampleVideos.size()) ];
        populateProjectExample( videoPath, example.creatorName, "", example.title, true );
	}
	else{
        animateOff(CLOUDS_HUD_PROJECT_EXAMPLE);
    }
#endif
}
Exemplo n.º 11
0
void CloudsHUDController::populateProjectExample(const string& videoPath, const string& textLeft, const string& textRight, const string& textTop, bool forceOn) {
    if( videoPlayer.isPlaying() ){
        videoPlayer.stop();
    }
    
    if( ofFile(videoPath).exists() ){
        videoPlayer.loadMovie(videoPath);
        videoPlayer.play();
        
        bSkipAVideoFrame = true;
        
        hudLabelMap["ProjectExampleTextboxLeft"]->setText( textLeft, forceOn );
        hudLabelMap["ProjectExampleTextboxRight"]->setText( textRight, forceOn );
        hudLabelMap["ProjectExampleTextBoxTop"]->setText( textTop, forceOn );
        
        if( forceOn ){
            animateOn( CLOUDS_HUD_PROJECT_EXAMPLE );
        }
    }else{
        cout << "CloudsHUDController :: Project example video does not exist: " << videoPath << endl;
    }
}
Exemplo n.º 12
0
void CloudsHUDController::update(){
	//HACK TO KEEP QUESTION ON after asked
	if(hudLabelMap["QuestionTextBox"]->getText() != "" && !hudLabelMap["QuestionTextBox"]->isVisible()){
		hudLabelMap["QuestionTextBox"]->animateIn();
		
	}
//	cout << "CURRENT QUESTION " << hudLabelMap["QuestionTextBox"]->getText() << " VISIBLE? " << (hudLabelMap["QuestionTextBox"]->isVisible() ? "YES" : "NO") << endl;

	for(int i = 0; i < allLayers.size(); i++){
		allLayers[i]->update();
	}
    
    float xScale = ofGetWindowWidth()/hudBounds.width;
    float yScale = ofGetWindowHeight()/hudBounds.height;
    
    scaleAmt = (xScale < yScale) ? xScale : yScale;

    home.hudScale = scaleAmt;
	home.update();
    
    if( videoPlayer.isPlaying() ){
        if( videoPlayer.isFrameNew() ){
            bSkipAVideoFrame = false;
            
            videoBounds.set(0, 0, videoPlayer.getWidth(), videoPlayer.getHeight() );
            videoBounds.scaleTo( svgVideoBounds );
        }
        videoPlayer.update();
    }
    
    if( home.wasHomeOpened() ){
        if( !bIsHudOpen ){
            animateOn( CLOUDS_HUD_FULL );
        }else{
            animateOff();
        }
    }
}
Exemplo n.º 13
0
void CloudsHUDController::actBegan(CloudsActEventArgs& args){
	bDrawHud = true;
	bActJustStarted = true;
	animateOn( CLOUDS_HUD_QUESTION );
}
Exemplo n.º 14
0
void SpriteInspector::inspectSprite(ds::ui::Sprite* sp) {
	clearProperties();

	if(!sp) return;

	mLinkedSprite = sp;

	// todo: make this an xml
	mLayout = new ds::ui::LayoutSprite(mEngine);
	mLayout->setSpriteName(L"This layout");
	mLayout->setLayoutType(ds::ui::LayoutSprite::kLayoutVFlow);
	//mLayout->setSpacing(5.0f);
	mLayout->setShrinkToChildren(ds::ui::LayoutSprite::kShrinkBoth);
	mLayout->setTransparent(false);
	mLayout->setColor(ci::Color(0.2f, 0.2f, 0.2f));
	addChildPtr(mLayout);

	addSpriteProperty(L"name", sp->getSpriteName());
	addSpriteProperty(L"type", ds::wstr_from_utf8(ds::ui::XmlImporter::getSpriteTypeForSprite(sp)));
	addSpriteProperty(L"size", sp->getSize());
	addSpriteProperty(L"color", sp->getColor());
	addSpriteProperty(L"opacity", sp->getOpacity());
	addSpriteProperty(L"center", sp->getCenter());
	addSpriteProperty(L"position", sp->getPosition());
	addSpriteProperty(L"rotation", sp->getRotation());
	addSpriteProperty(L"scale", sp->getScale());
	addSpriteProperty(L"clipping", sp->getClipping());
	addSpritePropertyBlend(L"blend_mode", sp->getBlendMode());
	addSpriteProperty(L"enable", sp->isEnabled());
	addSpriteProperty(L"multitouch", sp->getMultiTouchConstraints());
	addSpriteProperty(L"transparent", sp->getTransparent());
	addSpriteProperty(L"animate_on", ds::wstr_from_utf8(sp->getAnimateOnScript()));
	addSpriteProperty(L"t_pad", sp->mLayoutTPad);
	addSpriteProperty(L"l_pad", sp->mLayoutLPad);
	addSpriteProperty(L"b_pad", sp->mLayoutBPad);
	addSpriteProperty(L"r_pad", sp->mLayoutRPad);
	addSpriteProperty(L"layout_fudge", sp->mLayoutFudge);
	addSpriteProperty(L"layout_size", sp->mLayoutSize);
	addSpritePropertyLayoutSizeMode(L"layout_size_mode", sp->mLayoutUserType);
	addSpritePropertyLayoutVAlign(L"layout_v_align", sp->mLayoutVAlign);
	addSpritePropertyLayoutHAlign(L"layout_h_align", sp->mLayoutHAlign);

	ds::ui::LayoutSprite* ls = dynamic_cast<ds::ui::LayoutSprite*>(mLinkedSprite);
	if(ls){
		addSpritePropertyLayoutType(L"layout_type", ls->getLayoutType());
		addSpriteProperty(L"layout_spacing", ls->getSpacing());
		addSpritePropertyLayoutShrink(L"shrink_to_children", ls->getShrinkToChildren());
		addSpritePropertyLayoutVAlign(L"overall_alignment", ls->getOverallAlignment());
	}

	ds::ui::Text* texty = dynamic_cast<ds::ui::Text*>(mLinkedSprite);
	if(texty){
		addSpriteProperty(L"text", texty->getText());
		addSpriteProperty(L"font", ds::wstr_from_utf8(texty->getConfigName()));
	//	addSpriteProperty(L"font_size", texty->getFontSize());
	}

	ds::ui::MultilineText* multitexty = dynamic_cast<ds::ui::MultilineText*>(mLinkedSprite);
	if(multitexty){
		addSpriteProperty(L"resize_limit", ci::Vec2f(multitexty->getResizeLimitWidth(), multitexty->getResizeLimitHeight()));
		addSpritePropertyLayoutHAlign(L"text_align", multitexty->getAlignment());
	}

	ds::ui::Gradient* grad = dynamic_cast<ds::ui::Gradient*>(mLinkedSprite);
	if(grad){
		addSpriteProperty(L"gradientColors", ds::wstr_from_utf8(ds::ui::XmlImporter::getGradientColorsAsString(grad)));
	}

	ds::ui::Circle* circle = dynamic_cast<ds::ui::Circle*>(mLinkedSprite);
	if(circle){
		addSpriteProperty(L"filled", circle->getFilled());
		addSpriteProperty(L"radius", circle->getRadius());
	}

	ds::ui::Border* border = dynamic_cast<ds::ui::Border*>(mLinkedSprite);
	if(border){
		addSpriteProperty(L"border_width", border->getBorderWidth());
	}

	ds::ui::Image* img = dynamic_cast<ds::ui::Image*>(mLinkedSprite);
	if(img){
		addSpriteProperty(L"filename", ds::wstr_from_utf8(ds::Environment::contract(img->getImageFilename())));
		addSpriteProperty(L"circle_crop", img->getCircleCrop());
	}

	ds::ui::ImageButton* imgB = dynamic_cast<ds::ui::ImageButton*>(mLinkedSprite);
	if(imgB){
		std::string normImgFile = ds::Environment::contract(imgB->getNormalImage().getImageFilename());
		std::string highImgFile = ds::Environment::contract(imgB->getHighImage().getImageFilename());
		if(normImgFile == highImgFile){
			addSpriteProperty(L"filename", ds::wstr_from_utf8(normImgFile));
		} else {
			addSpriteProperty(L"up_image", ds::wstr_from_utf8(normImgFile));
			addSpriteProperty(L"down_image", ds::wstr_from_utf8(highImgFile));
		}
		addSpriteProperty(L"btn_touch_padding", imgB->getPad());
		addSpriteProperty(L"down_image_color", imgB->getHighImageColor());
	}

	layout();
	animateOn();
}