previous chapter contents page top page next chapter

ColorCoupon

inherits from Coupon
encodes empty field list

Class Description

Class ColorCoupon is a subclass of Coupon that allows the user to change the color of part of an object. Objects of this class work by calling SetPartColor on the coupon's target.

Remember that if the documentation and the software (especially the definition files) disagree, always trust the software.

Programming information

Instantiate: rarely
Subclass: rarely
Call its methods: never

You might instantiate objects of this class if you wanted to create your own color coupons, and you might create subclasses if you wanted to create a coupon for a specialized kind of color class.

Methods defined by class ColorCoupon

Class ColorCoupon defines the following methods:

Method Description
ApplyCoupon Overridden to call SetBorder on coupon's target.
Draw Overridden to show border in coupon instead of text.
Swallow Overridden to swallow other color coupons and mix colors.

Fields defined by class ColorCoupon

Class ColorCoupon defines no fields

Method Descriptions

ApplyCoupon
overrides ApplyCoupon

Call: rarely
Override: sometimes

Magic Cap calls ApplyCoupon when the user drops a coupon into a viewable object. ApplyCoupon should perform the action represented by the coupon. ColorCoupon_ApplyCoupon sets the target's border by calling SetBorder.

Draw

overrides Draw

Call: rarely
Override: sometimes

Magic Cap calls Draw to draw the coupon on the screen. ColorCoupon_Draw draws the coupon with an image that indicates what the target's border will look like when the coupon is applied.

See Viewable_Draw for more information.

Swallow

overrides Swallow

Call: rarely
Override: sometimes

Most coupon classes can't swallow other coupons. Color coupons swallow other color coupons and mix the colors, changing the surviving coupon's color to the newly mixed color.