设为首页收藏本站官方微博

【代理DLL汉化研究】 [C++] Overlay sample  覆盖代码实例

[复制链接]
查看: 1587|回复: 0
打印 上一主题 下一主题

【代理DLL汉化研究】 [C++] Overlay sample  覆盖代码实例

跳转到指定楼层
楼主
发表于 2009-5-22 11:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

【代理DLL汉化研究】 [C++] Overlay sample  覆盖代码实例

用于在全屏游戏上画东西,写字。
5 n0 w4 o" P7 p+ h' u- E: ?3 s/ y7 j; i/ a3 X
原文
7 h8 C8 Q8 r3 s9 ihttp://www.gamedev.net/community/forums/topic.asp?topic_id=359319
% M5 o* z: E6 G* A- c1 Y  m2 m3 a  r+ K1 M+ G7 U" i
A lot of people seem interested in knowing how to render content over full-screen applications, like XFire and Co, judging by the number of posts about it. Here’s an unmanaged overlaying sample. Visual Studio 2003 and 2005 solutions are included.
% H+ k4 p) _4 d" U& r0 t
; ]& z9 X% E' ^8 \) j; hThe sample uses DirectDraw overlays to render a black 256x64 box to the top-left of the screen, with some text in it. I would’ve shown you a screenshot, but I can’t, due to the way overlays work. Overlays are displayed as the device is painting the monitor from the primary surface. If it’s painting a location where an overlay exists, it paints the monitor with its color instead of the primary surface. Consequently, you can’t capture that in an image.0 ^* ^* ~* [' v) E3 e5 Z5 l) v
" \3 }1 W: P; q& G9 u( s
Back to the sample. The files of interest are:& s5 i) ]1 E3 o" z' Y! _
Overlay.cpp: Window creation (auto-generated, nothing interesting) and the main loop (important).
$ o% R% |4 a( V9 C* E6 Koverlay_renderer.h, overlay_renderer.cpp: The core of the sample. The code is fairly self-explanatory, though.6 l$ W8 J5 R* m0 r" l$ _5 B

& \  [' N; k" C3 `. ]" @One important thing to keep in mind is that overlay support comes with a set of limitations. The following limitations are not checked or accounted for in the sample:! [& L( ?7 }, g  G/ E7 i) K! C
dwAlignBoundarySrc
, h. N0 O) l$ B, M) r3 [dwAlignSizeSrc) Y# u: x; ]! I
dwAlignBoundaryDest: ?& @/ J2 T7 G, ~( K9 }
dwAlignSizeDest
- b) Z9 K3 B; R  {6 MdwAlignStrideAlign % I+ c( k( \7 C* H4 d  x
dwMinOverlayStretch
, o6 j9 n* P1 U/ odwMaxOverlayStretch
0 c( _: j) G3 Z' G% r
* ?8 I4 G. Y( [" J0 Z! oThe limitations are hardware-dependent. For example, my X300 doesn’t impose any alignment restrictions for the source or destination overlay rectangles. In a product, however, you’d want to make sure you check for these and abide by them. Use CapsViewer to find out the limitations of your hardware quickly. I don’t know if the October SDK caps database includes DirectDraw caps or not, but consider checking it out.4 g2 M& \7 h2 o# n; s
, C; [" S, x" r: f! O( k/ [; `
The limitations (and overlays in general) are documented under “DirectDraw->DirectDraw Essentials->Surfaces->Overlay Surfaces” in the DX7 documentation. It’s available at icarusIndie.
& a& Z. h# g9 j- a8 I9 j
/ p  {0 B% t& y* e6 R( gI might write a managed port, if someone’s interested. All feedback’s welcome.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 很美好很美好 很差劲很差劲
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

冒险解谜游戏中文网 ChinaAVG

官方微博官方微信号小黑屋 微信玩家群  

(C) ChinaAVG 2004 - 2019 All Right Reserved. Powered by Discuz! X3.2
辽ICP备11008827号 | 桂公网安备 45010702000051号

冒险,与你同在。 冒险解谜游戏中文网ChinaAVG诞生于2004年9月9日,是全球华人共同的冒险解谜类游戏家园。我们致力于提供各类冒险游戏资讯供大家学习交流。本站所有资源均不用于商业用途。

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