直接屏幕像素/帧缓冲区访问 [英] Direct screen pixel/framebuffer access

查看:40
本文介绍了直接屏幕像素/帧缓冲区访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试创建一个玩游戏的程序.IE.一个机器人".

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

我希望能够直接访问屏幕上的像素.IE.让我的程序看到"一个游戏,然后移动"(或者至少画出它会移动的图片).

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).

Windows 和 Linux 的建议都值得赞赏,但我猜测在 Linux 上应该更容易.

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

我猜这可以通过一些 X/Gnome 调用来完成?
我不害怕 C,即使是复杂的样本也欢迎.

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

推荐答案

SDL 是一个跨平台的允许您直接访问帧缓冲区像素的库.您可以通过像素访问示例了解如何访问屏幕上的像素文档维基.

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.

这篇关于直接屏幕像素/帧缓冲区访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