TAILIEUCHUNG - C++ Programming for Games Module II phần 8

Tham khảo tài liệu 'c++ programming for games module ii phần 8', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | provides another function which can give us a handle to a device context associated with a window s client area the function is called GetDC Get a DC associated with the window s client area. HDC hWndDC GetDC mhWnd The GetDC function takes a parameter to a window handle hwnd which specifies the window with which we want to associate the device context. The GetDC function then returns a handle to such a device context. Tank Animation Sample Figure shows a screenshot of the Tank animation sample we will write in this section. Figure A screenshot of the Tank sample. The tank is drawn using a rectangle for the tank base an ellipse for the gun base and a thick line . pen width 1 for the gun. You can move the tank up and down and from side to side with the W S A and D keys. You can rotate the gun with the Q and E keys. Finally you can fire bullets with the spacebar key. The bullets are modeled using ellipses. 220 Be aware that this program uses a 2D vector class called Vec2. This class is remarkably similar to the Vector3 class we developed in Chapter 7 so please take a moment to review the vector mathematics discussed in that chapter if you do not recall the concepts. We will be using vectors to determine directions. For example we will need to determine the direction a bullet should travel. In addition we will sometimes interpret the components of vectors as points. Before we begin an analysis of the tank program let us first look at the global variables the program uses the comments explain their purpose HWND HINSTANCE HMENU ghMainWnd 0 Main window handle. ghAppInst 0 Application instance handle. ghMainMenu 0 Menu handle. The backbuffer we will render onto. BackBuffer gBackBuffer 0 The text that will appear in the main window s caption bar. string gWndCaption Game Institute Tank Sample Client rectangle dimensions we will use. const int gClientWidth 800 const int gClientHeight 600 Center point of client rectangle. const POINT gClientCenter .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.