手机游戏开发实例(smartphone联机炸弹人)
c++ wince sdk AI<br><br>smartphone版本 和windows版本<br><br>目录<br>Table of content<br>I. Introduction.........................................................................................................................................................................5<br>II. Graphics and Gameplay .................................................................................................................................................7<br>II.1. Getting Started .............................................................................................................................................................7<br>II.1.1. First Test................................................................................................................................................................7<br>II.1.2. Windows Programming and Message Handling essentials ...........................................................................8<br>II.1.3. Drawing Bitmaps to the screen........................................................................................................................ 14<br>II.1.4. Sprite movement and user input....................................................................................................................... 18<br>II.1.5. Additional stuff to do........................................................................................................................................ 22<br>II.2. Dialogs........................................................................................................................................................................22<br>II.3. GAPI, Bitmaps and Blitters......................................................................................................................................26<br>II.3.1. GAPI.................................................................................................................................................................... 26<br>II.3.2. Bitmaps................................................................................................................................................................ 30<br>II.3.3. Blitters ................................................................................................................................................................. 33<br>II.4. Game Design ..............................................................................................................................................................38<br>II.4.1. Graphics .............................................................................................................................................................. 39<br>II.4.2. Game Area .......................................................................................................................................................... 39<br>II.4.3. Bomb handling................................................................................................................................................... 40<br>II.4.4. Player Sprites...................................................................................................................................................... 42<br>II.4.5. Computer Player ................................................................................................................................................ 42<br>II.5. Finishing the game ....................................................................................................................................................43<br>II.6. Debugging...................................................................................................................................................................44<br>II.7. Efficient and clean programming on CE devices..................................................................................................45<br>II.8. Hardware Button Click Sound.................................................................................................................................47<br>III. Communications............................................................................................................................................................50<br>III.1. Overview of the libraries ........................................................................................................................................50<br>III.1.1. Consequences.................................................................................................................................................... 51<br>III.2. Messages....................................................................................................................................................................53<br>III.3. Class CNetwork........................................................................................................................................................54<br>III.3. Class CNetBuffer......................................................................................................................................................56<br>III.4. DirectPlay .................................................................................................................................................................57<br>III.4.1. Introduction....................................................................................................................................................... 57<br>III.4.2. Different kinds of Service Providers.............................................................................................................. 57<br>III.5. Class CDPNet...........................................................................................................................................................59<br>III.5.1. DirectPlay Objects and Initialisation............................................................................................................. 60<br>III.5.2. Sending Data..................................................................................................................................................... 67<br>III.5.3. Game Abort ....................................................................................................................................................... 67<br>III.6. IrDATM (Infrared Data Association).....................................................................................................................68<br>III.6.1. Introduction....................................................................................................................................................... 68<br>III.6.2. Class CNet......................................................................................................................................................... 70<br>III.6.3. Initialise the CIRNet object............................................................................................................................ 71<br>III.6.4. The Recieve Thread......................................................................................................................................... 73<br>III.6.5. The Send Thread .............................................................................................................................................. 74<br>III.6.6. The Send Buffer ............................................................................................................................................... 75<br>III.6.7. The Receive Buffer.......................................................................................................................................... 79<br>III.6.8. Testing the basic network functions............................................................................................................... 81<br>III.6.9. Last things todo in the class CIRNet.............................................................................................................. 82<br>IV. Appendix A: Overview of the message identifiers.................................................................................................84<br>3<br>V. Appendix B: Network Statistics for DirectPlay .......................................................................................................85<br>VI. Appendix C: Configuration of Bluetooth Manager to play SmartBlaser over the Bluetooth Serial Port<br>Service. ....................................................................................................................................................................................86<br>VII. LITERATURE.............................................................................................................................................................89<br>Table of figures<br>Figure 1: Screenshot of SmartBlaster ________________________________________________________ 5<br>Figure 2: Communication Infrastructure______________________________________________________ 6<br>Figure 3: Create new project ______________________________________________________________ 6<br>Figure 4: screenshot from the running application in „project3“.__________________________________ 18<br>Figure 5: The Insert Resource dialog. Three different sized empty dialog templates are available. _________ 23<br>Figure 6: The resource editor. ____________________________________________________________ 25<br>Figure 7: Under Project – Settings, open the tab “Link” and include gx.lib to the library modules _________ 26<br>Figure 8: Under Tools – Options, open the tab “Directories”.. ____________________________________ 27<br>Figure 9: Output of the sample application on the Smartphone. ___________________________________ 28<br>Figure 10: Output of the sample application on the PocketPC..____________________________________ 28<br>Figure 11 a): fast blitter function b): colour keying____________________________________________ 38<br>Figure 12: and at last the sprites get drawn with colour keying being used.___________________________ 38<br>Figure 13: The block bitmap______________________________________________________________ 39<br>Figure 14 bombs triggered by bombs _______________________________________________________ 41<br>Figure 15: Error file logging calls to new and delete___________________________________________ 46<br>Figure 16: Activate the Platform SDK library for Visual Studio ___________________________________ 50<br>Figure 17: Configuration of COM ports for the bluetooth serial sevice______________________________ 52<br>Figure 18: Enumeration of the available DirectPlay Service Providers______________________________ 58<br>Figure 19 : Message flow during network session______________________________________________ 66<br>Figure 20: different IrDa layers___________________________________________________________ 69<br>Figure 21: pointer position in send and recv buffers______________________________________________ 78<br>Figure 22: DirectPlay Network Statistic _____________________________________________________ 85<br>Figure 23: Configaration of Smartblaster____________________________________________________ 86<br>Figure 24: Configuration of computer "DUDDLE"_____________________________________________ 87<br>Figure 25: Configuration of computer "BONGO" ______________________________________________ 88<br>Table of code fragments<br>Code fragment 1: Extract from the file “Blaster_CE.h” in “project3\Blaster_CE” _____________________ 14<br>Code fragment 2: Extract from the file “Blaster_CE.cpp” in “project3\Blaster_CE” ___________________ 15<br>Code fragment 3: The file “resource.h” in project3 “project3\Blaster_CE” __________________________ 15<br>Code fragment 4: Extract from the file “Blaster_CE.rc” in project3\Blaster_CE” _____________________ 15<br>Code fragment 5: The function “LoadBitmaps” in “project3\Blaster_CE”.___________________________ 16<br>Code fragment 6: The function “DrawGame” in “project3\Blaster_CE”.____________________________ 17<br>Code fragment 9: Extract from the file „Blaster_CE.h“ in project4_________________________________ 18<br>Code fragment 10: Extract of the function “DrawGame“ in project4 _______________________________ 19<br>Code fragment 11: The function DoKeydownMain in project4a ___________________________________ 20<br>Code fragment 12: Initialising the GAPI input functionality and retrieving keycode information ___________ 20<br>Code fragment 13: The modified message loop in project4b ______________________________________ 21<br>4<br>Code fragment 14: Open a dialog box_______________________________________________________ 23<br>Code fragment 15: Example of a dialog procedure_____________________________________________ 24<br>Code fragment 17: Creating and using a font _________________________________________________ 25<br>Code fragment 18: The function ”LoadBitmap“ _______________________________________________ 33<br>Code fragment 19: The first blitter method ___________________________________________________ 34<br>Code fragment 20: The Flip method switching between primary and secondary surface_________________ 35<br>Code fragment 22: A faster blit.___________________________________________________________ 36<br>Code fragment 23: Modified LoadBitmap function _____________________________________________ 36<br>Code fragment 24: The faster blit for landscape displays ________________________________________ 37<br>Code fragment 25: Draw the background bitmap to the background buffer. __________________________ 37<br>Code fragment 28: The process function for the game. __________________________________________ 44<br>Code fragment 29: Stop the click with a device management function. ______________________________ 47<br>Code fragment 30: Query the registry before stopping the click tone. _______________________________ 49<br>Code fragment 31: Restore old click tone setting. ______________________________________________ 49<br>Code fragment 32: An example of a send method.. _____________________________________________ 59<br>Code fragment 35: Summary of the CDPServer constructor ______________________________________ 61<br>Code fragment 37: Summary of the function InitDirectPlayClient().________________________________ 62<br>Code fragment 38: Information required to enumerate hosts______________________________________ 62<br>Code fragment 39: Summary of CDPClient:: SessionsDlgEnumHosts _______________________________ 63<br>Code fragment 40: Summary of SessionsDlgNoteEnumResponse() _________________________________ 64<br>Code fragment 42: Client connects to a host (function SessionsDlgJoinGame) ________________________ 65<br>Code fragment 43: Example of how to the server sends data to all direct play clients ___________________ 67<br>Code fragment 44: Example of how to the clint sends data to the server _____________________________ 67<br>Code fragment 45: The Thread used to initialise or reconnect a network connection. ___________________ 70<br>Code fragment 46: The receive thread ______________________________________________________ 74<br>Code fragment 47: The send thread ________________________________________________________ 75<br>Code fragment 48: Example using GetNextMsg and RealeaseNexttMsg to produce a message ____________ 76<br>Code fragment 49: GetNextMsg returns a pointer to the next free message in the send buffer _____________ 76<br>Code fragment 50: ReleaseNextMsg releases dwSize bytes to be sent by adjusting the write pointer ________ 76<br>Code fragment 52: The send thread writes incoming data in the receive buffer and increments the pointers __ 79<br>Code fragment 53: Process the messages contained in the receive buffer ____________________________ 80<br>Code fragment 54: Handle incomplete messages_______________________________________________ 81<br>Code fragment 56: When detecting a socket error in one of the threads, the threads will be stopped and the reconnection<br>process will be initialised._______________________________________________________ 83
- 1
- 2
- 3
- 粉丝: 29
- 资源: 17
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- ssm网络教学平台的设计与实现+vue.zip
- 电网管理中的分层决策 matlab源代码,代码按照高水平文章复现,保证正确 由于可再生能源发电、可变需求和计划外停电等因素的影响,电网管理是一个多时间尺度决策和随机行为的难题 在面对不确定性的情况下
- ssm四六级报名与成绩查询系统+jsp.zip
- ssm铁岭河医院医患管理系统+vue.zip
- ssm田径运动会成绩管理系统的设计与实现+vue.zip
- ssm实验室开放管理系统+jsp.zip
- ssm蜀都天香酒楼的网站设计与实现+jsp.zip
- ssm视频点播系统设计与实现+vue.zip
- ssm神马物流+vue.zip
- ssm实验室耗材管理系统设计与实现+jsp.zip
- ssm生活缴费系统及相关安全技术的设计与实现+jsp.zip
- ssm人事管理信息系统+jsp.zip
- ssm社区管理与服务的设计与实现+jsp.zip
- ssm社区文化宣传网站+jsp.zip
- Dell EMC Unity-Unisphere CLI Guide
- ssm汽车养护管理系统+jsp.zip