Object oriented Game Development -P10

Object oriented Game Development -P10: There’s a better than 50% chance that you have picked this title off the shelf in a bookshop and are wondering if it’s going to be another one of those ‘secrets of the inner circle’ type of titles. You know, the ones that promise to tell you unspoken truths on how to write really cool games but in reality offer up a rehash of a manual you may already have for free anyway. | 256 Object-oriented game development What we want to do is move the abstract concept of tenderers and sound managers into the PLATFORM namespace without bogging down said namespace with any specifics about hardware or implementation. In other words we d like the sort of structure illustrated in component terms here and in classes in Figure which decouples the packages. The Renderer and SoundManager types within the PLATFORM package are Strawman classes again see Chapter 4 that define no behaviour only pass type information . File ifndef PLATFORM_RENDERER_INCLUDED define PLATFORM_RENDERER_INCLUDED namespace PLATFORM class Renderer public Renderer virtual Renderer Figure Object diagram for platform-independent renderer and sound manager. PLATFORM Renderer j SoundManager j REND SOUND SoundManager Cross-platform development 257 end of PLATFORM namespace endif The Renderer within the REND package defines the generic tenderer behaviour. Though in principle we could have placed that generic behaviour within the PLATFORM component that would probably result in contamination of the PLATFORM name space with generic renderer specifics which it really has no business in knowing. This way keeps it sparkling clean. Cast your mind back to Figure the outline of a cross-platform renderer. Notice that there is no provision for rendering to off-screen buffers for example to draw shadows or a rear-view mirror in a vehicle-based game . This is because we may not be able to assume that all targets have sufficient video RAM VRAM to allow this. It s often better - and easier - in the long run to not define a piece of non-generic functionality in a generic system than to provide it and disable it in a platform-specific system. It is always possible to create a new component associated with the renderer that provides the functionality in the middle-level functionality band. Now we have to make the abstract into the concrete. For each platform type we .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.