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 < 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 < 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 > 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 > 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>
exportSprite之二(AFrame.java)
最新推荐文章于 2025-12-13 12:19:21 发布
本文介绍了一个名为AFrame的Java类,该类包含了一系列用于管理FModule实例的属性和方法。AFrame提供了默认构造函数以及带有指定大小和描述的构造函数,并实现了一个用于添加FModule的方法。此外,还详细说明了如何更新AFrame实例的边界坐标。
542

被折叠的 条评论
为什么被折叠?



