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

Đ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 5', 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ả | 15.2 Shape Primitives 15.2.1 Drawing Lines Line drawing is done with two functions. The first function moves the virtual pen to the starting point of the line. The second function draws a line from the previously specified starting point to a newly specified second point Following two functions draws a line from startX startY to endX endY . MoveToEx hdc startX startY 0 LineTo hdc endX endY Both functions take a handle to the device context as all drawing must be done through the device context. The second and third parameters for both functions are the x- and y-coordinates of a point which is relative to the client area rectangle. For MoveToEx that point is the starting point of the line. For LineTo that point is the ending point of the line. The fourth parameter of MoveToEx returns a POINT object of the last start point that was specified via a pointer parameter. If this value is not needed you can specify null. The program we will write to illustrate line drawing allows the user to define the line s start point by pressing the left mouse button. The user holds the left mouse button down and moves the mouse to a new point. When the user has found the point where he she wants the line s end point to be the user raises the left mouse button up. Figure 15.3 shows the program after some lines were drawn. Figure 15.3 The line drawing program. Users can draw lines by holding the left mouse button down 131 As the user moves the mouse around looking for the end point he she will expect to see the new line being drawn in real-time. That is a line from the start point to the current mouse position should constantly be drawn and updated interactively. In this way the user can see exactly how the line will look before raising the left mouse button to make the line permanent. This functionality requires some special code. Let us get started. First we have the following global variables and also a structure definition struct Line POINT p0 POINT p1 vector Line gLines Line gLine

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.