char *getNChars( int n ) { extern SDL_Window *window; SDL_Widget *label_edit; static char buf[32] = {0}; label_edit = printStr( "Please input MBSN into this editor.", 400, 275 ); drawEdit(); SDL_WidgetSetFocus(input_edit); while (edit_length < n) { SDL_Delay(50); } char *str = SDL_EditGetText(input_edit); sprintf(buf, "%s", str); // sprintf(buf, "Your inputs is %s.", str); // printMsg( buf ); SDL_WidgetClose(label_edit); SDL_WidgetClose(input_edit); refreshWin(); edit_length = 0; return buf; }
char *getNCharsPrompt( int n, char *prompt) { // printf( "len %d, prompt %s", n, prompt); // SDL_Delay( 5000); extern SDL_Window *window; SDL_Widget *label_edit; static char buf[32] = {0}; char strPrompt[4096] = {0}; sprintf( strPrompt, "Please inpute %s into this editer.", prompt); label_edit = printStr( strPrompt, 400, 275 ); drawEdit(); SDL_WidgetSetFocus(input_edit); while (edit_length < n) { SDL_Delay(50); } char *str = SDL_EditGetText(input_edit); sprintf(buf, "%s", str); // sprintf(buf, "Your inputs is %s.", str); // printMsg( buf ); SDL_WidgetClose(label_edit); SDL_WidgetClose(input_edit); refreshWin(); edit_length = 0; return buf; }
//-------------------------------------------------------------- void testApp::draw(){ if(edit) ofClear(0); // ofSetColor(255); ofPushMatrix(); if(fullscreen) ofScale(1.25, 1.25); ofEnableBlendMode(OF_BLENDMODE_ADD); if(edit) drawEdit(); else drawGraphics(); if(debug) drawDebug(); ofPopMatrix(); float mult = ofMap(part->getMainVal(), 0.8, 1.0, 0.0, 0.3, true); ofEnableBlendMode(OF_BLENDMODE_MULTIPLY); berserk.begin(); d += 0.1; berserk.setUniform1f("t", d); berserk.setUniform1fv("multi", &mult); ofRect(0,0,ofGetWidth(), ofGetHeight()); berserk.end(); }