Skip to content

Commit

Permalink
Interactivity prompt for mouse version
Browse files Browse the repository at this point in the history
  • Loading branch information
obviousjim committed Jun 30, 2014
1 parent 89dfd61 commit 30cc569
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<Widget>
<Kind>4</Kind>
<Name>camera swing x</Name>
<Value>66.666671753</Value>
<Value>42.647056580</Value>
</Widget>
<Widget>
<Kind>4</Kind>
Expand Down
12 changes: 6 additions & 6 deletions CloudsData/visualsystems/_Intro/Presets/TunnelWarp/Questions.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Canvas>
<Kind>40</Kind>
<Name>Questions</Name>
<IsMinified>1</IsMinified>
<XPosition>1.000000000</XPosition>
<YPosition>231.000000000</YPosition>
<IsMinified>0</IsMinified>
<XPosition>802.000000000</XPosition>
<YPosition>269.000000000</YPosition>
</Canvas>
<Widget>
<Kind>2</Kind>
Expand All @@ -29,13 +29,13 @@
<Widget>
<Kind>4</Kind>
<Name>Inner Radius</Name>
<Value>13.615762711</Value>
<Value>20.000000000</Value>
</Widget>
<Widget>
<Kind>6</Kind>
<Name>Tug Distance</Name>
<HighValue>134.285705566</HighValue>
<LowValue>91.428573608</LowValue>
<HighValue>153.578430176</HighValue>
<LowValue>62.598041534</LowValue>
</Widget>
<Widget>
<Kind>6</Kind>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Kind>40</Kind>
<Name>Settings</Name>
<IsMinified>0</IsMinified>
<XPosition>574.000000000</XPosition>
<YPosition>252.000000000</YPosition>
<XPosition>372.000000000</XPosition>
<YPosition>195.000000000</YPosition>
</Canvas>
<Widget>
<Kind>2</Kind>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,49 +13,49 @@
<SliderCurves>
<Mapping>
<Widget>
<WidgetName>Max Point Size</WidgetName>
<WidgetID>3</WidgetID>
<WidgetName>Max Distance</WidgetName>
<WidgetID>7</WidgetID>
<WidgetCanvasParent>RenderSettings</WidgetCanvasParent>
</Widget>
<Track></Track>
</Mapping>
<Mapping>
<Widget>
<WidgetName>Wireframe Alpha</WidgetName>
<WidgetID>15</WidgetID>
<WidgetName>Perlin Amplitude</WidgetName>
<WidgetID>9</WidgetID>
<WidgetCanvasParent>RenderSettings</WidgetCanvasParent>
</Widget>
<Track></Track>
</Mapping>
<Mapping>
<Widget>
<WidgetName>camera swing damp</WidgetName>
<WidgetID>80</WidgetID>
<WidgetCanvasParent>CamSettings</WidgetCanvasParent>
<WidgetName>Wireframe Alpha</WidgetName>
<WidgetID>15</WidgetID>
<WidgetCanvasParent>RenderSettings</WidgetCanvasParent>
</Widget>
<Track></Track>
</Mapping>
<Mapping>
<Widget>
<WidgetName>camera fwd force</WidgetName>
<WidgetID>70</WidgetID>
<WidgetName>camera swing damp</WidgetName>
<WidgetID>80</WidgetID>
<WidgetCanvasParent>CamSettings</WidgetCanvasParent>
</Widget>
<Track></Track>
</Mapping>
<Mapping>
<Widget>
<WidgetName>Max Distance</WidgetName>
<WidgetID>7</WidgetID>
<WidgetName>Max Point Size</WidgetName>
<WidgetID>3</WidgetID>
<WidgetCanvasParent>RenderSettings</WidgetCanvasParent>
</Widget>
<Track></Track>
</Mapping>
<Mapping>
<Widget>
<WidgetName>Perlin Amplitude</WidgetName>
<WidgetID>9</WidgetID>
<WidgetCanvasParent>RenderSettings</WidgetCanvasParent>
<WidgetName>camera fwd force</WidgetName>
<WidgetID>70</WidgetID>
<WidgetCanvasParent>CamSettings</WidgetCanvasParent>
</Widget>
<Track></Track>
</Mapping>
Expand Down
2 changes: 1 addition & 1 deletion CloudsHUDDesigner/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
//--------------------------------------------------------------
int main(){
// set width, height, mode (OF_WINDOW or OF_FULLSCREEN)
ofSetupOpenGL(1024, 768, OF_WINDOW);
ofSetupOpenGL(1920, 1080, OF_WINDOW);
ofRunApp(new testApp()); // start the app
}
17 changes: 11 additions & 6 deletions CloudsLibrary/src/Input/CloudsInputMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ CloudsInputMouse::CloudsInputMouse()
, lastMouseEventTime(0)
, mouseEventIdleInterval(5)
, feedbackAlpha(0)
, feedbackPrompt("USE YOUR MOUSE TO INTERACT")
, feedbackPrompt("USE THE MOUSE TO INTERACT")
, cursorDownSize(10)
, cursorUpSize(12)
{
feedbackFont.loadFont(GetCloudsDataPath() + "font/Blender-BOOK.ttf", 15);
feedbackFont.loadFont(GetCloudsDataPath() + "font/Blender-BOOK.ttf", 19);
}

