Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Orbiter SDK Orbiter software developers post your questions and answers about the SDK, the API interface, LUA, meshing, etc.

Reply
 
Thread Tools
Old 05-18-2019, 05:30 PM   #1
gattispilot
Addon Developer
 
gattispilot's Avatar
Default clbkConsumeDirectKey

So I have this:
Code:
int LER2016::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate) {
    // only process keydown events
    if (!down) return 0;

    

        if (key == OAPI_KEY_1) {    // rotate- 
            RevertDD0();
            return 1;
        }
        if (key == OAPI_KEY_2) {    // rotate- 
            RevertDD1();
            return 1;
        }
        if (key == OAPI_KEY_NUMPAD8) {    // rotate- 
            TURN_STATE = 1;
            return 1;
        }
        if (key == OAPI_KEY_3) {    // WHEELLOCK
            if (WHEELLOCK == 0) WHEELLOCK = 1;
            else WHEELLOCK = 0;
            return 1;
        }
        if (key == OAPI_KEY_V) {
            SelectCockpitView(CAM);
            CAM = CAM + 1;
            if (CAM > 4) CAM = 0;
            return 1;
        }
        if (key == OAPI_KEY_J) {
            RevertSSCREEN();
            return 1;
        }
        if (key == OAPI_KEY_E)
        {
            SeparateMMU();

        }
        if (key == OAPI_KEY_7)
        {
            if (lighton == 0) lighton = 1;
            else lighton = 0;
            return 1;
        }
    return 0;
}
int LER2016::clbkConsumeDirectKey(char *kstate) {

//    if (!firstTimestepDone) return 0;

    
     if (KEYDOWN(kstate, OAPI_KEY_SUBTRACT)) {
        //pEngine->DecreaseTgtSpeed(down);
         { FORWARDgear = 0;
         REVERSEgear = 1;
         neutralgear = 0;
         LASTGEAR = 0;
         LASTGEAR = 2;
            double dv = 0.001;
            targetSpeed = (targetSpeed + dv);
            if (targetSpeed <0) targetSpeed = 0;
            //SetAnimation(anim_SPEEDCONTROL, targetSpeed);
            //decreaseTgtSpeed = down;
            //increaseTgtSpeed = false;
        }
        return 0;
    }
    else if  (KEYDOWN(kstate, OAPI_KEY_ADD)) {
        FORWARDgear = 1;
        REVERSEgear = 0;
        neutralgear = 0;
        LASTGEAR = 0;
        double dv = 0.001;
        LASTGEAR = 1;
        targetSpeed = (targetSpeed + dv);
        if (targetSpeed > MAXSPEED) targetSpeed = MAXSPEED;
        return 0;
    }
    else if (KEYDOWN(kstate, OAPI_KEY_NUMPAD5)) {//brake
        neutralgear = 1;
        targetSpeed = (targetSpeed - 0.1);
        if (targetSpeed <0) targetSpeed = 0;
//        FORWARDgear = 0;
//        REVERSEgear = 0;
//        neutralgear = 1;
        
    return 0;
    }
    
    if (KEYDOWN(kstate, OAPI_KEY_NUMPAD7)) { // turns wheels left
        ROTATELEFT();
        RESETKEY(kstate, OAPI_KEY_NUMPAD7);
    }
    if (KEYDOWN(kstate, OAPI_KEY_NUMPAD9)) { // turns wheel right
        ROTATERIGHT();
        RESETKEY(kstate, OOAPI_KEY_NUMPAD9);
    }
    FORWARDgear = 0;
    REVERSEgear = 0;
    neutralgear = 1;
    targetSpeed = (targetSpeed - 0.001);
    if (targetSpeed <0) targetSpeed = 0;
    return 0;
}



But when I hold the ADD key down the numpad 7/9 does nothing. When I release the add they work
gattispilot is online now   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 11:11 PM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.