微云引擎(一)

1.字体
BitmapFont font = BitmapFont.loadFont(R.raw.ft,BitmapFont.xxStyle);
BitmapFontLabel bf1 = BitmapFontLabel.make(font,"购买成功");


2.图片
Texture2D lvl = Texture2D.makePNG(R.drawable.back);
lvl.autoRelease();
Sprite sprite =Sprite.make(lvl);
sprite.autoRelease();
addChild(sprite);
sprite.setPossition(s.width/2 , s.height/2);
sprite.autoRelease();


3.把一个dp值转化为像素值
ResolutionIndependent.resolveDp(v);



4.键与值
Charmap map = null;
map = CharMap.make();
map.autoRelease();
map.mapchar(rect,c);

rect-->字符图集在图片中的矩形
c-->映射到的字符整数表示字符UTF-8编码


5.动作跟踪器
MotionStreak mstreak = MotionStreak.make(0.01f,Texture2D.makePNG(R.drawable.streak),new WYColor4B(x,x,x,x),MotionStreak.STYLE);


6.Box2D初始方法
Box2D mBox2D = Box2D.make();
mBox2D.setDebugraw(true);
World mWorld = mBox2D.getWorld();
addChild(mBox2D);


BodyDef bodyDef = BodyDef.make();
Body mGroundBady = mBox2D.getworld().createBody(bodyDef);
bodyDef.destory();

你可能感兴趣的:(引擎)