def draw_triangle(fill, x, y, w, h, colr): mylistpoint = [ {'x':int(x), 'y':int(y + h - 1)}, \ {'x':int(x + w / 2), 'y':int(y)}, \ {'x':int(x + w - 1), 'y':int(y + h - 1)} ] pxpoint = xfl.fls_make_ptr_flpoint(mylistpoint) #gctx = xfl.fl_gc() #xfl.fl_state[xfl.fl_get_vclass()].gc[0] #xfl.fl_set_foreground(gctx, xfl.fl_get_flcolor(colr)) if fill: xfl.fl_polyf(pxpoint, 3, colr) else: xfl.fl_polygon(0, pxpoint, 3, colr)
def drawit(self, stobj): xfl.fl_winset(self.main_win) xfl.fl_mapcolor(xfl.FL_FREE_COL1, stobj.r, \ stobj.g, stobj.b) if stobj.type == 1: xfl.fl_rectf(stobj.x - stobj.size, \ stobj.y - stobj.size, 2 * stobj.size, \ 2 * stobj.size, xfl.FL_FREE_COL1) elif stobj.type == 2: xfl.fl_circf(stobj.x, stobj.y, stobj.size, \ xfl.FL_FREE_COL1) elif stobj.type == 3: mylistpoint = [ \ {'x':int(stobj.x - stobj.size), \ 'y':int(stobj.y + stobj.size)}, \ {'x':int(stobj.x + stobj.size), \ 'y':int(stobj.y + stobj.size)}, \ {'x':int(stobj.x), \ 'y':int(stobj.y - stobj.size)}] pxpoint = xfl.fls_make_ptr_flpoint(mylistpoint) xfl.fl_polyf(pxpoint, 3, xfl.FL_FREE_COL1)