Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

C++ Programming for Games Module II phần 8 pps
MIỄN PHÍ
Số trang
16
Kích thước
311.2 KB
Định dạng
PDF
Lượt xem
1648

C++ Programming for Games Module II phần 8 pps

Nội dung xem thử

Mô tả chi tiết

220

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.

17.3 Tank Animation Sample

Figure 17.2 shows a screenshot of the Tank animation sample we will write in this section.

Figure 17.2: 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 (i.e.,

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.

Tải ngay đi em, còn do dự, trời tối mất!