struct Point
pub struct Point {
pub x int
pub y int
}用途
公开结构体 `Point`。
参数
xint- 值
yint- 值
API
#ui/draw立即模式 2D 画布。
struct Pointpub struct Point {
pub x int
pub y int
}公开结构体 `Point`。
x inty intstruct Clickpub struct Click {
pub x int
pub y int
pub ok int
}公开结构体 `Click`。
x inty intok intconst in_nonepub const in_none = 0公开常量 `in_none`。 值为 `0`
无
const in_clickpub const in_click = 1公开常量 `in_click`。 值为 `1`
无
const in_scrollpub const in_scroll = 2公开常量 `in_scroll`。 值为 `2`
无
const in_dragpub const in_drag = 3公开常量 `in_drag`。 值为 `3`
无
struct Inputpub struct Input {
pub kind int
pub x int
pub y int
pub dx int
pub dy int
}公开结构体 `Input`。
kind intx inty intdx intdy intattachpub fn attach(w &mut ui.Window) intattach,返回 int。
w &mut ui.Windowint — 该类型的值
set_pan_enabledpub fn set_pan_enabled(on int) int设置 pan enabled。
on intint — 该类型的值
beginpub fn begin() intbegin,返回 int。
无
int — 该类型的值
presentpub fn present() intpresent,返回 int。
无
int — 该类型的值
clearpub fn clear() intclear,返回 int。
无
int — 该类型的值
set_bgpub fn set_bg(hex string) int设置 bg。
hex stringint — 该类型的值
set_colorpub fn set_color(hex string) int设置 color。
hex stringint — 该类型的值
set_fillpub fn set_fill(hex string) int设置 fill。
hex stringint — 该类型的值
set_strokepub fn set_stroke(hex string) int设置 stroke。
hex stringint — 该类型的值
set_widthpub fn set_width(w int) int设置 width。
w intint — 该类型的值
pushpub fn push() int压入。
无
int — 该类型的值
poppub fn pop() int弹出。
无
int — 该类型的值
originpub fn origin() intorigin,返回 int。
无
int — 该类型的值
translatepub fn translate(dx int, dy int) inttranslate,返回 int。
dx intdy intint — 该类型的值
rotatepub fn rotate(deg int) int旋转。
deg intint — 该类型的值
scalepub fn scale(sx int, sy int) intscale,返回 int。
sx intsy intint — 该类型的值
fill_rectpub fn fill_rect(x int, y int, w int, h int, hex string) intfill矩形。
x inty intw inth inthex stringint — 该类型的值
stroke_rectpub fn stroke_rect(x int, y int, w int, h int, hex string, width int) intstroke矩形。
x inty intw inth inthex stringwidth intint — 该类型的值
round_rectpub fn round_rect(x int, y int, w int, h int, radius int, fill string, stroke string, width int) int舍入矩形。
x inty intw inth intradius intfill stringstroke stringwidth intint — 该类型的值
diamondpub fn diamond(x int, y int, w int, h int, fill string, stroke string, width int) intdiamond,返回 int。
x inty intw inth intfill stringstroke stringwidth intint — 该类型的值
linepub fn line(x1 int, y1 int, x2 int, y2 int, hex string, width int) intline,返回 int。
x1 inty1 intx2 inty2 inthex stringwidth intint — 该类型的值
textpub fn text(x int, y int, size int, hex string, s string) int返回当前文本。
x inty intsize inthex strings stringint — 该类型的值
arrowpub fn arrow(x1 int, y1 int, x2 int, y2 int, hex string, width int) intarrow,返回 int。
x1 inty1 intx2 inty2 inthex stringwidth intint — 该类型的值
rectpub fn rect(x int, y int, w int, h int) int矩形。
x inty intw inth intint — 该类型的值
rect_linepub fn rect_line(x int, y int, w int, h int) int矩形line。
x inty intw inth intint — 该类型的值
circlepub fn circle(cx int, cy int, r int) intcircle,返回 int。
cx intcy intr intint — 该类型的值
circle_linepub fn circle_line(cx int, cy int, r int) intcircleline。
cx intcy intr intint — 该类型的值
fill_circlepub fn fill_circle(cx int, cy int, r int, hex string) intfillcircle。
cx intcy intr inthex stringint — 该类型的值
stroke_circlepub fn stroke_circle(cx int, cy int, r int, hex string, width int) intstrokecircle。
cx intcy intr inthex stringwidth intint — 该类型的值
ellipsepub fn ellipse(x int, y int, w int, h int) intellipse,返回 int。
x inty intw inth intint — 该类型的值
ellipse_linepub fn ellipse_line(x int, y int, w int, h int) intellipseline。
x inty intw inth intint — 该类型的值
fill_ellipsepub fn fill_ellipse(x int, y int, w int, h int, hex string) intfillellipse。
x inty intw inth inthex stringint — 该类型的值
stroke_ellipsepub fn stroke_ellipse(x int, y int, w int, h int, hex string, width int) intstrokeellipse。
x inty intw inth inthex stringwidth intint — 该类型的值
trianglepub fn triangle(x1 int, y1 int, x2 int, y2 int, x3 int, y3 int) inttriangle,返回 int。
x1 inty1 intx2 inty2 intx3 inty3 intint — 该类型的值
triangle_linepub fn triangle_line(x1 int, y1 int, x2 int, y2 int, x3 int, y3 int) inttriangleline。
x1 inty1 intx2 inty2 intx3 inty3 intint — 该类型的值
fill_trianglepub fn fill_triangle(x1 int, y1 int, x2 int, y2 int, x3 int, y3 int, hex string) intfilltriangle。
x1 inty1 intx2 inty2 intx3 inty3 inthex stringint — 该类型的值
stroke_trianglepub fn stroke_triangle(x1 int, y1 int, x2 int, y2 int, x3 int, y3 int, hex string, width int) intstroketriangle。
x1 inty1 intx2 inty2 intx3 inty3 inthex stringwidth intint — 该类型的值
polypub fn poly(pts &[]Point, fill string, stroke string, width int) intpoly,返回 int。
pts &[]Pointfill stringstroke stringwidth intint — 该类型的值
arcpub fn arc(cx int, cy int, r int, deg0 int, deg1 int, hex string, width int) intarc,返回 int。
cx intcy intr intdeg0 intdeg1 inthex stringwidth intint — 该类型的值
pointpub fn point(x int, y int, hex string, r int) intpoint,返回 int。
x inty inthex stringr intint — 该类型的值
click_ofpub fn click_of(ev ui.Event) Clickclickof。
ev ui.EventClick — 该类型的值
poll_clickpub fn poll_click(ech chan ui.Event) Clickpollclick。
ech chan ui.EventClick — 该类型的值
pollpub fn poll(ech chan ui.Event) Inputpoll,返回 Input。
ech chan ui.EventInput — 该类型的值
promptpub fn prompt(ech chan ui.Event, title string, seed string) stringprompt,返回 string。
ech chan ui.Eventtitle stringseed stringstring — 结果字符串
in_rectpub fn in_rect(c Click, x int, y int, w int, h int) boolin矩形。
c Clickx inty intw inth intbool — 是否成立
in_circlepub fn in_circle(c Click, cx int, cy int, r int) boolincircle。
c Clickcx intcy intr intbool — 是否成立