1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| local function setDesignResolution(r, framesize) if r.autoscale == "FILL_ALL" then view:setDesignResolutionSize(framesize.width, framesize.height, cc.ResolutionPolicy.FILL_ALL) else local scaleX, scaleY = framesize.width / r.width, framesize.height / r.height local width, height = framesize.width, framesize.height if r.autoscale == "FIXED_WIDTH" then width = framesize.width / scaleX height = framesize.height / scaleX view:setDesignResolutionSize(width, height, cc.ResolutionPolicy.NO_BORDER) elseif r.autoscale == "FIXED_HEIGHT" then width = framesize.width / scaleY height = framesize.height / scaleY view:setDesignResolutionSize(width, height, cc.ResolutionPolicy.NO_BORDER) elseif r.autoscale == "EXACT_FIT" then view:setDesignResolutionSize(r.width, r.height, cc.ResolutionPolicy.EXACT_FIT) elseif r.autoscale == "NO_BORDER" then view:setDesignResolutionSize(r.width, r.height, cc.ResolutionPolicy.NO_BORDER) elseif r.autoscale == "SHOW_ALL" then view:setDesignResolutionSize(r.width, r.height, cc.ResolutionPolicy.SHOW_ALL) else printError(string.format("display - invalid r.autoscale \"%s\"", r.autoscale)) end end end
|