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

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 - break Move right. case D break Move up--remember in Windows coords -y up. case W - break Move down. case S break Rotate tank gun to the left. case Q break Rotate tank gun to the right. case E break Fire a bullet. case VK_SPACE 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 Sprites 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 shows a bitmap of a military jet we could use in a 2D jet fighter style game. Figure A bitmap of a fighter jet. However there is a problem. Bitmaps are rectangular by definition. The actual jet part of Figure 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 illustrates the problem and Figure shows the desired correct output. 237 Figure 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 Drawing bitmaps correctly

Đã 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.