【正文】
按左功能鍵后,貪吃蛇蛇頭向上移動,說明向上按鍵功能正確。通過觀察上圖和前一個狀態(tài)的變化,我們發(fā)現此圖顯示了按右功能鍵后,貪吃蛇蛇頭向上移動,說明向上按鍵功能正確。當蛇死亡時,我們需要回到初始化界面,進行游戲的重玩,這時,我們需要按鍵回車鍵進行游戲的重新初始化工作,我們現在來進行回車鍵功能的測試工作,如下圖所示:通過觀察上圖和前一個狀態(tài)的變化,我們發(fā)現當我們按下回車鍵時,游戲重新回到初始化界面,說明此功能正確,測試結束。 分數和關卡測試玩家在進行游戲的比賽時,需要有個分數來進行統(tǒng)計,這個分數用來進行比較玩家的能力高低,我們要進行這個功能的測試,看是否隨著吃到游戲果實的增加,對應的分數也相應的增加,同時當玩家達到一定的分數后,是不是關卡也隨之增加,我們開始進行游戲的初始化界面如下:按下空格鍵,開始游戲,進行測試,玩家通過開始一段時間的游戲后,觀察上圖右面部分,分數和關卡數的文本框的變化情況,是不是和游戲規(guī)則里面的描述相符合,我們觀察下面的截圖,進行判斷:通過玩家一段時間的游戲后,此時顯示對應的分數為495分,不是初始化的0分,對應的關卡是4關,與目標測試結果相符合,說明功能正確,測試結束。總結與展望本論文描述了基于winCE設計思想開發(fā)的貪吃蛇游戲功能,采用了軟硬件相結合的嵌入式設計方案,開拓了自己對嵌入式領域的認知,,最后經過一系列的功能測試,下載內核,調試實驗開發(fā)板,完成了能夠在實驗板上運行的貪吃蛇游戲,總體來說,本次設計主要有幾下幾個特點:1. ,較其他嵌入式操作系統(tǒng)而言,具有的優(yōu)勢是:良好的操作界面、實時性較高、占用資源少、開發(fā)工具豐富以及強大的技術支持等等。2. 作為嵌入式程序設計,具有方便簡易的特性,我們定制的系統(tǒng)只需要夠用即可,嵌入式的核心思維就是簡易。3. 作為基于winCE嵌入式程序的開發(fā),提供了一個完整的過程,從一開始定制內核到下載內核,程序的編寫直至最后程序在板子上調試運行給初學者帶來了一個整體的指導,方便學習基于winCE嵌入式。然而,目前設計的基于嵌入式winCE貪吃蛇游戲還處于較原始的階段,實現的功能還不夠完善,但隨著相關技術的成熟和軟硬件平臺的發(fā)展,完善相關的游戲功能,使之更加完善,界面更加可視化,這樣我相信對于初學嵌入式的人來說會有很大的幫組。致謝時光飛逝,四年的大學生活轉瞬即逝。但這寶貴的四年求學生涯讓我成長了不少。首先我要深深的感謝我的恩師吳磊老師,在本次設計期間給予我悉心的指導。從論文題目的選定到方案的確定,再到具體的設計實現和論文的審核,無不傾注了吳老師的心血和辛勞。在這寶貴的四年時光里,吳老師淵博的知識、嚴謹的教學態(tài)度令我欽佩不已。同時,吳老師在學習上嚴格督促我,生活上給予我無微不至的關懷和幫助。從吳老師那里,不僅學到了許多的專業(yè)知識,而且學會了一些學習的方法和為人處事的道理,對我以后的工作學習,影響是非常深遠的。在這里深深的祝福吳老師工作順利、家庭幸福。其次需要感謝計算機一班的同學們,四年的同窗生涯,在學習生活上給了我許多無私熱情的幫助。尤其是班長團委等同學在學習和生活的團結互助中建立了深厚的友誼,一生都會好好珍惜。最后感謝我的父母,在我最困難的時候,他們始終給我最有力的支持和理解。正是因為你們的支持和理解,我才能在失敗和困難面前信心百倍,無所畏懼。在此一并致謝。參考文獻和注釋[1] 傅曦,[J].人民郵電出版社,2006年6月[2] [J].北京航天航空大學出版社,2006年[3] 張冬泉,[J].電子工業(yè)出版社,2006年[4] 劉大鵬,[J].微型電腦應用,2002年8月,18卷,8期:4344[5] 70Samp。[J].廣州致遠電子有限公司,2008年[6] 張晶,[J].嵌入式操作系統(tǒng)應用,2008年5月:39一42[7] 程序設計VisualC++++[J].電子工業(yè)出版社,2000年12月 [8] ++[J].清華大學出版社,2006年[9] ++入門、進階與應用實例[J].人民郵電出版社,2007年外文資料翻譯及原文翻譯原文The Windows Programming ModelPrograms written for traditional operating environments use a procedural programming model in which programs execute from top to bottom in an orderly fashion. The path taken from start to finish may vary with each invocation of the program depending on the input it receives or the conditions under which it is run, but the path remains fairly predictable. In a C program, execution begins with the first line in the function named main and ends when main returns. In between, main might call other functions and these functions might call even more functions, but ultimately it is the program—not the operating system—that determines what gets called and when. Windows programs operate differently. They use the eventdriven programming model illustrated in Figure 11, in which applications respond to events by processing messages sent by the operating system. An event could be a keystroke, a mouse click, or a mand for a window to repaint itself, among other things. The entry point for a Windows program is a function named WinMain, but most of the action takes place in a function known as the window procedure. The window procedure processes messages sent to the window. WinMain creates that window and then enters a message loop, alternately retrieving messages and dispatching them to the window procedure. Messages wait in a message queue until they are retrieved. A typical Windows application performs the bulk of its processing in response to the messages it receives, and in between messages, it does little except wait for the next message to arrive. The message loop ends when a WM_QUIT message is retrieved from the message queue, signaling that it39。s time for the application to end. This message usually appears because the user selected Exit from the File menu, clicked the close button (the small button with an X in the window39。s upper right corner), or selected Close from the window39。s system menu. When the message loop ends, WinMain returns and the application terminates. Figure 11. The Windows programming model. The window procedure typically calls other functions to help process the messages it receives. It can call functions local to the application, or it can call API functions provided by Windows. API functions are contained in special modules known as dynamiclink libraries, or DLLs. The Win32 API includes hundreds of functions that an application can call to perform various tasks such as creating a window, drawing a line, and performing file input and output. In C, the window procedure is typically implemented as a monolithic function containing a large switch statement with cases for individual messages. The code provided to process a particular message is known as a message handler. Messages that an application doesn39。t process are passed on to an API function named DefWindowProc, which provides default responses to unprocessed messages. Messages, Messages, and More MessagesWhere do messages e from, and what kinds of information do they convey? Windows defines hundreds of different message types. Most messages have names that begin with the letters WM and an underscore, as in WM_CREATE and WM_PAINT. These messages can be classified in various ways, but for the moment classification is not nearly as important as realizing the critical role messages play in the operation of an application. The following table shows 10 of the most mon messages. A window receives a WM_PAINT message, for example, when its interior needs repainting. One way to characterize a Windows program is to think of it as a collection of message handlers. To a large extent, it is a program39。s unique way of responding to messages that gives it its personality. Common Windows MessagesMessageSent WhenWM_CHARA character is input from the keyboard.WM_COMMANDThe user selects an item from a menu, or a control sends a notification to its parent.WM_CREATEA window is created.WM_DESTROYA window is destroyed.WM_LBUTTONDOWNThe left mouse button is pressed.WM_LBUTTONUPThe left mouse button is released.WM_MOUSEMOVE The mouse pointer is moved.WM_PAINTA window needs repainting.WM_QUITThe application is about to termin