找回密码
 加入
搜索
查看: 2140|回复: 3

[图形处理] 在游戏窗口中间画一个矩形框,怎么实现?

[复制链接]
发表于 2011-5-9 13:38:18 | 显示全部楼层 |阅读模式
在游戏窗口中间画一个矩形框,只有外框,中空。
宽度为游戏窗口的1/3
高度为1/2
发表于 2011-5-9 15:52:28 | 显示全部楼层
无法实现  gdi 试试
发表于 2011-5-9 19:13:31 | 显示全部楼层
给你个例子,自己看吧。 有注释。

#include <WindowsConstants.au3>
#include <WinAPI.au3>

ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 200, 20, 0xFF, 3000)

;              中心点的坐标X Y     线的长度/2  线宽  颜色   延迟时间
Func ShowCross($start_x, $start_y, $length, $width, $color, $time)
        Local $hDC, $hPen, $obj_orig

        $hDC = _WinAPI_GetWindowDC(0) ; 获取桌面的DC
        $hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)  ;创建画笔对象
        $obj_orig = _WinAPI_SelectObject($hDC, $hPen)  ;将对象选择到设备描述表中。
        
        _WinAPI_DrawLine($hDC, $start_x - $length, $start_y - $length, $start_x + $length, $start_y - $length) ; 上面的那条线 从左到右
        Sleep(1000)  ;这个延迟在实际应用中不需要。我是为了让你看的更清楚,才加的
        _WinAPI_DrawLine($hDC, $start_x - $length, $start_y + $length, $start_x + $length, $start_y + $length) ; 下面的那条线 从左到右
        Sleep(1000)  ;这个延迟在实际应用中不需要。我是为了让你看的更清楚,才加的
        _WinAPI_DrawLine($hDC, $start_x - $length, $start_y - $length, $start_x - $length, $start_y + $length) ; 左面的那条线 从上到下
        Sleep(1000)  ;这个延迟在实际应用中不需要。我是为了让你看的更清楚,才加的
        _WinAPI_DrawLine($hDC, $start_x + $length, $start_y - $length, $start_x + $length, $start_y + $length) ; 右面的那条线 从上到下
        Sleep($time)  ;延迟一段时间。
        ; 重画窗口。清除屏幕上的线条
        _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

        ; 清除资源
        _WinAPI_SelectObject($hDC, $obj_orig)
        _WinAPI_DeleteObject($hPen)
        _WinAPI_ReleaseDC(0, $hDC)
EndFunc
发表于 2011-5-9 21:20:13 | 显示全部楼层
按照3楼的代码,我对魔兽3窗口进行了绘图,可是对使用dx的游戏画面貌似不怎么好用哎,虽然也有画出来,但是一直闪烁,显示的也不完整
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-15 00:34 , Processed in 0.098789 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表