06月04, 2016

新的博客终于迁移完毕

之前一直是用wordpress写博客,这个域名申请了快6年了,我已经懒癌晚期了,现在终于开始重新写博客了。 机器放在阿里云上,备案也搞了,系统用的thinkjs开发的火麒麟博客系统。 接下来要多分享些跟技术有关的文章。

PS:希望自己可以坚持。

阅读全文 »

06月04, 2016

实现Flash背景上的拖动以及解决被Flash覆盖的问题

相信对于很多前端的同学来说,拖动并不陌生,网上随随便便搜一下能搜出很多关于拖动的文章,github上也有很多关于拖动的库可以用。最近接到一个需求,需要修改线上一个拖动窗口的功能。类似下图:

alt

看似简单的问题背后却隐藏着很多坑,让我不得不写这么一篇文章梳理一下。

阅读全文 »

09月21, 2011

How I make my first game by libgdx (1)

Hello guys,I am back. The little website is so deserted before because of my laziness. So now,I want it to be changed. I will use English by now so maybe I can improve my English. And I want all of people over the world can enjoy my little website. Closer to home. About 5 months ago,as I had just resigned,I decide to be an android developer. I want to do something different with my work before. So between software and game,I choose the game. After trying a lot framework,I choose libgdx and begin the great journey. I do not want to say how wonderful the libgdx is(please google and you will know why).I just tell you how I use it. So, let's begin. Ther are some articles in the web,but I will just write my own. Key 1: Preparing. As we know, if you want to make a game,you must have the resources(images,audio and so on). Because I am not good at painting,so after waste a lot of time in painting,I decide use other's image to be my game's actor. So I found a PC game called "Little Fighter" and it is perfect. I borrow some images from it in order to save my time in painting. Then I make a menu screen like that image below. alt By the way,it is easier to draw a screen by libgdx than by android's xml. You know,it is difficult to draw a screen as you want by edit an xml. Key 2: The map. I want to make a game,so I need a map. The best way is tilemap which is easier to build. Libgdx offer you a tool so called "tiled-preprocessor". All of your tile map must recod so the libgdx can use it. You must import it in eclipse and rebuild the "Java Build Path" of this project. You need to change the inputDir and the outputDir to your own path as I do below. For example:

 inputDir = new File("D:/maps");
 outputDir = new File("D:/maps/output");

And comment all "System.exit(0);" in order to run it. Then run it and you will get three files and they are want you need. In my application, I found the tile map is loads so slowly and it has something different with the original. So I change two places. The one is add this line settings.stripWhitespace=false; into the main method of the "TiledMapPacker.java" to make it look like the original . And change the last two num to "100" like tileMapRenderer = new TileMapRenderer(map, atlas, 100, 100); so it could loads quickly.

TO BE CONTINUE......

阅读全文 »