49 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:SpriteFrameClass.nut
 | |
| 路径:BaseClass/SpriteObject/SpriteFrameClass.nut
 | |
| 创建日期:2024-05-05	09:36
 | |
| 文件用途:精灵帧类
 | |
| */
 | |
| class CL_SpriteFrameObject extends CL_BaseObject {
 | |
| 
 | |
|     ImgPath = null;
 | |
|     ImgIndex = null;
 | |
| 
 | |
|     function _typeof() {
 | |
|         return "SpriteFrame";
 | |
|     }
 | |
| 
 | |
|     constructor(...) {
 | |
|         if (vargv.len() == 2) {
 | |
|             ImgPath = vargv[0];
 | |
|             ImgIndex = vargv[1];
 | |
|             C_Object = SpriteFrame_Create(ImgPath, ImgIndex);
 | |
|         } else {
 | |
|             C_Object = vargv[0];
 | |
|         }
 | |
|         // base.constructor(C_Object);
 | |
|     }
 | |
| 
 | |
|     //重写获取大小
 | |
|     function GetSize() {
 | |
|         return SpriteFrame_GetSize(this.C_Object);
 | |
|     }
 | |
| 
 | |
|     //重写设置坐标
 | |
|     function SetPosition(Value, ...) {
 | |
|         if (vargv.len() == 0) {
 | |
|             X = Value.x;
 | |
|             Y = Value.y;
 | |
|             SpriteFrame_SetPosition(this.C_Object, Value);
 | |
|         } else if (vargv.len() == 1) {
 | |
|             X = Value;
 | |
|             Y = vargv[0];
 | |
|             SpriteFrame_SetPosition(this.C_Object, Value, vargv[0]);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //返回一个画布精灵
 | |
|     function CreateOutLine(Color) {
 | |
|         return CL_SpriteObject(SpriteFrame_CreateOutLine(this.C_Object, Color));
 | |
|     }
 | |
| } |