quick-cocos2dx display

disply用于创建并显示UI,设置UI位置。它可以创建Node, Scene, Sprite等。。。
local display = {}

1、sizeInPixels
4、display.contentScaleFactor 
5、display.size             -- winsize             
6、display.width            -- size.w       
7、display.height           -- size.h
8、display.cx               -- w / 2  
9、display.cy               -- h / 2
10、display.c_left          -- -cx
11、display.c_right         -- cx
12、display.c_top           -- cy   
13、display.c_bottom        -- -cy
14、display.left            -- 0   
15、display.right           -- w   
16、display.top             -- h   
17、display.bottom          -- 0   
18、display.widthInPixels      
19、display.heightInPixels     

-- 颜色
display.COLOR_WHITE = ccc3(255, 255, 255)
display.COLOR_BLACK = ccc3(0, 0, 0)
display.COLOR_RED   = ccc3(255, 0, 0)
display.COLOR_GREEN = ccc3(0, 255, 0)
display.COLOR_BLUE  = ccc3(0, 0, 255)

display.AUTO_SIZE      = 0
display.FIXED_SIZE     = 1
display.LEFT_TO_RIGHT  = 0
display.RIGHT_TO_LEFT  = 1
display.TOP_TO_BOTTOM  = 2
display.BOTTOM_TO_TOP  = 3

-- 锚点
display.CENTER        = 1
display.LEFT_TOP      = 2; display.TOP_LEFT      = 2
display.CENTER_TOP    = 3; display.TOP_CENTER    = 3
display.RIGHT_TOP     = 4; display.TOP_RIGHT     = 4
display.CENTER_LEFT   = 5; display.LEFT_CENTER   = 5
display.CENTER_RIGHT  = 6; display.RIGHT_CENTER  = 6
display.BOTTOM_LEFT   = 7; display.LEFT_BOTTOM   = 7
display.BOTTOM_RIGHT  = 8; display.RIGHT_BOTTOM  = 8
display.BOTTOM_CENTER = 9; display.CENTER_BOTTOM = 9

display.ANCHOR_POINTS = {
    CCPoint(0.5, 0.5),  -- CENTER
    CCPoint(0, 1),      -- TOP_LEFT
    CCPoint(0.5, 1),    -- TOP_CENTER
    CCPoint(1, 1),      -- TOP_RIGHT
    CCPoint(0, 0.5),    -- CENTER_LEFT
    CCPoint(1, 0.5),    -- CENTER_RIGHT
    CCPoint(0, 0),      -- BOTTOM_LEFT
    CCPoint(1, 0),      -- BOTTOM_RIGHT
    CCPoint(0.5, 0),    -- BOTTOM_CENTER
}

-- 切屏特效
display.SCENE_TRANSITIONS = {
    CROSSFADE       = {CCTransitionCrossFade, 2},
    FADE            = {CCTransitionFade, 3, ccc3(0, 0, 0)},
    FADEBL          = {CCTransitionFadeBL, 2},
    FADEDOWN        = {CCTransitionFadeDown, 2},
    FADETR          = {CCTransitionFadeTR, 2},
    FADEUP          = {CCTransitionFadeUp, 2},
    FLIPANGULAR     = {CCTransitionFlipAngular, 3, kCCTransitionOrientationLeftOver},
    FLIPX           = {CCTransitionFlipX, 3, kCCTransitionOrientationLeftOver},
    FLIPY           = {CCTransitionFlipY, 3, kCCTransitionOrientationUpOver},
    JUMPZOOM        = {CCTransitionJumpZoom, 2},
    MOVEINB         = {CCTransitionMoveInB, 2},
    MOVEINL         = {CCTransitionMoveInL, 2},
    MOVEINR         = {CCTransitionMoveInR, 2},
    MOVEINT         = {CCTransitionMoveInT, 2},
    PAGETURN        = {CCTransitionPageTurn, 3, false},
    ROTOZOOM        = {CCTransitionRotoZoom, 2},
    SHRINKGROW      = {CCTransitionShrinkGrow, 2},
    SLIDEINB        = {CCTransitionSlideInB, 2},
    SLIDEINL        = {CCTransitionSlideInL, 2},
    SLIDEINR        = {CCTransitionSlideInR, 2},
    SLIDEINT        = {CCTransitionSlideInT, 2},
    SPLITCOLS       = {CCTransitionSplitCols, 2},
    SPLITROWS       = {CCTransitionSplitRows, 2},
    TURNOFFTILES    = {CCTransitionTurnOffTiles, 2},
    ZOOMFLIPANGULAR = {CCTransitionZoomFlipAngular, 2},
    ZOOMFLIPX       = {CCTransitionZoomFlipX, 3, kCCTransitionOrientationLeftOver},
    ZOOMFLIPY       = {CCTransitionZoomFlipY, 3, kCCTransitionOrientationUpOver},
}

