2 Commits

Author SHA1 Message Date
5759e8dbc6 Canvas API增加完成 2025-10-25 23:54:47 +08:00
433fa315b2 Actor API增加完成 2025-10-25 23:52:26 +08:00
8 changed files with 312 additions and 84 deletions

28
.vscode/launch.json vendored
View File

@@ -1,20 +1,12 @@
{ {
// 使用 IntelliSense 了解相关属性。 "version": "0.2.0",
// 悬停以查看现有属性的描述。 "configurations": [
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 {
"version": "0.2.0", "name": "Attach (squirrel) to localhost:2222",
"configurations": [ "type": "squirrel",
{ "request": "attach",
"type": "squirrel", "port": 2222,
"request": "attach", "address": "localhost"
"name": "Server", }
"port": 2222 ]
},
{
"type": "squirrel",
"request": "attach",
"name": "Client",
"port": 2222
}
]
} }

View File

@@ -30,6 +30,7 @@ function _MainUI_Enter_(UI_Scene) {
local Test1 = sq_CreaterWindowInstance("测试窗口", Window_NotiBox, 150, 150, 364, 356, 20); local Test1 = sq_CreaterWindowInstance("测试窗口", Window_NotiBox, 150, 150, 364, 356, 20);
Test1.ResetFoucus(); Test1.ResetFoucus();
local act = Actor();
// local Canv = Canvas(600, 600); // local Canv = Canvas(600, 600);
// _SYS_UI_SCENE_Instance_.AddChild(Canv); // _SYS_UI_SCENE_Instance_.AddChild(Canv);
@@ -53,3 +54,4 @@ function _MainUI_Update_(deltaTime) {
} }
//主界面UI退出回调 //主界面UI退出回调
function _MainUI_Exit_() {} function _MainUI_Exit_() {}

View File

@@ -17,47 +17,188 @@ class Actor extends BaseNode {
} }
} }
/**
* 设置名字
* @function
* @param {string} Name
* @returns {void}
*/
function SetName(Name) {
sq_SetName(this.C_Object, Name);
}
/**
* 获取名字
* @function
* @returns {string}
*/
function GetName() {
return sq_GetName(this.C_Object);
}
/**
* 添加子对象
* @function
* @param {Actor} Act
* @returns {void}
*/
function AddChild(Act) { function AddChild(Act) {
sq_AddChild(this.C_Object, Act.C_Object); sq_AddChild(this.C_Object, Act.C_Object);
} }
/**
* 移除子对象
* @function
* @param {Actor} Act
* @returns {void}
*/
function RemoveChild(Act) { function RemoveChild(Act) {
sq_RemoveChild(this.C_Object, Act.C_Object); sq_RemoveChild(this.C_Object, Act.C_Object);
} }
/**
* 设置层级
* @function
* @param {integer} Order
* @returns {void}
*/
function SetZOrder(Order) { function SetZOrder(Order) {
sq_SetZOrder(this.C_Object, Order); sq_SetZOrder(this.C_Object, Order);
} }
function SetScale(Value, ...) { /**
if (vargv.len() == 0) * 获取层级
sq_SetScale(this.C_Object, Value); * @function
else if (vargv.len() == 1) * @returns {*}
sq_SetScale(this.C_Object, Value, vargv[0]); */
function GetZOrder() {
return sq_GetZOrder(this.C_Object);
} }
function SetPos(Value, ...) { /**设置坐标 */
if (vargv.len() == 0) { function SetPos(...) {
sq_SetPos(this.C_Object, Value); if (vargv.len() == 1) {
} else if (vargv.len() == 1) { sq_SetPos(this.C_Object, vargv[0]);
sq_SetPos(this.C_Object, Value, vargv[0]); } else if (vargv.len() == 2) {
sq_SetPos(this.C_Object, vargv[0], vargv[1]);
} }
} }
function GetSize(){ /**
* 获取坐标
* @function
*/
function GetPos() {
return sq_GetPos(this.C_Object);
} }
/**
* 获取世界坐标
* @function
*/
function GetWorldPos() {
return sq_GetWorldPos(this.C_Object);
}
/**
* 设置透明度
* @function
* @param {integer} Alpha
* @returns {void}
*/
function SetAlpha(Alpha) {
sq_SetAlpha(this.C_Object, Alpha);
}
/**
* 获取透明度
* @function
* @returns {integer}
*/
function GetAlpha() {
return sq_GetAlpha(this.C_Object);
}
/**
* 设置缩放
* @function
*/
function SetScale(Value, ...) {
if (vargv.len() == 0) sq_SetScale(this.C_Object, Value);
else if (vargv.len() == 1) sq_SetScale(this.C_Object, Value, vargv[0]);
}
/**
* 获取缩放
* @function
*/
function GetScale() {
return sq_GetScale(this.C_Object);
}
/**
* 设置旋转角度
* @function
* @param {float} Angle
* @returns {void}
*/
function SetRotation(Angle) {
sq_SetRotation(this.C_Object, Angle);
}
/**
* 获取旋转角度
* @function
* @returns {float}
*/
function GetRotation() {
return sq_GetRotation(this.C_Object);
}
/**
* 设置大小
* @function
* @returns {void}
*/
function SetSize(Value, ...) {
if (vargv.len() == 0) sq_SetScale(this.C_Object, Value);
else if (vargv.len() == 1) sq_SetScale(this.C_Object, Value, vargv[0]);
}
/**
* 获取大小
* @function
*/
function GetSize() {
return sq_GetSize(this.C_Object);
}
/**
* 设置可见性
* @function
* @param {boolean} Flag
* @returns {void}
*/
function SetVisible(Flag) { function SetVisible(Flag) {
sq_SetVisible(this.C_Object, Flag); sq_SetVisible(this.C_Object, Flag);
} }
/**
function GetWorldPos(){ * 获取可见性
return sq_GetWorldPos(this.C_Object); * @function
* @returns {boolean}
*/
function GetVisible() {
return sq_GetVisible(this.C_Object);
} }
function SetName(Name) { /**
sq_SetName(this.C_Object, Name); *
* @function
* @param {BLENDMODE} BlendMode
* @returns {void}
*/
function SetBlendMode(BlendMode) {
sq_SetBlendMode(this.C_Object, BlendMode);
} }
} }

