📄 mingpp.h
字号:
class SWFGradient{ public: c_SWFGradient gradient; SWFGradient() { this->gradient = newSWFGradient(); } virtual ~SWFGradient() { destroySWFGradient(this->gradient); } void addEntry(float ratio, int r, int g, int b, int a=0xff) { SWFGradient_addEntry(this->gradient, ratio, r, g, b, a); } SWF_DECLAREONLY(SWFGradient);};/* SWFBitmap */class SWFBitmap : public SWFBlock{ public: c_SWFBitmap bitmap; SWFBitmap(const char *filename, const char *alpha=NULL) { if(strlen(filename) > 4) { if(strcmp(filename+strlen(filename)-4, ".dbl") == 0) this->bitmap = newSWFDBLBitmap(fopen(filename, "rb")); else if(strcmp(filename+strlen(filename)-4, ".jpg") == 0) { if(alpha != NULL) this->bitmap = newSWFJpegWithAlpha(fopen(filename, "rb"), fopen(alpha, "rb")); else this->bitmap = newSWFJpegBitmap(fopen(filename, "rb")); } else ; // XXX - throw exception } } SWFBitmap(SWFInput *input) { this->bitmap = newSWFBitmap_fromInput(input->input); } virtual ~SWFBitmap() { destroySWFBitmap(this->bitmap); } float getWidth() { return SWFBitmap_getWidth(this->bitmap); } float getHeight() { return SWFBitmap_getHeight(this->bitmap); } SWF_DECLAREONLY(SWFBitmap); SWFBitmap();};/* SWFFont */class SWFFont : public SWFBlock{ public: c_SWFFont font; SWFFont() { this->font = newSWFFont(); } SWFFont(FILE *file) { this->font = loadSWFFontFromFile(file); } SWFFont(const char *name) { if(strlen(name) > 4 && strcmp(name + strlen(name) - 4, ".fdb") == 0) this->font = loadSWFFontFromFile(fopen(name, "rb")); else this->font = 0 ; // wogl temporary !!!! newSWFBrowserFont(name); } virtual ~SWFFont() { destroySWFFont((c_SWFBlock)this->font); } c_SWFBlock getBlock() { return (c_SWFBlock)this->font; } float getStringWidth(char *string) { return SWFFont_getStringWidth(this->font, string); } float getWidth(char *string) { return SWFFont_getStringWidth(this->font, string); } float getAscent() { return SWFFont_getAscent(this->font); } float getDescent() { return SWFFont_getDescent(this->font); } float getLeading() { return SWFFont_getLeading(this->font); } SWF_DECLAREONLY(SWFFont);};/* SWFShape */class SWFShape : public SWFCharacter{ public: c_SWFShape shape; SWFShape() { this->shape = newSWFShape(); } SWFShape(c_SWFShape shape) { this->shape = shape; } virtual ~SWFShape() { destroySWFShape(this->shape); } c_SWFBlock getBlock() { return (c_SWFBlock)this->shape; } void movePen(float x, float y) { SWFShape_movePen(this->shape, x, y); } void movePenTo(float x, float y) { SWFShape_movePenTo(this->shape, x, y); } void drawLine(float x, float y) { SWFShape_drawLine(this->shape, x, y); } void drawLineTo(float x, float y) { SWFShape_drawLineTo(this->shape, x, y); } void drawCurve(float cx, float cy, float ax, float ay) { SWFShape_drawCurve(this->shape, cx, cy, ax, ay); } void drawCurveTo(float cx, float cy, float ax, float ay) { SWFShape_drawCurveTo(this->shape, cx, cy, ax, ay); } void drawCubic(float ax, float ay, float bx, float by, float cx, float cy) { SWFShape_drawCubic(this->shape, ax, ay, bx, by, cx, cy); } void drawCubicTo(float ax, float ay, float bx, float by, float cx, float cy) { SWFShape_drawCubicTo(this->shape, ax, ay, bx, by, cx, cy); } void end() { SWFShape_end(this->shape); } SWFFill *addSolidFill(int r, int g, int b, int a=0xff) { return new SWFFill(SWFShape_addSolidFill(this->shape, r, g, b, a)); } SWFFill *addGradientFill(SWFGradient *gradient, byte flags=0) { return new SWFFill(SWFShape_addGradientFill(this->shape, gradient->gradient, flags)); } SWFFill *addBitmapFill(SWFBitmap *bitmap, byte flags=0) { return new SWFFill(SWFShape_addBitmapFill(this->shape, bitmap->bitmap, flags)); } void setLeftFill(SWFFill *fill) { SWFShape_setLeftFill(this->shape, fill->fill); } void setRightFill(SWFFill *fill) { SWFShape_setRightFill(this->shape, fill->fill); } void setLine(unsigned short width, int r, int g, int b, int a=0xff) { SWFShape_setLine(this->shape, width, r, g, b, a); } void drawArc(float r, float startAngle, float endAngle) { SWFShape_drawArc(this->shape, r, startAngle, endAngle); } void drawCircle(float r) { SWFShape_drawCircle(this->shape, r); } void drawGlyph(SWFFont *font, unsigned short c, int size=0) { SWFShape_drawSizedGlyph(this->shape, font->font, c, size); } // deprecated? void drawFontGlyph(SWFFont *font, unsigned short c) { SWFShape_drawGlyph(this->shape, font->font, c); } SWF_DECLAREONLY(SWFShape);};/* SWFSprite */class SWFSprite : public SWFCharacter{ public: c_SWFMovieClip clip; SWFSprite() { this->clip = newSWFMovieClip(); } virtual ~SWFSprite() { destroySWFMovieClip(this->clip); } c_SWFBlock getBlock() { return (c_SWFBlock)this->clip; } void setNumberOfFrames(int nFrames) { SWFMovieClip_setNumberOfFrames(this->clip, nFrames); } SWFDisplayItem *add(SWFBlock *character) { return new SWFDisplayItem(SWFMovieClip_add(this->clip, character->getBlock())); } void remove(SWFDisplayItem *item) { SWFMovieClip_remove(this->clip, item->item); } void nextFrame() { SWFMovieClip_nextFrame(this->clip); } void labelFrame(char *label) { SWFMovieClip_labelFrame(this->clip, label); } SWF_DECLAREONLY(SWFSprite);};/* SWFMorph */class SWFMorph : public SWFCharacter{ public: c_SWFMorph morph; SWFMorph() { this->morph = newSWFMorphShape(); } virtual ~SWFMorph() { destroySWFMorph(this->morph); } c_SWFBlock getBlock() { return (c_SWFBlock)this->morph; } SWFShape *getShape1() { return new SWFShape(SWFMorph_getShape1(this->morph)); } SWFShape *getShape2() { return new SWFShape(SWFMorph_getShape2(this->morph)); } SWF_DECLAREONLY(SWFMorph);};/* SWFText */class SWFText : public SWFCharacter{ public: c_SWFText text; SWFText() { this->text = newSWFText2(); } virtual ~SWFText() { destroySWFText(this->text); } c_SWFBlock getBlock() { return (c_SWFBlock)this->text; } void setFont(SWFBlock *font) { SWFText_setFont(this->text, font->getBlock()); } void setHeight(float height) { SWFText_setHeight(this->text, height); } // I don't like this.. it's too easy to confuse with displayitem::moveTo void moveTo(float x, float y) { SWFText_moveTo(this->text, x, y); } void setColor(unsigned char r, unsigned char g, unsigned char b, int a=0xff) { SWFText_setColor(this->text, r, g, b, a); } void addString(const char *string, int *advance=NULL) { SWFText_addString(this->text, string, advance); } void addUTF8String(const char *string, int *advance=NULL) { SWFText_addUTF8String(this->text, string, advance); } void setSpacing(float spacing) { SWFText_setSpacing(this->text, spacing); } float getStringWidth(const char *string) { return SWFText_getStringWidth(this->text, string); } float getWidth(const char *string) { return SWFText_getStringWidth(this->text, string); } float getUTF8Width(const char *string) { return SWFText_getUTF8StringWidth(this->text, string); } SWF_DECLAREONLY(SWFText);};/* SWFTextField */class SWFTextField : public SWFCharacter{ public: c_SWFTextField textField; SWFTextField() { this->textField = newSWFTextField(); } virtual ~SWFTextField() { destroySWFTextField(this->textField); } c_SWFBlock getBlock() { return (c_SWFBlock)this->textField; } void setFont(SWFBlock *font) { SWFTextField_setFont(this->textField, font->getBlock()); } void setBounds(float width, float height) { SWFTextField_setBounds(this->textField, width, height); } void setFlags(int flags) { SWFTextField_setFlags(this->textField, flags); } void setColor(int r, int g, int b, int a=0xff) { SWFTextField_setColor(this->textField, r, g, b, a); } void setVariableName(const char *name) { SWFTextField_setVariableName(this->textField, name); } void addString(const char *string) { SWFTextField_addString(this->textField, string); } void addUTF8String(const char *string) { SWFTextField_addUTF8String(this->textField, string); } void setHeight(float height) { SWFTextField_setHeight(this->textField, height); } void setLeftMargin(float margin) { SWFTextField_setLeftMargin(this->textField, margin); } void setRightMargin(float margin) { SWFTextField_setRightMargin(this->textField, margin); } void setIndentation(float indentation) { SWFTextField_setIndentation(this->textField, indentation); } void setPadding(float padding) { SWFTextField_setPadding(this->textField, padding); } void setLineSpacing(float lineSpacing) { SWFTextField_setLineSpacing(this->textField, lineSpacing); } void setAlignment(SWFTextFieldAlignment alignment) { SWFTextField_setAlignment(this->textField, alignment); } void align(SWFTextFieldAlignment alignment) { SWFTextField_setAlignment(this->textField, alignment); } void setLength(int length) { SWFTextField_setLength(this->textField, length); } SWF_DECLAREONLY(SWFTextField);};/* SWFButton */class SWFButton : public SWFCharacter{ public: c_SWFButton button; SWFButton() { this->button = newSWFButton(); } virtual ~SWFButton() { destroySWFButton(this->button); } c_SWFBlock getBlock() { return (c_SWFBlock)this->button; } void addShape(SWFCharacter *character, byte flags) { SWFButton_addShape(this->button, (c_SWFCharacter)character->getBlock(), flags); } void addAction(SWFAction *action, int flags) { SWFButton_addAction(this->button, action->action, flags); } void setMenu(int flag=0) { SWFButton_setMenu(this->button, flag); } SWF_DECLAREONLY(SWFButton);};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -