Direct screen pixel/framebuffer access

2019-07-15 22:59发布

I'd like to try and create a program playing a game. I.e. "a bot".

I want to be able to directly access the pixels on the screen. I.e. have my program "see" a game and then "make a move"(or at least draw a picture of what move it would make).

Both Windows and Linux advice is appreciated, though my guess is that it should be easier to do on Linux.

I'm guessing this could be done with some X/Gnome call?
I'm not afraid of C, even complex samples are welcome.

1条回答
贪生不怕死
2楼-- · 2019-07-15 23:03

SDL is a cross-platform library that allows you to directly access framebuffer pixels. You can learn about accessing the pixels on screen through the pixel access example on the documentation wiki.

Generally speaking, bots don't see the game graphics but see the underlying data structure instead, unless you are trying to do something related to computer vision.

查看更多
登录 后发表回答