View File

@@ -14,11 +14,31 @@ class Canvas extends Actor {
sq_RegisterDestruction(C_Object, this); sq_RegisterDestruction(C_Object, this);
} }
/**
* 绘制Img
* @function
* @param {string} Img img路径
* @param {integer} Index img编号
* @param {integer} X X坐标
* @param {integer} Y Y坐标
* @returns {void}
*/
function DrawImg(Img, Index, X, Y) { function DrawImg(Img, Index, X, Y) {
sq_Canvas_DrawImg(C_Object, Img, Index, {x = X, y = Y}); sq_Canvas_DrawImg(C_Object, Img, Index, { x = X, y = Y });
} }
/**
* 根据矩形绘制Img
* @function
* @param {string} Img img路径
* @param {integer} Index img编号
* @param {integer} X X坐标
* @param {integer} Y Y坐标
* @param {any} Width 宽度
* @param {any} Height 高度
* @returns {void}
*/
function DrawImgRect(Img, Index, X, Y, Width, Height) { function DrawImgRect(Img, Index, X, Y, Width, Height) {
sq_Canvas_DrawImgRect(C_Object, Img, Index, {x = X, y = Y,w = Width, h = Height}); sq_Canvas_DrawImgRect(C_Object, Img, Index, { x = X, y = Y, w = Width, h = Height });
} }
} }

View File

@@ -27,8 +27,15 @@ class Window_hud extends GameWindow {
* @returns {void} * @returns {void}
*/ */
function OnMouseEvent(Type, Data, EventInteractiveFlag) { function OnMouseEvent(Type, Data, EventInteractiveFlag) {
base.OnMouseEvent(Type, Data, EventInteractiveFlag) base.OnMouseEvent(Type, Data, EventInteractiveFlag);
if(Type == UI_EVENT.MOUSEBUTTONDOWN) { if (Type == UI_EVENT.MOUSEBUTTONDOWN) {
} }
} }
/**
* 重载ResetFoucus函数本窗口不需要改变焦点
* @function
* @returns {void}
*/
function ResetFoucus() {}
} }

View File

