📄 ming.py
字号:
mingc.SWFMovie_labelFrame(self.this, label) # deprecated: def simpleOutput(self): return mingc.SWFMovie_simpleOutput(self.this)class SWFSprite(SWFBase): def __init__(self): self.this = mingc.newSWFMovieClip() self.blocks = [] def __del__(self): mingc.destroySWFMovieClip(self.this) def setNumberOfFrames(self, frames): mingc.SWFMovieClip_setNumberOfFrames(self.this, frames) def add(self, block): self.blocks.append(block) return SWFDisplayItem(mingc.SWFMovieClip_add(self.this, block.this)) def remove(self, item): mingc.SWFMovieClip_remove(self.this, item.this) def nextFrame(self): mingc.SWFMovieClip_nextFrame(self.this) def labelFrame(self, label): mingc.SWFMovieClip_labelFrame(self.this, label)# deprecated:class SWFMovieClip(SWFSprite): passclass SWFMorph(SWFBase): def __init__(self): self.this = mingc.newSWFMorphShape() def __del__(self): mingc.destroySWFMorph(self.this) def getShape1(self): # have to keep a reference so that it doesn't scope out self.shape1 = SWFShape(mingc.SWFMorph_getShape1(self.this)) return self.shape1 def getShape2(self): self.shape2 = SWFShape(mingc.SWFMorph_getShape2(self.this)) return self.shape2# deprecated:class SWFMorphShape(SWFMorph): passclass SWFFont(SWFBase): def __init__(self, name): if name[-4:] == '.fdb': self.browserfont = 0 self.this = mingc.loadSWFFontFromFile(open(name, "rb")) else: self.browserfont = 1 self.this = mingc.newSWFBrowserFont(name) def __del__(self): if self.browserfont: mingc.destroySWFBrowserFont(self.this) else: mingc.destroySWFFont(self.this) def getAscent(self): return mingc.SWFFont_getAscent(self.this) def getDescent(self): return mingc.SWFFont_getDescent(self.this) def getLeading(self): return mingc.SWFFont_getLeading(self.this) def getStringWidth(self, string): return mingc.SWFFont_getStringWidth(self.this, string) # or: (?) def getWidth(self, string): return mingc.SWFFont_getStringWidth(self.this, string)class SWFBitmap(SWFBase): def __init__(self, fname, alpha=None): ext = fname[-4:] if ext == '.dbl' or ext == '.DBL': self.file = open(fname, "rb") self.this = mingc.newSWFDBLBitmap(self.file) elif ext == '.jpg' or ext == '.JPG': self.file = open(fname, "rb") if alpha is None: self.this = mingc.newSWFJpegBitmap(self.file) else: self.alpha = open(alpha, "rb") self.this = mingc.newSWFJpegWithAlpha(self.file, self.alpha) def __del__(self): mingc.destroySWFBitmap(self.this) def getWidth(self): return mingc.SWFBitmap_getWidth(self.this) def getHeight(self): return mingc.SWFBitmap_getHeight(self.this)# deprecated:class SWFDBLBitmap(SWFBitmap): def __init__(self, fname): self.this = mingc.newSWFDBLBitmap(open(fname, "rb"))# deprecated:class JpegBitmap(SWFBitmap): def __init__(self, fname, alpha=None): if alpha is None: self.this = mingc.newSWFJpegBitmap(open(fname, "rb")) else: self.this = mingc.newSWFJpegWithAlpha(open(fname, "rb"), open(alpha, "rb"))class SWFText(SWFBase): def __init__(self): self.this = mingc.newSWFText2() def __del__(self): mingc.destroySWFText(self.this) def setFont(self, font): mingc.SWFText_setFont(self.this, font.this) def setHeight(self, height): mingc.SWFText_setHeight(self.this, height) def moveTo(self, x, y): mingc.SWFText_moveTo(self.this, x, y) def setColor(self, r, g, b, a=0xff): mingc.SWFText_setColor(self.this, r, g, b, a) def addString(self, s, advance=None): mingc.SWFText_addString(self.this, s, advance) def addUTF8String(self, s, advance=None): mingc.SWFText_addUTF8String(self.this, s, advance) def setSpacing(self, spacing): mingc.SWFText_setSpacing(self.this, spacing) def getAscent(self): return mingc.SWFText_getAscent(self.this) def getDescent(self): return mingc.SWFText_getDescent(self.this) def getLeading(self): return mingc.SWFText_getLeading(self.this) def getWidth(self, string): return mingc.SWFText_getStringWidth(self.this, string) def getUTF8Width(self, string): return mingc.SWFText_getUTF8StringWidth(self.this, string) # deprecated: def setXY(self, x, y): mingc.SWFText_setXY(self.this, x, y)class SWFText2(SWFText): def __init__(self): self.this = mingc.newSWFText2()class SWFTextField(SWFBase): def __init__(self, flags=None): self.this = mingc.newSWFTextField() if flags is not None: mingc.SWFTextField_setFlags(self.this, flags) def __del__(self): mingc.destroySWFTextField(self.this) def setFont(self, font): self.font = font mingc.SWFTextField_setFont(self.this, font) def setBounds(self, width, height): mingc.SWFTextField_setBounds(self.this, width, height) def setFlags(self, flags): mingc.SWFTextField_setFlags(self.this, flags) def setColor(self, r, g, b, a=0xff): mingc.SWFTextField_setColor(self.this, r, g, b, a) def setVariableName(self, name): mingc.SWFTextField_setVariableName(self.this, name) def addString(self, string): mingc.SWFTextField_addString(self.this, string) def setHeight(self, height): mingc.SWFTextField_setHeight(self.this, height) def setLeftMargin(self, leftMargin): mingc.SWFTextField_setLeftMargin(self.this, leftMargin) def setRightMargin(self, rightMargin): mingc.SWFTextField_setRightMargin(self.this, rightMargin) def setIndentation(self, indentation): mingc.SWFTextField_setIndentation(self.this, indentation) def setLineSpacing(self, lineSpacing): mingc.SWFTextField_setLineSpacing(self.this, lineSpacing) def setAlignment(self, alignment): mingc.SWFTextField_setAlignment(self.this, alignment) # or just: def align(self, alignment): mingc.SWFTextField_setAlignment(self.this, alignment) def setLength(self, length): mingc.SWFTextField_setLength(self.this, length)# textfield alignment flags:SWFTEXTFIELD_ALIGN_LEFT = mingc.SWFTEXTFIELD_ALIGN_LEFTSWFTEXTFIELD_ALIGN_RIGHT = mingc.SWFTEXTFIELD_ALIGN_RIGHTSWFTEXTFIELD_ALIGN_CENTER = mingc.SWFTEXTFIELD_ALIGN_CENTERSWFTEXTFIELD_ALIGN_JUSTIFY = mingc.SWFTEXTFIELD_ALIGN_JUSTIFY# other flags:SWFTEXTFIELD_HASLENGTH = mingc.SWFTEXTFIELD_HASLENGTHSWFTEXTFIELD_NOEDIT = mingc.SWFTEXTFIELD_NOEDITSWFTEXTFIELD_PASSWORD = mingc.SWFTEXTFIELD_PASSWORDSWFTEXTFIELD_MULTILINE = mingc.SWFTEXTFIELD_MULTILINESWFTEXTFIELD_WORDWRAP = mingc.SWFTEXTFIELD_WORDWRAPSWFTEXTFIELD_DRAWBOX = mingc.SWFTEXTFIELD_DRAWBOXSWFTEXTFIELD_NOSELECT = mingc.SWFTEXTFIELD_NOSELECTclass SWFSound(SWFBase): def __init__(self, fname, flags=0): self.file = open(fname, "rb") self.this = mingc.newSWFSoundFromFileno(self.file.fileno(), flags) # display list destroys this..class SWFSoundStream(SWFBase): def __init__(self, fname): self.file = open(fname, "rb") self.this = mingc.newSWFSoundStreamFromFileno(self.file.fileno()) # display list destroys this..class SWFAction(SWFBase): def __init__(self, script): self.this = mingc.compileSWFActionCode(script) # assigned object will destroy this..class SWFGradient(SWFBase): def __init__(self): self.this = mingc.newSWFGradient() def __del__(self): mingc.destroySWFGradient(self.this) def addEntry(self, ratio, r, g, b, a=0xff): mingc.SWFGradient_addEntry(self.this, ratio, r, g, b, a)class SWFButton(SWFBase): def __init__(self): self.this = mingc.newSWFButton() self.shapes = [] def __del__(self): mingc.destroySWFButton(self.this) def setUp(self, character): self.addShape(character, SWFBUTTON_UP) def setDown(self, character): self.addShape(character, SWFBUTTON_DOWN) def setOver(self, character): self.addShape(character, SWFBUTTON_OVER) def setHit(self, character): self.addShape(character, SWFBUTTON_HIT) def addShape(self, character, flags): self.shapes.append(character) mingc.SWFButton_addShape(self.this, character, flags) def addAction(self, action, flags): mingc.SWFButton_addAction(self.this, action, flags)def SWFBUTTON_KEYPRESS(c): return mingc.swfButton_keypress(c)# addShape flags:SWFBUTTON_UP = mingc.SWFBUTTON_UPSWFBUTTON_HIT = mingc.SWFBUTTON_HITSWFBUTTON_DOWN = mingc.SWFBUTTON_DOWNSWFBUTTON_OVER = mingc.SWFBUTTON_OVER# addAction flags:SWFBUTTON_MOUSEUPOUTSIDE = mingc.SWFBUTTON_MOUSEUPOUTSIDESWFBUTTON_DRAGOVER = mingc.SWFBUTTON_DRAGOVERSWFBUTTON_DRAGOUT = mingc.SWFBUTTON_DRAGOUTSWFBUTTON_MOUSEUP = mingc.SWFBUTTON_MOUSEUPSWFBUTTON_MOUSEDOWN = mingc.SWFBUTTON_MOUSEDOWNSWFBUTTON_MOUSEOUT = mingc.SWFBUTTON_MOUSEOUTSWFBUTTON_MOUSEOVER = mingc.SWFBUTTON_MOUSEOVER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -