![Phân tích tư tưởng của nhân dân qua đoạn thơ: Những người vợ nhớ chồng… Những cuộc đời đã hóa sông núi ta trong Đất nước của Nguyễn Khoa Điềm](https://timtailieu.net/upload/document/136415/phan-tich-tu-tuong-cua-nhan-dan-qua-doan-tho-039-039-nhung-nguoi-vo-nho-chong-nhung-cuoc-doi-da-hoa-song-nui-ta-039-039-trong-dat-nuoc-cua-nguyen-khoa-136415.jpg)
3D Game Programming All in One- P13
Số trang: 30
Loại file: pdf
Dung lượng: 1.16 MB
Lượt xem: 16
Lượt tải: 0
Xem trước 3 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
3D Game Programming All in One- P13: During the past several years while working on the Tubettiland “Online Campaign” softwareand more recently while working on the Tubettiworld game, I figure I’ve receivedmore than a hundred queries from people of all ages about how to get started makinggames. There were queries from 40-year-olds and 13-year-olds and every age in between.Most e-mails were from guys I would estimate to be in their late teens or early 20s.
Nội dung trích xuất từ tài liệu:
3D Game Programming All in One- P13 Selected Common Code Client Modules 267 // First see if there is a callback installed that doesnt have a type; // if so, that callback is always executed when a message arrives. for (%i = 0; (%func = $MSGCB[, %i]) !$= ; %i++) { call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9,%a10); } // Next look for a callback for this particular type of ServerMessage. if (%tag !$= ) { for (%i = 0; (%func = $MSGCB[%tag, %i]) !$= ; %i++) { call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9,%a10); } }}function AddMessageCallback(%msgType, %func){ for (%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ; %i++) { // If it already exists as a callback for this type, // nothing to do. if (%afunc $= %func) { return; } } // Set it up. $MSGCB[%msgType, %i] = %func;}function DefaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7,%a8, %a9, %a10){ OnServerMessage(detag(%msgString));}AddMessageCallback(, DefaultMessageCallback);The first function, ClientCmdChatMessage, is for chat messages only and is invoked on theclient when the server uses the CommandToClient function with the message type ChatMessage.Refer back to the server-side message module if you need to. The first parameter (%sender)is the GameConnection object handle of the player that sent the chat message. The secondparameter (%voice) is an Audio Voice identifier string. Parameter three (%pitch) will also becovered in the audio chapter later. Finally, the fourth parameter (%msgString) contains the Team LRN268 Chapter 7 ■ Common Scripts actual chat message in a tagged string. The rest of the parameters are not actually acted on so can be safely ignored for now. The parameters are passed on to the pseudo-handler OnChatMessage. Its called a pseudo-handler because the function that calls OnChatMessage is not really calling out from the engine. However, it is useful to treat this operation as if a callback message and handler were involved for conceptual reasons. The next function, ClientCmdServerMessage, is used to deal with game event descriptions, which may or may not include text messages. These can be sent using the message func- tions in the server-side Message module. Those functions use CommandToClient with the type ServerMessage, which invokes the function described next. For ServerMessage messages, the client can install callbacks that will be run according to the type of the message. Obviously, ClientCmdServerMessage is more involved. After it uses the GetWord function to extract the message type as the first text word from the string %msgType, it iterates through the message callback array ($MSGCB) looking for any untyped callback functions and exe- cutes them all. It then goes through the array again, looking for registered callback func- tions with the same message type as the incoming message, executing any that it finds. The next function, addMessageCallback, is used to register callback functions in the $MSGCB message callback array. This is not complex; addMessageCallback merely steps through the array looking for the function to be registered. If it isnt there, addMessageCallback stores a handle to the function in the next available slot. The last function, DefaultMessageCallback, is supplied in order to provide an untyped mes- sage to be registered. The registration takes place with the line after the function definition. A Final Word The common code base includes a ton of functions and methods. We have only touched on about half of them here. I aimed to show you the most important modules and their contents, and I think thats been accomplished nicely. For your browsing pleasure, Table 7.2 contains a reference to find all the functions in all common code modules. Team LRN A Final Word 269Table 7.2 Common Code FunctionsModule Functioncommon/main.cs InitCommon InitBaseClient InitBaseServer DisplayHelp ParseArgs OnStart OnExitcommon/client/actionMap.cs ActionMap::copyBind ActionMap::blockBindcommon/client/audio.cs OpenALInit OpenALShutdowncommon/client/canvas.cs InitCanvas ResetCanvascom ...
Nội dung trích xuất từ tài liệu:
3D Game Programming All in One- P13 Selected Common Code Client Modules 267 // First see if there is a callback installed that doesnt have a type; // if so, that callback is always executed when a message arrives. for (%i = 0; (%func = $MSGCB[, %i]) !$= ; %i++) { call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9,%a10); } // Next look for a callback for this particular type of ServerMessage. if (%tag !$= ) { for (%i = 0; (%func = $MSGCB[%tag, %i]) !$= ; %i++) { call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9,%a10); } }}function AddMessageCallback(%msgType, %func){ for (%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ; %i++) { // If it already exists as a callback for this type, // nothing to do. if (%afunc $= %func) { return; } } // Set it up. $MSGCB[%msgType, %i] = %func;}function DefaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7,%a8, %a9, %a10){ OnServerMessage(detag(%msgString));}AddMessageCallback(, DefaultMessageCallback);The first function, ClientCmdChatMessage, is for chat messages only and is invoked on theclient when the server uses the CommandToClient function with the message type ChatMessage.Refer back to the server-side message module if you need to. The first parameter (%sender)is the GameConnection object handle of the player that sent the chat message. The secondparameter (%voice) is an Audio Voice identifier string. Parameter three (%pitch) will also becovered in the audio chapter later. Finally, the fourth parameter (%msgString) contains the Team LRN268 Chapter 7 ■ Common Scripts actual chat message in a tagged string. The rest of the parameters are not actually acted on so can be safely ignored for now. The parameters are passed on to the pseudo-handler OnChatMessage. Its called a pseudo-handler because the function that calls OnChatMessage is not really calling out from the engine. However, it is useful to treat this operation as if a callback message and handler were involved for conceptual reasons. The next function, ClientCmdServerMessage, is used to deal with game event descriptions, which may or may not include text messages. These can be sent using the message func- tions in the server-side Message module. Those functions use CommandToClient with the type ServerMessage, which invokes the function described next. For ServerMessage messages, the client can install callbacks that will be run according to the type of the message. Obviously, ClientCmdServerMessage is more involved. After it uses the GetWord function to extract the message type as the first text word from the string %msgType, it iterates through the message callback array ($MSGCB) looking for any untyped callback functions and exe- cutes them all. It then goes through the array again, looking for registered callback func- tions with the same message type as the incoming message, executing any that it finds. The next function, addMessageCallback, is used to register callback functions in the $MSGCB message callback array. This is not complex; addMessageCallback merely steps through the array looking for the function to be registered. If it isnt there, addMessageCallback stores a handle to the function in the next available slot. The last function, DefaultMessageCallback, is supplied in order to provide an untyped mes- sage to be registered. The registration takes place with the line after the function definition. A Final Word The common code base includes a ton of functions and methods. We have only touched on about half of them here. I aimed to show you the most important modules and their contents, and I think thats been accomplished nicely. For your browsing pleasure, Table 7.2 contains a reference to find all the functions in all common code modules. Team LRN A Final Word 269Table 7.2 Common Code FunctionsModule Functioncommon/main.cs InitCommon InitBaseClient InitBaseServer DisplayHelp ParseArgs OnStart OnExitcommon/client/actionMap.cs ActionMap::copyBind ActionMap::blockBindcommon/client/audio.cs OpenALInit OpenALShutdowncommon/client/canvas.cs InitCanvas ResetCanvascom ...
Tìm kiếm theo từ khóa liên quan:
thiết kế web giáo trình thiết kế flash CSS cơ bản giáo trình photoshop kỹ thuật cắt htmlTài liệu liên quan:
-
Báo cáo thực tập: Đề tài thiết kế Web
77 trang 578 2 0 -
Đề thi thực hành môn Thiết kế Web - Trường Cao đẳng nghề Vĩnh Phúc
3 trang 287 2 0 -
182 trang 188 0 0
-
MỘT SỐ ĐIỂM CẦN CHÚ Ý KHI THIẾT KẾ WEB
5 trang 116 0 0 -
GIÁO TRÌNH LẬP TRÌNH WEB_PHẦN 2_BÀI 3
3 trang 105 0 0 -
Giáo trình Nhập môn thiết kế website
58 trang 84 0 0 -
81 trang 77 0 0
-
Tài liệu giảng dạy Thiết kế giao diện Web - Trường CĐ Kinh tế - Kỹ thuật Vinatex TP. HCM
88 trang 75 0 0 -
112 trang 69 0 0
-
Hướng dân sử dụng Navicat để Create , Backup , Restore Database
7 trang 68 0 0