TAILIEUCHUNG - Game Programming All in One 2 nd Edition phần 6

các nguồn tài nguyên ít ỏi cung cấp cho đến nay (trong các hình thức của các chức năng Allegro bạn đã học được) và giới thiệu một số chức năng mới sẽ được đề cập chi tiết hơn trong sau đó chương. Cập nhật Trước tiên, bạn cần phải thực hiện một vài thay đổi nhỏ các tập tin tiêu đề . | A Limited View of the World 341 scroll window. It is common to use the entire screen in scrolling-shooter games but roleplaying games often use a smaller window on the screen for scrolling using the rest of the screen for gameplay combat inventory and so on and player party information see Figure . Figure Some games use a smaller scroll window on the game screen. You could display one huge bitmap image in the virtual game world representing the current level of the game and then copy blit a portion of that virtual world onto the screen. This is the simplest form of scrolling. Another method uses tiles to create the game world which I ll cover shortly. First you ll write a short program to demonstrate how to use bitmap scrolling. A Limited View of the World I have written a program called Scrollscreen that I will show you. The chapter10 ScrollScreen folder on the CD-ROM contains the file used in this program. Although I encourage you to write the program yourself feel free to load the project in either KDevelop Dev-C or Visual C . Figure shows the file. When you run the program the program will load the image into the virtual buffer and display the upper-left corner in the 640x480 screen. You can change the resolution if you want and I also encourage you to try running the program in full-screen mode using GFX_AUTODETECT_FULLSCREEN for the best effect. The program detects when the 342 Chapter 10 Programming Tile-Based Backgrounds with Scrolling 0 0 640 Use arrow keys to scroll the view around in the virtual background. 480 640 480 Figure The file is loaded into the virtual memory buffer for scrolling. arrow keys have been pressed and adjusts the x and y variables accordingly. Displaying the correct view is then a simple matter of blitting with the x and y variables see Figure . Figure The Scrollscreen program demonstrates how to perform virtual buffer scrolling. A Limited View of the World 343 .

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.