开发者

If AI presses buttons - what buttons to press (key codes)

开发者 https://www.devze.com 2023-04-02 14:23 出处:网络
I\'m programming an android game, where AI, like human, \"presses buttons\" - sends key events (KeyUp and KeyDown). I know, that there are some instrumental buttons like turn off, menu, etc. I\'m usin

I'm programming an android game, where AI, like human, "presses buttons" - sends key events (KeyUp and KeyDown). I know, that there are some instrumental buttons like turn off, menu, etc. I'm using the following key codes now:

        for(int i=1;i<8;i++) {
            _set.setButtons(i, 398+i*2, 399+i*2);
        }

So it is 400,401,...,413. I've read on developer.android.com, that this codes are not assigned to anything. Is it safe to开发者_如何学编程 use this codes for AI "presses"? Is it a good manner?


So, I'm using it for 2 months and all is ok. AI dispatches key event, which is handled in the same way as human's key press.

0

精彩评论

暂无评论...
验证码 换一张
取 消