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

  • 相关阅读:
    Npm 被公司墙解决方法
    使用Docker开发NodeJs APP
    如何利用Require.Js管理多页面站点文件(译)
    Swift语言指南(十)--字符串与字符
    Swift语言指南(九)--基本运算符
    Swift语言指南(八)--语言基础之元组
    Swift语言指南(七)--语言基础之布尔值和类型别名
    web 开发入门
    JDBC的操作总结
    JDBC连接数据库
  • 原文地址:https://www.cnblogs.com/wendao/p/egn_cocos2dx_coordinate_etc.html
Copyright © 2011-2022 走看看