Previous Book Contents Book Index Next

Inside Macintosh: Apple Game Sprockets Guide /


Chapter 2 - DrawSprocket

DrawSprocket is the part of Apple Game Sprockets that gives your Macintosh video game control over special display and device-access features. For some features, DrawSprocket interacts directly with the Mac OS; for others, it can make use of specialized video subsystems and third party video cards. Those features that are not directly supported in hardware are emulated in software in a highly optimized manner, allowing you to rely on their presence when creating your game.

Before reading this chapter, you should be generally familiar with Apple Game Sprockets, as described in the preface to this book. This chapter does not discuss Macintosh graphics systems or drawing functions; for that information, please consult the appropriate reference, such as Inside Macintosh: Imaging With QuickDraw. This chapter does not discuss Macintosh video hardware; for that information, please consult Macintosh Family Hardware Reference and Designing PCI Cards and Drivers for the Macintosh Family.

DrawSprocket relies on the Display Manager for some of its tasks, and you can use Display Manager features in conjunction with DrawSprocket. See the Display Manager documentation for more information.

This chapter starts by introducing the features of DrawSprocket, and then shows how your game can use DrawSprocket to choose a resolution and pixel depth for drawing, allocate a display, perform gamma fading for smooth transitions, and use double-buffering or page-flipping to draw to the display. It also describes other features such as overlays, underlays, and pixel scaling. The section "DrawSprocket Reference" (page 2-22) provides a complete reference to the constants, data structures, and functions provided by DrawSprocket. For a list of constants, data structures, and functions see "Summary of DrawSprocket" (page 2-77).


Chapter Contents
About DrawSprocket
Display Configuration
Contexts and the Play State
Page Flipping and Software Buffering
How Triple Buffering Works
Gamma Fading
Underlays, Overlays, and Transparency Masks
Pixel Scaling
Other Features
Video Driver Support
Using DrawSprocket
Choosing a Context
Initializing the Context Attributes Structure
Finding a Context
Reserving and Activating a Context
Creating Underlays and Overlays
How Underlays Work
How Overlays Work
Fading the Display
Double-Buffered Drawing
Improving Performance With Dirty Rectangles
Cleaning Up Before Quitting DrawSprocket
Debugging
DrawSprocket Reference
Constants
Depth Masks
Color Needs
Special Display Features
Buffer Kind
Pixel Scaling
Play State
Data Structures
Context Attributes Structure
DrawSprocket Functions
Using DrawSprocket
Choosing a Context and Saving Preferences
Manipulating a Context
Drawing and Double Buffering
Using Alternate Buffers
Handling a Mouse
Manipulating Color Lookup Tables
Processing System Events
Utility Functions
Application-Defined Functions
Summary of DrawSprocket
Constants
Depth Masks
Color Needs
Special Display Features
Buffer Kind
Pixel Scaling
Play State
Data Types
Context Attributes Structure
DrawSprocket Functions
Using DrawSprocket
Choosing a Context and Saving Preferences
Manipulating a Context
Drawing and Double Buffering
Using Alternate Buffers
Handling a Mouse
Manipulating Color Lookup Tables
Processing System Events
Utility Functions
Application-Defined Functions
Result Codes

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996