コード例 #1
0
void ofx2DPro::guiEvent(ofxUIEventArgs &e){
    string name = e.widget->getName();

    if(name == "SAVE"){
        ofxUIButton *b = (ofxUIButton *) e.widget;
        if(b->getValue()){
#ifdef TARGET_OSX
            string presetName = SystemTextBoxDialog("Save Preset As", currentPresetName);
#else
			string presetName = ofSystemTextBoxDialog("Save Preset As", currentPresetName);
#endif
            guiSave(presetName);
            currentPresetName = presetName;
        }
    } else if(name == "LOAD"){
        ofxUIButton *b = (ofxUIButton *) e.widget;
        if(b->getValue()){
            ofFileDialogResult result = ofSystemLoadDialog("Load Visual System Preset Folder", true, getDataPath()+"Presets/");
            if(result.bSuccess && result.fileName.length()){
                guiLoadFromPath(result.filePath);
            } else {
                guiLoad();
            }
        }
    } else if( name == "EDIT" ){
        
    } else if( name == "DEBUG" ){
        
    } else {
        ofxUIToggle *t = (ofxUIToggle *) e.widget;
        if(t != NULL){
            if(t->getValue()){
                guiLoad(name);
            }
        }
    }
    selfGuiEvent(e);
}
コード例 #2
0
void ofx2DPro::play(){
    
    if (!bPlaying){
        selfBegin();
        
#ifdef TARGET_RASPBERRY_PI
        consoleListener.setup(this);
#endif
        ofRegisterMouseEvents(this);
        ofRegisterKeyEvents(this);
        ofAddListener(ofEvents().update,this,&ofx2DPro::update);
        ofAddListener(ofEvents().draw,this,&ofx2DPro::draw);
        ofAddListener(ofEvents().exit,this,&ofx2DPro::exit);
        ofAddListener(ofEvents().windowResized, this, &ofx2DPro::windowResized);
        
        guiLoad();
        guiHide();
        
        bRenderSystem = true;
        bUpdateSystem = true;
        bPlaying = true;
    }
}
コード例 #3
0
ファイル: guiMenu.c プロジェクト: awsdert/medit
int  guiData_OnValueChanged ( Ihandle *ih )
{
  switch ( IupGetInt ( ih, IUP_VALUE ) )
  {
  // Load
  case guiData_Load:
    guiLoad( 1 );
    break;

  case guiData_Reset:
    appMethods.OnReset();
    break;

  // Save
  case guiData_Save:
    guiSave();
    break;

  case guiData_Apply:
    appMethods.OnApply();
    break;

  // Modify List
  case guiData_Add:
    appMethods.OnAdd ( 0 );
    break;

  case guiData_Ins:
    appMethods.OnAdd ( 1 );
    break;

  case guiData_Shu:
    appMethods.OnMov ( 1, 1 );
    break;

  case guiData_ShuNB:
    appMethods.OnMov ( 0, 1 );
    break;

  case guiData_Shd:
    appMethods.OnMov ( 1, -1 );
    break;

  case guiData_ShdNB:
    appMethods.OnMov ( 0, -1 );
    break;

  case guiData_Shl:
    appMethods.OnMov ( -1, 0 );
    break;

  case guiData_Shr:
    appMethods.OnMov ( 1, 0 );
    break;

  case guiData_Rem:
    appMethods.OnRem();
    break;

  default:
    return IUP_DEFAULT;
  }

  IupSetInt ( ih, IUP_VALUE, 0 );
  guiMenu_OnValueChanged( guiMenu );
  return IUP_DEFAULT;
}