giu_Canvas

通过canvas创建自定义的组件:

return giu.Custom(func() {
   canvas := giu.GetCanvas()
   pos := giu.GetCursorScreenPos()
   //aw, ah := giu.GetAvaiableRegion()
   //width1 := aw /// giu.Context.GetPlatform().GetContentScale()
   //height1 := ah /// giu.Context.GetPlatform().GetContentScale()

   if img.texture != nil {

      posTexture1 := pos.Add(imageLib.Pt(0, 0))
      posTexture2 := pos.Add(imageLib.Pt(int(780), int(580)))
      canvas.AddImage(img.texture, posTexture1, posTexture2)
   }
})

giu.GetCursorScreenPos()

//获取顶点坐标

aw, ah := giu.GetAvaiableRegion()

//获取dpi适配后的屏幕像素宽,高。需要做换算才能转换到gui坐标

width1 := aw / giu.Context.GetPlatform().GetContentScale()
height1 := ah / giu.Context.GetPlatform().GetContentScale()

© 2021 hanbaoaaa record.浙ICP备20005263号
asdad
联系方式 asdasd
2021-5-8 4:19
sss
回复数 (0) 点击展开
加载更多

新增评论

称呼
联系方式
邮箱(选填)
内容

提交

取消