标题: 曹操传引擎开发
性别:男-离线 岱瀛
(deving)

长平侯
川峡东路经略使
监管使

Rank: 19Rank: 19Rank: 19Rank: 19
组别 经略使
级别 左将军
好贴 1
功绩 2293
帖子 1370
编号 55810
注册 2005-12-22
来自 人间
家族 慕容世家


发表于 2007-5-27 23:06 资料 个人空间 短消息 看全部作者
e5文件是一种资源文件,图片那些是采用LS压缩的。做游戏的,一般都要了解一种所谓的图片打包的方法吧。

写代码的确可以用LoadImgae之类的函数去读一张图片,但是一般游戏都不会用独立的一个文件夹里打无数张BMP来做的。一般都会打包滴。打包自然就有压缩。Van的工具是一种解压。

另外,象曹操传里面,还有一种资源文件,是DLL的。一般DLL的图都比较小,运行的时候直接采用LoadLibrary的方法把DLL加载进程序,然后进行些操作。


附件里是曹操传里面CmdIcon.dll的VC源代码工程。

其他的曹操传的资源DLL文件也差不多都是这样Build出来的,都没什么代码的

[ 本帖最后由 岱瀛 于 2007-5-27 23:08 编辑 ]


附件: CmdIconResource.zip (2007-5-27 23:08, 160.27 K)
该附件被下载次数 317


顶部
性别:男-离线 岱瀛
(deving)

长平侯
川峡东路经略使
监管使

Rank: 19Rank: 19Rank: 19Rank: 19
组别 经略使
级别 左将军
好贴 1
功绩 2293
帖子 1370
编号 55810
注册 2005-12-22
来自 人间
家族 慕容世家


发表于 2007-6-4 11:11 资料 个人空间 短消息 看全部作者
这几天挺忙的,米来看版面。

发现楼主在研究那个调色版的,我个人建议还是不要调色版好吧

256色的才会用调色版,既然自己写了,于现在的机器配置,为什么还要用256色呢

---------------------------------------------
网络战棋对战,最终其实可以是两个Client端的对抗。Server端其实只是解决一些全局信息,比如 多少人在线这些,不然都服务器端转压力太大而且速度 速度慢。(如果两个Client连不上,打洞,打不通,那就最后也就只好Server转了

--------------------------------------------------

先把单机做好吧,改转网络版只要你之前的代码结构,设计框架做得好,那是绝对没有问题的且相当简单的。

以曹操传的引擎改网络版都不难,何况自己写?

大致的接口可以这样。

参数一: 当前人物战场信息对象(战场坐标值,攻击力到士气的五围值,属于哪一方等等)

参数一:当前全局战场信息对象(当前天气,战场地图的整型二维数组,上面没人用0标记,有人用HPCurrent值标记其中敌人用负数,我军和友军用正数)

当这些信息传入本地函数,那么是单机版,传入服务器,由服务器返回素和服务器的单人版。

当这些信息传入远方客户端,在远方客户端机器上重画,由远方机器用户操作后,返回这些参数,又本地重画,变成了循环反复了。

所以,联机和单机相比,只是多了下网络传输部分的代码,砖可以一块一块加,楼一层一层建,慢慢来不麻烦。


顶部
性别:男-离线 岱瀛
(deving)

长平侯
川峡东路经略使
监管使

Rank: 19Rank: 19Rank: 19Rank: 19
组别 经略使
级别 左将军
好贴 1
功绩 2293
帖子 1370
编号 55810
注册 2005-12-22
来自 人间
家族 慕容世家


发表于 2007-7-31 11:42 资料 个人空间 短消息 看全部作者


QUOTE:
原帖由 JLQSheenero 于 2007-7-31 09:43 发表
我也在自己开发引擎,但是最后发现图像镂空处理的时候竟然把图像内部的黑色也镂
了。请问应怎样用Bitblt,才不会挖掉内部的黑色。(还是个初中生,弱弱……)

一般这种镂空都会牺牲掉一种颜色来处理的。比如你用纯黑色RGB(255,255,255)做底,你图片内部的黑,你用(255,255,254)之类的,肉眼是分辨不出来的,但是程序是能判断出来的,这样就可以达到你要的镂空效果了。
其实画镂空也不必要自己用Bitblt来做了,挺麻烦的。  Windows提供有下面这个函数可以用。
(传说win 2000以下的不太能用,2000以上的OS就无所谓了)

函数的信息如下:

TransparentBlt


The TransparentBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.

BOOL TransparentBlt(
  HDC hdcDest,
  int nXOriginDest,
  int nYOriginDest,
  int nWidthDest,
  int hHeightDest,
  HDC hdcSrc,
  int nXOriginSrc,
  int nYOriginSrc,
  int nWidthSrc,
  int nHeightSrc,
  UINT crTransparent
);

Parameters
hdcDest
Handle to the destination device context.
nXOriginDest
Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.
nYOriginDest
Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.
nWidthDest
Specifies the width, in logical units, of the destination rectangle.
hHeightDest
Handle to the height, in logical units, of the destination rectangle.
hdcSrc
Handle to the source device context.
nXOriginSrc
Specifies the x-coordinate, in logical units, of the source rectangle.
nYOriginSrc
Specifies the y-coordinate, in logical units, of the source rectangle.
nWidthSrc
Specifies the width, in logical units, of the source rectangle.
nHeightSrc
Specifies the height, in logical units, of the source rectangle.
crTransparent
The RGB color in the source bitmap to treat as transparent.
Return Values
If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE.

Windows NT: To get extended error information, callGetLastError.

Remarks
The TransparentBlt function is supported for source bitmaps of 4 bits per pixel and 8 bits per pixel. Use AlphaBlend to specify 32-bit per pixel bitmaps with transparency.

If the source and destination rectangles are not the same size, the source bitmap is stretched to match the destination rectangle. When the SetStretchBltMode function is used, the iStretchMode modes of BLACKONWHITE and WHITEONBLACK are converted to COLORONCOLOR for the TransparentBlt function.

The destination device context specifies the transformation type for the destination coordinates. The source device context specifies the transformation type for the source coordinates.

TransparentBlt does not mirror a bitmap if either the width or height, of either the source or destination, is negative.
顶部
性别:男-离线 岱瀛
(deving)

长平侯
川峡东路经略使
监管使

Rank: 19Rank: 19Rank: 19Rank: 19
组别 经略使
级别 左将军
好贴 1
功绩 2293
帖子 1370
编号 55810
注册 2005-12-22
来自 人间
家族 慕容世家


发表于 2007-8-2 11:38 资料 个人空间 短消息 看全部作者


QUOTE:
原帖由 JLQSheenero 于 2007-8-1 18:32 发表
谢谢
不过为什么构建时会出错
BitmapBasic.obj : error LNK2001: unresolved external symbol __imp__TransparentBlt@44

把msimg32.lib这个文件连接进去,如果用VC的话,在项目编译选项里面有可以设置的(#pragma comment 的方法也可以)。
这个文件在VC安装目录下应该是能找到的。
顶部

正在浏览此帖的会员 - 共 7 人在线




当前时区 GMT+8, 现在时间是 2024-10-3 05:33
京ICP备2023018092号 轩辕春秋 2003-2023 www.xycq.org.cn

Powered by Discuz! 5.0.0 2001-2006 Comsenz Inc.
Processed in 0.011786 second(s), 10 queries , Gzip enabled

清除 Cookies - 联系我们 - 轩辕春秋 - Archiver - WAP