void CloudsInputMouse::enable(){
Expand Down Expand Up @@ -87,7 +87,8 @@ void CloudsInputMouse::drawCursorDefault(CloudsCursorMode mode, ofVec3f& pos, bo
selfDrawCursorDefault(mode, pos, bDragged, focus, fadeOut, bDragged? cursorDownSize:cursorUpSize);
}

void CloudsInputMouse::drawFeedback(float width, float height){
void CloudsInputMouse::drawFeedback(float width, float height, bool drawBrightText){
ofPushStyle();
static ofxEasingQuad easingQuad;

if ((!feedbackTween.isRunning() && feedbackTween.isCompleted())) {
Expand All @@ -102,9 +103,13 @@ void CloudsInputMouse::drawFeedback(float width, float height){
}

feedbackAlpha = feedbackTween.update();

ofSetColor(ofColor::white, feedbackAlpha);
feedbackFont.drawString(feedbackPrompt, (width- feedbackFont.stringWidth(feedbackPrompt)) / 2, height - feedbackFont.stringHeight(feedbackPrompt) - 10);
float positionX = (width - feedbackFont.stringWidth(feedbackPrompt)) / 2;
float positionY = height - feedbackFont.stringHeight(feedbackPrompt) - 10;
ofSetColor(drawBrightText ? ofColor::black : ofColor::white, feedbackAlpha);
feedbackFont.drawString(feedbackPrompt, positionX, positionY);
ofSetColor(drawBrightText ? ofColor::white : ofColor::black, feedbackAlpha);
feedbackFont.drawString(feedbackPrompt, positionX-3, positionY-3);
ofPopStyle();
}

void SetCloudsInputMouse()
Expand Down
2 changes: 1 addition & 1 deletion CloudsLibrary/src/Input/CloudsInputMouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CloudsInputMouse : public CloudsInput
void mouseDragged(ofMouseEventArgs& data);
void mouseReleased(ofMouseEventArgs& data);

void drawFeedback(float width, float height);
void drawFeedback(float width, float height, bool drawBrightText);
float feedbackAlpha;
ofTrueTypeFont feedbackFont;
string feedbackPrompt;
Expand Down
15 changes: 15 additions & 0 deletions CloudsLibrary/src/RGBD/CloudsPlaybackController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include "CloudsInputKinectOSC.h"
#endif

#ifdef MOUSE_INPUT
#include "CloudsInputMouse.h"
#endif

bool listsort(pair<int,string> a, pair<int,string> b){
return a.first > b.first;
}
Expand Down Expand Up @@ -1216,6 +1220,17 @@ void CloudsPlaybackController::drawRenderTarget(){
hud.draw();
CloudsVisualSystem::getRGBDVideoPlayer().drawSubtitles();
#endif

#ifdef MOUSE_INPUT
if (currentVisualSystem->bPromptForInteraction) {
bool drawBrightText = currentVisualSystem->getBgColor().getBrightness() < .5;
ofPtr<CloudsInputMouse> mouseInput = dynamic_pointer_cast<CloudsInputMouse>(GetCloudsInput());
mouseInput->drawFeedback(
currentVisualSystem->getCanvasWidth(),
currentVisualSystem->getCanvasHeight(), drawBrightText);
}
#endif

ofPopStyle();
}
else{
Expand Down
76 changes: 39 additions & 37 deletions CloudsLibrary/src/RGBD/HUD/CloudsHUDController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,9 @@ void CloudsHUDController::animateOn(CloudsHUDLayerSet layer){
}
else if( (layer & CLOUDS_HUD_PROJECT_EXAMPLE) != 0 ){
//JG TEMP
// hudLabelMap["ProjectExampleTextboxLeft"]->animateIn( true );
// hudLabelMap["ProjectExampleTextboxRight"]->animateIn( true );
// hudLabelMap["ProjectExampleTextBoxTop"]->animateIn( true );
hudLabelMap["ProjectExampleTextboxLeft"]->animateIn( true );
hudLabelMap["ProjectExampleTextboxRight"]->animateIn( true );
hudLabelMap["ProjectExampleTextBoxTop"]->animateIn( true );
//JG TEMP
}
else if( (layer & CLOUDS_HUD_MAP) != 0 ){
Expand All @@ -806,6 +806,8 @@ void CloudsHUDController::animateOff(CloudsHUDLayerSet layer){
}

// EZ: CODE BELOW IS FOR INSTANT OUT (TEMP!!!)
// JG: BARBICAN PUTTIN BACK IN
/*
for (map<CloudsHUDLayerSet, vector<CloudsHUDLayer*> >::iterator it = layerSets.begin(); it != layerSets.end(); ++it) {
if ((layer & it->first) != 0) {
hudOpenMap[it->first] = false;
Expand Down Expand Up @@ -839,41 +841,41 @@ void CloudsHUDController::animateOff(CloudsHUDLayerSet layer){
else if( (layer & CLOUDS_HUD_QUESTION) != 0 ){
hudLabelMap["QuestionTextBox"]->instantOut();
}

*/
// EZ: CODE BELOW IS FOR ANIMATING, LET'S JUST INSTANT OUT FOR NOW
// for (map<CloudsHUDLayerSet, vector<CloudsHUDLayer*> >::iterator it = layerSets.begin(); it != layerSets.end(); ++it) {
// if ((layer & it->first) != 0) {
// hudOpenMap[it->first] = false;
// for (int i = 0; i < it->second.size(); i++) {
// it->second[i]->close();
// }
// }
// }
//
// // animate out text, this is sub-optimal
// if( layer == CLOUDS_HUD_FULL ){
// for( map<string, CloudsHUDLabel*>::iterator it=hudLabelMap.begin(); it!= hudLabelMap.end(); ++it ){
// (it->second)->animateOut();
// }
// }
// else if( (layer & CLOUDS_HUD_LOWER_THIRD) != 0 ){
// hudLabelMap["BylineFirstNameTextBox_1_"]->animateOut();
// hudLabelMap["BylineLastNameTextBox"]->animateOut();
// hudLabelMap["BylineTopicTextBoxTop"]->animateOut();
// hudLabelMap["BylineTopicTextBoxBottom"]->animateOut();
// hudLabelMap["BylineBodyCopyTextBox"]->animateOut();
// }
// else if( (layer & CLOUDS_HUD_PROJECT_EXAMPLE) != 0 ){
// hudLabelMap["ProjectExampleTextboxLeft"]->animateOut();
// hudLabelMap["ProjectExampleTextboxRight"]->animateOut();
// hudLabelMap["ProjectExampleTextBoxTop"]->animateOut();
// }
// else if( (layer & CLOUDS_HUD_MAP) != 0 ){
//
// }
// else if( (layer & CLOUDS_HUD_QUESTION) != 0 ){
// hudLabelMap["QuestionTextBox"]->animateOut();
// }
for (map<CloudsHUDLayerSet, vector<CloudsHUDLayer*> >::iterator it = layerSets.begin(); it != layerSets.end(); ++it) {
if ((layer & it->first) != 0) {
hudOpenMap[it->first] = false;
for (int i = 0; i < it->second.size(); i++) {
it->second[i]->close();
}
}
}

// animate out text, this is sub-optimal
if( layer == CLOUDS_HUD_FULL ){
for( map<string, CloudsHUDLabel*>::iterator it=hudLabelMap.begin(); it!= hudLabelMap.end(); ++it ){
(it->second)->animateOut();
}
}
else if( (layer & CLOUDS_HUD_LOWER_THIRD) != 0 ){
hudLabelMap["BylineFirstNameTextBox_1_"]->animateOut();
hudLabelMap["BylineLastNameTextBox"]->animateOut();
hudLabelMap["BylineTopicTextBoxTop"]->animateOut();
hudLabelMap["BylineTopicTextBoxBottom"]->animateOut();
hudLabelMap["BylineBodyCopyTextBox"]->animateOut();
}
else if( (layer & CLOUDS_HUD_PROJECT_EXAMPLE) != 0 ){
hudLabelMap["ProjectExampleTextboxLeft"]->animateOut();
hudLabelMap["ProjectExampleTextboxRight"]->animateOut();
hudLabelMap["ProjectExampleTextBoxTop"]->animateOut();
}
else if( (layer & CLOUDS_HUD_MAP) != 0 ){

}
else if( (layer & CLOUDS_HUD_QUESTION) != 0 ){
hudLabelMap["QuestionTextBox"]->animateOut();
}
}

void CloudsHUDController::saveGuiSettings(){
Expand Down
2 changes: 2 additions & 0 deletions CloudsLibrary/src/VisualSystemsLibrary/CloudsVisualSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,14 @@ void CloudsVisualSystem::draw(ofEventArgs & args)
#ifdef KINECT_INPUT
drawKinectDebug();
#endif
/*
#ifdef MOUSE_INPUT
if (bPromptForInteraction) {
ofPtr<CloudsInputMouse> mouseInput = dynamic_pointer_cast<CloudsInputMouse>(GetCloudsInput());
mouseInput->drawFeedback(CloudsVisualSystem::getSharedRenderTarget().getWidth(), CloudsVisualSystem::getSharedRenderTarget().getHeight());
}
#endif
*/

}

Expand Down
4 changes: 3 additions & 1 deletion CloudsLibrary/src/VisualSystemsLibrary/CloudsVisualSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ class CloudsVisualSystem {
float interludeTypeScale;
float interludeTypeYOffset;
float interludeTypeTracking;

bool bPromptForInteraction;

protected:

Expand All @@ -357,8 +359,8 @@ class CloudsVisualSystem {
ofxUISuperCanvas *tlGui;
ofxUISuperCanvas *postGui;


#if defined(MOUSE_INPUT)
bool bPromptForInteraction;
#elif defined(KINECT_INPUT)
ofxUISuperCanvas *kinectGui;
#elif defined(OCULUS_RIFT)
Expand Down
18 changes: 17 additions & 1 deletion VSGesturePaint/src/testApp.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#include "testApp.h"

#include "CloudsInputMouse.h"

//--------------------------------------------------------------
void testApp::setup(){
ofSetVerticalSync(true);

gesturePaint.setDrawToScreen(false);

gesturePaint.setup();
gesturePaint.playSystem();


}

Expand All @@ -20,6 +23,19 @@ void testApp::update(){
//--------------------------------------------------------------
void testApp::draw(){

gesturePaint.selfPostDraw();

//#ifdef MOUSE_INPUT

if (gesturePaint.bPromptForInteraction) {
bool drawBrightText = gesturePaint.getBgColor().getBrightness() < .5;
ofPtr<CloudsInputMouse> mouseInput = dynamic_pointer_cast<CloudsInputMouse>(GetCloudsInput());
mouseInput->drawFeedback(
gesturePaint.getCanvasWidth(),
gesturePaint.getCanvasHeight(), drawBrightText);
}

//#endif
}

//--------------------------------------------------------------
Expand Down

0 comments on commit 30cc569

Please sign in to comment.