int Dragonfly::clbkConsumeBufferedKey (DWORD key, bool down, char *kstate) { int idx, mode; if (!down) return 0; // only process keydown events if (KEYMOD_SHIFT (kstate)) { } else if (KEYMOD_CONTROL (kstate)) { switch (key) { case OAPI_KEY_DIVIDE: if (SetAttitudeMode (GetAttitudeMode() >= 1 ? 0 : 1)) mode = Internals.Nav_mode_switch->pos = GetAttitudeMode()-1; idx = Internals.Nav_mode_switch->idx; oapiTriggerPanelRedrawArea (0, idx); return 1; } } else { switch (key) { case OAPI_KEY_DIVIDE: if (ToggleAttitudeMode()) { mode = Internals.Nav_mode_switch->pos = GetAttitudeMode()-1; idx = Internals.Nav_mode_switch->idx; oapiTriggerPanelRedrawArea (0, idx); return 1; } }//end switch } return 0; }
// Keyboard interface handler int MMU::clbkConsumeDirectKey (char *kstate) { OBJHANDLE hvessel; if (KEYMOD_SHIFT (kstate)) { return 0; // shift combinations are reserved } else if (KEYMOD_CONTROL (kstate)) { // insert ctrl key combinations here } else { // unmodified keys if (KEYDOWN (kstate, OAPI_KEY_E)) { // "End EVA" if (oapiAcceptDelayedKey (OAPI_KEY_E, 1.0)) { char name[256]; char vname[256]; UINT i; strcpy (vname, GetName()); for (i=0;i<strlen(vname)+1;i++) name[i]=0; for (i=0;i<strlen(vname)-4;i++) name[i]=vname[i]; //strncpy (name, vname,strlen(vname)+1-4); hvessel=oapiGetVesselByName(name); if (hvessel != 0) oapiSetFocusObject(hvessel); }; return 1; } } return 0; }
int EVA::clbkConsumeDirectKey(char *keystate) { if (KEYMOD_SHIFT (keystate)) { return 0; } else if (KEYMOD_CONTROL (keystate)) { } else { if (KEYDOWN (keystate, OAPI_KEY_E)) { if (oapiAcceptDelayedKey (OAPI_KEY_E, 1.0)) { GoDock1 = true; return 1; } } } return 0; }
int MMU::clbkConsumeBufferedKey (DWORD key, bool down, char *kstate) { if (!down) return 0; // only process keydown events if (KEYMOD_SHIFT (kstate)) { } else if (KEYMOD_CONTROL (kstate)) { } else { // unmodified keys switch (key) { case OAPI_KEY_E: { // end EVA DOCKHANDLE hDock = GetDockHandle (0); OBJHANDLE mate = GetDockStatus (hDock); if (mate) { oapiSetFocusObject(mate); oapiDeleteVessel (GetHandle(), mate); } } return 1; } } return 0; }
// -------------------------------------------------------------- // Keyboard interface handler (buffered key events) // -------------------------------------------------------------- int HST::clbkConsumeBufferedKey (DWORD key, bool down, char *kstate) { if (!down) return 0; // only process keydown events if (KEYMOD_CONTROL (kstate)) { switch (key) { case OAPI_KEY_1: // deploy/retract antenna RevertAntenna(); return 1; case OAPI_KEY_2: // open/close hatch RevertHatch(); return 1; case OAPI_KEY_3: // open/fold solar arrays RevertArray(); return 1; } } return 0; }