René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
DisplayItem [Ming wrapper class] | ||
The sourceDisplayItem.h
#ifndef DISPLAY_ITEM_H #define DISPLAY_ITEM_H #include <string> #include "ming.h" class DisplayItem { friend class MovieClip_; protected: DisplayItem(SWFDisplayItem d); public: void Move (float x, float y); void MoveTo (float x, float y); void Rotate (float degrees); void RotateTo (float degrees); void AddColor (); void MultColor(); void Name (std::string const&); /* Used together with Morphs */ void Ratio (float); void ScaleTo (float x, float y); void AddColor (int r, int g, int g, int a=255); void MultColor(float r, float g, float b, float a= 1); private: friend class Movie; friend class MovieClip; friend class Shape; friend class DisplayClip; /* Z can only be set when the DisplayItem was newly added. Therefore, it's private. The higher z, the better a DisplayItem is visible*/ void Z (unsigned int z); /* Depth can only be set when the DisplayItem was newly added. Therefore, it's private */ void MaskLevel(unsigned int); SWFDisplayItem item_; }; #endif DisplayItem.cpp
#include "DisplayItem.h" #include "Action.h" DisplayItem::DisplayItem(SWFDisplayItem d) { item_ = d; } void DisplayItem::Move(float x, float y) { SWFDisplayItem_move(item_, x, y); } void DisplayItem::MoveTo(float x, float y) { SWFDisplayItem_moveTo(item_, x, y); } void DisplayItem::Rotate(float degrees) { SWFDisplayItem_rotate(item_, degrees); } void DisplayItem::RotateTo(float degrees) { SWFDisplayItem_rotateTo(item_, degrees); } void DisplayItem::Name(std::string const& name) { SWFDisplayItem_setName(item_, name.c_str()); } void DisplayItem::Z(unsigned int z) { SWFDisplayItem_setDepth(item_, z); } void DisplayItem::Ratio(float r) { SWFDisplayItem_setRatio(item_, r); } void DisplayItem::ScaleTo(float x, float y) { SWFDisplayItem_scaleTo(item_, x, y); } void DisplayItem::MaskLevel(unsigned int level) { SWFDisplayItem_setMaskLevel(item_, level); } void DisplayItem::AddColor(int r, int g, int b, int a) { SWFDisplayItem_setColorAdd(item_, r, g, b, a); } void DisplayItem::MultColor(float r, float g, float b, float a) { SWFDisplayItem_setColorMult(item_, r, g, b, a); } Examples
|