新增画布类,三联,九宫格控件
This commit is contained in:
@@ -56,4 +56,8 @@ class Actor extends BaseNode {
|
||||
function GetWorldPos(){
|
||||
return sq_GetWorldPos(this.C_Object);
|
||||
}
|
||||
|
||||
function SetName(Name) {
|
||||
sq_SetName(this.C_Object, Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,5 @@ class BaseNode {
|
||||
//析构对象
|
||||
if (DestructFlag) sq_RegisterDestruction(C_Object, this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
24
UI/ObjectClass/Canvas.nut
Normal file
24
UI/ObjectClass/Canvas.nut
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
文件名:Canvas.nut
|
||||
路径:UI/ObjectClass/Canvas.nut
|
||||
创建日期:2025-10-24 22:00
|
||||
文件用途:画布类
|
||||
*/
|
||||
class Canvas extends Actor {
|
||||
function _typeof() {
|
||||
return "Canvas";
|
||||
}
|
||||
|
||||
constructor(Width, Height) {
|
||||
C_Object = sq_CreateCanvas(Width, Height);
|
||||
sq_RegisterDestruction(C_Object, this);
|
||||
}
|
||||
|
||||
function DrawImg(Img, Index, X, Y) {
|
||||
sq_Canvas_DrawImg(C_Object, Img, Index, {x = X, y = Y});
|
||||
}
|
||||
|
||||
function DrawImgRect(Img, Index, X, Y, Width, Height) {
|
||||
sq_Canvas_DrawImgRect(C_Object, Img, Index, {x = X, y = Y,w = Width, h = Height});
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ class Sprite extends Actor {
|
||||
}
|
||||
|
||||
constructor(ImgPath, Idx) {
|
||||
base.constructor(sq_CreateSprite(ImgPath, Idx))
|
||||
C_Object = sq_CreateSprite(ImgPath, Idx);
|
||||
sq_RegisterDestruction(C_Object,this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user