exportSprite之二(AFrame.java)

本文介绍了AFrame类的Java实现,包括成员变量定义、构造方法及appendModule方法的使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

AFrame.java<wbr style="line-height:25px"><wbr style="line-height:25px"><div style="line-height:25px"> <span style="line-height:25px">文件如下</span>:</div> <div style="line-height:25px"> <div style="line-height:25px"> <span style="color:#000080; line-height:25px">public class</span><span style="line-height:25px"><span style="color:#000080; line-height:25px">AFrame</span></span> </div> <div style="line-height:25px">{</div> <div style="line-height:25px"><br style="line-height:25px"></div> <div style="line-height:25px"> int id = 0;</div> <div style="line-height:25px"> int moduelCnt = 0;</div> <div style="line-height:25px"> int kDefaultFModuleSizeMax = 500;</div> <div style="line-height:25px"> FModule fModules[];</div> <div style="line-height:25px"> String des = "";</div> <div style="line-height:25px"> int rc_x = 0;</div> <div style="line-height:25px"> int rc_y = 0;</div> <div style="line-height:25px"> int rc_w = 0;</div> <div style="line-height:25px"> int rc_h = 0;</div> <div style="line-height:25px"> int w = 0;</div> <div style="line-height:25px"> int h = 0;</div> <div style="line-height:25px"><br style="line-height:25px"></div> <div style="line-height:25px"> <span style="color:#0000FF; line-height:25px">AFrame()</span> </div> <div style="line-height:25px"> {</div> <div style="line-height:25px"> fModules = new FModule[kDefaultFModuleSizeMax];</div> <div style="line-height:25px"> }</div> <div style="line-height:25px"><br style="line-height:25px"></div> <div style="line-height:25px"> <span style="color:#0000FF; line-height:25px">AFrame(int fModulesize, String des)</span> </div> <div style="line-height:25px"> {</div> <div style="line-height:25px"> fModules = new FModule[fModulesize];</div> <div style="line-height:25px"> this.des = des;</div> <div style="line-height:25px"> }</div> <div style="line-height:25px"><br style="line-height:25px"></div> <div style="line-height:25px"> <span style="color:#0000FF; line-height:25px">void appendModule(FModule fmodule)</span> </div> <div style="line-height:25px"> {</div> <div style="line-height:25px"> fModules[moduelCnt++] = fmodule;</div> <div style="line-height:25px"> int x1=rc_x;</div> <div style="line-height:25px"> int y1=rc_y;</div> <div style="line-height:25px"> int x2=rc_x+rc_w;</div> <div style="line-height:25px"> int y2=rc_y+rc_h; </div> <div style="line-height:25px"> if (fmodule.x &lt; rc_x)</div> <div style="line-height:25px"> {</div> <div style="line-height:25px"> rc_x = fmodule.x;</div> <div style="line-height:25px"> }</div> <div style="line-height:25px"> if (fmodule.y &lt; rc_y)</div> <div style="line-height:25px"> {</div> <div style="line-height:25px"> rc_y = fmodule.y;</div> <div style="line-height:25px"> }</div> <div style="line-height:25px"> if (fmodule.x+fmodule.w &gt; x2)</div> <div style="line-height:25px"> {</div> <div style="line-height:25px"> x2 = fmodule.x+fmodule.w;</div> <div style="line-height:25px"> }</div> <div style="line-height:25px"> if (fmodule.y+fmodule.h &gt; y2)</div> <div style="line-height:25px"> {</div> <div style="line-height:25px"> y2 = fmodule.y+fmodule.h;</div> <div style="line-height:25px"> }</div> <div style="line-height:25px"> rc_w=x2-rc_x;</div> <div style="line-height:25px"> rc_h=y2-rc_y;</div> <div style="line-height:25px"> }</div> <div style="line-height:25px">}</div> </div> </wbr></wbr>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值