Đang chuẩn bị liên kết để tải về tài liệu:
microsoft visual basic game programming with directx phần 8

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

giải thích bất cứ điều gì khác trong phát hiện va chạm Chương 1 và Nettrix. GDI + trò chơi nếu chúng ta sử dụng thủ thuật này hình ảnh động.Hình 7-9: Một con thỏ nhảy mà không có dự đoán trò chơi thú vị đa phương tiện bằng cách sử dụng Managed DirectX 9.0 và Tiếp theo chúng ta sẽ thảo luận về một khái niệm phim hoạt hình | RegKey.Close Catch IstServiceProviders.SelectedIndex 0 End Try Else lstServiceProviders.SelectedIndex 0 End f End Sub In the next section we ll write the code for creating game sessions and joining them. Coding the Session Methods Although we are coding a single class for the sessions there ll be specific methods executed by the host and others used by the client. We ll discuss these methods in separated sections so that we won t confuse the two. Creating and Destroying Sessions To create a session in DirectPlay we simply call the Host method of the Peer object passing the appropriate parameters which enables us to receive connections from other computers. TheHost method will receive two parameters an ApplicationDescription 0 bject which will give the game GUID and the session name and the Addressobject which points to the service provider to be used Public Function CreateSession strSessionName As String As Boolean Try Create the application description object Dim AppDesc As New ApplicationDescription AppDesc.GuidApplication GameGuid AppDesc.SessionName strSessionName No special flags AppDesc.Flags 0 Host a game on DPAddress as described by AppDesc DPPeer.Host AppDesc DPAddress CreateSession True Catch e As DirectPlayException MessageBox.Show Error when creating a session e.ErrorString __ - e.ErrorString clsGameServer.CreateSession CreateSession False End Try End Function We must follow here a rule of thumb for any program Close what you opened. So we ll add code for the CloseConnection method which can be called if the program wants to explicitly close the connection to other computers. Public Sub CloseConnection DPPeer.Dispose End Sub These two methods will be used only by the Host and they are all we need to create and destroy game sessions. Since many games will need a configuration screen to receive the session name from the player we can add an extra Create-Session method that receives no .