display.TEXTURES_PIXEL_FORMAT = {}

-- 创建一个场景
-- name 场景名
function display.newScene(name)                   

-- 场景切换特效
-- scene 
-- transitionType : 特效名称(就是特效类的类名)
-- time : 持续时间
-- more : 每个场景切换类的构造参数个数不同!!!more为备用参数
function display.wrapSceneWithTransition(scene, transitionType, time, more)    -- 

-- quick对display进行了封装,原cocos2dx版切场景有runwithscene, replaceScene, 还有场景切换特效
-- quick只提供replaceScene,他根据情况,自动判断调用具体调用哪一个
function display.replaceScene(newScene, transitionType, time, more)

-- 当前scene
function display.getRunningScene()

-- 暂停
function display.pause()

-- 继续
function display.resume()

-- 创建layer
function display.newLayer()

function display.newColorLayer(color)

function display.newNode()

function display.newClippingRegionNode(rect)

-- quick对sprite的创建进行了封装。原本创建sprite的方法有:Sprite:create(str),spriteFrameByName(str)
-- 以及CCSprite:create(spriteFrame).
-- quick可以根据参数类型,确定具体调哪一个函数,
-- filename : ①以‘#’开头的字符串,调用spriteFrameByName;
--             ②不是以‘#’开头的字符串。调用create
--             ③如果是CCSpriteFrame的userdata, 则调用createWithSpriteFrame
-- 还能创建时直接指定位置
function display.newSprite(filename, x, y)

-- file分‘#’与非‘#’。但只能是字符串,不能是其他类型,这点与newSprite不同。
-- size为CCSize类型
function display.newScale9Sprite(filename, x, y, size)

-- title地图
-- rect地图卡片大小,默认为设备大小
function display.newTilesSprite(filename, rect)

-- 创建一个圆形Node
function display.newCircle(radius)

-- 创建一个矩形Node
-- width : ①CCRect , 则pos取width的x,y。size取width的w,h
-- ② CCSize x,y = 0 ; size取width的w,h
-- ③ width,height都为int,pos取0,0.size取width,height
function display.newRect(width, height)

-- 多边形
-- points格式为{{x,y},{x,y},{x,y}}
function display.newPolygon(points, scale)

-- 对齐函数实际上就是修改target的锚点。
-- x,y若not nil则调用setPosition。
function display.align(target, anchorPoint, x, y)

-- 异步加载图片
-- callback参数类型:
function display.addImageAsync(imagePath, callback)


function display.addSpriteFramesWithFile(plistFilename, image)

function display.removeSpriteFramesWithFile(plistFilename, imageName)

function display.setTexturePixelFormat(filename, format)

function display.removeSpriteFrameByImageName(imageName)

-- 实际调用SpriteBatchNode
-- image:图片名字
-- capacity 容量
function display.newBatchNode(image, capacity)

-- frameName为string
function display.newSpriteFrame(frameName)

-- pattern为这图片名。如有frame1, frame2, rame3...frame19 则pattern为“frame”
-- begin :如上例为1
-- length : 如上例为19
function display.newFrames(pattern, begin, length, isReversed)

-- frames为图片帧数组(table)
function display.newAnimation(frames, time)

function display.setAnimationCache(name, animation)

function display.getAnimationCache(name)

function display.removeAnimationCache(name)

function display.removeUnusedSpriteFrames()

display.PROGRESS_TIMER_BAR = kCCProgressTimerTypeBar
display.PROGRESS_TIMER_RADIAL = kCCProgressTimerTypeRadial

-- image可以是string,也可以是一张图片
function display.newProgressTimer(image, progresssType)

return display

你可能感兴趣的:(display,lua,cocos2dx,qiuck-lua)