技术标签: libgdx
打包工具的使用请参考
奋斗小土豆丶的博文 http://blog.sina.com.cn/s/blog_940dd50a0101cvp1.html
反打包工具
1。这个网上已经有了
public static void main(String[] args) {
toPNG("D:/libgdx-0.9.8/tools/test-me!/inputpng/canyonbunny-ui.pack",
"D:/libgdx-0.9.8/tools/test-me!/inputpng/canyonbunny-ui.png",
"D:/libgdx-0.9.8/tools/test-me!/outputpng");
}
public static void toPNG(String pathTxt, String pathPNG, String OUT) {
ArrayList<String> name = new ArrayList<String>();
ArrayList<String> xy = new ArrayList<String>();
ArrayList<String> size = new ArrayList<String>();
Boolean isfirst = true ;
int num = 5;
try {
String encoding = "GBK";
File file = new File(pathTxt);
if (file.isFile() && file.exists()) { // 判断文件是否存在
InputStreamReader read = new InputStreamReader(
new FileInputStream(file), encoding);// 考虑到编码格式
BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt = null;
int lineNum = 0, lineNum2 = 0;
while ((lineTxt = bufferedReader.readLine()) != null) {
if(isfirst){
if(lineTxt.trim().equals("")){
num = 6 ;
}else{
num = 5;
}
isfirst = false ;
}
lineNum++;
if (lineNum2 > 0)
lineNum2++;
if (lineNum == num)
lineNum2 = 1;
if (lineNum % 7 == num)
name.add(lineTxt);
if (lineNum2 % 7 == 3)
xy.add(lineTxt);
if (lineNum2 % 7 == 4)
size.add(lineTxt);
}
read.close();
} else {
System.out.println("找不到指定的文件");
}
System.out.println(xy);
System.out.println(size);
BufferedImage image = (BufferedImage) ImageIO
.read(new File(pathPNG));
for (int i = 0; i < name.size(); i++) {
String p1 = name.get(i), p2 = xy.get(i), p3 = size.get(i);
int x = 0, y = 0, w = 0, h = 0, flag = 0;
for (int j = 0; j < p2.length(); j++) {
if (p2.charAt(j) <= '9' && p2.charAt(j) >= '0') {
if (flag == 0) {
x = x * 10 + p2.charAt(j) - '0';
} else {
y = y * 10 + p2.charAt(j) - '0';
}
}
if (p2.charAt(j) == ',')
flag = 1;
}
flag = 0;
for (int j = 0; j < p3.length(); j++) {
if (p3.charAt(j) <= '9' && p3.charAt(j) >= '0') {
if (flag == 0)
w = w * 10 + p3.charAt(j) - '0';
else
h = h * 10 + p3.charAt(j) - '0';
}
if (p3.charAt(j) == ',')
flag = 1;
}
File f = new File(OUT);
if (!f.exists())
f.mkdirs();
ImageIO.write(image.getSubimage(x, y, w, h), "png",
new FileOutputStream(OUT + "/" + p1 + ".png"));
System.out.println(p1 + ".png生成成功");
}
} catch (Exception e) {
System.out.println("读取文件内容出错");
e.printStackTrace();
}
}
public class Main {
public static void main(String[] args) {
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "CanyonBunny";
cfg.useGL20 = false;
cfg.width = 1;
cfg.height = 1;
new LwjglApplication(new RestoreTexturePackerLibGdx(), cfg).exit();
}
}
public class RestoreTexturePackerLibGdx extends Game {
TextureAtlas atlas;
ArrayList<String> name = new ArrayList<String>();
ArrayList<String> xy = new ArrayList<String>();
ArrayList<String> size = new ArrayList<String>();
@Override
public void create() {
String out = "D:/libgdx-0.9.8/tools/test-me!/outputpng_test";
atlas = new TextureAtlas(Gdx.files.internal("data/canyonbunny.pack"));
Array<AtlasRegion> array = atlas.getRegions();
for(int i=0;i<array.size;i++){
AtlasRegion a = atlas.getRegions().get(i);
name.add(a.name);
xy.add("xy: "+a.getRegionX()+", "+a.getRegionY());
size.add("size: "+a.getRegionWidth()+", "+a.getRegionHeight());
}
BufferedImage image;
try {
image = (BufferedImage) ImageIO
.read(Gdx.files.internal("data/canyonbunny.png").read());
for (int i = 0; i < name.size(); i++) {
String p1 = name.get(i), p2 = xy.get(i), p3 = size.get(i);
int x = 0, y = 0, w = 0, h = 0, flag = 0;
for (int j = 0; j < p2.length(); j++) {
if (p2.charAt(j) <= '9' && p2.charAt(j) >= '0') {
if (flag == 0) {
x = x * 10 + p2.charAt(j) - '0';
} else {
y = y * 10 + p2.charAt(j) - '0';
}
}
if (p2.charAt(j) == ',')
flag = 1;
}
flag = 0;
for (int j = 0; j < p3.length(); j++) {
if (p3.charAt(j) <= '9' && p3.charAt(j) >= '0') {
if (flag == 0)
w = w * 10 + p3.charAt(j) - '0';
else
h = h * 10 + p3.charAt(j) - '0';
}
if (p3.charAt(j) == ',')
flag = 1;
}
File f = new File(out);
if (!f.exists())
f.mkdirs();
ImageIO.write(image.getSubimage(x, y, w, h), "png",
new FileOutputStream(out + "/" + p1 + ".png"));
System.out.println(p1 + ".png生成成功");
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
附上Learning Libgdx Game Development这本书的所有图片素材
常用Linux官方镜像目前收集`系统包含Ubuntu、ArchLinux、Debian、Cent OS、Fedora、Deepin、ZRMPSEL(Chrome OS)、Mac OsubuntuArch LinuxDebianCent_icfs-3.8.8.22-linux-4.18.0-arm64百度云下载
挂载一个新分区到mnt下,出现错误。但是在之前的nand flash上, 执行是ok的,原来的flash 128k block,7分区10M现在的flash 1M block 7分区6M,执行不是ok的,扩大分区后成功。要存储一些必要的信息,不能太小了。改成100M就ok了。_mount yaffs2
最近在做IIS管理软件的时候,在连接ADIL的时候老是出错,研究了半天没找出原因。因为先前一直用web来测试,一直没注意到权限问题,今天在msdn上刚刚找到原因,原来是IIS操作权限的问题,问题找到了,也好解决了。打开web.config然后在system.web节点中添加一属性 <identity impersonate="true" />OK转载于...
文/编辑 | 小Dream哥星球开设的必要性时间过的很快,转眼在有三AI开设NLP专栏已经2个月了。是时候总结下了,我们的NLP专栏按计划更新了NLP中用的常用的机器学习..._系统性的学习聊天
var svgCaptcha = require('svg-captcha');//验证码router.get('/captcha',function(req,res,next){ var code = svgCaptcha.create({ // 翻转颜色 inverse: false, ignoreChars: '0o1i', ..._node svg-captcha
前几次装系统都遇到使用poppler的epdfview打开中文PDF乱码,解决方法是安装poppler-data。
图片与文字标题组成的无序列表,会因为标题长度的不同,而出现换行.这样就出现图片无法左对齐的问题.可以这样,一,加上这个css样式.nowrap{white-space:nowrap;overflow:hidden;}二,或用程序逻辑判断.比如循环到第四个图片时,添加一个hr换行符标签.hr{background:#ddd;color:#ddd;clear:both;float...
DB2可以设置,在诊断日志db2diag.log中出现某些字符串时,自动抓取您想要的数据。比如,您想要在db2diag.log中出现'lock escalation'时,自动收集所有应用的snapshot和db2pd -locks的数据:发生锁升级时,db2diag.log示例如下:2017-07-11-00.03.05.697614-420 E98324E966
ELK 是 Elasticsearch、Logstash、Kibana 的简称,这三者是核心套件,但并非全部。这里介绍使用 Spring Cloud 对 ELK 进行整合,实现统一日志系统的搭建。_springcloud日志通过tcp输出到logstash
鹰眼插件 AMap.OverView默认在地图右下角显示缩略图<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>map</title> <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=ce..._高德api删除按钮
ElasticSearch7.2入门ElasticSearch介绍ElasticSearch,head,logstash安装一.启动Head二.启动Elasticsearch三.同步Mysql数据到Elasticsearch总结ElasticSearch介绍Elasticsearch是一个开源的高扩展的分布式全文检索引擎,它可以近乎实时的存储、检索数据;本身扩展性很好,可以扩展到上百台服务器,..._elasticsearch7.2.6
1.安装pyhdf包(2)在dos命令行下切换到包所在的文件夹,并运行pip install 包名进行安装。2.读hdf4文件#导入包from pyhdf.SD import *from osgeo import osrimport numpy as np(1)#读取文件file="3B43.20100501.7.HDF"hdf=SD(file)#获取hdf文件的属性信息attr=hdf.attr..._python读取hdf4文件