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

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

Nói theo nghĩa gốc, Linux là nhân ( kernel ) của HĐH. Nhân là 1 phần mềm đảm trách chức vụ liên lạc giữa các chương trình ứng dụng máy tính và phần cứng. Cung cấp các chứng năng như: quản lý file, quản lý bộ nhớ ảo, các thiết bị nhập xuất nhưng ổ cứng, màn hình, bàn phím, Nhưng Nhân Linux chưa phải là 1 HĐH | MASTERING SDL 157 particle.y y particle.angle rand 360 particle.energy double rand energy 1000 1000.0 Set the particle s color. particle.r r particle.g g particle.b b Add the particle to the particle system. AddParticle particle This is directly from another code listing. It creates a 16-bit pixel. static Uint16 CreateHicolorPixel SDL_PixelFormat fmt Uint8 red Uint8 green Uint8 blue Uint16 value This series of bit shifts uses the information from the SDL_Format structure to correctly compose a 16-bit pixel value from 8-bit red green and blue data. value red fmt- Rloss fmt- Rshift green fmt- Gloss fmt- Gshift blue fmt- Bloss fmt- Bshift return value Our particle system is limited to 10 000 particles. That should be plenty since there will rarely be more than two or three explosions on the screen at once. It is an arbitrary limit I have tested this code with five times that many particles but after a point it takes a noticeable toll on the game s framerate. CreateParticleExplosion is the main interface to the particle system. This function creates the requested number of particles of a given color and maximum velocity blasting outward from a given origin. We ll create explosions by calling 158 CHAPTER 4 CreateParticleExplosion several times with different velocities and colors. This will allow us to simulate a colorful explosion with hotter particles closer to the center of the blast. Remember that we care little about proper physics it s been said that game programming is all about taking as many shortcuts as possible without cheating the player of a good experience. If an explosion looks good it is good. The other two important particle system routines are UpdateParticles and DrawParticles. The former recalculates the position and color of each particle and checks to see whether it should be removed from the system. Particles are removed when they have faded to black and are therefore invisible since the backdrop is also mostly black . The latter draws a pixel for

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.