@@ -17,6 +17,7 @@ class Window_NotiBox extends GameWindow {
function InitSprite() { function InitSprite() {
local Sp = Sprite("sprite/hud/newantonui.img", 0); local Sp = Sprite("sprite/hud/newantonui.img", 0);
Sp.SetBlendMode(1);
AddChild(Sp); AddChild(Sp);
local Textobj = Text("测试文本",0,sq_RGBA(255,255,255,255)); local Textobj = Text("测试文本",0,sq_RGBA(255,255,255,255));

View File

@@ -6,31 +6,72 @@
*/ */
enum CHARACTERJOB { enum CHARACTERJOB {
SWORDMAN, // 男鬼剑士 /**男鬼剑士 */
FIGHTER, // 女格斗家 SWORDMAN,
GUNNER, // 男神枪手 /**女格斗家 */
MAGE, // 女魔法师 FIGHTER,
PRIEST, // 男圣职者 /**男神枪手 */
AT_GUNNER, // 女神枪手 GUNNER,
THIEF, // 暗夜使者 /**女魔法师 */
AT_FIGHTER, // 男格斗家 MAGE,
AT_MAGE, // 男魔法师 /**男圣职者 */
DEMONIC_SWORDMAN, // 黑暗武士 PRIEST,
CREATOR_MAGE, // 缔造者 /**女神枪手 */
AT_SWORDMAN, // 女鬼剑士 AT_GUNNER,
KNIGHT, // 守护者 /**暗夜使者 */
DEMONIC_LANCER, // 魔枪士 THIEF,
AT_PRIEST, // 女圣职者 /**男格斗家 */
GUN_BLADER, // 枪剑士 AT_FIGHTER,
ARCHER, // 弓箭手 /**男魔法师 */
MAX // 无 AT_MAGE,
/**黑暗武士 */
DEMONIC_SWORDMAN,
/**缔造者 */
CREATOR_MAGE,
/**女鬼剑士 */
AT_SWORDMAN,
/**守护者 */
KNIGHT,
/**魔枪士 */
DEMONIC_LANCER,
/**女圣职者 */
AT_PRIEST,
/**枪剑士 */
GUN_BLADER,
/**弓箭手 */
ARCHER,
/**无 */
MAX
} }
enum UI_EVENT { enum UI_EVENT {
MOUSEMOTION, //鼠标移动 /**鼠标移动 */
MOUSEBUTTONDOWN, //鼠标按下 MOUSEMOTION,
MOUSEBUTTONUP, //鼠标释放 /**鼠标按下 */
MOUSEWHEEL //鼠标滚轮 MOUSEBUTTONDOWN,
KEYDOWN //键盘按下 /**鼠标释放 */
KEYUP //键盘释放 MOUSEBUTTONUP,
/**鼠标滚轮 */
MOUSEWHEEL,
/**键盘按下 */
KEYDOWN,
/**键盘释放 */
KEYUP
}
enum BLENDMODE {
/**无 */
BLENDMODE_NONE,
/**线性减淡 */
BLENDMODE_LINEARDODGE,
/**减淡 */
BLENDMODE_DODGE,
/**变暗 */
BLENDMODE_DARK,
/**异或 */
BLENDMODE_XOR,
/**灰度模式 */
BLENDMODE_MONOCHROME,
/**扭曲 */
BLENDMODE_SPACE_DISTORT
} }

View File

@@ -92,16 +92,16 @@ function sq_GetDirection(C_Object) {}
function sq_SetDirection(C_Object, Dir) {} function sq_SetDirection(C_Object, Dir) {}
function sq_CreateActor() {} function sq_CreateActor() {}
function sq_RegisterDestruction(a,b) {} function sq_RegisterDestruction(a, b) {}
function sq_CreateSprite(a,b) {} function sq_CreateSprite(a, b) {}
function sq_CreateCanvas(a,b) {} function sq_CreateCanvas(a, b) {}
function sq_CreateText(a,b,c) {} function sq_CreateText(a, b, c) {}
function sq_AddChild(a,b){} function sq_AddChild(a, b) {}
function sq_RemoveChild(a,b){} function sq_RemoveChild(a, b) {}
function sq_SetZOrder(a,b){} function sq_SetZOrder(a, b) {}
function sq_SetPos(a,...){} function sq_SetPos(a, ...) {}
function sq_SetScale(a,...){} function sq_SetScale(a, ...) {}
/** /**
* *
@@ -110,15 +110,39 @@ function sq_SetScale(a,...){}
* @param {any} b * @param {any} b
* @returns {any} * @returns {any}
*/ */
function pow(a,b){} function pow(a, b) {}
function sq_GetWorldPos(a) {
local t = { x = 1, y = 1 };
return t;
}
function sq_SetVisible(a, b) {}
function sq_SetAlpha(a, b) {}
function sq_SetName(a, b) {}
function sq_SetSize(...) {}
function sq_SetRotation(a, b) {}
function sq_GetName(a) {}
function sq_GetVisible(a) {}
function sq_GetSize(a) {
local t = { x = 1, y = 1 };
return t;
}
function sq_GetRotation(a) {}
function sq_GetAlpha(a) {}
function sq_GetScale(a) {
local t = { x = 1, y = 1 };
return t;
}
function sq_GetZOrder(a) {}
function sq_SetBlendMode(a, b) {}
function sq_Canvas_DrawImg(a, b, c, d) {}
function sq_Canvas_DrawImgRect(a, b, c, d) {}
function sq_GetImg(a) {}
function sq_GetPng(a, b) {}
function sq_OutPutTable(...) {}
function sq_GetWorldPos(a){} function sq_GetPos(a) {
function sq_SetVisible(a,b){} local t = { x = 1, y = 1 };
function sq_SetName(a,b){} return t;
function sq_Canvas_DrawImg(a,b,c,d){} }
function sq_Canvas_DrawImgRect(a,b,c,d){} function output(...) {}
function sq_GetImg(a){}
function sq_GetPng(a,b){}
function sq_OutPutTable(...){}
function output(...){}