From 17d44e2d21c1d230e717afaf562960860fa2bc27 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 4 Mar 2014 15:41:48 +0800 Subject: [PATCH 1/4] Feature #4236: property apis and some manual implementations added to JSB --- .../project.pbxproj | 12 + frameworks/js-bindings/bindings/script/jsb.js | 2 + .../bindings/script/jsb_cocos2d.js | 2 +- .../bindings/script/jsb_property_apis.js | 558 ++++++++++++++++++ .../bindings/script/jsb_property_impls.js | 113 ++++ samples/js-tests/src/LayerTest/LayerTest.js | 32 +- 6 files changed, 704 insertions(+), 15 deletions(-) create mode 100644 frameworks/js-bindings/bindings/script/jsb_property_apis.js create mode 100644 frameworks/js-bindings/bindings/script/jsb_property_impls.js diff --git a/build/cocos2d_jsb_samples.xcodeproj/project.pbxproj b/build/cocos2d_jsb_samples.xcodeproj/project.pbxproj index 100fe2c6b7..abfd2d50d1 100644 --- a/build/cocos2d_jsb_samples.xcodeproj/project.pbxproj +++ b/build/cocos2d_jsb_samples.xcodeproj/project.pbxproj @@ -90,6 +90,10 @@ A035A5E71782290400987F6C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; }; A035A5E81782290400987F6C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64822165F391E007D4F18 /* Cocoa.framework */; }; A035A71217822E9E00987F6C /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A035A71117822E9E00987F6C /* libsqlite3.dylib */; }; + BA175BB118C5A2CA0040EA39 /* jsb_property_apis.js in Sources */ = {isa = PBXBuildFile; fileRef = BA175BAE18C5A2CA0040EA39 /* jsb_property_apis.js */; }; + BA175BB318C5A2CA0040EA39 /* jsb_property_impls.js in Sources */ = {isa = PBXBuildFile; fileRef = BA175BAF18C5A2CA0040EA39 /* jsb_property_impls.js */; }; + BA175BB418C5A2DA0040EA39 /* jsb_property_apis.js in Resources */ = {isa = PBXBuildFile; fileRef = BA175BAE18C5A2CA0040EA39 /* jsb_property_apis.js */; }; + BA175BB518C5A2DA0040EA39 /* jsb_property_impls.js in Resources */ = {isa = PBXBuildFile; fileRef = BA175BAF18C5A2CA0040EA39 /* jsb_property_impls.js */; }; D60AE43817F9143D00757E4B /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60AE43317F7FFE100757E4B /* CoreMotion.framework */; }; ED743D1717D099F10004076B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDCC747E17C455FD007B692C /* IOKit.framework */; }; /* End PBXBuildFile section */ @@ -312,6 +316,8 @@ A07A52B91783AE900073F6A7 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; }; A07A52BB1783AEB80073F6A7 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; A07A52C11783B01F0073F6A7 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; }; + BA175BAE18C5A2CA0040EA39 /* jsb_property_apis.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = jsb_property_apis.js; path = "../frameworks/js-bindings/bindings/script/jsb_property_apis.js"; sourceTree = ""; }; + BA175BAF18C5A2CA0040EA39 /* jsb_property_impls.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = jsb_property_impls.js; path = "../frameworks/js-bindings/bindings/script/jsb_property_impls.js"; sourceTree = ""; }; D60AE43317F7FFE100757E4B /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; }; EDCC747E17C455FD007B692C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -386,6 +392,8 @@ 1A487B4218BF3E7F007EEB98 /* jsb_cocos2d_constants.js */, 1A487B4318BF3E7F007EEB98 /* jsb_cocos2d_extension.js */, 1A487B4418BF3E7F007EEB98 /* jsb_cocos2d_gui.js */, + BA175BAE18C5A2CA0040EA39 /* jsb_property_apis.js */, + BA175BAF18C5A2CA0040EA39 /* jsb_property_impls.js */, 1A487B4518BF3E7F007EEB98 /* jsb_cocos2d_studio.js */, 1A487B4718BF3E7F007EEB98 /* jsb_cocosbuilder.js */, 1A487B4818BF3E7F007EEB98 /* jsb_debugger.js */, @@ -740,6 +748,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + BA175BB418C5A2DA0040EA39 /* jsb_property_apis.js in Resources */, + BA175BB518C5A2DA0040EA39 /* jsb_property_impls.js in Resources */, 1A487B6C18BF3EDF007EEB98 /* jsb.js in Resources */, 1A487B6D18BF3EDF007EEB98 /* jsb_chipmunk.js in Resources */, 1A487B6E18BF3EDF007EEB98 /* jsb_chipmunk_constants.js in Resources */, @@ -773,7 +783,9 @@ 1A604F5A18BF1D6000CC9A93 /* RootViewController.mm in Sources */, 1A604F3A18BF1D5600CC9A93 /* AppDelegate.cpp in Sources */, 1A604F5918BF1D6000CC9A93 /* main.m in Sources */, + BA175BB118C5A2CA0040EA39 /* jsb_property_apis.js in Sources */, 1A604F4D18BF1D6000CC9A93 /* AppController.mm in Sources */, + BA175BB318C5A2CA0040EA39 /* jsb_property_impls.js in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/frameworks/js-bindings/bindings/script/jsb.js b/frameworks/js-bindings/bindings/script/jsb.js index b1dffd791e..7ba2644cf8 100644 --- a/frameworks/js-bindings/bindings/script/jsb.js +++ b/frameworks/js-bindings/bindings/script/jsb.js @@ -8,6 +8,8 @@ require('jsb_cocos2d.js'); require('jsb_cocos2d_extension.js'); require('jsb_cocos2d_studio.js'); require('jsb_cocos2d_gui.js'); +require('jsb_property_impls.js'); +require('jsb_property_apis.js'); require('jsb_chipmunk_constants.js'); require('jsb_chipmunk.js'); require('jsb_opengl_constants.js'); diff --git a/frameworks/js-bindings/bindings/script/jsb_cocos2d.js b/frameworks/js-bindings/bindings/script/jsb_cocos2d.js index 8c1c2cfc09..a655a3fcf9 100644 --- a/frameworks/js-bindings/bindings/script/jsb_cocos2d.js +++ b/frameworks/js-bindings/bindings/script/jsb_cocos2d.js @@ -19,7 +19,7 @@ cc.TARGET_PLATFORM = { PC_BROWSER:101 }; -cc.RESOLUTION_POLICY = { +cc.ResolutionPolicy = { // The entire application is visible in the specified area without trying to preserve the original aspect ratio. // Distortion can occur, and the application may appear stretched or compressed. EXACT_FIT:0, diff --git a/frameworks/js-bindings/bindings/script/jsb_property_apis.js b/frameworks/js-bindings/bindings/script/jsb_property_apis.js new file mode 100644 index 0000000000..c770a0565b --- /dev/null +++ b/frameworks/js-bindings/bindings/script/jsb_property_apis.js @@ -0,0 +1,558 @@ +cc.defineGetterSetter = function (proto, prop, getter, setter) +{ + var desc = { enumerable: false, configurable: true }; + getter && (desc.get = getter); + setter && (desc.set = setter); + Object.defineProperty(proto, prop, desc); +}; + +// Overrides +var _proto = cc.AtlasNode.prototype; +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); + +_proto = cc.LabelTTF.prototype; +cc.defineGetterSetter(_proto, "size", _proto.getContentSize, _proto.setContentSize); +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + +_proto = cc.LayerColor.prototype; +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); + +_proto = cc.LayerGradient.prototype; +cc.defineGetterSetter(_proto, "size", _proto.getContentSize, _proto.setContentSize); +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + +_proto = cc.Sprite.prototype; +cc.defineGetterSetter(_proto, "ignoreAnchor", _proto.isIgnoreAnchorPointForPosition, _proto.ignoreAnchorPointForPosition); + +_proto = cc.LabelAtlas.prototype; +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); + +_proto = cc.LabelBMFont.prototype; +cc.defineGetterSetter(_proto, "anchor", _proto._getAnchor, _proto._setAnchor); +//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +cc.defineGetterSetter(_proto, "scale", _proto.getScale, _proto.setScale); +cc.defineGetterSetter(_proto, "scaleX", _proto.getScaleX, _proto.setScaleX); +cc.defineGetterSetter(_proto, "scaleY", _proto.getScaleY, _proto.setScaleY); +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "cascadeOpacity", _proto.isCascadeOpacityEnabled, _proto.setCascadeOpacityEnabled); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "cascadeColor", _proto.isCascadeColorEnabled, _proto.setCascadeColorEnabled); + +_proto = cc.Menu.prototype; +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); + +_proto = cc.MenuItem.prototype; +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); + +_proto = cc.MotionStreak.prototype; +cc.defineGetterSetter(_proto, "x", _proto.getPositionX, _proto.setPositionX); +cc.defineGetterSetter(_proto, "y", _proto.getPositionY, _proto.setPositionY); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); + +_proto = cc.ParticleSystem.prototype; +cc.defineGetterSetter(_proto, "rotation", _proto.getRotation, _proto.setRotation); +cc.defineGetterSetter(_proto, "scale", _proto.getScale, _proto.setScale); +cc.defineGetterSetter(_proto, "scaleX", _proto.getScaleX, _proto.setScaleX); +cc.defineGetterSetter(_proto, "scaleY", _proto.getScaleY, _proto.setScaleY); + +_proto = cc.PhysicsSprite.prototype; +cc.defineGetterSetter(_proto, "body", _proto.getBody, _proto.setBody); +cc.defineGetterSetter(_proto, "x", _proto.getPositionX, _proto.setPositionX); +cc.defineGetterSetter(_proto, "y", _proto.getPositionY, _proto.setPositionY); +cc.defineGetterSetter(_proto, "rotation", _proto.getRotation, _proto.setRotation); +cc.defineGetterSetter(_proto, "dirty", _proto.isDirty); + +_proto = cc.ProgressTimer.prototype; +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); + +_proto = cc.TextFieldTTF.prototype; +cc.defineGetterSetter(_proto, "string", _proto.getString, _proto.setString); + +_proto = ccs.Bone.prototype; +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "zIndex", _proto.getLocalZOrder, _proto.setLocalZOrder); + +_proto = ccui.Widget.prototype; +cc.defineGetterSetter(_proto, "x", _proto.getPositionX, _proto.setPositionX); +cc.defineGetterSetter(_proto, "y", _proto.getPositionY, _proto.setPositionY); +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); +cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); +cc.defineGetterSetter(_proto, "children", _proto.getChildren); +cc.defineGetterSetter(_proto, "childrenCount", _proto.getChildrenCount); + +_proto = ccui.ScrollView.prototype; +cc.defineGetterSetter(_proto, "children", _proto.getChildren); +cc.defineGetterSetter(_proto, "childrenCount", _proto.getChildrenCount); +cc.defineGetterSetter(_proto, "layoutType", _proto.getLayoutType, _proto.setLayoutType); + +_proto = ccui.Button.prototype; +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); +cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); + +_proto = ccui.CheckBox.prototype; +//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); +cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + +_proto = ccui.ImageView.prototype; +//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); +cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + +_proto = ccui.Text.prototype; +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +cc.defineGetterSetter(_proto, "scaleX", _proto.getScaleX, _proto.setScaleX); +cc.defineGetterSetter(_proto, "scaleY", _proto.getScaleY, _proto.setScaleY); +cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); +cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); + +_proto = ccui.TextAtlas.prototype; +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); + +_proto = ccui.TextBMFont.prototype; +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); + +_proto = ccui.LoadingBar.prototype; +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + +_proto = ccui.Slider.prototype; +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + +_proto = ccui.TextField.prototype; +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); + +_proto = cc.Control.prototype; +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); + +_proto = cc.ControlButton.prototype; +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); + +_proto = cc.ControlColourPicker.prototype; +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); + +_proto = cc.ControlHuePicker.prototype; +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); + +_proto = cc.ControlPotentiometer.prototype; +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); + +_proto = cc.ControlSaturationBrightnessPicker.prototype; +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); + +_proto = cc.ControlSlider.prototype; +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); + +_proto = cc.ControlSwitch.prototype; +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); + +_proto = cc.Scale9Sprite.prototype; +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); + +_proto = cc.ScrollView.prototype; +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + + + + +// Extends +var _proto = cc.ClippingNode.prototype; +cc.defineGetterSetter(_proto, "stencil", _proto.getStencil, _proto.setStencil); + +_proto = cc.AtlasNode.prototype; +cc.defineGetterSetter(_proto, "texture", _proto.getTexture, _proto.setTexture); + +_proto = cc.Node.prototype; +cc.defineGetterSetter(_proto, "x", _proto.getPositionX, _proto.setPositionX); +cc.defineGetterSetter(_proto, "y", _proto.getPositionY, _proto.setPositionY); +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +cc.defineGetterSetter(_proto, "skewX", _proto.getSkewX, _proto.setSkewX); +cc.defineGetterSetter(_proto, "skewY", _proto.getSkewY, _proto.setSkewY); +cc.defineGetterSetter(_proto, "zIndex", _proto.getLocalZOrder, _proto.setLocalZOrder); +cc.defineGetterSetter(_proto, "vertexZ", _proto.getVertexZ, _proto.setVertexZ); +cc.defineGetterSetter(_proto, "rotation", _proto.getRotation, _proto.setRotation); +cc.defineGetterSetter(_proto, "rotationX", _proto.getRotationX, _proto.setRotationX); +cc.defineGetterSetter(_proto, "rotationY", _proto.getRotationY, _proto.setRotationY); +cc.defineGetterSetter(_proto, "scale", _proto.getScale, _proto.setScale); +cc.defineGetterSetter(_proto, "scaleX", _proto.getScaleX, _proto.setScaleX); +cc.defineGetterSetter(_proto, "scaleY", _proto.getScaleY, _proto.setScaleY); +cc.defineGetterSetter(_proto, "children", _proto.getChildren); +cc.defineGetterSetter(_proto, "childrenCount", _proto.getChildrenCount); +cc.defineGetterSetter(_proto, "parent", _proto.getParent, _proto.setParent); +cc.defineGetterSetter(_proto, "visible", _proto.isVisible, _proto.setVisible); +cc.defineGetterSetter(_proto, "running", _proto.isRunning); +cc.defineGetterSetter(_proto, "ignoreAnchor", _proto.isIgnoreAnchorPointForPosition, _proto.ignoreAnchorPointForPosition); +cc.defineGetterSetter(_proto, "actionManager", _proto.getActionManager, _proto.setActionManager); +cc.defineGetterSetter(_proto, "scheduler", _proto.getScheduler, _proto.setScheduler); +cc.defineGetterSetter(_proto, "shaderProgram", _proto.getShaderProgram, _proto.setShaderProgram); +cc.defineGetterSetter(_proto, "glServerState", _proto.getGLServerState, _proto.setGLServerState); + +_proto = cc.NodeRGBA.prototype; +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); +cc.defineGetterSetter(_proto, "cascadeOpacity", _proto.isCascadeOpacityEnabled, _proto.setCascadeOpacityEnabled); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "cascadeColor", _proto.isCascadeColorEnabled, _proto.setCascadeColorEnabled); + +_proto = cc.LabelTTF.prototype; +cc.defineGetterSetter(_proto, "string", _proto.getString, _proto.setString); +cc.defineGetterSetter(_proto, "textAlign", _proto.getHorizontalAlignment, _proto.setHorizontalAlignment); +cc.defineGetterSetter(_proto, "verticalAlign", _proto.getVerticalAlignment, _proto.setVerticalAlignment); +cc.defineGetterSetter(_proto, "fontSize", _proto.getFontSize, _proto.setFontSize); +cc.defineGetterSetter(_proto, "fontName", _proto.getFontName, _proto.setFontName); +cc.defineGetterSetter(_proto, "font", _proto._getFont, _proto._setFont); +cc.defineGetterSetter(_proto, "boundingWidth", _proto._getBoundingWidth, _proto._setBoundingWidth); +cc.defineGetterSetter(_proto, "boundingHeight", _proto._getBoundingHeight, _proto._setBoundingHeight); +cc.defineGetterSetter(_proto, "fillStyle", _proto._getFillStyle, _proto.setFontFillColor); +cc.defineGetterSetter(_proto, "strokeStyle", _proto._getStrokeStyle, _proto._setStrokeStyle); +cc.defineGetterSetter(_proto, "lineWidth", _proto._getLineWidth, _proto._setLineWidth); +cc.defineGetterSetter(_proto, "shadowOffsetX", _proto._getShadowOffsetX, _proto._setShadowOffsetX); +cc.defineGetterSetter(_proto, "shadowOffsetY", _proto._getShadowOffsetY, _proto._setShadowOffsetY); +cc.defineGetterSetter(_proto, "shadowOpacity", _proto._getShadowOpacity, _proto._setShadowOpacity); +cc.defineGetterSetter(_proto, "shadowBlur", _proto._getShadowBlur, _proto._setShadowBlur); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); + +_proto = cc.LayerRGBA.prototype; +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "cascadeOpacity", _proto.isCascadeOpacityEnabled, _proto.setCascadeOpacityEnabled); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); +cc.defineGetterSetter(_proto, "cascadeColor", _proto.isCascadeColorEnabled, _proto.setCascadeColorEnabled); + +_proto = cc.LayerColor.prototype; +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + +_proto = cc.LayerGradient.prototype; +cc.defineGetterSetter(_proto, "startColor", _proto.getStartColor, _proto.setStartColor); +cc.defineGetterSetter(_proto, "endColor", _proto.getEndColor, _proto.setEndColor); +cc.defineGetterSetter(_proto, "startOpacity", _proto.getStartOpacity, _proto.setStartOpacity); +cc.defineGetterSetter(_proto, "endOpacity", _proto.getEndOpacity, _proto.setEndOpacity); +cc.defineGetterSetter(_proto, "vector", _proto.getVector, _proto.setVector); +cc.defineGetterSetter(_proto, "compresseInterpolation", _proto.isCompressedInterpolation, _proto.setCompressedInterpolation); + +_proto = cc.Sprite.prototype; +cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); +cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); +cc.defineGetterSetter(_proto, "offsetX", _proto._getOffsetX); +cc.defineGetterSetter(_proto, "offsetY", _proto._getOffsetY); +cc.defineGetterSetter(_proto, "texture", _proto.getTexture, _proto.setTexture); +cc.defineGetterSetter(_proto, "textureRectRotated", _proto.isTextureRectRotated); +cc.defineGetterSetter(_proto, "batchNode", _proto.getBatchNode, _proto.setBatchNode); +cc.defineGetterSetter(_proto, "quad", _proto.getQuad); +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); +cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); + +_proto = cc.SpriteBatchNode.prototype; +cc.defineGetterSetter(_proto, "descendants", _proto.getDescendants); +cc.defineGetterSetter(_proto, "texture", _proto.getTexture, _proto.setTexture); + +_proto = cc.Texture2D.prototype; +cc.defineGetterSetter(_proto, "name", _proto.getName); +cc.defineGetterSetter(_proto, "pixelFormat", _proto.getPixelFormat); +cc.defineGetterSetter(_proto, "pixelsWidth", _proto.getPixelsWide); +cc.defineGetterSetter(_proto, "pixelsHeight", _proto.getPixelsHigh); +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); + +_proto = cc.LabelAtlas.prototype; +cc.defineGetterSetter(_proto, "string", _proto.getString, _proto.setString); +cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); + +_proto = cc.LabelBMFont.prototype; +cc.defineGetterSetter(_proto, "string", _proto.getString, _proto._setStringForSetter); +cc.defineGetterSetter(_proto, "textAlign", _proto._getAlignment, _proto.setAlignment); +cc.defineGetterSetter(_proto, "boundingWidth", _proto._getBoundingWidth, _proto.setBoundingWidth); + +_proto = cc.MenuItem.prototype; +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); + +_proto = cc.MenuItemLabel.prototype; +cc.defineGetterSetter(_proto, "string", _proto.getString, _proto.setString); +cc.defineGetterSetter(_proto, "label", _proto.getLabel, _proto.setLabel); +cc.defineGetterSetter(_proto, "disabledColor", _proto.getDisabledColor, _proto.setDisabledColor); + +_proto = cc.MenuItemFont.prototype; +//cc.defineGetterSetter(_proto, "fontSize", _proto.fontSize, _proto.setFontSize); +//cc.defineGetterSetter(_proto, "fontName", _proto.fontName, _proto.setFontName); + +_proto = cc.MenuItemSprite.prototype; +cc.defineGetterSetter(_proto, "normalImage", _proto.getNormalImage, _proto.setNormalImage); +cc.defineGetterSetter(_proto, "selectedImage", _proto.getSelectedImage, _proto.setSelectedImage); +cc.defineGetterSetter(_proto, "disabledImage", _proto.getDisabledImage, _proto.setDisabledImage); + +_proto = cc.ParticleBatchNode.prototype; +cc.defineGetterSetter(_proto, "texture", _proto.getTexture, _proto.setTexture); + +_proto = cc.ParticleSystem.prototype; +cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); +cc.defineGetterSetter(_proto, "batchNode", _proto.getBatchNode, _proto.setBatchNode); +cc.defineGetterSetter(_proto, "active", _proto.isActive); +cc.defineGetterSetter(_proto, "sourcePos", _proto.getSourcePosition, _proto.setSourcePosition); +cc.defineGetterSetter(_proto, "posVar", _proto.getPosVar, _proto.setPosVar); +cc.defineGetterSetter(_proto, "gravity", _proto.getGravity, _proto.setGravity); +cc.defineGetterSetter(_proto, "speed", _proto.getSpeed, _proto.setSpeed); +cc.defineGetterSetter(_proto, "speedVar", _proto.getSpeedVar, _proto.setSpeedVar); +cc.defineGetterSetter(_proto, "tangentialAccel", _proto.getTangentialAccel, _proto.setTangentialAccel); +cc.defineGetterSetter(_proto, "tangentialAccelVar", _proto.getTangentialAccelVar, _proto.setTangentialAccelVar); +cc.defineGetterSetter(_proto, "rotationIsDir", _proto.getRotationIsDir, _proto.setRotationIsDir); +cc.defineGetterSetter(_proto, "startRadius", _proto.getStartRadius, _proto.setStartRadius); +cc.defineGetterSetter(_proto, "startRadiusVar", _proto.getStartRadiusVar, _proto.setStartRadiusVar); +cc.defineGetterSetter(_proto, "endRadius", _proto.getEndRadius, _proto.setEndRadius); +cc.defineGetterSetter(_proto, "endRadiusVar", _proto.getEndRadiusVar, _proto.setEndRadiusVar); +cc.defineGetterSetter(_proto, "rotatePerS", _proto.getRotatePerSecond, _proto.setRotatePerSecond); +cc.defineGetterSetter(_proto, "rotatePerSVar", _proto.getRotatePerSecondVar, _proto.setRotatePerSecondVar); +cc.defineGetterSetter(_proto, "startColor", _proto.getStartColor, _proto.setStartColor); +cc.defineGetterSetter(_proto, "startColorVar", _proto.getStartColorVar, _proto.setStartColorVar); +cc.defineGetterSetter(_proto, "endColor", _proto.getEndColor, _proto.setEndColor); +cc.defineGetterSetter(_proto, "endColorVar", _proto.getEndColorVar, _proto.setEndColorVar); +cc.defineGetterSetter(_proto, "totalParticles", _proto.getTotalParticles, _proto.setTotalParticles); +cc.defineGetterSetter(_proto, "texture", _proto.getTexture, _proto.setTexture); + +_proto = cc.ProgressTimer.prototype; +cc.defineGetterSetter(_proto, "midPoint", _proto.getMidpoint, _proto.setMidpoint); +cc.defineGetterSetter(_proto, "barChangeRate", _proto.getBarChangeRate, _proto.setBarChangeRate); +cc.defineGetterSetter(_proto, "type", _proto.getType, _proto.setType); +cc.defineGetterSetter(_proto, "percentage", _proto.getPercentage, _proto.setPercentage); +cc.defineGetterSetter(_proto, "sprite", _proto.getSprite, _proto.setSprite); +cc.defineGetterSetter(_proto, "reverseDir", _proto.isReverseDirection, _proto.setReverseDirection); + +_proto = cc.RenderTexture.prototype; +cc.defineGetterSetter(_proto, "clearColorVal", _proto.getClearColor, _proto.setClearColor); + +_proto = cc.TMXLayer.prototype; +cc.defineGetterSetter(_proto, "layerWidth", _proto._getLayerWidth, _proto._setLayerWidth); +cc.defineGetterSetter(_proto, "layerHeight", _proto._getLayerHeight, _proto._setLayerHeight); +cc.defineGetterSetter(_proto, "tileWidth", _proto._getTileWidth, _proto._setTileWidth); +cc.defineGetterSetter(_proto, "tileHeight", _proto._getTileHeight, _proto._setTileHeight); +cc.defineGetterSetter(_proto, "texture", _proto.getTexture, _proto.setTexture); + +_proto = cc.TMXTiledMap.prototype; +cc.defineGetterSetter(_proto, "mapWidth", _proto._getMapWidth, _proto._setMapWidth); +cc.defineGetterSetter(_proto, "mapHeight", _proto._getMapHeight, _proto._setMapHeight); +cc.defineGetterSetter(_proto, "tileWidth", _proto._getTileWidth, _proto._setTileWidth); +cc.defineGetterSetter(_proto, "tileHeight", _proto._getTileHeight, _proto._setTileHeight); + +_proto = cc.TMXMapInfo.prototype; +cc.defineGetterSetter(_proto, "mapWidth", _proto._getMapWidth, _proto._setMapWidth); +cc.defineGetterSetter(_proto, "mapHeight", _proto._getMapHeight, _proto._setMapHeight); +cc.defineGetterSetter(_proto, "tileWidth", _proto._getTileWidth, _proto._setTileWidth); +cc.defineGetterSetter(_proto, "tileHeight", _proto._getTileHeight, _proto._setTileHeight); + +_proto = ccs.Armature.prototype; +cc.defineGetterSetter(_proto, "parentBone", _proto.getParentBone, _proto.setParentBone); +cc.defineGetterSetter(_proto, "body", _proto.getBody, _proto.setBody); +cc.defineGetterSetter(_proto, "colliderFilter", _proto.setColliderFilter); + +_proto = ccs.Bone.prototype; +cc.defineGetterSetter(_proto, "boneData", _proto.getBoneData, _proto.setBoneData); +cc.defineGetterSetter(_proto, "armature", _proto.getArmature, _proto.setArmature); +cc.defineGetterSetter(_proto, "childArmature", _proto.getChildArmature, _proto.setChildArmature); +cc.defineGetterSetter(_proto, "childrenBone", _proto.getChildrenBone); +cc.defineGetterSetter(_proto, "tween", _proto.getTween); +cc.defineGetterSetter(_proto, "tweenData", _proto.getTweenData); +cc.defineGetterSetter(_proto, "colliderFilter", _proto.getColliderFilter, _proto.setColliderFilter); + +_proto = ccs.Skin.prototype; +cc.defineGetterSetter(_proto, "skinData", _proto.getSkinData, _proto.setSkinData); +cc.defineGetterSetter(_proto, "displayName", _proto.getDisplayName); + +_proto = ccui.Widget.prototype; +cc.defineGetterSetter(_proto, "xPercent", _proto._getXPercent, _proto._setXPercent); +cc.defineGetterSetter(_proto, "yPercent", _proto._getYPercent, _proto._setYPercent); +cc.defineGetterSetter(_proto, "widthPercent", _proto._getWidthPercent, _proto._setWidthPercent); +cc.defineGetterSetter(_proto, "heightPercent", _proto._getHeightPercent, _proto._setHeightPercent); +cc.defineGetterSetter(_proto, "widgetParent", _proto.getWidgetParent); +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); +cc.defineGetterSetter(_proto, "focused", _proto.isFocused, _proto.setFocused); +cc.defineGetterSetter(_proto, "sizeType", _proto.getSizeType, _proto.setSizeType); +cc.defineGetterSetter(_proto, "widgetType", _proto.getWidgetType); +cc.defineGetterSetter(_proto, "touchEnabled", _proto.isTouchEnabled, _proto.setTouchEnabled); +cc.defineGetterSetter(_proto, "updateEnabled", _proto.isUpdateEnabled, _proto.setUpdateEnabled); +cc.defineGetterSetter(_proto, "bright", _proto.isBright, _proto.setBright); +cc.defineGetterSetter(_proto, "name", _proto.getName, _proto.setName); +cc.defineGetterSetter(_proto, "actionTag", _proto.getActionTag, _proto.setActionTag); + +_proto = ccui.Layout.prototype; +cc.defineGetterSetter(_proto, "clippingEnabled", _proto.isClippingEnabled, _proto.setClippingEnabled); +cc.defineGetterSetter(_proto, "clippingType", _proto.setClippingType); +cc.defineGetterSetter(_proto, "layoutType", _proto.getLayoutType, _proto.setLayoutType); + +_proto = ccui.Button.prototype; +cc.defineGetterSetter(_proto, "titleText", _proto.getTitleText, _proto.setTitleText); +cc.defineGetterSetter(_proto, "titleFont", _proto._getTitleFont, _proto._setTitleFont); +cc.defineGetterSetter(_proto, "titleFontSize", _proto.getTitleFontSize, _proto.setTitleFontSize); +cc.defineGetterSetter(_proto, "titleFontName", _proto.getTitleFontName, _proto.setTitleFontName); + +_proto = ccui.CheckBox.prototype; +cc.defineGetterSetter(_proto, "selected", _proto.getSelectedState, _proto.setSelectedState); + +_proto = ccui.Text.prototype; +cc.defineGetterSetter(_proto, "boundingWidth", _proto._getBoundingWidth, _proto._setBoundingWidth); +cc.defineGetterSetter(_proto, "boundingHeight", _proto._getBoundingHeight, _proto._setBoundingHeight); +cc.defineGetterSetter(_proto, "string", _proto.getStringValue, _proto.setText); +cc.defineGetterSetter(_proto, "stringLength", _proto.getStringLength); +cc.defineGetterSetter(_proto, "font", _proto._getFont, _proto._setFont); +cc.defineGetterSetter(_proto, "fontName", _proto._getFontName, _proto.setFontName); +cc.defineGetterSetter(_proto, "fontSize", _proto._getFontSize, _proto.setFontSize); +cc.defineGetterSetter(_proto, "textAlign", _proto._getHorizontalAlignment, _proto.setTextHorizontalAlignment); +cc.defineGetterSetter(_proto, "verticalAlign", _proto._getVerticalAlignment, _proto.setTextVerticalAlignment); + +_proto = ccui.TextAtlas.prototype; +cc.defineGetterSetter(_proto, "string", _proto.getStringValue, _proto.setStringValue); + +_proto = ccui.TextBMFont.prototype; +cc.defineGetterSetter(_proto, "string", _proto.getStringValue, _proto.setStringValue); + +_proto = ccui.LoadingBar.prototype; +cc.defineGetterSetter(_proto, "direction", _proto.getDirection, _proto.setDirection); +cc.defineGetterSetter(_proto, "percent", _proto.getPercent, _proto.setPercent); + +_proto = ccui.Slider.prototype; +cc.defineGetterSetter(_proto, "percent", _proto.getPercent, _proto.setPercent); + +_proto = ccui.TextField.prototype; +cc.defineGetterSetter(_proto, "maxLengthEnabled", _proto.isMaxLengthEnabled, _proto.setMaxLengthEnabled); +cc.defineGetterSetter(_proto, "maxLength", _proto.getMaxLength, _proto.setMaxLength); +cc.defineGetterSetter(_proto, "passwordEnabled", _proto.isPasswordEnabled, _proto.setPasswordEnabled); +cc.defineGetterSetter(_proto, "string", _proto.getStringValue, _proto.setText); +cc.defineGetterSetter(_proto, "font", _proto._getFont, _proto._setFont); +cc.defineGetterSetter(_proto, "fontSize", _proto._getFontSize, _proto.setFontSize); +cc.defineGetterSetter(_proto, "fontName", _proto._getFontName, _proto.setFontName); + +_proto = ccui.ScrollView.prototype; +cc.defineGetterSetter(_proto, "innerWidth", _proto._getInnerWidth, _proto._setInnerWidth); +cc.defineGetterSetter(_proto, "innerHeight", _proto._getInnerHeight, _proto._setInnerHeight); + +_proto = cc.EditBox.prototype; +cc.defineGetterSetter(_proto, "font", _proto._setFont); +cc.defineGetterSetter(_proto, "fontName", _proto.setFontName); +cc.defineGetterSetter(_proto, "fontSize", _proto.setFontSize); +cc.defineGetterSetter(_proto, "string", _proto.getText, _proto.setText); +cc.defineGetterSetter(_proto, "maxLength", _proto.getMaxLength, _proto.setMaxLength); + +_proto = cc.Control.prototype; +cc.defineGetterSetter(_proto, "state", _proto.getState); +cc.defineGetterSetter(_proto, "enabled", _proto.isEnabled, _proto.setEnabled); +cc.defineGetterSetter(_proto, "selected", _proto.isSelected, _proto.setSelected); +cc.defineGetterSetter(_proto, "highlighted", _proto.isHighlighted, _proto.setHighlighted); + +_proto = cc.ControlButton.prototype; +cc.defineGetterSetter(_proto, "preferredSize", _proto.getPreferredSize, _proto.setPreferredSize); +cc.defineGetterSetter(_proto, "labelAnchor", _proto.getLabelAnchorPoint, _proto.setLabelAnchorPoint); + +_proto = cc.ControlColourPicker.prototype; +cc.defineGetterSetter(_proto, "background", _proto.getBackground); + +_proto = cc.ControlHuePicker.prototype; +cc.defineGetterSetter(_proto, "hue", _proto.getHue, _proto.setHue); +cc.defineGetterSetter(_proto, "huePercent", _proto.getHuePercentage, _proto.setHuePercentage); +cc.defineGetterSetter(_proto, "background", _proto.getBackground); +cc.defineGetterSetter(_proto, "slider", _proto.getSlider); +cc.defineGetterSetter(_proto, "startPos", _proto.getStartPos); + +_proto = cc.ControlPotentiometer.prototype; +cc.defineGetterSetter(_proto, "value", _proto.getValue, _proto.setValue); +cc.defineGetterSetter(_proto, "minValue", _proto.getMinimumValue, _proto.setMinimumValue); +cc.defineGetterSetter(_proto, "maxValue", _proto.getMaximumValue, _proto.setMaximumValue); +cc.defineGetterSetter(_proto, "progressTimer", _proto.getProgressTimer, _proto.setProgressTimer); +cc.defineGetterSetter(_proto, "thumbSprite", _proto.getThumbSprite, _proto.setThumbSprite); +cc.defineGetterSetter(_proto, "prevLocation", _proto.getPreviousLocation, _proto.setPreviousLocation); + +_proto = cc.ControlSaturationBrightnessPicker.prototype; +cc.defineGetterSetter(_proto, "saturation", _proto.getSaturation); +cc.defineGetterSetter(_proto, "brightness", _proto.getBrightness); +cc.defineGetterSetter(_proto, "background", _proto.getBackground); +cc.defineGetterSetter(_proto, "overlay", _proto.getOverlay); +cc.defineGetterSetter(_proto, "shadow", _proto.getShadow); +cc.defineGetterSetter(_proto, "slider", _proto.getSlider); +cc.defineGetterSetter(_proto, "startPos", _proto.getStartPos); + +_proto = cc.ControlSlider.prototype; +cc.defineGetterSetter(_proto, "value", _proto.getValue, _proto.setValue); +cc.defineGetterSetter(_proto, "minValue", _proto.getMinimumValue, _proto.setMinimumValue); +cc.defineGetterSetter(_proto, "maxValue", _proto.getMaximumValue, _proto.setMaximumValue); +cc.defineGetterSetter(_proto, "minAllowedValue", _proto.getMinimumAllowedValue, _proto.setMinimumAllowedValue); +cc.defineGetterSetter(_proto, "maxAllowedValue", _proto.getMaximumAllowedValue, _proto.setMaximumAllowedValue); +cc.defineGetterSetter(_proto, "thumbSprite", _proto.getThumbSprite); +cc.defineGetterSetter(_proto, "progressSprite", _proto.getProgressSprite); +cc.defineGetterSetter(_proto, "backgroundSprite", _proto.getBackgroundSprite); + +_proto = cc.ControlStepper.prototype; +cc.defineGetterSetter(_proto, "wraps", _proto.getWraps, _proto.setWraps); +cc.defineGetterSetter(_proto, "value", _proto.getValue, _proto.setValue); +cc.defineGetterSetter(_proto, "minValue", _proto.getMinimumValue, _proto.setMinimumValue); +cc.defineGetterSetter(_proto, "maxValue", _proto.getMaximumValue, _proto.setMaximumValue); +cc.defineGetterSetter(_proto, "stepValue", _proto.getStepValue, _proto.setStepValue); +cc.defineGetterSetter(_proto, "continuous", _proto.isContinuous); +cc.defineGetterSetter(_proto, "minusSprite", _proto.getMinusSprite, _proto.setMinusSprite); +cc.defineGetterSetter(_proto, "plusSprite", _proto.getPlusSprite, _proto.setPlusSprite); +cc.defineGetterSetter(_proto, "minusLabel", _proto.getMinusLabel, _proto.setMinusLabel); + +_proto = cc.Scale9Sprite.prototype; +cc.defineGetterSetter(_proto, "preferredSize", _proto.getPreferredSize, _proto.setPreferredSize); +cc.defineGetterSetter(_proto, "capInsets", _proto.getCapInsets, _proto.setCapInsets); +cc.defineGetterSetter(_proto, "insetLeft", _proto.getInsetLeft, _proto.setInsetLeft); +cc.defineGetterSetter(_proto, "insetTop", _proto.getInsetTop, _proto.setInsetTop); +cc.defineGetterSetter(_proto, "insetRight", _proto.getInsetRight, _proto.setInsetRight); +cc.defineGetterSetter(_proto, "insetBottom", _proto.getInsetBottom, _proto.setInsetBottom); + +_proto = cc.ScrollView.prototype; +cc.defineGetterSetter(_proto, "direction", _proto.getDirection, _proto.setDirection); + +_proto = cc.TableViewCell.prototype; +cc.defineGetterSetter(_proto, "objectId", _proto.getObjectID, _proto.setObjectID); diff --git a/frameworks/js-bindings/bindings/script/jsb_property_impls.js b/frameworks/js-bindings/bindings/script/jsb_property_impls.js new file mode 100644 index 0000000000..b079e19462 --- /dev/null +++ b/frameworks/js-bindings/bindings/script/jsb_property_impls.js @@ -0,0 +1,113 @@ +function _safeExtend(obj, list) { + for (var key in list) + if(!obj[key]) + obj[key] = list[key]; +} + +var _undefined = { + _jsbUndefined: function(message) { + cc.log("Not implemented yet in JSB"); + return undefined; + }, + _customUndefined: function(message) { + return function() { + cc.log("Not implemented yet in JSB"); + message && cc.log(message); + return undefined; + } + }, + _shadowUndefined: _undefined._customUndefined("Please use enableShadow function"), + _strokeUndefined: _undefined._customUndefined("Please use enableStroke function") +} + +_safeExtend(cc.Node.prototype, { + _getWidth: function() { + return this.getContentSize().width; + }, + _getHeight: function() { + return this.getContentSize().height; + }, + + _setWidth: function(width) { + this.setContentSize(width, this.getContentSize().height); + }, + _setHeight: function(height) { + this.setContentSize(this.getContentSize().width, height); + }, + + _getAnchorX: function() { + return this.getAnchorPoint().x; + }, + _getAnchorY: function() { + return this.getAnchorPoint().y; + }, + + _setAnchorX: function(x) { + this.setAnchorPoint(x, this.getAnchorPoint().y); + }, + _setAnchorY: function(y) { + this.setAnchorPoint(this.getAnchorPoint().x, y); + } +}); + +_safeExtend(cc.LabelTTF.prototype, { + _fontStyleRE: /^(\d+)px\s+['"]?([\w\s\d]+)['"]?$/, + + _getFont: function() { + var size = this.getFontSize(); + var name = this.getFontName(); + return size + "px '" + name + "'"; + }, + + _setFont: function(fontStyle) { + var res = this._fontStyleRE.exec(fontStyle); + if(res) { + this.setFontSize(parseInt(res[1])); + this.setFontName(res[2]); + } + }, + + _getBoundingWidth: function() { + return this.getDimensions().width; + }, + _getBoundingHeight: function() { + return this.getDimensions().height; + }, + + _setBoundingWidth: function(w) { + var size = cc.size(w, this.getDimensions().height); + this.setDimensions(size); + }, + _setBoundingHeight: function(h) { + var size = cc.size(this.getDimensions().width, h); + this.setDimensions(size); + }, + + _getFillStyle: _undefined._jsbUndefined, + _getStrokeStyle: _undefined._strokeUndefined, + _setStrokeStyle: _undefined._strokeUndefined, + _getLineWidth: _undefined._strokeUndefined, + _setLineWidth: _undefined._strokeUndefined, + _getShadowOffsetX: _undefined._shadowUndefined, + _setShadowOffsetX: _undefined._shadowUndefined, + _getShadowOffsetY: _undefined._shadowUndefined, + _setShadowOffsetY: _undefined._shadowUndefined, + _getShadowOpacity: _undefined._shadowUndefined, + _setShadowOpacity: _undefined._shadowUndefined, + _getShadowBlur: _undefined._shadowUndefined, + _setShadowBlur: _undefined._shadowUndefined +}); + +_safeExtend(cc.Sprite.prototype, { + _getOffsetX: function() { + return this.getOffsetPosition().x; + }, + _getOffsetY: function() { + return this.getOffsetPosition().y; + } +}); + +_safeExtend(cc.LabelBMFont.prototype, { + _getAlignment: _undefined._jsbUndefined, + _getBoundingWidth: _undefined._jsbUndefined +}); diff --git a/samples/js-tests/src/LayerTest/LayerTest.js b/samples/js-tests/src/LayerTest/LayerTest.js index ae06483708..18f2265de9 100644 --- a/samples/js-tests/src/LayerTest/LayerTest.js +++ b/samples/js-tests/src/LayerTest/LayerTest.js @@ -99,8 +99,11 @@ var LayerTest1 = LayerTest.extend({ var s = director.getWinSize(); var layer = cc.LayerColor.create(cc.c4b(255, 0, 0, 128), 200, 200); - layer.ignoreAnchorPointForPosition(false); - layer.setPosition(s.width / 2, s.height / 2); + layer.ignoreAnchor = false; + layer.x = s.width / 3; + layer.y = s.height / 2; + layer.anchorX = 0; + layer.anchorY = 0.5 this.addChild(layer, 1, cc.TAG_LAYER); }, title:function () { @@ -108,10 +111,11 @@ var LayerTest1 = LayerTest.extend({ }, updateSize:function (location) { - var newSize = cc.size(Math.abs(location.x - winSize.width / 2) * 2, Math.abs(location.y - winSize.height / 2) * 2); var l = this.getChildByTag(cc.TAG_LAYER); - l.setContentSize(newSize); + //l.setContentSize(newSize); + l.width = Math.abs(location.x - winSize.width / 2) * 2; + l.height = Math.abs(location.y - winSize.height / 2) * 2; }, // events @@ -123,7 +127,7 @@ var LayerTest1 = LayerTest.extend({ onTouchesMoved:function (touches, event) { this.updateSize( touches[0].getLocation() ); }, - + // // Automation @@ -177,7 +181,7 @@ var IgnoreAnchorpointTest1 = LayerTest.extend({ pixel2: {"0": 100, "1": 50, "2": 50, "3": 200}, getExpectedResult:function() { - + var s = director.getWinSize(); var ret = {"big": "yes", "small": "yes"}; return JSON.stringify(ret); @@ -190,7 +194,7 @@ var IgnoreAnchorpointTest1 = LayerTest.extend({ var ret3 = this.readPixels(s.width - 50, s.height - 50, 50, 50); var ret = {"big": this.containsPixel(ret2, this.pixel1, true, 100) ? "yes" : "no", "small": this.containsPixel(ret3, this.pixel2, true, 100) ? "yes" : "no"}; - + return JSON.stringify(ret); } }); @@ -223,7 +227,7 @@ var IgnoreAnchorpointTest2 = LayerTest.extend({ pixel2: {"0": 100, "1": 50, "2": 50, "3": 200}, getExpectedResult:function() { - + var s = director.getWinSize(); var ret = {"big": "yes", "small": "yes"}; return JSON.stringify(ret); @@ -236,7 +240,7 @@ var IgnoreAnchorpointTest2 = LayerTest.extend({ var ret3 = this.readPixels(s.width - 50, s.height - 50, 5, 5); var ret = {"big": this.containsPixel(ret2, this.pixel1, true, 100) ? "yes" : "no", "small": this.containsPixel(ret3, this.pixel2, true, 100) ? "yes" : "no"}; - + return JSON.stringify(ret); } }); @@ -333,7 +337,7 @@ var LayerTest2 = LayerTest.extend({ testDuration: 2.1, tintTest: {"r": 0, "g": 128, "b": 60}, getExpectedResult:function() { - + var s = director.getWinSize(); var ret = {"tint": "yes", "opacity": 0}; return JSON.stringify(ret); @@ -347,7 +351,7 @@ var LayerTest2 = LayerTest.extend({ var inColorRange = function (pix1, pix2) { // Color on iOS comes as 0,128,128 and on web as 0,128,0 - if(abs(pix1.r - pix2.r) < 50 && abs(pix1.g - pix2.g) < 50 && + if(abs(pix1.r - pix2.r) < 50 && abs(pix1.g - pix2.g) < 50 && abs(pix1.b - pix2.b) < 90) { return true; } @@ -358,7 +362,7 @@ var LayerTest2 = LayerTest.extend({ var op = this.getChildByTag(LAYERTEST2_LAYER2_TAG).getOpacity(); var ret = {"tint": inColorRange(tint, this.tintTest) ? "yes" : "no", "opacity": op}; - + return JSON.stringify(ret); } }); @@ -490,7 +494,7 @@ var LayerGradient = LayerTest.extend({ pixel2: {"0": 0, "1": 255, "2": 0, "3": 255}, getExpectedResult:function() { - + var s = director.getWinSize(); var ret = {"bottomleft": "yes", "topright": "yes"}; return JSON.stringify(ret); @@ -503,7 +507,7 @@ var LayerGradient = LayerTest.extend({ var ret3 = this.readPixels(s.width - 50, s.height - 50, 50, 50); var ret = {"bottomleft": this.containsPixel(ret2, this.pixel1) ? "yes" : "no", "topright": this.containsPixel(ret3, this.pixel2) ? "yes" : "no"}; - + return JSON.stringify(ret); } }); From 50db618e7c31e8250b3e8a6b2009dd7fbba1d0ee Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 4 Mar 2014 15:50:14 +0800 Subject: [PATCH 2/4] Feature #4236: Resolve bug of _undefined --- .../bindings/script/jsb_property_impls.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/frameworks/js-bindings/bindings/script/jsb_property_impls.js b/frameworks/js-bindings/bindings/script/jsb_property_impls.js index b079e19462..f8cd3acc2d 100644 --- a/frameworks/js-bindings/bindings/script/jsb_property_impls.js +++ b/frameworks/js-bindings/bindings/script/jsb_property_impls.js @@ -4,20 +4,21 @@ function _safeExtend(obj, list) { obj[key] = list[key]; } +function _customUndefined(message) { + return function() { + cc.log("Not implemented yet in JSB"); + message && cc.log(message); + return undefined; + } +} + var _undefined = { _jsbUndefined: function(message) { cc.log("Not implemented yet in JSB"); return undefined; }, - _customUndefined: function(message) { - return function() { - cc.log("Not implemented yet in JSB"); - message && cc.log(message); - return undefined; - } - }, - _shadowUndefined: _undefined._customUndefined("Please use enableShadow function"), - _strokeUndefined: _undefined._customUndefined("Please use enableStroke function") + _shadowUndefined: _customUndefined("Please use enableShadow function"), + _strokeUndefined: _customUndefined("Please use enableStroke function") } _safeExtend(cc.Node.prototype, { From ae6f2f17fd3e300796ec95200074634c91c1b6d4 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 4 Mar 2014 17:19:12 +0800 Subject: [PATCH 3/4] Feature #4236: Manual implementations added to JSB --- .../bindings/script/jsb_property_apis.js | 71 ++++--- .../bindings/script/jsb_property_impls.js | 184 ++++++++++++++++++ 2 files changed, 217 insertions(+), 38 deletions(-) diff --git a/frameworks/js-bindings/bindings/script/jsb_property_apis.js b/frameworks/js-bindings/bindings/script/jsb_property_apis.js index c770a0565b..4eecc77f1d 100644 --- a/frameworks/js-bindings/bindings/script/jsb_property_apis.js +++ b/frameworks/js-bindings/bindings/script/jsb_property_apis.js @@ -36,7 +36,6 @@ _proto = cc.LabelAtlas.prototype; cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); _proto = cc.LabelBMFont.prototype; -cc.defineGetterSetter(_proto, "anchor", _proto._getAnchor, _proto._setAnchor); //cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); //cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); cc.defineGetterSetter(_proto, "scale", _proto.getScale, _proto.setScale); @@ -104,10 +103,10 @@ cc.defineGetterSetter(_proto, "childrenCount", _proto.getChildrenCount); cc.defineGetterSetter(_proto, "layoutType", _proto.getLayoutType, _proto.setLayoutType); _proto = ccui.Button.prototype; -cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); -cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); -cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); -cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); cc.defineGetterSetter(_proto, "color", _proto.getColor, _proto.setColor); @@ -117,16 +116,16 @@ _proto = ccui.CheckBox.prototype; //cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); -cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); -cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); _proto = ccui.ImageView.prototype; //cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); //cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); -cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); -cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); _proto = ccui.Text.prototype; //cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); @@ -138,31 +137,33 @@ cc.defineGetterSetter(_proto, "scaleY", _proto.getScaleY, _proto.setScaleY); cc.defineGetterSetter(_proto, "flippedX", _proto.isFlippedX, _proto.setFlippedX); cc.defineGetterSetter(_proto, "flippedY", _proto.isFlippedY, _proto.setFlippedY); +/* _proto = ccui.TextAtlas.prototype; -//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); -//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); -//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); -//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); _proto = ccui.TextBMFont.prototype; -//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); -//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); -//cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); -//cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); +cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); _proto = ccui.LoadingBar.prototype; -//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); -//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); _proto = ccui.Slider.prototype; -//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); -//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); _proto = ccui.TextField.prototype; cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); cc.defineGetterSetter(_proto, "anchorX", _proto._getAnchorX, _proto._setAnchorX); cc.defineGetterSetter(_proto, "anchorY", _proto._getAnchorY, _proto._setAnchorY); +*/ _proto = cc.Control.prototype; cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); @@ -198,8 +199,8 @@ cc.defineGetterSetter(_proto, "opacity", _proto.getOpacity, _proto.setOpacity); cc.defineGetterSetter(_proto, "opacityModifyRGB", _proto.isOpacityModifyRGB, _proto.setOpacityModifyRGB); _proto = cc.ScrollView.prototype; -cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); -cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); +//cc.defineGetterSetter(_proto, "width", _proto._getWidth, _proto._setWidth); +//cc.defineGetterSetter(_proto, "height", _proto._getHeight, _proto._setHeight); @@ -387,12 +388,6 @@ cc.defineGetterSetter(_proto, "mapHeight", _proto._getMapHeight, _proto._setMapH cc.defineGetterSetter(_proto, "tileWidth", _proto._getTileWidth, _proto._setTileWidth); cc.defineGetterSetter(_proto, "tileHeight", _proto._getTileHeight, _proto._setTileHeight); -_proto = cc.TMXMapInfo.prototype; -cc.defineGetterSetter(_proto, "mapWidth", _proto._getMapWidth, _proto._setMapWidth); -cc.defineGetterSetter(_proto, "mapHeight", _proto._getMapHeight, _proto._setMapHeight); -cc.defineGetterSetter(_proto, "tileWidth", _proto._getTileWidth, _proto._setTileWidth); -cc.defineGetterSetter(_proto, "tileHeight", _proto._getTileHeight, _proto._setTileHeight); - _proto = ccs.Armature.prototype; cc.defineGetterSetter(_proto, "parentBone", _proto.getParentBone, _proto.setParentBone); cc.defineGetterSetter(_proto, "body", _proto.getBody, _proto.setBody); @@ -447,10 +442,10 @@ cc.defineGetterSetter(_proto, "boundingHeight", _proto._getBoundingHeight, _prot cc.defineGetterSetter(_proto, "string", _proto.getStringValue, _proto.setText); cc.defineGetterSetter(_proto, "stringLength", _proto.getStringLength); cc.defineGetterSetter(_proto, "font", _proto._getFont, _proto._setFont); -cc.defineGetterSetter(_proto, "fontName", _proto._getFontName, _proto.setFontName); -cc.defineGetterSetter(_proto, "fontSize", _proto._getFontSize, _proto.setFontSize); -cc.defineGetterSetter(_proto, "textAlign", _proto._getHorizontalAlignment, _proto.setTextHorizontalAlignment); -cc.defineGetterSetter(_proto, "verticalAlign", _proto._getVerticalAlignment, _proto.setTextVerticalAlignment); +cc.defineGetterSetter(_proto, "fontName", _proto.getFontName, _proto.setFontName); +cc.defineGetterSetter(_proto, "fontSize", _proto.getFontSize, _proto.setFontSize); +cc.defineGetterSetter(_proto, "textAlign", _proto.getHorizontalAlignment, _proto.setTextHorizontalAlignment); +cc.defineGetterSetter(_proto, "verticalAlign", _proto.getVerticalAlignment, _proto.setTextVerticalAlignment); _proto = ccui.TextAtlas.prototype; cc.defineGetterSetter(_proto, "string", _proto.getStringValue, _proto.setStringValue); @@ -471,17 +466,17 @@ cc.defineGetterSetter(_proto, "maxLength", _proto.getMaxLength, _proto.setMaxLen cc.defineGetterSetter(_proto, "passwordEnabled", _proto.isPasswordEnabled, _proto.setPasswordEnabled); cc.defineGetterSetter(_proto, "string", _proto.getStringValue, _proto.setText); cc.defineGetterSetter(_proto, "font", _proto._getFont, _proto._setFont); -cc.defineGetterSetter(_proto, "fontSize", _proto._getFontSize, _proto.setFontSize); -cc.defineGetterSetter(_proto, "fontName", _proto._getFontName, _proto.setFontName); +cc.defineGetterSetter(_proto, "fontSize", _proto.getFontSize, _proto.setFontSize); +cc.defineGetterSetter(_proto, "fontName", _proto.getFontName, _proto.setFontName); _proto = ccui.ScrollView.prototype; cc.defineGetterSetter(_proto, "innerWidth", _proto._getInnerWidth, _proto._setInnerWidth); cc.defineGetterSetter(_proto, "innerHeight", _proto._getInnerHeight, _proto._setInnerHeight); _proto = cc.EditBox.prototype; -cc.defineGetterSetter(_proto, "font", _proto._setFont); -cc.defineGetterSetter(_proto, "fontName", _proto.setFontName); -cc.defineGetterSetter(_proto, "fontSize", _proto.setFontSize); +cc.defineGetterSetter(_proto, "font", null, _proto._setFont); +cc.defineGetterSetter(_proto, "fontName", null, _proto.setFontName); +cc.defineGetterSetter(_proto, "fontSize", null, _proto.setFontSize); cc.defineGetterSetter(_proto, "string", _proto.getText, _proto.setText); cc.defineGetterSetter(_proto, "maxLength", _proto.getMaxLength, _proto.setMaxLength); diff --git a/frameworks/js-bindings/bindings/script/jsb_property_impls.js b/frameworks/js-bindings/bindings/script/jsb_property_impls.js index f8cd3acc2d..1bcf4858bc 100644 --- a/frameworks/js-bindings/bindings/script/jsb_property_impls.js +++ b/frameworks/js-bindings/bindings/script/jsb_property_impls.js @@ -112,3 +112,187 @@ _safeExtend(cc.LabelBMFont.prototype, { _getAlignment: _undefined._jsbUndefined, _getBoundingWidth: _undefined._jsbUndefined }); + +_safeExtend(cc.TMXLayer.prototype, { + _getLayerWidth: function() { + return this.getLayerSize().width; + }, + _getLayerHeight: function() { + return this.getLayerSize().height; + }, + + _setLayerWidth: function(w) { + var size = cc.size(w, this.getLayerSize().height); + this.setLayerSize(size); + }, + _setLayerHeight: function(h) { + var size = cc.size(this.getLayerSize().width, h); + this.setLayerSize(size); + }, + + _getTileWidth: function() { + return this.getMapTileSize().width; + }, + _getTileHeight: function() { + return this.getMapTileSize().height; + }, + + _setTileWidth: function(w) { + var size = cc.size(w, this.getMapTileSize().height); + this.setMapTileSize(size); + }, + _setTileHeight: function(h) { + var size = cc.size(this.getMapTileSize().width, h); + this.setMapTileSize(size); + } +}); + +_safeExtend(cc.TMXTiledMap.prototype, { + _getMapWidth: function() { + return this.getMapSize().width; + }, + _getMapHeight: function() { + return this.getMapSize().height; + }, + + _setMapWidth: function(w) { + var size = cc.size(w, this.getMapSize().height); + this.setMapSize(size); + }, + _setMapHeight: function(h) { + var size = cc.size(this.getMapSize().width, h); + this.setMapSize(size); + }, + + _getTileWidth: function() { + return this.getTileSize().width; + }, + _getTileHeight: function() { + return this.getTileSize().height; + }, + + _setTileWidth: function(w) { + var size = cc.size(w, this.getTileSize().height); + this.setTileSize(size); + }, + _setTileHeight: function(h) { + var size = cc.size(this.getTileSize().width, h); + this.setTileSize(size); + } +}); + +_safeExtend(ccui.Widget.prototype, { + _getXPercent: function() { + return this.getPositionPercent().x; + }, + _getYPercent: function() { + return this.getPositionPercent().y; + }, + + _setXPercent: function(x) { + var p = cc.p(x, this.getPositionPercent().y); + this.setPositionPercent(p); + }, + _setYPercent: function(y) { + var p = cc.p(this.getPositionPercent().x, y); + this.setPositionPercent(p); + }, + + _getWidthPercent: function() { + return this.getSizePercent().width; + }, + _getHeightPercent: function() { + return this.getSizePercent().height; + }, + + _setWidthPercent: function(w) { + var size = cc.size(w, this.getSizePercent().height); + this.setSizePercent(size); + }, + _setHeightPercent: function(h) { + var size = cc.size(this.getSizePercent().width, h); + this.setSizePercent(size); + } +}); + +_safeExtend(ccui.Button.prototype, { + _fontStyleRE: /^(\d+)px\s+['"]?([\w\s\d]+)['"]?$/, + + _getTitleFont: function() { + var size = this.getTitleFontSize(); + var name = this.getTitleFontName(); + return size + "px '" + name + "'"; + }, + + _setTitleFont: function(fontStyle) { + var res = this._fontStyleRE.exec(fontStyle); + if(res) { + this.setTitleFontSize(parseInt(res[1])); + this.setTitleFontName(res[2]); + } + } +}); + +_safeExtend(ccui.Text.prototype, { + _getBoundingWidth: function() { + return this.getTextAreaSize().width; + }, + _getBoundingHeight: function() { + return this.getTextAreaSize().height; + }, + + _setBoundingWidth: function(w) { + var size = cc.size(w, this.getTextAreaSize().height); + this.setTextAreaSize(size); + }, + _setBoundingHeight: function(h) { + var size = cc.size(this.getTextAreaSize().width, h); + this.setTextAreaSize(size); + } +}); + +_safeExtend(ccui.TextField.prototype, { + _fontStyleRE: /^(\d+)px\s+['"]?([\w\s\d]+)['"]?$/, + + _getFont: function() { + var size = this.getFontSize(); + var name = this.getFontName(); + return size + "px '" + name + "'"; + }, + + _setFont: function(fontStyle) { + var res = this._fontStyleRE.exec(fontStyle); + if(res) { + this.setFontSize(parseInt(res[1])); + this.setFontName(res[2]); + } + } +}); + +_safeExtend(ccui.ScrollView.prototype, { + _getInnerWidth: function() { + return this.getInnerContentSize().width; + }, + _getInnerHeight: function() { + return this.getInnerContentSize().height; + }, + + _setInnerWidth: function(w) { + var size = cc.size(w, this.getInnerContentSize().height); + this.setInnerContentSize(size); + }, + _setInnerHeight: function(h) { + var size = cc.size(this.getInnerContentSize().width, h); + this.setInnerContentSize(size); + } +}); + +_safeExtend(ccui.EditBox.prototype, { + _setFont: function(fontStyle) { + var res = cc.LabelTTF.prototype._fontStyleRE.exec(fontStyle); + if(res) { + this.setFontSize(parseInt(res[1])); + this.setFontName(res[2]); + } + } +}); From 9209b8ac99c6b4f551c8dec202d8a2c6307a5e04 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 4 Mar 2014 18:24:34 +0800 Subject: [PATCH 4/4] Feature #4236: Remove ccui.EditBox --- .../bindings/script/jsb_property_impls.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frameworks/js-bindings/bindings/script/jsb_property_impls.js b/frameworks/js-bindings/bindings/script/jsb_property_impls.js index 1bcf4858bc..737b3d37fb 100644 --- a/frameworks/js-bindings/bindings/script/jsb_property_impls.js +++ b/frameworks/js-bindings/bindings/script/jsb_property_impls.js @@ -287,12 +287,12 @@ _safeExtend(ccui.ScrollView.prototype, { } }); -_safeExtend(ccui.EditBox.prototype, { - _setFont: function(fontStyle) { - var res = cc.LabelTTF.prototype._fontStyleRE.exec(fontStyle); - if(res) { - this.setFontSize(parseInt(res[1])); - this.setFontName(res[2]); - } - } -}); +// _safeExtend(ccui.EditBox.prototype, { +// _setFont: function(fontStyle) { +// var res = cc.LabelTTF.prototype._fontStyleRE.exec(fontStyle); +// if(res) { +// this.setFontSize(parseInt(res[1])); +// this.setFontName(res[2]); +// } +// } +// });