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.
精彩评论