8.3. Arm2D 模块 API 文档

8.3.1. API

8.3.1.1. class Window:

def __init__(self):...
def addCallBack(callback:any):...

Interface of callback:

callback(frameBuff: Tile, isNewFrame:int)

def __init__():...
def create_region(x:int,y:int,w:int,h:int)->Region:...
def create_location(x:int,y:int)->Location:...
def update():...

8.3.1.2. class Tile:

def __init__(self):...
def get_root(self,validRegion:Region,offset:Location)->Tile:...
def generate_child(self,reg:Region,clipRegion:int)->Tile:...
def width_compare(self,reference:Region)->int:...
def height_compare(self,reference:Region)->int:...
def shape_compare(self,reference:Region)->int:...
def region_diff(self,tile:Tile)->Region:...
def transform(self,reg:Region,centre:Location)->int:...
def is_root_tile(self)->int:...
def get_absolute_location(self)->Location:...
def is_point_inside_region(region:Region,location:Location)->int:...
def tile_copy(src:Tile,des:Tile,des_reg:Region,mode:int)->int:...
def tile_rotation(src:Tile,des:Tile,des_reg:Region,centre:Location,angle:float,mask_color:int)->int:...
def alpha_blending(src:Tile,des:Tile,reg:Region,alp:int)->int:...
def fill_colour(tile:Tile,reg:Region,colour:int)->int:...

8.3.1.3. class Region:

def __init__(self):...
def intersect(self,in2:Region)->Region:...

8.3.1.4. class Location:

def __init__(self):...

8.3.1.5. class Star(Tile):

def __init__(self):...

8.3.1.6. class BackGround:

def __init__(self):...
def setColor(self,color:int):...
def getColor(self)->int:...
def update(self):...

8.3.1.7. class ElementList:

def update(self):...

8.3.1.8. class Element:

def __init__(self):...
def move(self,x:int,y:int):...
def right(self,x:int):...
def lift(self,x:int):...
def up(self,y:int):...
def down(self,y:int):...
def update(self):...
def setAlpha(self,alpha:int):...

8.3.1.9. class Box(Element):

def update(self):...
def __init__(self):...
def setColor(self,color:int):...
def setSize(self,x:int,y:int):...

8.3.2. Examples

8.3.2.1. main.py

import PikaStdLib
import Arm2D

mem = PikaStdLib.MemChecker()
mem.max()
win = Arm2D.Window()
win.init()
win.background.setColor('white')
win.elems.box = Arm2D.Box()
win.elems.box.init()
while True:
    win.elems.box.move(20, 20)
    win.elems.box.setColor('green')
    win.update()
    win.elems.box.move(30, 50)
    win.elems.box.setColor('blue')
    win.update()
    win.elems.box.move(50,30)
    win.elems.box.setColor('red')
    win.update()
    mem.max()