Đang chuẩn bị liên kết để tải về tài liệu:
C++ Programming for Games Module II phần 9

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

Tham khảo tài liệu 'c++ programming for games module ii phần 9', 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ả | Destroy the window when the user selects the exit menu item. case ID_FILE_EXIT DestroyWindow ghMainWnd break return 0 case WM_KEYDOWN switch wParam Move left. case A gTankPos.x - 5.0f break Move right. case D gTankPos.x 5.0f break Move up--remember in Windows coords -y up. case W gTankPos.y - 5.0f break Move down. case S gTankPos.y 5.0f break Rotate tank gun to the left. case Q gGunDir.rotate -0.1f break Rotate tank gun to the right. case E gGunDir.rotate 0.1f break Fire a bullet. case VK_SPACE gBulletList.push back gTankPos gGunDir break return 0 Destroy application resources. case WM_dEsTROY DeleteObject gGunPen delete gBackBuffer PostQuitMessage 0 return 0 Forward any other messages we didn t handle to the default window procedure. return DefWindowProc hWnd msg wParam lParam 236 17.4 Sprites 17.4.1 Theory Although the tank from the tank sample is reminiscent of early classic computer gaming its graphics are obviously extremely primitive. A more contemporary solution is for an artist to paint a detailed tank image using some image editing software such as Adobe Photoshop and perhaps base it on a photograph of a real tank. The artist can then save the image say as a .bmp file which we can load and use in our programs. This can lead us to some better-looking graphics. For example Figure 17.6 shows a bitmap of a military jet we could use in a 2D jet fighter style game. Figure 17.6 A bitmap of a fighter jet. However there is a problem. Bitmaps are rectangular by definition. The actual jet part of Figure 17.6 is not rectangular but as you can see it lies on a rectangular background. However when we draw these bitmaps we do not want this black background to be drawn Figure 17.7 illustrates the problem and Figure 17.8 shows the desired correct output. 237 Figure 17.7 Drawing bitmaps incorrectly. The problem is that the bitmap pixels that are not part of the actual image show through that is the black background pixels are visible. Figure 17.8 Drawing bitmaps correctly

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.