zoukankan      html  css  js  c++  java
  • cocos2dx 笔记

      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

  • 相关阅读:
    SQL存储过程基础(从基础开始学,加油!)
    SQL语句经典大全
    SQL SQL语句的增删改查
    web app iphone4 iphone5 iphone6 响应式布局 适配代码
    DOM和 jquery 基础
    HTML 和CSS 语言
    python的目标
    老男孩学习DAY11-1 进程、进程池、协程
    老男孩python DAY10 soket 编程
    老男孩全栈PYTHON -DAY8-面向妹子(对象)编程
  • 原文地址:https://www.cnblogs.com/wendao/p/egn_cocos2dx_coordinate_etc.html
Copyright © 2011-2022 走看看