cocos2d-x 笔记

  Cocos2d utility functions convertToGL and convertToUI allow for easy conversions between points in the UIKit coordinate system and the OpenGL ES coordinate system. You will use these functions when trying to get the location of a touch event,converting it from UIKit to OpenGL ES coordinates.(UIKit coordinate system has the orign(0,0) at the upper left of the screen)

  Images Files
  Your characters start out as images on the flash storage of the iphone/ipad.The format of files is typically PNG or JPEG .Once the images are loaded into memory, they are stored in an uncompressed texture format.PNG is the preferred format for images on the IOS devices.

  Texture
  The image file of your character has to be decompressed and possibly converted into a format that the iphone and ipad GPU can understand and loaded into RAM before it can be used. The loaded image in RAM is referred to as a texture. The GPU can natively handle a few compressed formats such as PVRTC;others have to be stored as uncompression of your images data.This is what OpenGL ES draws on the screen. The decompression of your images is why a PNG image may be small in flash storage but in memory takes up much more as it is stored uncompressed.

  (下面的引自 子龙山人)默认情况下,当你在cocos2d里加载一张图片的时候,对于每个像素点使用4个byte来表示——red、green、blue和alpha。这个就简称RGBA8888。
  默认像素格式来 加载图片的话,图像宽度(width)* 图像高度(height)*每一个像素的位数(bytes per pixel) = 内存大小
  此时,如果有一张512*512的图片,那么当你使用默认的像素格式去加载它的话,将耗512*512*4=1MB 

write by fgd

转载于:https://www.cnblogs.com/wendao/archive/2012/01/30/egn_cocos2dx_coordinate_etc.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值