Ejemplo n.º 1
0
void ofx2DPro::exit(ofEventArgs & args){
    if(logGui.isRecording()){
        logGui.record(false);
    }
    
    guiSave("Working");
    guis.clear();
    selfExit();
}
Ejemplo n.º 2
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);
}
Ejemplo n.º 3
0
void ofx2DPro::stop(){
    if (bPlaying){
        if(logGui.isRecording()){
            logGui.record(false);
        }
        
        guiHide();
        guiSave();
        
        ofUnregisterMouseEvents(this);
        ofUnregisterKeyEvents(this);
        ofRemoveListener(ofEvents().update, this, &ofx2DPro::update);
        ofRemoveListener(ofEvents().draw, this, &ofx2DPro::draw);
        ofRemoveListener(ofEvents().exit, this, &ofx2DPro::exit);
        ofRemoveListener(ofEvents().windowResized, this, &ofx2DPro::windowResized);
        
        selfEnd();
        
        bRenderSystem = false;
        bUpdateSystem = false;
        bPlaying = false;
    }
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
//------------------------------------------------------- KEYBOARD
void ofx2DPro::keyPressed(ofKeyEventArgs & args){
    
    if (bGui){
        for (auto &it : guis) {
            if(it->hasKeyboardFocus()){
                return;
            }
        }
        
        switch (args.key) {
            case '\\':
                guiArrange(0);
                return;
                break;
            case '1':
                guiArrange(1);
                return;
                break;
            case '2':
                guiArrange(2);
                return;
                break;
            case '3':
                guiArrange(3);
                return;
                break;
            case '4':
                guiArrange(4);
                return;
                break;
        }
    }
    
#ifdef TARGET_OSX
    if( getModifierSpecialPressed() ){
#else
    if( getModifierControlPressed() ){
#endif
        switch (args.key){
            case 's':
                guiSave(currentPresetName);
                logGui.screenShot(currentPresetName);
                break;
            case 'S':{
#ifdef TARGET_OSX
                string presetName = SystemTextBoxDialog("Save Preset As", currentPresetName);
#else
                string presetName = ofSystemTextBoxDialog("Save Preset As", currentPresetName);
#endif
                guiSave(presetName);
                currentPresetName = presetName;
            }
                break;
            case 'r':{
                logGui.record(!logGui.isRecording());
            }
                break;
            case 'f':
                ofToggleFullscreen();
                break;
            case 'e':
                bEdit = !bEdit;
                break;
            case 'd':
                bDebug = !bDebug;
                break;
        }
    } else {
        if(args.key == 'h'){
//#ifndef PACKED_APP
            guiToggle();
//#endif
        } else {
            selfKeyPressed(args);
        }
    }
}

void ofx2DPro::keyReleased(ofKeyEventArgs & args){
    switch (args.key){
        default:
            selfKeyReleased(args);
            break;
    }
}

//-------------------------------------------------------- MOUSE

bool ofx2DPro::cursorIsOverGUI(){
    if (bGui){
        for(auto &it: guis){
            if(it->isHit(ofGetMouseX(), ofGetMouseY())){
                return true;
            }
        }
    }
	return false;
}

void ofx2DPro::mouseMoved(ofMouseEventArgs& data){
    selfMouseMoved(data);
}