分享
 
 
 

(译)win32asm实例-0

王朝system·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

这个教程写得非常好,希望你能喜欢。

-译者

Mosaic tutorial拼图游戏教程

Introduction介绍

In this lesson you will create a simple mosaic game. You probably know this kind of puzzles. An image or a matrix of numbers have to be placed in the right order by shuffeling the pieces into place. This lesson will teach you how to create this game step by step. It is useful to read the tutorials first before you start with this lesson. It's level is aimed at the beginner, everything is explained.

在本教程中,你将创建一个简单的拼图游戏。你可能知道这种字画迷。一幅画或一个数字矩阵必须由从一个地方拖到另一个地方来摆好顺序。本教程将一步步教你怎样创建这个游戏。在开始这个教程前,读一读前面的教程(win32asm教程-译者注)是很有帮助的。难度面向初学者,每件事都会得到解释。

Prologue前言

This lesson is aimed at the beginner in asm. Every step in creating the program is explained. It is not just source code with comments, but it teaches you how to build up a program from scratch. My advice is to fully read the tutorial, and try to make the program yourself. This lesson is quite long but it will help you very much if you read it all.

本教程着眼于asm的初学者。程序创建中的每一步都会解释。这不仅仅是带有注释的源代码,而是教你如何白手起家的创建一个程序。我的建议是通读前面的教程,并且试着自己来写程序。本教程相当的长,但如果你都读了的话将对你很有益处。

Checklist清单

Make sure you have the following installed:

确保你安装了一下工具:

· The masm32 package, version 6 with at least service pack 2 (win32asm.cjb.net)

· A good resource editor. This is not necessary, but a lot easier to do it by hand. To make this lesson accessible for anyone, I'll explain how to write the resources by hand (they are simply text files), but if you know how to use a resource editor you can use that instead. Good resource editors are: Borland Resource Workshop* (protools.cjb.net) and the resource editor in Microsoft Visual Studio (Visual C++).

· A resource compiler (rc.exe will do for hand written files and microsoft visual studio's resource editor, but not for BRW).

· make sure that you have included the \masm32\bin folder and the paths of the other necessairy tools included in your path.

· masm32包,版本6加上至少sp2

· 一个好用的资源编辑器。这不是必须的,但用它做会更加容易。为了使得本教程对所有人都可用,我将用手工的办法来解释如何写资源(它们仅仅是文本文件)。但如果你知道怎样使用资源编辑器,你也可以用它代替。好的资源编辑器有:Borland Resource Workshop(protools.cjb.net)和微软Visual Studio(Visual C++)中的资源编辑器。

· 一个资源编译器(rc.exe可以用于手工写的文件和微软Visual Studio的资源编辑器,但不可以用于

BRW)

· 确保你把\masm32\bin文件夹和其他必要工具的路径包含在你的路径(path环境变量)中了。

* BRW is no longer supported by Borland so you can download this legally (although I don't know for sure), but you need the brc32 tool to compile it (their resoure format is somewhat different from microsoft's, so using rc.exe wouldn't work). This tool is included in the TASM package but you cannot download this legally.

*BRW已经不再由Borland支持因而你可以合法地下载(虽然我不确知),但你需要

brc32工具来编译它(它们地格式和微软地有些不同,因而使rc.exe工作不正常),这个工具包含在TASM包中,但你不能合法地下载它。

Glossary小字典

As this is a lesson for the real beginners, this list of definitions can be useful. Read them if you don't know them already, it will help you understand the rest of the lesson.

因为这是一本面向初学者的教程,这个定义列表可能会有用。如果你还不知道它们,读一读吧。它将对你理解后面的课程很有帮助。

Resources

A resource is data that is stored in the program file. A resource can be an icon, a table with strings, menu, dialog, bitmap, user defined data etc. The resources are first defined in a .rc file. This is a simple text file which you can write manually but it's much easier to use a resource editor like borland resource workshop or the editor in visual studio. The resources are then compiled into a binary file (.res). This file is then linked (yes with link) to the executable. Resources are accessed by their IDs. These IDs can be set in the resource file and in your source code you use the same ID to access the resource.

Owner-drawn windows

Owner-drawn windows are windows that are drawn by the program instead of the system. In this lesson a static control is used as an owner-drawn window. A WM_DRAWITEM message is sent to the window when the control needs to be drawn.

Local variables

Local variables are variables (i.e. data) that is used only in a specific procedure. Local data is saved while the procedure is running, but deleted afterwards (it is stored on the stack). Local variables are declared with LOCAL at the start of a procedure:

SomeProc proc ....

LOCAL localvar:DWORD

资源

资源是储存在程序文件中的数据。一个资源可以是图标,字符串的表格,菜单,位图,用户定义的数据等。资源先在rc文件中定义。这是一个你可以手工写的简单纯文本文件但用像Borland Resource Workshop或Visual Studio中的工具会更简单。然后,资源被编译为二进制文件(.res)。再后,文件被链接(是的,用链接器)到可执行文件中。资源通过它们的ID(s),存储。这些ID可以在资源文件中设置而且在你的源代码中,你使用相同的ID来读取资源。

Owner-drawn 窗口

Owner-drawn 窗口是由程序代替系统画出的窗口。在本教程中,一个静态控件被用作Owner-drawn窗口。WM_DRAWITEM消息在控件需要画出的时候发送给窗口

局部变量

局部变量仅仅是用于指定过程的变量(就是数据)。局部变量在过程运行时被保存但之后就删除了(他储存在栈中)。局部变量在过程开始处用LOCAL声明:

SomeProc proc ....

LOCAL localvar:DWORD

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有