Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Windows / AGK2 Tier 2 keyboard problem

Author
Message
Ataribaby
1
Years of Service
User Offline
Joined: 5th Sep 2016
Location:
Posted: 14th Sep 2016 21:06
Hello,
I am new here as I bought AGK2 on Steam and trying create game in Tier 2 in C++ with VS 2015 and I encountered problem with keyboard. I made simple code to move avatar with cursor keys like this

if (agk::GetRawKeyState(38))
{
agk::MoveObjectLocalZ(1, 1.0f * (float)(FrameTime() / 1000.f));
animCMD = 1;
}
else if (agk::GetRawKeyState(40))
{
agk::MoveObjectLocalZ(1, -1.0f * (float)(FrameTime() / 1000.f));
animCMD = 1;
}

it moves avatar back and forth on cursor up/down keypresses. All works fine till game window (doesn't matter if windowed or fullscreen) lose focus meanwhile I keep pressed cursor keys to move avatar. Then keys get stuck and even if game window get focus again keys looks like pressed and I need tap key again to stop move.

I will expect GetRawKeyState will react to lost focus. I tried to look into core.cpp but so far I don't know how to fix this. Also GetPaused() is always 0 even window lose focus.

Any help how to solve this please? Tier 2 looks like amazing way to write simple game.

Cheers,
Tom
Ataribaby
1
Years of Service
User Offline
Joined: 5th Sep 2016
Location:
Posted: 15th Sep 2016 11:43
Solved it by changing Core.cpp

+ Code Snippet

Login to post a reply

Server time is: 2018-02-21 10:49:42
Your offset time is: 2018-02-21 10:49:42