mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into issue_11887
This commit is contained in:
commit
7f9028b20c
1
AUTHORS
1
AUTHORS
|
@ -7,6 +7,7 @@ Core Developers:
|
|||
XiaoMing Zhang (Minggo)
|
||||
JianHua Chen (James)
|
||||
Zhe Wang (Walzer)
|
||||
Hao Wu (Wu-Hao)
|
||||
Qingkui Hu (samuele3hu)
|
||||
Huabing Xu (dabingnn)
|
||||
Wenhai Lin (Dhilan007)
|
||||
|
|
|
@ -2017,6 +2017,10 @@
|
|||
B5CE6DC91B3C05BA002B0419 /* UIRadioButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DC61B3C05BA002B0419 /* UIRadioButton.cpp */; };
|
||||
B5CE6DCA1B3C05BA002B0419 /* UIRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CE6DC71B3C05BA002B0419 /* UIRadioButton.h */; };
|
||||
B5CE6DCB1B3C05BA002B0419 /* UIRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CE6DC71B3C05BA002B0419 /* UIRadioButton.h */; };
|
||||
B5668D7D1B3838E4003CBD5E /* UIScrollViewBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5668D7B1B3838E4003CBD5E /* UIScrollViewBar.cpp */; };
|
||||
B5668D7E1B3838E4003CBD5E /* UIScrollViewBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5668D7B1B3838E4003CBD5E /* UIScrollViewBar.cpp */; };
|
||||
B5668D7F1B3838E4003CBD5E /* UIScrollViewBar.h in Headers */ = {isa = PBXBuildFile; fileRef = B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */; };
|
||||
B5668D801B3838E4003CBD5E /* UIScrollViewBar.h in Headers */ = {isa = PBXBuildFile; fileRef = B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */; };
|
||||
B603F1A81AC8EA0900A9579C /* CCTerrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */; };
|
||||
B603F1A91AC8EA0900A9579C /* CCTerrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */; };
|
||||
B603F1AA1AC8EA0900A9579C /* CCTerrain.h in Headers */ = {isa = PBXBuildFile; fileRef = B603F1A71AC8EA0900A9579C /* CCTerrain.h */; };
|
||||
|
@ -4704,6 +4708,8 @@
|
|||
B5CE6DBD1B3BF2B1002B0419 /* UIAbstractCheckButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAbstractCheckButton.h; sourceTree = "<group>"; };
|
||||
B5CE6DC61B3C05BA002B0419 /* UIRadioButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIRadioButton.cpp; sourceTree = "<group>"; };
|
||||
B5CE6DC71B3C05BA002B0419 /* UIRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRadioButton.h; sourceTree = "<group>"; };
|
||||
B5668D7B1B3838E4003CBD5E /* UIScrollViewBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScrollViewBar.cpp; sourceTree = "<group>"; };
|
||||
B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollViewBar.h; sourceTree = "<group>"; };
|
||||
B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTerrain.cpp; sourceTree = "<group>"; };
|
||||
B603F1A71AC8EA0900A9579C /* CCTerrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTerrain.h; sourceTree = "<group>"; };
|
||||
B603F1B11AC8F1FD00A9579C /* ccShader_3D_Terrain.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Terrain.frag; sourceTree = "<group>"; };
|
||||
|
@ -5606,6 +5612,7 @@
|
|||
2905F9E618CF08D000240AA3 /* ui */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
usesTabs = 0;
|
||||
};
|
||||
1551A340158F2AB200E66CFE /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
|
@ -6841,6 +6848,8 @@
|
|||
2905FA0518CF08D000240AA3 /* UIRichText.h */,
|
||||
2905FA0718CF08D000240AA3 /* UIScrollView.cpp */,
|
||||
2905FA0818CF08D000240AA3 /* UIScrollView.h */,
|
||||
B5668D7B1B3838E4003CBD5E /* UIScrollViewBar.cpp */,
|
||||
B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */,
|
||||
2905FA0918CF08D000240AA3 /* UISlider.cpp */,
|
||||
2905FA0A18CF08D100240AA3 /* UISlider.h */,
|
||||
2905FA0B18CF08D100240AA3 /* UIText.cpp */,
|
||||
|
@ -9405,6 +9414,7 @@
|
|||
B6CAB24B1AF9AA1A00B9B856 /* btConvexPlaneCollisionAlgorithm.h in Headers */,
|
||||
B6CAB5391AF9AA1A00B9B856 /* cl.h in Headers */,
|
||||
15AE1BC219AADFFB00C27E9E /* ExtensionMacros.h in Headers */,
|
||||
B5668D7F1B3838E4003CBD5E /* UIScrollViewBar.h in Headers */,
|
||||
B665E4001AA80A6600DDB1C5 /* CCPUSphereCollider.h in Headers */,
|
||||
B6CAB42D1AF9AA1A00B9B856 /* btVehicleRaycaster.h in Headers */,
|
||||
15AE1BDF19AAE01E00C27E9E /* CCInvocation.h in Headers */,
|
||||
|
@ -10459,6 +10469,7 @@
|
|||
B6CAB4B01AF9AA1A00B9B856 /* SpuCollisionTaskProcess.h in Headers */,
|
||||
15AE185D19AAD31200C27E9E /* CocosDenshion.h in Headers */,
|
||||
B6CAB3661AF9AA1A00B9B856 /* btContinuousConvexCollision.h in Headers */,
|
||||
B5668D801B3838E4003CBD5E /* UIScrollViewBar.h in Headers */,
|
||||
15AE194319AAD35100C27E9E /* CCColliderDetector.h in Headers */,
|
||||
382F7ADF1AB1292A002EBECF /* CCObjectExtensionData.h in Headers */,
|
||||
B6CAB3A81AF9AA1A00B9B856 /* btConstraintSolver.h in Headers */,
|
||||
|
@ -11584,6 +11595,7 @@
|
|||
50ABC00D1926664800A911A9 /* CCFileUtils.cpp in Sources */,
|
||||
50ABBE4D1925AB6F00A911A9 /* CCEventCustom.cpp in Sources */,
|
||||
15AE1A6819AAD40300C27E9E /* b2WorldCallbacks.cpp in Sources */,
|
||||
B5668D7D1B3838E4003CBD5E /* UIScrollViewBar.cpp in Sources */,
|
||||
B665E2D21AA80A6500DDB1C5 /* CCPUInterParticleColliderTranslator.cpp in Sources */,
|
||||
B6CAB3811AF9AA1A00B9B856 /* btMinkowskiPenetrationDepthSolver.cpp in Sources */,
|
||||
B6CAB4AD1AF9AA1A00B9B856 /* SpuCollisionTaskProcess.cpp in Sources */,
|
||||
|
@ -11735,6 +11747,7 @@
|
|||
38B8E2E219E671D2002D7CE7 /* UILayoutComponent.cpp in Sources */,
|
||||
B6CAB3D21AF9AA1A00B9B856 /* btSliderConstraint.cpp in Sources */,
|
||||
B2165EEA19921124000BE3E6 /* CCPrimitiveCommand.cpp in Sources */,
|
||||
B5668D7E1B3838E4003CBD5E /* UIScrollViewBar.cpp in Sources */,
|
||||
B665E32B1AA80A6500DDB1C5 /* CCPUOnCountObserver.cpp in Sources */,
|
||||
15AE185C19AAD31200C27E9E /* CDOpenALSupport.m in Sources */,
|
||||
B6CAB3B01AF9AA1A00B9B856 /* btFixedConstraint.cpp in Sources */,
|
||||
|
|
|
@ -4069,6 +4069,7 @@
|
|||
);
|
||||
name = CustomTemplate;
|
||||
sourceTree = "<group>";
|
||||
usesTabs = 0;
|
||||
};
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0630"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1856634B1B4155D3009EF2AE"
|
||||
BuildableName = "js-tests Mac.app"
|
||||
BlueprintName = "js-tests Mac"
|
||||
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1856634B1B4155D3009EF2AE"
|
||||
BuildableName = "js-tests Mac.app"
|
||||
BlueprintName = "js-tests Mac"
|
||||
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1856634B1B4155D3009EF2AE"
|
||||
BuildableName = "js-tests Mac.app"
|
||||
BlueprintName = "js-tests Mac"
|
||||
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1856634B1B4155D3009EF2AE"
|
||||
BuildableName = "js-tests Mac.app"
|
||||
BlueprintName = "js-tests Mac"
|
||||
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0630"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "185663961B4155DD009EF2AE"
|
||||
BuildableName = "js-tests iOS.app"
|
||||
BlueprintName = "js-tests iOS"
|
||||
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "185663961B4155DD009EF2AE"
|
||||
BuildableName = "js-tests iOS.app"
|
||||
BlueprintName = "js-tests iOS"
|
||||
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "185663961B4155DD009EF2AE"
|
||||
BuildableName = "js-tests iOS.app"
|
||||
BlueprintName = "js-tests iOS"
|
||||
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "185663961B4155DD009EF2AE"
|
||||
BuildableName = "js-tests iOS.app"
|
||||
BlueprintName = "js-tests iOS"
|
||||
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -492,7 +492,7 @@ void ClippingNode::onAfterDrawStencil()
|
|||
|
||||
// restore the depth test state
|
||||
glDepthMask(_currentDepthWriteMask);
|
||||
RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask);
|
||||
RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask != 0);
|
||||
|
||||
//if (currentDepthTestEnabled) {
|
||||
// glEnable(GL_DEPTH_TEST);
|
||||
|
|
|
@ -104,6 +104,8 @@ static inline Tex2F __t(const Vec2 &v)
|
|||
|
||||
// implementation of DrawNode
|
||||
|
||||
static const int DEFAULT_LINE_WIDTH = 2;
|
||||
|
||||
DrawNode::DrawNode()
|
||||
: _vao(0)
|
||||
, _vbo(0)
|
||||
|
@ -123,6 +125,7 @@ DrawNode::DrawNode()
|
|||
, _dirty(false)
|
||||
, _dirtyGLPoint(false)
|
||||
, _dirtyGLLine(false)
|
||||
, _lineWidth(DEFAULT_LINE_WIDTH)
|
||||
{
|
||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
}
|
||||
|
@ -393,7 +396,7 @@ void DrawNode::onDrawGLLine(const Mat4 &transform, uint32_t flags)
|
|||
// texcood
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
|
||||
}
|
||||
glLineWidth(2);
|
||||
glLineWidth(_lineWidth);
|
||||
glDrawArrays(GL_LINES, 0, _bufferCountGLLine);
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
|
@ -921,6 +924,7 @@ void DrawNode::clear()
|
|||
_dirtyGLLine = true;
|
||||
_bufferCountGLPoint = 0;
|
||||
_dirtyGLPoint = true;
|
||||
_lineWidth = DEFAULT_LINE_WIDTH;
|
||||
}
|
||||
|
||||
const BlendFunc& DrawNode::getBlendFunc() const
|
||||
|
@ -933,4 +937,9 @@ void DrawNode::setBlendFunc(const BlendFunc &blendFunc)
|
|||
_blendFunc = blendFunc;
|
||||
}
|
||||
|
||||
void DrawNode::setLineWidth(int lineWidth)
|
||||
{
|
||||
_lineWidth = lineWidth;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -311,6 +311,8 @@ public:
|
|||
// Overrides
|
||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||
|
||||
void setLineWidth(int lineWidth);
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
DrawNode();
|
||||
virtual ~DrawNode();
|
||||
|
@ -350,6 +352,8 @@ protected:
|
|||
bool _dirty;
|
||||
bool _dirtyGLPoint;
|
||||
bool _dirtyGLLine;
|
||||
|
||||
int _lineWidth;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
||||
|
|
|
@ -223,7 +223,7 @@ bool Sprite::initWithPolygon(const cocos2d::PolygonInfo &info)
|
|||
{
|
||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(info.filename);
|
||||
bool res = false;
|
||||
if(initWithTexture(texture));
|
||||
if(initWithTexture(texture))
|
||||
{
|
||||
_polyInfo = info;
|
||||
setContentSize(_polyInfo.rect.size/Director::getInstance()->getContentScaleFactor());
|
||||
|
@ -449,7 +449,7 @@ void Sprite::debugDraw(bool on)
|
|||
auto last = _polyInfo.triangles.indexCount/3;
|
||||
auto _indices = _polyInfo.triangles.indices;
|
||||
auto _verts = _polyInfo.triangles.verts;
|
||||
for(unsigned int i = 0; i < last; i++)
|
||||
for(ssize_t i = 0; i < last; i++)
|
||||
{
|
||||
//draw 3 lines
|
||||
Vec3 from =_verts[_indices[i*3]].vertices;
|
||||
|
|
|
@ -647,6 +647,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\ui\UIRichText.cpp" />
|
||||
<ClCompile Include="..\ui\UIScale9Sprite.cpp" />
|
||||
<ClCompile Include="..\ui\UIScrollView.cpp" />
|
||||
<ClCompile Include="..\ui\UIScrollViewBar.cpp" />
|
||||
<ClCompile Include="..\ui\UISlider.cpp" />
|
||||
<ClCompile Include="..\ui\UIText.cpp" />
|
||||
<ClCompile Include="..\ui\UITextAtlas.cpp" />
|
||||
|
|
|
@ -931,6 +931,9 @@
|
|||
<ClCompile Include="..\ui\UIScrollView.cpp">
|
||||
<Filter>ui\UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ui\UIScrollViewBar.cpp">
|
||||
<Filter>ui\UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp">
|
||||
<Filter>cocostudio\TimelineAction\trigger</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -1136,6 +1136,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIRichText.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIScale9Sprite.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIScrollView.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIScrollViewBar.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UISlider.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIText.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UITextAtlas.cpp" />
|
||||
|
@ -1259,4 +1260,7 @@
|
|||
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d.vcxproj.filters" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d_wp8.vcxproj.filters" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<ItemGroup>
|
||||
<Text Include="$(MSBuildThisFileDirectory)..\..\..\..\physics3d\CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -2291,6 +2291,9 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIScrollView.cpp">
|
||||
<Filter>ui\UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIScrollViewBar.cpp">
|
||||
<Filter>ui\UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp">
|
||||
<Filter>ui\UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
|
@ -3897,4 +3900,7 @@
|
|||
<Filter>3d</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<ItemGroup>
|
||||
<Text Include="$(MSBuildThisFileDirectory)..\..\..\..\physics3d\CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -642,6 +642,7 @@
|
|||
<ClCompile Include="..\..\ui\UIRichText.cpp" />
|
||||
<ClCompile Include="..\..\ui\UIScale9Sprite.cpp" />
|
||||
<ClCompile Include="..\..\ui\UIScrollView.cpp" />
|
||||
<ClCompile Include="..\..\ui\UIScrollViewBar.cpp" />
|
||||
<ClCompile Include="..\..\ui\UISlider.cpp" />
|
||||
<ClCompile Include="..\..\ui\UIText.cpp" />
|
||||
<ClCompile Include="..\..\ui\UITextAtlas.cpp" />
|
||||
|
|
|
@ -1761,6 +1761,9 @@
|
|||
<ClCompile Include="..\..\ui\UIScrollView.cpp">
|
||||
<Filter>ui\UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ui\UIScrollViewBar.cpp">
|
||||
<Filter>ui\UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ui\UIButton.cpp">
|
||||
<Filter>ui\UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -275,7 +275,7 @@ void InitMaterial(ObjLoader::material_t& material)
|
|||
|
||||
static std::string& replacePathSeperator(std::string& path)
|
||||
{
|
||||
for (int i = 0; i < path.size(); i++) {
|
||||
for (size_t i = 0; i < path.size(); i++) {
|
||||
if (path[i] == '\\')
|
||||
path[i] = '/';
|
||||
}
|
||||
|
|
|
@ -460,12 +460,12 @@ Terrain::~Terrain()
|
|||
}
|
||||
}
|
||||
|
||||
for(int i =0;i<_chunkLodIndicesSet.size();i++)
|
||||
for(size_t i =0;i<_chunkLodIndicesSet.size();i++)
|
||||
{
|
||||
glDeleteBuffers(1,&(_chunkLodIndicesSet[i]._chunkIndices._indices));
|
||||
}
|
||||
|
||||
for(int i =0;i<_chunkLodIndicesSkirtSet.size();i++)
|
||||
for(size_t i =0;i<_chunkLodIndicesSkirtSet.size();i++)
|
||||
{
|
||||
glDeleteBuffers(1,&(_chunkLodIndicesSkirtSet[i]._chunkIndices._indices));
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ Terrain::ChunkIndices Terrain::lookForIndicesLOD(int neighborLod[4], int selfLod
|
|||
int test[5];
|
||||
memcpy(test,neighborLod,sizeof(int [4]));
|
||||
test[4] = selfLod;
|
||||
for(int i =0;i<_chunkLodIndicesSet.size();i++)
|
||||
for(size_t i =0;i<_chunkLodIndicesSet.size();i++)
|
||||
{
|
||||
if(memcmp(test,_chunkLodIndicesSet[i]._relativeLod,sizeof(test))==0)
|
||||
{
|
||||
|
@ -723,7 +723,7 @@ Terrain::ChunkIndices Terrain::lookForIndicesLODSkrit(int selfLod, bool * result
|
|||
return badResult;
|
||||
}
|
||||
|
||||
for(int i =0;i<_chunkLodIndicesSkirtSet.size();i++)
|
||||
for(size_t i =0;i<_chunkLodIndicesSkirtSet.size();i++)
|
||||
{
|
||||
if(_chunkLodIndicesSkirtSet[i]._selfLod == selfLod)
|
||||
{
|
||||
|
@ -1234,7 +1234,7 @@ void Terrain::Chunk::updateIndicesLOD()
|
|||
void Terrain::Chunk::calculateAABB()
|
||||
{
|
||||
std::vector<Vec3>pos;
|
||||
for(int i =0;i<_originalVertices.size();i++)
|
||||
for(size_t i =0;i<_originalVertices.size();i++)
|
||||
{
|
||||
pos.push_back(_originalVertices[i]._position);
|
||||
}
|
||||
|
@ -1245,7 +1245,7 @@ void Terrain::Chunk::calculateSlope()
|
|||
{
|
||||
//find max slope
|
||||
auto lowest = _originalVertices[0]._position;
|
||||
for(int i = 0;i<_originalVertices.size();i++)
|
||||
for(size_t i = 0;i<_originalVertices.size();i++)
|
||||
{
|
||||
if(_originalVertices[i]._position.y< lowest.y)
|
||||
{
|
||||
|
@ -1253,7 +1253,7 @@ void Terrain::Chunk::calculateSlope()
|
|||
}
|
||||
}
|
||||
auto highest = _originalVertices[0]._position;
|
||||
for(int i = 0;i<_originalVertices.size();i++)
|
||||
for(size_t i = 0;i<_originalVertices.size();i++)
|
||||
{
|
||||
if(_originalVertices[i]._position.y> highest.y)
|
||||
{
|
||||
|
|
|
@ -164,7 +164,7 @@ double gettime()
|
|||
long long getTimeInMilliseconds()
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
gettimeofday (&tv, nullptr);
|
||||
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ Node* Timeline::getNode() const
|
|||
return _node;
|
||||
}
|
||||
|
||||
void Timeline::apply(int frameIndex)
|
||||
void Timeline::apply(unsigned int frameIndex)
|
||||
{
|
||||
if (_currentKeyFrame)
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ void Timeline::apply(int frameIndex)
|
|||
}
|
||||
}
|
||||
|
||||
void Timeline::binarySearchKeyFrame(int frameIndex)
|
||||
void Timeline::binarySearchKeyFrame(unsigned int frameIndex)
|
||||
{
|
||||
Frame *from = nullptr;
|
||||
Frame *to = nullptr;
|
||||
|
@ -202,7 +202,7 @@ void Timeline::binarySearchKeyFrame(int frameIndex)
|
|||
}
|
||||
}
|
||||
|
||||
void Timeline::updateCurrentKeyFrame(int frameIndex)
|
||||
void Timeline::updateCurrentKeyFrame(unsigned int frameIndex)
|
||||
{
|
||||
//! If play to current frame's front or back, then find current frame again
|
||||
if (frameIndex < _currentKeyFrameIndex || frameIndex >= _currentKeyFrameIndex + _betweenDuration)
|
||||
|
@ -223,7 +223,7 @@ void Timeline::updateCurrentKeyFrame(int frameIndex)
|
|||
}
|
||||
else if(frameIndex >= _frames.at(length - 1)->getFrameIndex())
|
||||
{
|
||||
int lastFrameIndex = _frames.at(length - 1)->getFrameIndex();
|
||||
unsigned int lastFrameIndex = _frames.at(length - 1)->getFrameIndex();
|
||||
if(_currentKeyFrameIndex >= lastFrameIndex)
|
||||
return;
|
||||
frameIndex = lastFrameIndex;
|
||||
|
@ -236,7 +236,7 @@ void Timeline::updateCurrentKeyFrame(int frameIndex)
|
|||
_currentKeyFrameIndex = from->getFrameIndex();
|
||||
|
||||
_toIndex = _fromIndex + 1;
|
||||
if (_toIndex >= length)
|
||||
if ((ssize_t)_toIndex >= length)
|
||||
{
|
||||
_toIndex = 0;
|
||||
}
|
||||
|
|
|
@ -62,19 +62,19 @@ public:
|
|||
virtual Timeline* clone();
|
||||
|
||||
protected:
|
||||
virtual void apply(int frameIndex);
|
||||
virtual void apply(unsigned int frameIndex);
|
||||
|
||||
virtual void binarySearchKeyFrame (int frameIndex);
|
||||
virtual void updateCurrentKeyFrame(int frameIndex);
|
||||
virtual void binarySearchKeyFrame (unsigned int frameIndex);
|
||||
virtual void updateCurrentKeyFrame(unsigned int frameIndex);
|
||||
|
||||
cocos2d::Vector<Frame*> _frames;
|
||||
Frame* _currentKeyFrame;
|
||||
int _currentKeyFrameIndex;
|
||||
unsigned int _currentKeyFrameIndex;
|
||||
|
||||
int _fromIndex;
|
||||
int _toIndex;
|
||||
int _betweenDuration;
|
||||
int _actionTag;
|
||||
unsigned int _fromIndex;
|
||||
unsigned int _toIndex;
|
||||
unsigned int _betweenDuration;
|
||||
unsigned int _actionTag;
|
||||
|
||||
ActionTimeline* _ActionTimeline;
|
||||
cocos2d::Node* _node;
|
||||
|
|
|
@ -885,7 +885,7 @@ namespace cocostudio
|
|||
button->setBright(displaystate);
|
||||
button->setEnabled(displaystate);
|
||||
|
||||
bool outlineEnabled = options->outlineEnabled();
|
||||
bool outlineEnabled = options->outlineEnabled() != 0;
|
||||
if (outlineEnabled)
|
||||
{
|
||||
auto f_outlineColor = options->outlineColor();
|
||||
|
@ -897,7 +897,7 @@ namespace cocostudio
|
|||
}
|
||||
}
|
||||
|
||||
bool shadowEnabled = options->shadowEnabled();
|
||||
bool shadowEnabled = options->shadowEnabled() != 0;
|
||||
if (shadowEnabled)
|
||||
{
|
||||
auto f_shadowColor = options->shadowColor();
|
||||
|
|
|
@ -448,7 +448,7 @@ namespace cocostudio
|
|||
//}
|
||||
}
|
||||
|
||||
bool outlineEnabled = options->outlineEnabled();
|
||||
bool outlineEnabled = options->outlineEnabled() != 0;
|
||||
if (outlineEnabled)
|
||||
{
|
||||
auto f_outlineColor = options->outlineColor();
|
||||
|
@ -459,7 +459,7 @@ namespace cocostudio
|
|||
}
|
||||
}
|
||||
|
||||
bool shadowEnabled = options->shadowEnabled();
|
||||
bool shadowEnabled = options->shadowEnabled() != 0;
|
||||
if (shadowEnabled)
|
||||
{
|
||||
auto f_shadowColor = options->shadowColor();
|
||||
|
|
|
@ -11148,6 +11148,16 @@ color4f
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setLineWidth
|
||||
* @param {int} arg0
|
||||
*/
|
||||
setLineWidth : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method onDrawGLPoint
|
||||
* @param {mat4_object} arg0
|
||||
|
|
|
@ -2683,6 +2683,16 @@ bool
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setScrollBarEnabled
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
setScrollBarEnabled : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isInertiaScrollEnabled
|
||||
* @return {bool}
|
||||
|
@ -2717,6 +2727,16 @@ getDirection : function (
|
|||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setScrollBarColor
|
||||
* @param {color3b_object} arg0
|
||||
*/
|
||||
setScrollBarColor : function (
|
||||
color3b
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method scrollToBottomLeft
|
||||
* @param {float} arg0
|
||||
|
@ -2825,6 +2845,26 @@ float
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setScrollBarAutoHideTime
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setScrollBarAutoHideTime : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setScrollBarPositionFromCornerForHorizontal
|
||||
* @param {vec2_object} arg0
|
||||
*/
|
||||
setScrollBarPositionFromCornerForHorizontal : function (
|
||||
vec2
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setInertiaScrollEnabled
|
||||
* @param {bool} arg0
|
||||
|
@ -2835,6 +2875,16 @@ bool
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getScrollBarColor
|
||||
* @return {color3b_object}
|
||||
*/
|
||||
getScrollBarColor : function (
|
||||
)
|
||||
{
|
||||
return cc.Color3B;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method jumpToTopLeft
|
||||
*/
|
||||
|
@ -2861,6 +2911,26 @@ jumpToBottomRight : function (
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getScrollBarPositionFromCornerForHorizontal
|
||||
* @return {vec2_object}
|
||||
*/
|
||||
getScrollBarPositionFromCornerForHorizontal : function (
|
||||
)
|
||||
{
|
||||
return cc.Vec2;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setScrollBarWidth
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setScrollBarWidth : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setBounceEnabled
|
||||
* @param {bool} arg0
|
||||
|
@ -2901,6 +2971,16 @@ vec2
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getScrollBarPositionFromCornerForVertical
|
||||
* @return {vec2_object}
|
||||
*/
|
||||
getScrollBarPositionFromCornerForVertical : function (
|
||||
)
|
||||
{
|
||||
return cc.Vec2;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method scrollToPercentVertical
|
||||
* @param {float} arg0
|
||||
|
@ -2927,6 +3007,16 @@ bool
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setScrollBarAutoHideEnabled
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
setScrollBarAutoHideEnabled : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method scrollToBottomRight
|
||||
* @param {float} arg0
|
||||
|
@ -2939,6 +3029,36 @@ bool
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setScrollBarPositionFromCorner
|
||||
* @param {vec2_object} arg0
|
||||
*/
|
||||
setScrollBarPositionFromCorner : function (
|
||||
vec2
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setScrollBarPositionFromCornerForVertical
|
||||
* @param {vec2_object} arg0
|
||||
*/
|
||||
setScrollBarPositionFromCornerForVertical : function (
|
||||
vec2
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getScrollBarAutoHideTime
|
||||
* @return {float}
|
||||
*/
|
||||
getScrollBarAutoHideTime : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method jumpToLeft
|
||||
*/
|
||||
|
@ -2959,6 +3079,36 @@ bool
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isScrollBarEnabled
|
||||
* @return {bool}
|
||||
*/
|
||||
isScrollBarEnabled : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getScrollBarWidth
|
||||
* @return {float}
|
||||
*/
|
||||
getScrollBarWidth : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isScrollBarAutoHideEnabled
|
||||
* @return {bool}
|
||||
*/
|
||||
isScrollBarAutoHideEnabled : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method jumpToRight
|
||||
*/
|
||||
|
|
|
@ -34936,6 +34936,26 @@ bool js_cocos2dx_DrawNode_drawSolidCircle(JSContext *cx, uint32_t argc, jsval *v
|
|||
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawSolidCircle : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_DrawNode_setLineWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_setLineWidth : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
int arg0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_setLineWidth : Error processing arguments");
|
||||
cobj->setLineWidth(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_DrawNode_setLineWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_DrawNode_onDrawGLPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -35536,6 +35556,7 @@ void js_register_cocos2dx_DrawNode(JSContext *cx, JS::HandleObject global) {
|
|||
JS_FN("drawPoints", js_cocos2dx_DrawNode_drawPoints, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("drawRect", js_cocos2dx_DrawNode_drawRect, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("drawSolidCircle", js_cocos2dx_DrawNode_drawSolidCircle, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setLineWidth", js_cocos2dx_DrawNode_setLineWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("onDrawGLPoint", js_cocos2dx_DrawNode_onDrawGLPoint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("drawDot", js_cocos2dx_DrawNode_drawDot, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("drawCatmullRom", js_cocos2dx_DrawNode_drawCatmullRom, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
|
|
@ -2122,6 +2122,7 @@ bool js_cocos2dx_DrawNode_drawLine(JSContext *cx, uint32_t argc, jsval *vp);
|
|||
bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_DrawNode_drawRect(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_DrawNode_drawSolidCircle(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_DrawNode_setLineWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_DrawNode_onDrawGLPoint(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_DrawNode_drawDot(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_DrawNode_drawCatmullRom(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
|
|
@ -7284,6 +7284,26 @@ bool js_cocos2dx_ui_ScrollView_scrollToPercentHorizontal(JSContext *cx, uint32_t
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_scrollToPercentHorizontal : wrong number of arguments: %d, was expecting %d", argc, 3);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarEnabled : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
bool arg0;
|
||||
arg0 = JS::ToBoolean(args.get(0));
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarEnabled : Error processing arguments");
|
||||
cobj->setScrollBarEnabled(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setScrollBarEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_isInertiaScrollEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7344,6 +7364,26 @@ bool js_cocos2dx_ui_ScrollView_getDirection(JSContext *cx, uint32_t argc, jsval
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_getDirection : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarColor(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarColor : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
cocos2d::Color3B arg0;
|
||||
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarColor : Error processing arguments");
|
||||
cobj->setScrollBarColor(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setScrollBarColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToBottomLeft(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7557,6 +7597,46 @@ bool js_cocos2dx_ui_ScrollView_jumpToPercentVertical(JSContext *cx, uint32_t arg
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_jumpToPercentVertical : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
double arg0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime : Error processing arguments");
|
||||
cobj->setScrollBarAutoHideTime(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
cocos2d::Vec2 arg0;
|
||||
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal : Error processing arguments");
|
||||
cobj->setScrollBarPositionFromCornerForHorizontal(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setInertiaScrollEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7577,6 +7657,24 @@ bool js_cocos2dx_ui_ScrollView_setInertiaScrollEnabled(JSContext *cx, uint32_t a
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setInertiaScrollEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarColor(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_getScrollBarColor : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
const cocos2d::Color3B& ret = cobj->getScrollBarColor();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = cccolor3b_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_getScrollBarColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToTopLeft(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7629,6 +7727,44 @@ bool js_cocos2dx_ui_ScrollView_jumpToBottomRight(JSContext *cx, uint32_t argc, j
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_jumpToBottomRight : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cocos2d::Vec2 ret = cobj->getScrollBarPositionFromCornerForHorizontal();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = vector2_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarWidth : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
double arg0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarWidth : Error processing arguments");
|
||||
cobj->setScrollBarWidth(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setScrollBarWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setBounceEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7707,6 +7843,24 @@ bool js_cocos2dx_ui_ScrollView_jumpToPercentBothDirection(JSContext *cx, uint32_
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_jumpToPercentBothDirection : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cocos2d::Vec2 ret = cobj->getScrollBarPositionFromCornerForVertical();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = vector2_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToPercentVertical(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7753,6 +7907,26 @@ bool js_cocos2dx_ui_ScrollView_scrollToBottom(JSContext *cx, uint32_t argc, jsva
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_scrollToBottom : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
bool arg0;
|
||||
arg0 = JS::ToBoolean(args.get(0));
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled : Error processing arguments");
|
||||
cobj->setScrollBarAutoHideEnabled(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToBottomRight(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7775,6 +7949,64 @@ bool js_cocos2dx_ui_ScrollView_scrollToBottomRight(JSContext *cx, uint32_t argc,
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_scrollToBottomRight : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
cocos2d::Vec2 arg0;
|
||||
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner : Error processing arguments");
|
||||
cobj->setScrollBarPositionFromCorner(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
cocos2d::Vec2 arg0;
|
||||
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical : Error processing arguments");
|
||||
cobj->setScrollBarPositionFromCornerForVertical(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
double ret = cobj->getScrollBarAutoHideTime();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToLeft(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7813,6 +8045,60 @@ bool js_cocos2dx_ui_ScrollView_scrollToRight(JSContext *cx, uint32_t argc, jsval
|
|||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_scrollToRight : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_isScrollBarEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_isScrollBarEnabled : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->isScrollBarEnabled();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_isScrollBarEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_getScrollBarWidth : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
double ret = cobj->getScrollBarWidth();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_getScrollBarWidth : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->isScrollBarAutoHideEnabled();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToRight(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -7966,9 +8252,11 @@ void js_register_cocos2dx_ui_ScrollView(JSContext *cx, JS::HandleObject global)
|
|||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("scrollToTop", js_cocos2dx_ui_ScrollView_scrollToTop, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToPercentHorizontal", js_cocos2dx_ui_ScrollView_scrollToPercentHorizontal, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarEnabled", js_cocos2dx_ui_ScrollView_setScrollBarEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isInertiaScrollEnabled", js_cocos2dx_ui_ScrollView_isInertiaScrollEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToPercentBothDirection", js_cocos2dx_ui_ScrollView_scrollToPercentBothDirection, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getDirection", js_cocos2dx_ui_ScrollView_getDirection, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarColor", js_cocos2dx_ui_ScrollView_setScrollBarColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToBottomLeft", js_cocos2dx_ui_ScrollView_scrollToBottomLeft, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getInnerContainer", js_cocos2dx_ui_ScrollView_getInnerContainer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToBottom", js_cocos2dx_ui_ScrollView_jumpToBottom, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -7980,19 +8268,32 @@ void js_register_cocos2dx_ui_ScrollView(JSContext *cx, JS::HandleObject global)
|
|||
JS_FN("getInnerContainerSize", js_cocos2dx_ui_ScrollView_getInnerContainerSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isBounceEnabled", js_cocos2dx_ui_ScrollView_isBounceEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToPercentVertical", js_cocos2dx_ui_ScrollView_jumpToPercentVertical, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarAutoHideTime", js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarPositionFromCornerForHorizontal", js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setInertiaScrollEnabled", js_cocos2dx_ui_ScrollView_setInertiaScrollEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getScrollBarColor", js_cocos2dx_ui_ScrollView_getScrollBarColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToTopLeft", js_cocos2dx_ui_ScrollView_jumpToTopLeft, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToPercentHorizontal", js_cocos2dx_ui_ScrollView_jumpToPercentHorizontal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToBottomRight", js_cocos2dx_ui_ScrollView_jumpToBottomRight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getScrollBarPositionFromCornerForHorizontal", js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarWidth", js_cocos2dx_ui_ScrollView_setScrollBarWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBounceEnabled", js_cocos2dx_ui_ScrollView_setBounceEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToTop", js_cocos2dx_ui_ScrollView_jumpToTop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToLeft", js_cocos2dx_ui_ScrollView_scrollToLeft, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToPercentBothDirection", js_cocos2dx_ui_ScrollView_jumpToPercentBothDirection, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getScrollBarPositionFromCornerForVertical", js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToPercentVertical", js_cocos2dx_ui_ScrollView_scrollToPercentVertical, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToBottom", js_cocos2dx_ui_ScrollView_scrollToBottom, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarAutoHideEnabled", js_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToBottomRight", js_cocos2dx_ui_ScrollView_scrollToBottomRight, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarPositionFromCorner", js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setScrollBarPositionFromCornerForVertical", js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getScrollBarAutoHideTime", js_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToLeft", js_cocos2dx_ui_ScrollView_jumpToLeft, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToRight", js_cocos2dx_ui_ScrollView_scrollToRight, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isScrollBarEnabled", js_cocos2dx_ui_ScrollView_isScrollBarEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getScrollBarWidth", js_cocos2dx_ui_ScrollView_getScrollBarWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isScrollBarAutoHideEnabled", js_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("jumpToRight", js_cocos2dx_ui_ScrollView_jumpToRight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("scrollToTopRight", js_cocos2dx_ui_ScrollView_scrollToTopRight, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("ctor", js_cocos2d_ui_ScrollView_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
|
|
@ -367,9 +367,11 @@ void js_register_cocos2dx_ui_ScrollView(JSContext *cx, JS::HandleObject global);
|
|||
void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToTop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToPercentHorizontal(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_isInertiaScrollEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToPercentBothDirection(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getDirection(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToBottomLeft(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getInnerContainer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToBottom(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -381,19 +383,32 @@ bool js_cocos2dx_ui_ScrollView_setInnerContainerSize(JSContext *cx, uint32_t arg
|
|||
bool js_cocos2dx_ui_ScrollView_getInnerContainerSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_isBounceEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToPercentVertical(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setInertiaScrollEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToTopLeft(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToPercentHorizontal(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToBottomRight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setBounceEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToTop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToLeft(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToPercentBothDirection(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToPercentVertical(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToBottom(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToBottomRight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToLeft(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToRight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_isScrollBarEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_getScrollBarWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_jumpToRight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_scrollToTopRight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ui_ScrollView_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
|
|
@ -265,6 +265,9 @@ bool js_cocos2dx_Node_onExitTransitionDidStart(JSContext *cx, uint32_t argc, jsv
|
|||
bool js_cocos2dx_Component_onEnter(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Component_onExit(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
bool js_cocos2dx_retain(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_release(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
void get_or_create_js_obj(JSContext* cx, JS::HandleObject obj, const std::string &name, JS::MutableHandleObject jsObj);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -879,35 +879,6 @@ bool js_cocos2dx_ext_AssetsManager_getFailedAssets(JSContext *cx, uint32_t argc,
|
|||
}
|
||||
*/
|
||||
|
||||
bool js_cocos2dx_ext_retain(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *thisObj = JS_THIS_OBJECT(cx, vp);
|
||||
if (thisObj) {
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(thisObj);
|
||||
if (proxy) {
|
||||
((Ref *)proxy->ptr)->retain();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
JS_ReportError(cx, "Invalid Native Object.");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_ext_release(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *thisObj = JS_THIS_OBJECT(cx, vp);
|
||||
if (thisObj) {
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(thisObj);
|
||||
if (proxy) {
|
||||
((Ref *)proxy->ptr)->release();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
JS_ReportError(cx, "Invalid Native Object.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
__JSDownloaderDelegator::__JSDownloaderDelegator(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleObject callback)
|
||||
: _cx(cx)
|
||||
, _url(url)
|
||||
|
@ -1077,11 +1048,11 @@ void register_all_cocos2dx_extension_manual(JSContext* cx, JS::HandleObject glob
|
|||
get_or_create_js_obj(cx, global, "cc", &ccObj);
|
||||
|
||||
JS::RootedObject am(cx, jsb_cocos2d_extension_AssetsManagerEx_prototype);
|
||||
JS_DefineFunction(cx, am, "retain", js_cocos2dx_ext_retain, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, am, "release", js_cocos2dx_ext_release, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, am, "retain", js_cocos2dx_retain, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, am, "release", js_cocos2dx_release, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS::RootedObject manifest(cx, jsb_cocos2d_extension_Manifest_prototype);
|
||||
JS_DefineFunction(cx, manifest, "retain", js_cocos2dx_ext_retain, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, manifest, "release", js_cocos2dx_ext_release, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, manifest, "retain", js_cocos2dx_retain, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, manifest, "release", js_cocos2dx_release, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
//JS_DefineFunction(cx, jsb_cocos2d_extension_AssetsManager_prototype, "updateAssets", js_cocos2dx_ext_AssetsManager_updateAssets, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
//JS_DefineFunction(cx, jsb_cocos2d_extension_AssetsManager_prototype, "getFailedAssets", js_cocos2dx_ext_AssetsManager_getFailedAssets, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "XMLHTTPRequest.h"
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include "cocos2d_specifics.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -986,6 +987,8 @@ void MinXmlHttpRequest::_js_register(JSContext *cx, JS::HandleObject global)
|
|||
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, getAllResponseHeaders),
|
||||
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, getResponseHeader),
|
||||
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, overrideMimeType),
|
||||
JS_FN("retain", js_cocos2dx_retain, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("release", js_cocos2dx_release, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ ccui.Layout.RELATIVE = 3;
|
|||
ccui.Layout.CLIPPING_STENCIL = 0;
|
||||
ccui.Layout.CLIPPING_SCISSOR = 1;
|
||||
|
||||
ccui.Layout.BACKGROUND_IMAGE_ZORDER = -2;
|
||||
ccui.Layout.BACKGROUND_IMAGE_ZORDER = -1;
|
||||
ccui.Layout.BACKGROUND_RENDERER_ZORDER = -2;
|
||||
|
||||
/*
|
||||
|
|
|
@ -43,6 +43,13 @@
|
|||
-- @param #color4f_table color
|
||||
-- @return DrawNode#DrawNode self (return value: cc.DrawNode)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#DrawNode] setLineWidth
|
||||
-- @param self
|
||||
-- @param #int lineWidth
|
||||
-- @return DrawNode#DrawNode self (return value: cc.DrawNode)
|
||||
|
||||
--------------------------------
|
||||
-- js NA
|
||||
-- @function [parent=#DrawNode] onDrawGLPoint
|
||||
|
|
|
@ -26,6 +26,14 @@
|
|||
-- @param #bool attenuated
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Toggle scroll bar enabled.<br>
|
||||
-- param enabled True if enable scroll bar, false otherwise.
|
||||
-- @function [parent=#ScrollView] setScrollBarEnabled
|
||||
-- @param self
|
||||
-- @param #bool enabled
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Query inertia scroll state.<br>
|
||||
-- return True if inertia is enabled, false otherwise.
|
||||
|
@ -53,6 +61,14 @@
|
|||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set the scroll bar's color<br>
|
||||
-- param the scroll bar's color
|
||||
-- @function [parent=#ScrollView] setScrollBarColor
|
||||
-- @param self
|
||||
-- @param #color3b_table color
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- Scroll inner container to bottom and left boundary of scrollview.<br>
|
||||
-- param second Time in seconds.<br>
|
||||
|
@ -148,6 +164,22 @@
|
|||
-- @param #function callback
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set scroll bar auto hide time<br>
|
||||
-- param scroll bar auto hide time
|
||||
-- @function [parent=#ScrollView] setScrollBarAutoHideTime
|
||||
-- @param self
|
||||
-- @param #float autoHideTime
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set the horizontal scroll bar position from left-bottom corner.<br>
|
||||
-- param positionFromCorner The position from left-bottom corner
|
||||
-- @function [parent=#ScrollView] setScrollBarPositionFromCornerForHorizontal
|
||||
-- @param self
|
||||
-- @param #vec2_table positionFromCorner
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Toggle whether enable scroll inertia while scrolling.<br>
|
||||
-- param enabled True if enable inertia, false otherwise.
|
||||
|
@ -156,6 +188,13 @@
|
|||
-- @param #bool enabled
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Get the scroll bar's color<br>
|
||||
-- return the scroll bar's color
|
||||
-- @function [parent=#ScrollView] getScrollBarColor
|
||||
-- @param self
|
||||
-- @return color3b_table#color3b_table ret (return value: color3b_table)
|
||||
|
||||
--------------------------------
|
||||
-- Move inner container to top and left boundary of scrollview.
|
||||
-- @function [parent=#ScrollView] jumpToTopLeft
|
||||
|
@ -176,6 +215,21 @@
|
|||
-- @param self
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Get the horizontal scroll bar's position from right-top corner.<br>
|
||||
-- return positionFromCorner
|
||||
-- @function [parent=#ScrollView] getScrollBarPositionFromCornerForHorizontal
|
||||
-- @param self
|
||||
-- @return vec2_table#vec2_table ret (return value: vec2_table)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set the scroll bar's width<br>
|
||||
-- param width The scroll bar's width
|
||||
-- @function [parent=#ScrollView] setScrollBarWidth
|
||||
-- @param self
|
||||
-- @param #float width
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Toggle bounce enabled when scroll to the edge.<br>
|
||||
-- param enabled True if enable bounce, false otherwise.
|
||||
|
@ -208,6 +262,13 @@
|
|||
-- @param #vec2_table percent
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Get the vertical scroll bar's position from right-top corner.<br>
|
||||
-- return positionFromCorner
|
||||
-- @function [parent=#ScrollView] getScrollBarPositionFromCornerForVertical
|
||||
-- @param self
|
||||
-- @return vec2_table#vec2_table ret (return value: vec2_table)
|
||||
|
||||
--------------------------------
|
||||
-- Scroll inner container to vertical percent position of scrollview.<br>
|
||||
-- param percent A value between 0 and 100.<br>
|
||||
|
@ -230,6 +291,14 @@
|
|||
-- @param #bool attenuated
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set scroll bar auto hide state<br>
|
||||
-- param scroll bar auto hide state
|
||||
-- @function [parent=#ScrollView] setScrollBarAutoHideEnabled
|
||||
-- @param self
|
||||
-- @param #bool autoHideEnabled
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- Scroll inner container to bottom and right boundary of scrollview.<br>
|
||||
-- param second Time in seconds<br>
|
||||
|
@ -240,6 +309,29 @@
|
|||
-- @param #bool attenuated
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set the scroll bar positions from the left-bottom corner (horizontal) and right-top corner (vertical).<br>
|
||||
-- param positionFromCorner The position from the left-bottom corner (horizontal) and right-top corner (vertical).
|
||||
-- @function [parent=#ScrollView] setScrollBarPositionFromCorner
|
||||
-- @param self
|
||||
-- @param #vec2_table positionFromCorner
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Set the vertical scroll bar position from right-top corner.<br>
|
||||
-- param positionFromCorner The position from right-top corner
|
||||
-- @function [parent=#ScrollView] setScrollBarPositionFromCornerForVertical
|
||||
-- @param self
|
||||
-- @param #vec2_table positionFromCorner
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Get the scroll bar's auto hide time<br>
|
||||
-- return the scroll bar's auto hide time
|
||||
-- @function [parent=#ScrollView] getScrollBarAutoHideTime
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- Move inner container to left boundary of scrollview.
|
||||
-- @function [parent=#ScrollView] jumpToLeft
|
||||
|
@ -256,6 +348,27 @@
|
|||
-- @param #bool attenuated
|
||||
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
|
||||
|
||||
--------------------------------
|
||||
-- brief Query scroll bar state.<br>
|
||||
-- return True if scroll bar is enabled, false otherwise.
|
||||
-- @function [parent=#ScrollView] isScrollBarEnabled
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- brief Get the scroll bar's width<br>
|
||||
-- return the scroll bar's width
|
||||
-- @function [parent=#ScrollView] getScrollBarWidth
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
-- brief Query scroll bar auto hide state<br>
|
||||
-- return True if scroll bar auto hide is enabled, false otherwise.
|
||||
-- @function [parent=#ScrollView] isScrollBarAutoHideEnabled
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- Move inner container to right boundary of scrollview.
|
||||
-- @function [parent=#ScrollView] jumpToRight
|
||||
|
|
|
@ -47134,6 +47134,56 @@ int lua_cocos2dx_DrawNode_drawSolidCircle(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_DrawNode_setLineWidth(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::DrawNode* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_setLineWidth'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
int arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.DrawNode:setLineWidth");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_DrawNode_setLineWidth'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setLineWidth(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:setLineWidth",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_setLineWidth'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_DrawNode_onDrawGLPoint(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -48040,6 +48090,7 @@ int lua_register_cocos2dx_DrawNode(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"drawLine",lua_cocos2dx_DrawNode_drawLine);
|
||||
tolua_function(tolua_S,"drawRect",lua_cocos2dx_DrawNode_drawRect);
|
||||
tolua_function(tolua_S,"drawSolidCircle",lua_cocos2dx_DrawNode_drawSolidCircle);
|
||||
tolua_function(tolua_S,"setLineWidth",lua_cocos2dx_DrawNode_setLineWidth);
|
||||
tolua_function(tolua_S,"onDrawGLPoint",lua_cocos2dx_DrawNode_onDrawGLPoint);
|
||||
tolua_function(tolua_S,"drawDot",lua_cocos2dx_DrawNode_drawDot);
|
||||
tolua_function(tolua_S,"drawSegment",lua_cocos2dx_DrawNode_drawSegment);
|
||||
|
|
|
@ -2062,6 +2062,7 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // __cocos2dx_h__
|
||||
|
|
|
@ -11205,6 +11205,56 @@ int lua_cocos2dx_ui_ScrollView_scrollToPercentHorizontal(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setScrollBarEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_setScrollBarEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
bool arg0;
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.ScrollView:setScrollBarEnabled");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_setScrollBarEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScrollBarEnabled(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:setScrollBarEnabled",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_setScrollBarEnabled'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_isInertiaScrollEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -11355,6 +11405,56 @@ int lua_cocos2dx_ui_ScrollView_getDirection(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setScrollBarColor(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_setScrollBarColor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Color3B arg0;
|
||||
|
||||
ok &= luaval_to_color3b(tolua_S, 2, &arg0, "ccui.ScrollView:setScrollBarColor");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_setScrollBarColor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScrollBarColor(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:setScrollBarColor",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_setScrollBarColor'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_scrollToBottomLeft(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -11947,6 +12047,106 @@ int lua_cocos2dx_ui_ScrollView_addEventListener(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
double arg0;
|
||||
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.ScrollView:setScrollBarAutoHideTime");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScrollBarAutoHideTime(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:setScrollBarAutoHideTime",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Vec2 arg0;
|
||||
|
||||
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.ScrollView:setScrollBarPositionFromCornerForHorizontal");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScrollBarPositionFromCornerForHorizontal(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:setScrollBarPositionFromCornerForHorizontal",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setInertiaScrollEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -11997,6 +12197,53 @@ int lua_cocos2dx_ui_ScrollView_setInertiaScrollEnabled(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_getScrollBarColor(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_getScrollBarColor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_getScrollBarColor'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
const cocos2d::Color3B& ret = cobj->getScrollBarColor();
|
||||
color3b_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:getScrollBarColor",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_getScrollBarColor'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_jumpToTopLeft(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12141,6 +12388,103 @@ int lua_cocos2dx_ui_ScrollView_jumpToBottomRight(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::Vec2 ret = cobj->getScrollBarPositionFromCornerForHorizontal();
|
||||
vec2_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:getScrollBarPositionFromCornerForHorizontal",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setScrollBarWidth(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_setScrollBarWidth'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
double arg0;
|
||||
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.ScrollView:setScrollBarWidth");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_setScrollBarWidth'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScrollBarWidth(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:setScrollBarWidth",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_setScrollBarWidth'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setBounceEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12341,6 +12685,53 @@ int lua_cocos2dx_ui_ScrollView_jumpToPercentBothDirection(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::Vec2 ret = cobj->getScrollBarPositionFromCornerForVertical();
|
||||
vec2_to_luaval(tolua_S, ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:getScrollBarPositionFromCornerForVertical",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_scrollToPercentVertical(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12450,6 +12841,56 @@ int lua_cocos2dx_ui_ScrollView_scrollToBottom(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
bool arg0;
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.ScrollView:setScrollBarAutoHideEnabled");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScrollBarAutoHideEnabled(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:setScrollBarAutoHideEnabled",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_scrollToBottomRight(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12503,6 +12944,153 @@ int lua_cocos2dx_ui_ScrollView_scrollToBottomRight(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Vec2 arg0;
|
||||
|
||||
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.ScrollView:setScrollBarPositionFromCorner");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScrollBarPositionFromCorner(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:setScrollBarPositionFromCorner",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Vec2 arg0;
|
||||
|
||||
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.ScrollView:setScrollBarPositionFromCornerForVertical");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setScrollBarPositionFromCornerForVertical(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:setScrollBarPositionFromCornerForVertical",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
double ret = cobj->getScrollBarAutoHideTime();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:getScrollBarAutoHideTime",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_jumpToLeft(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12603,6 +13191,147 @@ int lua_cocos2dx_ui_ScrollView_scrollToRight(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_isScrollBarEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_isScrollBarEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_isScrollBarEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->isScrollBarEnabled();
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:isScrollBarEnabled",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_isScrollBarEnabled'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_getScrollBarWidth(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_getScrollBarWidth'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_getScrollBarWidth'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
double ret = cobj->getScrollBarWidth();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:getScrollBarWidth",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_getScrollBarWidth'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::ui::ScrollView* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::ui::ScrollView*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->isScrollBarAutoHideEnabled();
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ScrollView:isScrollBarAutoHideEnabled",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_ui_ScrollView_jumpToRight(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -12823,9 +13552,11 @@ int lua_register_cocos2dx_ui_ScrollView(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"new",lua_cocos2dx_ui_ScrollView_constructor);
|
||||
tolua_function(tolua_S,"scrollToTop",lua_cocos2dx_ui_ScrollView_scrollToTop);
|
||||
tolua_function(tolua_S,"scrollToPercentHorizontal",lua_cocos2dx_ui_ScrollView_scrollToPercentHorizontal);
|
||||
tolua_function(tolua_S,"setScrollBarEnabled",lua_cocos2dx_ui_ScrollView_setScrollBarEnabled);
|
||||
tolua_function(tolua_S,"isInertiaScrollEnabled",lua_cocos2dx_ui_ScrollView_isInertiaScrollEnabled);
|
||||
tolua_function(tolua_S,"scrollToPercentBothDirection",lua_cocos2dx_ui_ScrollView_scrollToPercentBothDirection);
|
||||
tolua_function(tolua_S,"getDirection",lua_cocos2dx_ui_ScrollView_getDirection);
|
||||
tolua_function(tolua_S,"setScrollBarColor",lua_cocos2dx_ui_ScrollView_setScrollBarColor);
|
||||
tolua_function(tolua_S,"scrollToBottomLeft",lua_cocos2dx_ui_ScrollView_scrollToBottomLeft);
|
||||
tolua_function(tolua_S,"getInnerContainer",lua_cocos2dx_ui_ScrollView_getInnerContainer);
|
||||
tolua_function(tolua_S,"jumpToBottom",lua_cocos2dx_ui_ScrollView_jumpToBottom);
|
||||
|
@ -12838,19 +13569,32 @@ int lua_register_cocos2dx_ui_ScrollView(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"isBounceEnabled",lua_cocos2dx_ui_ScrollView_isBounceEnabled);
|
||||
tolua_function(tolua_S,"jumpToPercentVertical",lua_cocos2dx_ui_ScrollView_jumpToPercentVertical);
|
||||
tolua_function(tolua_S,"addEventListener",lua_cocos2dx_ui_ScrollView_addEventListener);
|
||||
tolua_function(tolua_S,"setScrollBarAutoHideTime",lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime);
|
||||
tolua_function(tolua_S,"setScrollBarPositionFromCornerForHorizontal",lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForHorizontal);
|
||||
tolua_function(tolua_S,"setInertiaScrollEnabled",lua_cocos2dx_ui_ScrollView_setInertiaScrollEnabled);
|
||||
tolua_function(tolua_S,"getScrollBarColor",lua_cocos2dx_ui_ScrollView_getScrollBarColor);
|
||||
tolua_function(tolua_S,"jumpToTopLeft",lua_cocos2dx_ui_ScrollView_jumpToTopLeft);
|
||||
tolua_function(tolua_S,"jumpToPercentHorizontal",lua_cocos2dx_ui_ScrollView_jumpToPercentHorizontal);
|
||||
tolua_function(tolua_S,"jumpToBottomRight",lua_cocos2dx_ui_ScrollView_jumpToBottomRight);
|
||||
tolua_function(tolua_S,"getScrollBarPositionFromCornerForHorizontal",lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForHorizontal);
|
||||
tolua_function(tolua_S,"setScrollBarWidth",lua_cocos2dx_ui_ScrollView_setScrollBarWidth);
|
||||
tolua_function(tolua_S,"setBounceEnabled",lua_cocos2dx_ui_ScrollView_setBounceEnabled);
|
||||
tolua_function(tolua_S,"jumpToTop",lua_cocos2dx_ui_ScrollView_jumpToTop);
|
||||
tolua_function(tolua_S,"scrollToLeft",lua_cocos2dx_ui_ScrollView_scrollToLeft);
|
||||
tolua_function(tolua_S,"jumpToPercentBothDirection",lua_cocos2dx_ui_ScrollView_jumpToPercentBothDirection);
|
||||
tolua_function(tolua_S,"getScrollBarPositionFromCornerForVertical",lua_cocos2dx_ui_ScrollView_getScrollBarPositionFromCornerForVertical);
|
||||
tolua_function(tolua_S,"scrollToPercentVertical",lua_cocos2dx_ui_ScrollView_scrollToPercentVertical);
|
||||
tolua_function(tolua_S,"scrollToBottom",lua_cocos2dx_ui_ScrollView_scrollToBottom);
|
||||
tolua_function(tolua_S,"setScrollBarAutoHideEnabled",lua_cocos2dx_ui_ScrollView_setScrollBarAutoHideEnabled);
|
||||
tolua_function(tolua_S,"scrollToBottomRight",lua_cocos2dx_ui_ScrollView_scrollToBottomRight);
|
||||
tolua_function(tolua_S,"setScrollBarPositionFromCorner",lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCorner);
|
||||
tolua_function(tolua_S,"setScrollBarPositionFromCornerForVertical",lua_cocos2dx_ui_ScrollView_setScrollBarPositionFromCornerForVertical);
|
||||
tolua_function(tolua_S,"getScrollBarAutoHideTime",lua_cocos2dx_ui_ScrollView_getScrollBarAutoHideTime);
|
||||
tolua_function(tolua_S,"jumpToLeft",lua_cocos2dx_ui_ScrollView_jumpToLeft);
|
||||
tolua_function(tolua_S,"scrollToRight",lua_cocos2dx_ui_ScrollView_scrollToRight);
|
||||
tolua_function(tolua_S,"isScrollBarEnabled",lua_cocos2dx_ui_ScrollView_isScrollBarEnabled);
|
||||
tolua_function(tolua_S,"getScrollBarWidth",lua_cocos2dx_ui_ScrollView_getScrollBarWidth);
|
||||
tolua_function(tolua_S,"isScrollBarAutoHideEnabled",lua_cocos2dx_ui_ScrollView_isScrollBarAutoHideEnabled);
|
||||
tolua_function(tolua_S,"jumpToRight",lua_cocos2dx_ui_ScrollView_jumpToRight);
|
||||
tolua_function(tolua_S,"scrollToTopRight",lua_cocos2dx_ui_ScrollView_scrollToTopRight);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_ui_ScrollView_create);
|
||||
|
|
|
@ -539,6 +539,21 @@ int register_all_cocos2dx_ui(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ function Layer:onTouch(callback, isMultiTouches, swallowTouches)
|
|||
event.x = args[1]
|
||||
event.y = args[2]
|
||||
end
|
||||
callback(event)
|
||||
return callback( event )
|
||||
end, isMultiTouches, 0, swallowTouches)
|
||||
self:setTouchEnabled(true)
|
||||
return self
|
||||
|
|
|
@ -19,6 +19,7 @@ UIHelper.cpp \
|
|||
UIListView.cpp \
|
||||
UIPageView.cpp \
|
||||
UIScrollView.cpp \
|
||||
UIScrollViewBar.cpp \
|
||||
UIButton.cpp \
|
||||
UIAbstractCheckButton.cpp \
|
||||
UICheckBox.cpp \
|
||||
|
|
|
@ -41,6 +41,7 @@ set(COCOS_UI_SRC
|
|||
ui/UIRichText.cpp
|
||||
ui/UIScale9Sprite.cpp
|
||||
ui/UIScrollView.cpp
|
||||
ui/UIScrollViewBar.cpp
|
||||
ui/UISlider.cpp
|
||||
ui/UIText.cpp
|
||||
ui/UITextAtlas.cpp
|
||||
|
|
|
@ -410,7 +410,7 @@ void Layout::drawFullScreenQuadClearStencil()
|
|||
void Layout::onAfterDrawStencil()
|
||||
{
|
||||
glDepthMask(_currentDepthWriteMask);
|
||||
RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask);
|
||||
RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask != 0);
|
||||
|
||||
glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le);
|
||||
// RenderState::StateBlock::_defaultState->setStencilFunction(
|
||||
|
|
|
@ -26,17 +26,19 @@ THE SOFTWARE.
|
|||
#include "base/CCDirector.h"
|
||||
#include "base/ccUtils.h"
|
||||
#include "platform/CCDevice.h"
|
||||
#include "ui/UIScrollViewBar.h"
|
||||
#include "2d/CCTweenFunction.h"
|
||||
#include "2d/CCCamera.h"
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
static const float INERTIA_DEACCELERATION = 3000.0f;
|
||||
static const float BOUNCE_BACK_DURATION = 0.3f;
|
||||
static const float INERTIA_DEACCELERATION = 700.0f;
|
||||
static const float INERTIA_VELOCITY_MAX = 2500;
|
||||
static const float BOUNCE_BACK_DURATION = 1.0f;
|
||||
#define MOVE_INCH 7.0f/160.0f
|
||||
|
||||
static float convertDistanceFromPointToInch(Vec2 dis)
|
||||
static float convertDistanceFromPointToInch(const Vec2& dis)
|
||||
{
|
||||
auto glview = Director::getInstance()->getOpenGLView();
|
||||
int dpi = Device::getDPI();
|
||||
|
@ -66,6 +68,9 @@ _autoScrollDuration(0),
|
|||
_autoScrollAccumulatedTime(0),
|
||||
_bounceEnabled(false),
|
||||
_bouncingBack(false),
|
||||
_scrollBarEnabled(true),
|
||||
_verticalScrollBar(nullptr),
|
||||
_horizontalScrollBar(nullptr),
|
||||
_scrollViewEventListener(nullptr),
|
||||
_scrollViewEventSelector(nullptr),
|
||||
_eventCallback(nullptr)
|
||||
|
@ -75,6 +80,8 @@ _eventCallback(nullptr)
|
|||
|
||||
ScrollView::~ScrollView()
|
||||
{
|
||||
_verticalScrollBar = nullptr;
|
||||
_horizontalScrollBar = nullptr;
|
||||
_scrollViewEventListener = nullptr;
|
||||
_scrollViewEventSelector = nullptr;
|
||||
}
|
||||
|
@ -111,6 +118,10 @@ bool ScrollView::init()
|
|||
{
|
||||
setClippingEnabled(true);
|
||||
_innerContainer->setTouchEnabled(false);
|
||||
if(_scrollBarEnabled)
|
||||
{
|
||||
initScrollBar();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -164,20 +175,6 @@ void ScrollView::setInnerContainerSize(const Size &size)
|
|||
}
|
||||
_innerContainer->setContentSize(Size(innerSizeWidth, innerSizeHeight));
|
||||
|
||||
// Scroll children appropriately
|
||||
{
|
||||
float offsetX = originalInnerSize.height - innerSizeHeight;
|
||||
float offsetY = 0;
|
||||
if (_innerContainer->getRightBoundary() <= _contentSize.width)
|
||||
{
|
||||
offsetX = originalInnerSize.width - innerSizeWidth;
|
||||
}
|
||||
if(offsetX != 0 || offsetY != 0)
|
||||
{
|
||||
scrollChildren(offsetX, offsetY);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate and set the position of the inner container.
|
||||
Vec2 pos = _innerContainer->getPosition();
|
||||
if (_innerContainer->getLeftBoundary() > 0.0f)
|
||||
|
@ -267,7 +264,27 @@ Node* ScrollView::getChildByName(const std::string& name)const
|
|||
void ScrollView::moveChildren(float offsetX, float offsetY)
|
||||
{
|
||||
Vec2 position = _innerContainer->getPosition() + Vec2(offsetX, offsetY);
|
||||
moveChildrenToPosition(position);
|
||||
}
|
||||
|
||||
void ScrollView::moveChildrenToPosition(const Vec2& position)
|
||||
{
|
||||
_innerContainer->setPosition(position);
|
||||
|
||||
Vec2 outOfBoundary = getHowMuchOutOfBoundary(Vec2::ZERO);
|
||||
updateScrollBar(outOfBoundary);
|
||||
}
|
||||
|
||||
void ScrollView::updateScrollBar(const Vec2& outOfBoundary)
|
||||
{
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
_verticalScrollBar->onScrolled(outOfBoundary);
|
||||
}
|
||||
if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
_horizontalScrollBar->onScrolled(outOfBoundary);
|
||||
}
|
||||
}
|
||||
|
||||
bool ScrollView::startBounceBackIfNeeded()
|
||||
|
@ -317,7 +334,7 @@ void ScrollView::processAutoScrolling(float deltaTime)
|
|||
float percentage = _autoScrollAccumulatedTime / _autoScrollDuration;
|
||||
if(percentage >= 1)
|
||||
{
|
||||
_innerContainer->setPosition(_autoScrollStartPosition + _autoScrollTargetDelta);
|
||||
moveChildrenToPosition(_autoScrollStartPosition + _autoScrollTargetDelta);
|
||||
_autoScrolling = false;
|
||||
_bouncingBack = false;
|
||||
}
|
||||
|
@ -325,10 +342,10 @@ void ScrollView::processAutoScrolling(float deltaTime)
|
|||
{
|
||||
if(_autoScrollAttenuate)
|
||||
{
|
||||
percentage = tweenfunc::expoEaseOut(percentage);
|
||||
percentage = tweenfunc::quintEaseOut(percentage);
|
||||
}
|
||||
Vec2 moveDelta = _autoScrollTargetDelta * percentage;
|
||||
|
||||
|
||||
// Dispatch related events if bouncing
|
||||
if(_bouncingBack)
|
||||
{
|
||||
|
@ -349,7 +366,7 @@ void ScrollView::processAutoScrolling(float deltaTime)
|
|||
processScrollEvent(MoveDirection::BOTTOM, true);
|
||||
}
|
||||
}
|
||||
_innerContainer->setPosition(_autoScrollStartPosition + moveDelta);
|
||||
moveChildrenToPosition(_autoScrollStartPosition + moveDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,10 +374,10 @@ bool ScrollView::isOutOfBoundary(MoveDirection dir) const
|
|||
{
|
||||
switch(dir)
|
||||
{
|
||||
case MoveDirection::TOP: return _innerContainer->getTopBoundary() < _topBoundary;
|
||||
case MoveDirection::BOTTOM: return _innerContainer->getBottomBoundary() > _bottomBoundary;
|
||||
case MoveDirection::LEFT: return _innerContainer->getLeftBoundary() > _leftBoundary;
|
||||
case MoveDirection::RIGHT: return _innerContainer->getRightBoundary() < _rightBoundary;
|
||||
case MoveDirection::TOP: return _innerContainer->getTopBoundary() < _topBoundary;
|
||||
case MoveDirection::BOTTOM: return _innerContainer->getBottomBoundary() > _bottomBoundary;
|
||||
case MoveDirection::LEFT: return _innerContainer->getLeftBoundary() > _leftBoundary;
|
||||
case MoveDirection::RIGHT: return _innerContainer->getRightBoundary() < _rightBoundary;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,39 +418,43 @@ void ScrollView::jumpToDestination(const Vec2 &des)
|
|||
{
|
||||
finalOffsetX = MAX(des.x, _contentSize.width - _innerContainer->getContentSize().width);
|
||||
}
|
||||
_innerContainer->setPosition(Vec2(finalOffsetX, finalOffsetY));
|
||||
moveChildrenToPosition(Vec2(finalOffsetX, finalOffsetY));
|
||||
}
|
||||
|
||||
void ScrollView::startInertiaScroll()
|
||||
{
|
||||
if(_inertiaTouchTimeDeltas.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float totalDuration = 0;
|
||||
for(auto i = _inertiaTouchTimeDeltas.begin(); i != _inertiaTouchTimeDeltas.end(); ++i)
|
||||
{
|
||||
totalDuration += (*i);
|
||||
}
|
||||
if(totalDuration >= 0.5f)
|
||||
for(auto &timeDelta : _inertiaTouchTimeDeltas)
|
||||
{
|
||||
totalDuration += timeDelta;
|
||||
}
|
||||
if(totalDuration == 0 || totalDuration >= 0.5f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_inertiaScrolling = true;
|
||||
|
||||
|
||||
// Calcualte the initial velocity
|
||||
Vec2 totalMovement;
|
||||
for(auto &displacement : _inertiaTouchDisplacements)
|
||||
{
|
||||
totalMovement += displacement;
|
||||
}
|
||||
|
||||
for(auto i = _inertiaTouchDisplacements.begin(); i != _inertiaTouchDisplacements.end(); ++i)
|
||||
{
|
||||
totalMovement += (*i);
|
||||
}
|
||||
totalMovement.x = (_direction == Direction::VERTICAL ? 0 : totalMovement.x);
|
||||
totalMovement.y = (_direction == Direction::HORIZONTAL ? 0 : totalMovement.y);
|
||||
|
||||
|
||||
_inertiaInitiVelocity = totalMovement / totalDuration;
|
||||
|
||||
_inertiaInitiVelocity.x = MIN(_inertiaInitiVelocity.x, INERTIA_VELOCITY_MAX);
|
||||
_inertiaInitiVelocity.y = MIN(_inertiaInitiVelocity.y, INERTIA_VELOCITY_MAX);
|
||||
_inertiaInitiVelocity.x = MAX(_inertiaInitiVelocity.x, -INERTIA_VELOCITY_MAX);
|
||||
_inertiaInitiVelocity.y = MAX(_inertiaInitiVelocity.y, -INERTIA_VELOCITY_MAX);
|
||||
|
||||
// Calculate values for ease out
|
||||
_inertiaScrollExpectedTime = _inertiaInitiVelocity.length() / INERTIA_DEACCELERATION;
|
||||
_inertiaScrollElapsedTime = 0;
|
||||
|
@ -445,7 +466,7 @@ void ScrollView::processInertiaScrolling(float dt)
|
|||
if(isOutOfBoundaryLeftOrRight() || isOutOfBoundaryTopOrBottom())
|
||||
{
|
||||
// If the inner container is out of boundary, shorten the inertia time.
|
||||
_inertiaScrollElapsedTime += dt * 15;
|
||||
_inertiaScrollElapsedTime += dt * (45000 / INERTIA_DEACCELERATION);
|
||||
}
|
||||
float percentage = _inertiaScrollElapsedTime / _inertiaScrollExpectedTime;
|
||||
if(percentage >= 1)
|
||||
|
@ -454,8 +475,8 @@ void ScrollView::processInertiaScrolling(float dt)
|
|||
startBounceBackIfNeeded();
|
||||
return;
|
||||
}
|
||||
percentage = tweenfunc::expoEaseOut(percentage);
|
||||
|
||||
percentage = tweenfunc::quartEaseOut(percentage);
|
||||
|
||||
Vec2 inertiaVelocity = _inertiaInitiVelocity * (1 - percentage);
|
||||
Vec2 displacement = inertiaVelocity * dt;
|
||||
if(!_bounceEnabled)
|
||||
|
@ -471,70 +492,10 @@ void ScrollView::processInertiaScrolling(float dt)
|
|||
moveChildren(displacement.x, displacement.y);
|
||||
}
|
||||
|
||||
bool ScrollView::processScrollUp(float* offsetYResult, float touchOffsetY)
|
||||
{
|
||||
float icBottomPos = _innerContainer->getBottomBoundary();
|
||||
if (icBottomPos + touchOffsetY < _bottomBoundary)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(!_bounceEnabled)
|
||||
{
|
||||
(*offsetYResult) = _bottomBoundary - icBottomPos;
|
||||
}
|
||||
processScrollEvent(MoveDirection::BOTTOM, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScrollView::processScrollDown(float* offsetYResult, float touchOffsetY)
|
||||
{
|
||||
float icTopPos = _innerContainer->getTopBoundary();
|
||||
if (icTopPos + touchOffsetY > _topBoundary)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(!_bounceEnabled)
|
||||
{
|
||||
(*offsetYResult) = _topBoundary - icTopPos;
|
||||
}
|
||||
processScrollEvent(MoveDirection::TOP, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScrollView::processScrollLeft(float* offsetXResult, float touchOffsetX)
|
||||
{
|
||||
float icRightPos = _innerContainer->getRightBoundary();
|
||||
if (icRightPos + touchOffsetX > _rightBoundary)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(!_bounceEnabled)
|
||||
{
|
||||
(*offsetXResult) = _rightBoundary - icRightPos;
|
||||
}
|
||||
processScrollEvent(MoveDirection::RIGHT, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScrollView::processScrollRight(float* offsetXResult, float touchOffsetX)
|
||||
{
|
||||
float icLeftPos = _innerContainer->getLeftBoundary();
|
||||
if (icLeftPos + touchOffsetX < _leftBoundary)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(!_bounceEnabled)
|
||||
{
|
||||
(*offsetXResult) = _leftBoundary - icLeftPos;
|
||||
}
|
||||
processScrollEvent(MoveDirection::LEFT, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY)
|
||||
{
|
||||
processScrollingEvent();
|
||||
|
||||
|
||||
touchOffsetX = (_direction == Direction::VERTICAL ? 0 : touchOffsetX);
|
||||
touchOffsetY = (_direction == Direction::HORIZONTAL ? 0 : touchOffsetY);
|
||||
if(_bounceEnabled)
|
||||
|
@ -543,28 +504,64 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY)
|
|||
touchOffsetX *= (isOutOfBoundaryLeftOrRight() ? 0.5f : 1);
|
||||
touchOffsetY *= (isOutOfBoundaryTopOrBottom() ? 0.5f : 1);
|
||||
}
|
||||
|
||||
|
||||
float realOffsetX = touchOffsetX;
|
||||
float realOffsetY = touchOffsetY;
|
||||
|
||||
|
||||
bool scrollEnabledUpDown = true;
|
||||
bool scrollEnabledLeftRight = true;
|
||||
if (touchOffsetY > 0.0f) // up
|
||||
{
|
||||
scrollEnabledUpDown = processScrollUp(&realOffsetY, touchOffsetY);
|
||||
float icBottomPos = _innerContainer->getBottomBoundary();
|
||||
if (icBottomPos + touchOffsetY >= _bottomBoundary)
|
||||
{
|
||||
if(!_bounceEnabled)
|
||||
{
|
||||
realOffsetY = _bottomBoundary - icBottomPos;
|
||||
}
|
||||
processScrollEvent(MoveDirection::BOTTOM, false);
|
||||
scrollEnabledUpDown = false;
|
||||
}
|
||||
}
|
||||
else if (touchOffsetY < 0.0f) // down
|
||||
{
|
||||
scrollEnabledUpDown = processScrollDown(&realOffsetY, touchOffsetY);
|
||||
float icTopPos = _innerContainer->getTopBoundary();
|
||||
if (icTopPos + touchOffsetY <= _topBoundary)
|
||||
{
|
||||
if(!_bounceEnabled)
|
||||
{
|
||||
realOffsetY = _topBoundary - icTopPos;
|
||||
}
|
||||
processScrollEvent(MoveDirection::TOP, false);
|
||||
scrollEnabledUpDown = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool scrollEnabledLeftRight = true;
|
||||
if (touchOffsetX < 0.0f) // left
|
||||
{
|
||||
scrollEnabledLeftRight = processScrollLeft(&realOffsetX, touchOffsetX);
|
||||
float icRightPos = _innerContainer->getRightBoundary();
|
||||
if (icRightPos + touchOffsetX <= _rightBoundary)
|
||||
{
|
||||
if(!_bounceEnabled)
|
||||
{
|
||||
realOffsetX = _rightBoundary - icRightPos;
|
||||
}
|
||||
processScrollEvent(MoveDirection::RIGHT, false);
|
||||
scrollEnabledLeftRight = false;
|
||||
}
|
||||
}
|
||||
else if (touchOffsetX > 0.0f) // right
|
||||
{
|
||||
scrollEnabledLeftRight = processScrollRight(&realOffsetX, touchOffsetX);
|
||||
float icLeftPos = _innerContainer->getLeftBoundary();
|
||||
if (icLeftPos + touchOffsetX >= _leftBoundary)
|
||||
{
|
||||
if(!_bounceEnabled)
|
||||
{
|
||||
realOffsetX = _leftBoundary - icLeftPos;
|
||||
}
|
||||
processScrollEvent(MoveDirection::LEFT, false);
|
||||
scrollEnabledLeftRight = false;
|
||||
}
|
||||
}
|
||||
moveChildren(realOffsetX, realOffsetY);
|
||||
return scrollEnabledUpDown || scrollEnabledLeftRight;
|
||||
|
@ -596,7 +593,7 @@ void ScrollView::scrollToTopLeft(float second, bool attenuated)
|
|||
{
|
||||
if (_direction != Direction::BOTH)
|
||||
{
|
||||
CCLOG("Scroll diretion is not both!");
|
||||
CCLOG("Scroll direction is not both!");
|
||||
return;
|
||||
}
|
||||
startAutoScrollChildrenWithDestination(Vec2(0.0f, _contentSize.height - _innerContainer->getContentSize().height), second, attenuated);
|
||||
|
@ -606,7 +603,7 @@ void ScrollView::scrollToTopRight(float second, bool attenuated)
|
|||
{
|
||||
if (_direction != Direction::BOTH)
|
||||
{
|
||||
CCLOG("Scroll diretion is not both!");
|
||||
CCLOG("Scroll direction is not both!");
|
||||
return;
|
||||
}
|
||||
startAutoScrollChildrenWithDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width,
|
||||
|
@ -617,7 +614,7 @@ void ScrollView::scrollToBottomLeft(float second, bool attenuated)
|
|||
{
|
||||
if (_direction != Direction::BOTH)
|
||||
{
|
||||
CCLOG("Scroll diretion is not both!");
|
||||
CCLOG("Scroll direction is not both!");
|
||||
return;
|
||||
}
|
||||
startAutoScrollChildrenWithDestination(Vec2::ZERO, second, attenuated);
|
||||
|
@ -627,7 +624,7 @@ void ScrollView::scrollToBottomRight(float second, bool attenuated)
|
|||
{
|
||||
if (_direction != Direction::BOTH)
|
||||
{
|
||||
CCLOG("Scroll diretion is not both!");
|
||||
CCLOG("Scroll direction is not both!");
|
||||
return;
|
||||
}
|
||||
startAutoScrollChildrenWithDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, 0.0f), second, attenuated);
|
||||
|
@ -683,7 +680,7 @@ void ScrollView::jumpToTopLeft()
|
|||
{
|
||||
if (_direction != Direction::BOTH)
|
||||
{
|
||||
CCLOG("Scroll diretion is not both!");
|
||||
CCLOG("Scroll direction is not both!");
|
||||
return;
|
||||
}
|
||||
jumpToDestination(Vec2(0.0f, _contentSize.height - _innerContainer->getContentSize().height));
|
||||
|
@ -693,7 +690,7 @@ void ScrollView::jumpToTopRight()
|
|||
{
|
||||
if (_direction != Direction::BOTH)
|
||||
{
|
||||
CCLOG("Scroll diretion is not both!");
|
||||
CCLOG("Scroll direction is not both!");
|
||||
return;
|
||||
}
|
||||
jumpToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width,
|
||||
|
@ -704,7 +701,7 @@ void ScrollView::jumpToBottomLeft()
|
|||
{
|
||||
if (_direction != Direction::BOTH)
|
||||
{
|
||||
CCLOG("Scroll diretion is not both!");
|
||||
CCLOG("Scroll direction is not both!");
|
||||
return;
|
||||
}
|
||||
jumpToDestination(Vec2::ZERO);
|
||||
|
@ -714,7 +711,7 @@ void ScrollView::jumpToBottomRight()
|
|||
{
|
||||
if (_direction != Direction::BOTH)
|
||||
{
|
||||
CCLOG("Scroll diretion is not both!");
|
||||
CCLOG("Scroll direction is not both!");
|
||||
return;
|
||||
}
|
||||
jumpToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, 0.0f));
|
||||
|
@ -749,22 +746,21 @@ void ScrollView::startRecordSlidAction()
|
|||
{
|
||||
if (_inertiaScrolling)
|
||||
{
|
||||
_inertiaScrolling = false;
|
||||
_inertiaScrolling = false;
|
||||
}
|
||||
if(_autoScrolling)
|
||||
{
|
||||
_autoScrolling = false;
|
||||
_bouncingBack = false;
|
||||
}
|
||||
if(_autoScrolling)
|
||||
{
|
||||
_autoScrolling = false;
|
||||
_bouncingBack = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollView::endRecordSlidAction()
|
||||
{
|
||||
bool bounceBackStarted = startBounceBackIfNeeded();
|
||||
if(!bounceBackStarted && _inertiaScrollEnabled)
|
||||
{
|
||||
startInertiaScroll();
|
||||
|
||||
bool bounceBackStarted = startBounceBackIfNeeded();
|
||||
if(!bounceBackStarted && _inertiaScrollEnabled)
|
||||
{
|
||||
startInertiaScroll();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -776,6 +772,15 @@ void ScrollView::handlePressLogic(Touch *touch)
|
|||
_inertiaPrevTouchTimestamp = utils::getTimeInMilliseconds();
|
||||
_inertiaTouchDisplacements.clear();
|
||||
_inertiaTouchTimeDeltas.clear();
|
||||
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
_verticalScrollBar->onTouchBegan();
|
||||
}
|
||||
if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
_horizontalScrollBar->onTouchBegan();
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollView::handleMoveLogic(Touch *touch)
|
||||
|
@ -807,6 +812,15 @@ void ScrollView::handleReleaseLogic(Touch *touch)
|
|||
{
|
||||
endRecordSlidAction();
|
||||
_bePressed = false;
|
||||
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
_verticalScrollBar->onTouchEnded();
|
||||
}
|
||||
if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
_horizontalScrollBar->onTouchEnded();
|
||||
}
|
||||
}
|
||||
|
||||
bool ScrollView::onTouchBegan(Touch *touch, Event *unusedEvent)
|
||||
|
@ -857,10 +871,10 @@ void ScrollView::update(float dt)
|
|||
{
|
||||
processInertiaScrolling(dt);
|
||||
}
|
||||
else if (_autoScrolling)
|
||||
{
|
||||
processAutoScrolling(dt);
|
||||
}
|
||||
else if (_autoScrolling)
|
||||
{
|
||||
processAutoScrolling(dt);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sender,Touch* touch)
|
||||
|
@ -944,7 +958,7 @@ void ScrollView::processScrollEvent(MoveDirection dir, bool bounce)
|
|||
scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_RIGHT : SCROLLVIEW_EVENT_SCROLL_TO_RIGHT);
|
||||
eventType = (bounce ? EventType::BOUNCE_RIGHT : EventType::SCROLL_TO_RIGHT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
dispatchEvent(scrollEventType, eventType);
|
||||
}
|
||||
|
@ -986,6 +1000,11 @@ void ScrollView::addEventListener(const ccScrollViewCallback& callback)
|
|||
void ScrollView::setDirection(Direction dir)
|
||||
{
|
||||
_direction = dir;
|
||||
if(_scrollBarEnabled)
|
||||
{
|
||||
removeScrollBar();
|
||||
initScrollBar();
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView::Direction ScrollView::getDirection()const
|
||||
|
@ -1013,6 +1032,177 @@ bool ScrollView::isInertiaScrollEnabled() const
|
|||
return _inertiaScrollEnabled;
|
||||
}
|
||||
|
||||
void ScrollView::setScrollBarEnabled(bool enabled)
|
||||
{
|
||||
if(_scrollBarEnabled == enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(_scrollBarEnabled)
|
||||
{
|
||||
removeScrollBar();
|
||||
}
|
||||
_scrollBarEnabled = enabled;
|
||||
if(_scrollBarEnabled)
|
||||
{
|
||||
initScrollBar();
|
||||
}
|
||||
}
|
||||
|
||||
bool ScrollView::isScrollBarEnabled() const
|
||||
{
|
||||
return _scrollBarEnabled;
|
||||
}
|
||||
|
||||
void ScrollView::setScrollBarPositionFromCorner(const Vec2& positionFromCorner)
|
||||
{
|
||||
if(_direction != Direction::HORIZONTAL)
|
||||
{
|
||||
setScrollBarPositionFromCornerForVertical(positionFromCorner);
|
||||
}
|
||||
if(_direction != Direction::VERTICAL)
|
||||
{
|
||||
setScrollBarPositionFromCornerForHorizontal(positionFromCorner);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollView::setScrollBarPositionFromCornerForVertical(const Vec2& positionFromCorner)
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
CCASSERT(_direction != Direction::HORIZONTAL, "Scroll view doesn't have a vertical scroll bar!");
|
||||
_verticalScrollBar->setPositionFromCorner(positionFromCorner);
|
||||
}
|
||||
|
||||
Vec2 ScrollView::getScrollBarPositionFromCornerForVertical() const
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
CCASSERT(_direction != Direction::HORIZONTAL, "Scroll view doesn't have a vertical scroll bar!");
|
||||
return _verticalScrollBar->getPositionFromCorner();
|
||||
}
|
||||
|
||||
void ScrollView::setScrollBarPositionFromCornerForHorizontal(const Vec2& positionFromCorner)
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
CCASSERT(_direction != Direction::VERTICAL, "Scroll view doesn't have a horizontal scroll bar!");
|
||||
_horizontalScrollBar->setPositionFromCorner(positionFromCorner);
|
||||
}
|
||||
|
||||
Vec2 ScrollView::getScrollBarPositionFromCornerForHorizontal() const
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
CCASSERT(_direction != Direction::VERTICAL, "Scroll view doesn't have a horizontal scroll bar!");
|
||||
return _horizontalScrollBar->getPositionFromCorner();
|
||||
}
|
||||
|
||||
void ScrollView::setScrollBarWidth(float width)
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
_verticalScrollBar->setWidth(width);
|
||||
}
|
||||
if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
_horizontalScrollBar->setWidth(width);
|
||||
}
|
||||
}
|
||||
|
||||
float ScrollView::getScrollBarWidth() const
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
return _verticalScrollBar->getWidth();
|
||||
}
|
||||
else if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
return _horizontalScrollBar->getWidth();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ScrollView::setScrollBarColor(const Color3B& color)
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
_verticalScrollBar->setColor(color);
|
||||
}
|
||||
if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
_horizontalScrollBar->setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
const Color3B& ScrollView::getScrollBarColor() const
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
return _verticalScrollBar->getColor();
|
||||
}
|
||||
else if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
return _horizontalScrollBar->getColor();
|
||||
}
|
||||
return Color3B::WHITE;
|
||||
}
|
||||
|
||||
void ScrollView::setScrollBarAutoHideEnabled(bool autoHideEnabled)
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
_verticalScrollBar->setAutoHideEnabled(autoHideEnabled);
|
||||
}
|
||||
if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
_horizontalScrollBar->setAutoHideEnabled(autoHideEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
bool ScrollView::isScrollBarAutoHideEnabled() const
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
return _verticalScrollBar->isAutoHideEnabled();
|
||||
}
|
||||
else if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
return _horizontalScrollBar->isAutoHideEnabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScrollView::setScrollBarAutoHideTime(float autoHideTime)
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
_verticalScrollBar->setAutoHideTime(autoHideTime);
|
||||
}
|
||||
if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
_horizontalScrollBar->setAutoHideTime(autoHideTime);
|
||||
}
|
||||
}
|
||||
|
||||
float ScrollView::getScrollBarAutoHideTime() const
|
||||
{
|
||||
CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!");
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
return _verticalScrollBar->getAutoHideTime();
|
||||
}
|
||||
else if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
return _horizontalScrollBar->getAutoHideTime();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Layout* ScrollView::getInnerContainer()const
|
||||
{
|
||||
return _innerContainer;
|
||||
|
@ -1087,6 +1277,51 @@ void ScrollView::copySpecialProperties(Widget *widget)
|
|||
_scrollViewEventSelector = scrollView->_scrollViewEventSelector;
|
||||
_eventCallback = scrollView->_eventCallback;
|
||||
_ccEventCallback = scrollView->_ccEventCallback;
|
||||
|
||||
setScrollBarEnabled(scrollView->isScrollBarEnabled());
|
||||
if(isScrollBarEnabled())
|
||||
{
|
||||
if(_direction != Direction::HORIZONTAL)
|
||||
{
|
||||
setScrollBarPositionFromCornerForVertical(scrollView->getScrollBarPositionFromCornerForVertical());
|
||||
}
|
||||
if(_direction != Direction::VERTICAL)
|
||||
{
|
||||
setScrollBarPositionFromCornerForHorizontal(scrollView->getScrollBarPositionFromCornerForHorizontal());
|
||||
}
|
||||
setScrollBarWidth(scrollView->getScrollBarWidth());
|
||||
setScrollBarColor(scrollView->getScrollBarColor());
|
||||
setScrollBarAutoHideEnabled(scrollView->isScrollBarAutoHideEnabled());
|
||||
setScrollBarAutoHideTime(scrollView->getScrollBarAutoHideTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollView::initScrollBar()
|
||||
{
|
||||
if(_direction != Direction::HORIZONTAL && _verticalScrollBar == nullptr)
|
||||
{
|
||||
_verticalScrollBar = ScrollViewBar::create(this, Direction::VERTICAL);
|
||||
addProtectedChild(_verticalScrollBar, 2);
|
||||
}
|
||||
if(_direction != Direction::VERTICAL && _horizontalScrollBar == nullptr)
|
||||
{
|
||||
_horizontalScrollBar = ScrollViewBar::create(this, Direction::HORIZONTAL);
|
||||
addProtectedChild(_horizontalScrollBar, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollView::removeScrollBar()
|
||||
{
|
||||
if(_verticalScrollBar != nullptr)
|
||||
{
|
||||
removeProtectedChild(_verticalScrollBar);
|
||||
_verticalScrollBar = nullptr;
|
||||
}
|
||||
if(_horizontalScrollBar != nullptr)
|
||||
{
|
||||
removeProtectedChild(_horizontalScrollBar);
|
||||
_horizontalScrollBar = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ class EventFocusListener;
|
|||
|
||||
namespace ui {
|
||||
|
||||
class ScrollViewBar;
|
||||
|
||||
/**
|
||||
*Scrollview scroll event type.
|
||||
*@deprecated use @see `ScrollView::EventType` instead.
|
||||
|
@ -369,7 +371,112 @@ public:
|
|||
* @return True if inertia is enabled, false otherwise.
|
||||
*/
|
||||
bool isInertiaScrollEnabled() const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Toggle scroll bar enabled.
|
||||
*
|
||||
* @param enabled True if enable scroll bar, false otherwise.
|
||||
*/
|
||||
void setScrollBarEnabled(bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Query scroll bar state.
|
||||
*
|
||||
* @return True if scroll bar is enabled, false otherwise.
|
||||
*/
|
||||
bool isScrollBarEnabled() const;
|
||||
|
||||
/**
|
||||
* @brief Set the scroll bar positions from the left-bottom corner (horizontal) and right-top corner (vertical).
|
||||
*
|
||||
* @param positionFromCorner The position from the left-bottom corner (horizontal) and right-top corner (vertical).
|
||||
*/
|
||||
void setScrollBarPositionFromCorner(const Vec2& positionFromCorner);
|
||||
|
||||
/**
|
||||
* @brief Set the vertical scroll bar position from right-top corner.
|
||||
*
|
||||
* @param positionFromCorner The position from right-top corner
|
||||
*/
|
||||
void setScrollBarPositionFromCornerForVertical(const Vec2& positionFromCorner);
|
||||
|
||||
/**
|
||||
* @brief Get the vertical scroll bar's position from right-top corner.
|
||||
*
|
||||
* @return positionFromCorner
|
||||
*/
|
||||
Vec2 getScrollBarPositionFromCornerForVertical() const;
|
||||
|
||||
/**
|
||||
* @brief Set the horizontal scroll bar position from left-bottom corner.
|
||||
*
|
||||
* @param positionFromCorner The position from left-bottom corner
|
||||
*/
|
||||
void setScrollBarPositionFromCornerForHorizontal(const Vec2& positionFromCorner);
|
||||
|
||||
/**
|
||||
* @brief Get the horizontal scroll bar's position from right-top corner.
|
||||
*
|
||||
* @return positionFromCorner
|
||||
*/
|
||||
Vec2 getScrollBarPositionFromCornerForHorizontal() const;
|
||||
|
||||
/**
|
||||
* @brief Set the scroll bar's width
|
||||
*
|
||||
* @param width The scroll bar's width
|
||||
*/
|
||||
void setScrollBarWidth(float width);
|
||||
|
||||
/**
|
||||
* @brief Get the scroll bar's width
|
||||
*
|
||||
* @return the scroll bar's width
|
||||
*/
|
||||
float getScrollBarWidth() const;
|
||||
|
||||
/**
|
||||
* @brief Set the scroll bar's color
|
||||
*
|
||||
* @param the scroll bar's color
|
||||
*/
|
||||
void setScrollBarColor(const Color3B& color);
|
||||
|
||||
/**
|
||||
* @brief Get the scroll bar's color
|
||||
*
|
||||
* @return the scroll bar's color
|
||||
*/
|
||||
const Color3B& getScrollBarColor() const;
|
||||
|
||||
/**
|
||||
* @brief Set scroll bar auto hide state
|
||||
*
|
||||
* @param scroll bar auto hide state
|
||||
*/
|
||||
void setScrollBarAutoHideEnabled(bool autoHideEnabled);
|
||||
|
||||
/**
|
||||
* @brief Query scroll bar auto hide state
|
||||
*
|
||||
* @return True if scroll bar auto hide is enabled, false otherwise.
|
||||
*/
|
||||
bool isScrollBarAutoHideEnabled() const;
|
||||
|
||||
/**
|
||||
* @brief Set scroll bar auto hide time
|
||||
*
|
||||
* @param scroll bar auto hide time
|
||||
*/
|
||||
void setScrollBarAutoHideTime(float autoHideTime);
|
||||
|
||||
/**
|
||||
* @brief Get the scroll bar's auto hide time
|
||||
*
|
||||
* @return the scroll bar's auto hide time
|
||||
*/
|
||||
float getScrollBarAutoHideTime() const;
|
||||
|
||||
/**
|
||||
* Set layout type for scrollview.
|
||||
*
|
||||
|
@ -416,7 +523,7 @@ protected:
|
|||
LEFT,
|
||||
RIGHT,
|
||||
};
|
||||
|
||||
|
||||
virtual void initRenderer() override;
|
||||
|
||||
virtual void onSizeChanged() override;
|
||||
|
@ -425,16 +532,20 @@ protected:
|
|||
virtual Widget* createCloneInstance() override;
|
||||
virtual void copySpecialProperties(Widget* model) override;
|
||||
virtual void copyClonedWidgetChildren(Widget* model) override;
|
||||
|
||||
|
||||
virtual void initScrollBar();
|
||||
virtual void removeScrollBar();
|
||||
|
||||
bool isOutOfBoundary(MoveDirection dir) const;
|
||||
bool isOutOfBoundaryTopOrBottom() const;
|
||||
bool isOutOfBoundaryLeftOrRight() const;
|
||||
|
||||
|
||||
void moveChildren(float offsetX, float offsetY);
|
||||
|
||||
void moveChildrenToPosition(const Vec2& position);
|
||||
|
||||
void startInertiaScroll();
|
||||
void processInertiaScrolling(float dt);
|
||||
|
||||
|
||||
void startAutoScroll(const Vec2& deltaMove, float duration, bool attenuated);
|
||||
void startAutoScrollChildrenWithDestination(const Vec2& des, float second, bool attenuated);
|
||||
void processAutoScrolling(float deltaTime);
|
||||
|
@ -443,30 +554,25 @@ protected:
|
|||
|
||||
void jumpToDestination(const Vec2& des);
|
||||
|
||||
|
||||
virtual bool scrollChildren(float touchOffsetX, float touchOffsetY);
|
||||
|
||||
// Without bounce
|
||||
bool processScrollUp(float* offsetYResult, float touchOffsetY);
|
||||
bool processScrollDown(float* offsetYResult, float touchOffsetY);
|
||||
bool processScrollLeft(float* offsetXResult, float touchOffsetX);
|
||||
bool processScrollRight(float* offsetXResult, float touchOffsetX);
|
||||
|
||||
void startRecordSlidAction();
|
||||
virtual void endRecordSlidAction();
|
||||
|
||||
//ScrollViewProtocol
|
||||
virtual void handlePressLogic(Touch *touch) ;
|
||||
virtual void handleMoveLogic(Touch *touch) ;
|
||||
virtual void handleReleaseLogic(Touch *touch) ;
|
||||
virtual void handlePressLogic(Touch *touch);
|
||||
virtual void handleMoveLogic(Touch *touch);
|
||||
virtual void handleReleaseLogic(Touch *touch);
|
||||
|
||||
virtual void interceptTouchEvent(Widget::TouchEventType event,Widget* sender,Touch *touch) override;
|
||||
|
||||
|
||||
void processScrollEvent(MoveDirection dir, bool bounce);
|
||||
void processScrollingEvent();
|
||||
void dispatchEvent(ScrollviewEventType scrollEventType, EventType eventType);
|
||||
|
||||
|
||||
Vec2 getHowMuchOutOfBoundary(const Vec2& addition) const;
|
||||
|
||||
void updateScrollBar(const Vec2& outOfBoundary);
|
||||
|
||||
protected:
|
||||
Layout* _innerContainer;
|
||||
|
@ -497,10 +603,14 @@ protected:
|
|||
Vec2 _autoScrollTargetDelta;
|
||||
float _autoScrollDuration;
|
||||
float _autoScrollAccumulatedTime;
|
||||
|
||||
|
||||
bool _bounceEnabled;
|
||||
bool _bouncingBack;
|
||||
|
||||
|
||||
bool _scrollBarEnabled;
|
||||
ScrollViewBar* _verticalScrollBar;
|
||||
ScrollViewBar* _horizontalScrollBar;
|
||||
|
||||
Ref* _scrollViewEventListener;
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2015 Neo Kim (neo.kim@neofect.com)
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "UIScrollViewBar.h"
|
||||
#include "CCImage.h"
|
||||
#include "2d/CCSprite.h"
|
||||
#include "base/base64.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
static const char* HALF_CIRCLE_IMAGE = "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAGCAMAAADAMI+zAAAAIVBMVEX///////////////////////////////////////////9/gMdvAAAAC3RSTlMAAgMLLFBTYWNkZuZhN4QAAAAvSURBVAjXRchBDgAgCAPBIi0q/3+wxBiZU7cAjJpTNBSPvMLrf7tqgPkR6hB2xzpFkgIfM9q/8QAAAABJRU5ErkJggg==";
|
||||
static const char* BODY_IMAGE_1_PIXEL_HEIGHT = "iVBORw0KGgoAAAANSUhEUgAAAAwAAAABCAMAAADdNb8LAAAAA1BMVEX///+nxBvIAAAAAXRSTlNm5DccCwAAAApJREFUeAFjQAYAAA0AAWHNnKQAAAAASUVORK5CYII=";
|
||||
|
||||
static const Color3B DEFAULT_COLOR(52, 65, 87);
|
||||
static const float DEFAULT_MARGIN = 20;
|
||||
static const float DEFAULT_AUTO_HIDE_TIME = 0.2f;
|
||||
|
||||
static Sprite* createSpriteFromBase64(const char* base64String)
|
||||
{
|
||||
unsigned char* decoded;
|
||||
int length = base64Decode((const unsigned char*) base64String, (unsigned int) strlen(base64String), &decoded);
|
||||
|
||||
Image *image = new Image();
|
||||
bool imageResult = image->initWithImageData(decoded, length);
|
||||
CCASSERT(imageResult, "Failed to create image from base64!");
|
||||
free(decoded);
|
||||
|
||||
Texture2D *texture = new Texture2D();
|
||||
texture->initWithImage(image);
|
||||
texture->setAliasTexParameters();
|
||||
image->release();
|
||||
|
||||
Sprite* sprite = Sprite::createWithTexture(texture);
|
||||
texture->release();
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
||||
ScrollViewBar::ScrollViewBar(ScrollView* parent, ScrollView::Direction direction):
|
||||
_parent(parent),
|
||||
_direction(direction),
|
||||
_upperHalfCircle(nullptr),
|
||||
_lowerHalfCircle(nullptr),
|
||||
_body(nullptr),
|
||||
_marginFromBoundary(DEFAULT_MARGIN),
|
||||
_marginForLength(DEFAULT_MARGIN),
|
||||
_touching(false),
|
||||
_autoHideEnabled(true),
|
||||
_autoHideTime(DEFAULT_AUTO_HIDE_TIME),
|
||||
_autoHideRemainingTime(0)
|
||||
{
|
||||
CCASSERT(parent != nullptr, "Parent scroll view must not be null!");
|
||||
CCASSERT(direction != ScrollView::Direction::BOTH, "Illegal scroll direction for scroll bar!");
|
||||
setCascadeColorEnabled(true);
|
||||
setCascadeOpacityEnabled(true);
|
||||
}
|
||||
|
||||
ScrollViewBar::~ScrollViewBar()
|
||||
{
|
||||
}
|
||||
|
||||
ScrollViewBar* ScrollViewBar::create(ScrollView* parent, ScrollView::Direction direction)
|
||||
{
|
||||
ScrollViewBar* node = new (std::nothrow) ScrollViewBar(parent, direction);
|
||||
if (node && node->init())
|
||||
{
|
||||
node->autorelease();
|
||||
return node;
|
||||
}
|
||||
CC_SAFE_DELETE(node);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ScrollViewBar::init()
|
||||
{
|
||||
if (!ProtectedNode::init())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_upperHalfCircle = createSpriteFromBase64(HALF_CIRCLE_IMAGE);
|
||||
_upperHalfCircle->setAnchorPoint(Vec2::ANCHOR_MIDDLE_BOTTOM);
|
||||
addChild(_upperHalfCircle);
|
||||
|
||||
_lowerHalfCircle = Sprite::createWithTexture(_upperHalfCircle->getTexture(), _upperHalfCircle->getTextureRect(), _upperHalfCircle->isTextureRectRotated());
|
||||
_lowerHalfCircle->setScaleY(-1);
|
||||
_lowerHalfCircle->setAnchorPoint(Vec2::ANCHOR_MIDDLE_BOTTOM);
|
||||
addChild(_lowerHalfCircle);
|
||||
|
||||
_body = createSpriteFromBase64(BODY_IMAGE_1_PIXEL_HEIGHT);
|
||||
_body->setAnchorPoint(Vec2::ANCHOR_MIDDLE_BOTTOM);
|
||||
addChild(_body);
|
||||
|
||||
setColor(DEFAULT_COLOR);
|
||||
|
||||
if(_direction == ScrollView::Direction::HORIZONTAL)
|
||||
{
|
||||
setRotation(90);
|
||||
}
|
||||
|
||||
if(_autoHideEnabled)
|
||||
{
|
||||
setOpacity(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScrollViewBar::setPositionFromCorner(const Vec2& positionFromCorner)
|
||||
{
|
||||
if(_direction == ScrollView::Direction::VERTICAL)
|
||||
{
|
||||
_marginForLength = positionFromCorner.y;
|
||||
_marginFromBoundary = positionFromCorner.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_marginForLength = positionFromCorner.x;
|
||||
_marginFromBoundary = positionFromCorner.y;
|
||||
}
|
||||
}
|
||||
|
||||
Vec2 ScrollViewBar::getPositionFromCorner() const
|
||||
{
|
||||
if(_direction == ScrollView::Direction::VERTICAL)
|
||||
{
|
||||
return Vec2(_marginFromBoundary, _marginForLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Vec2(_marginForLength, _marginFromBoundary);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollViewBar::setWidth(float width)
|
||||
{
|
||||
float scale = width / _body->getContentSize().width;
|
||||
_body->setScaleX(scale);
|
||||
_upperHalfCircle->setScale(scale);
|
||||
_lowerHalfCircle->setScale(-scale);
|
||||
}
|
||||
|
||||
void ScrollViewBar::setAutoHideEnabled(bool autoHideEnabled)
|
||||
{
|
||||
_autoHideEnabled = autoHideEnabled;
|
||||
setOpacity(255);
|
||||
}
|
||||
|
||||
float ScrollViewBar::getWidth() const
|
||||
{
|
||||
return _body->getBoundingBox().size.width;
|
||||
}
|
||||
|
||||
void ScrollViewBar::updateLength(float length)
|
||||
{
|
||||
float ratio = length / _body->getTextureRect().size.height;
|
||||
_body->setScaleY(ratio);
|
||||
_upperHalfCircle->setPositionY(_body->getPositionY() + length);
|
||||
}
|
||||
|
||||
void ScrollViewBar::onEnter()
|
||||
{
|
||||
ProtectedNode::onEnter();
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
void ScrollViewBar::update(float deltaTime)
|
||||
{
|
||||
if(!_autoHideEnabled || _autoHideRemainingTime <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if(_touching)
|
||||
{
|
||||
// If it is touching, don't auto hide.
|
||||
return;
|
||||
}
|
||||
|
||||
_autoHideRemainingTime -= deltaTime;
|
||||
if(_autoHideRemainingTime <= _autoHideTime)
|
||||
{
|
||||
_autoHideRemainingTime = MAX(0, _autoHideRemainingTime);
|
||||
this->setOpacity(255 * (_autoHideRemainingTime / _autoHideTime));
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollViewBar::onTouchBegan()
|
||||
{
|
||||
if(!_autoHideEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_touching = true;
|
||||
}
|
||||
|
||||
void ScrollViewBar::onTouchEnded()
|
||||
{
|
||||
if(!_autoHideEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_touching = false;
|
||||
|
||||
if(_autoHideRemainingTime <= 0)
|
||||
{
|
||||
// If the remaining time is 0, it means that it didn't moved after touch started so scroll bar is not showing.
|
||||
return;
|
||||
}
|
||||
_autoHideRemainingTime = _autoHideTime;
|
||||
}
|
||||
|
||||
void ScrollViewBar::onScrolled(const Vec2& outOfBoundary)
|
||||
{
|
||||
if(_autoHideEnabled)
|
||||
{
|
||||
_autoHideRemainingTime = _autoHideTime;
|
||||
setOpacity(255);
|
||||
}
|
||||
|
||||
Layout* innerContainer = _parent->getInnerContainer();
|
||||
|
||||
float innerContainerMeasure = 0;
|
||||
float scrollViewMeasure = 0;
|
||||
float outOfBoundaryValue = 0;
|
||||
float innerContainerPosition = 0;
|
||||
if(_direction == ScrollView::Direction::VERTICAL)
|
||||
{
|
||||
innerContainerMeasure = innerContainer->getContentSize().height;
|
||||
scrollViewMeasure = _parent->getContentSize().height;
|
||||
outOfBoundaryValue = outOfBoundary.y;
|
||||
innerContainerPosition = -innerContainer->getPositionY();
|
||||
}
|
||||
else if(_direction == ScrollView::Direction::HORIZONTAL)
|
||||
{
|
||||
innerContainerMeasure = innerContainer->getContentSize().width;
|
||||
scrollViewMeasure = _parent->getContentSize().width;
|
||||
outOfBoundaryValue = outOfBoundary.x;
|
||||
innerContainerPosition = -innerContainer->getPositionX();
|
||||
}
|
||||
|
||||
float length = calculateLength(innerContainerMeasure, scrollViewMeasure, outOfBoundaryValue);
|
||||
Vec2 position = calculatePosition(innerContainerMeasure, scrollViewMeasure, innerContainerPosition, outOfBoundaryValue, length);
|
||||
updateLength(length);
|
||||
setPosition(position);
|
||||
}
|
||||
|
||||
float ScrollViewBar::calculateLength(float innerContainerMeasure, float scrollViewMeasure, float outOfBoundaryValue)
|
||||
{
|
||||
float denominatorValue = innerContainerMeasure;
|
||||
if(outOfBoundaryValue != 0)
|
||||
{
|
||||
// If it is out of boundary, the length of scroll bar gets shorter quickly.
|
||||
static const float GETTING_SHORTER_FACTOR = 20;
|
||||
denominatorValue += (outOfBoundaryValue > 0 ? outOfBoundaryValue : -outOfBoundaryValue) * GETTING_SHORTER_FACTOR;
|
||||
}
|
||||
|
||||
float lengthRatio = scrollViewMeasure / denominatorValue;
|
||||
return fabsf(scrollViewMeasure - 2 * _marginForLength) * lengthRatio;
|
||||
}
|
||||
|
||||
Vec2 ScrollViewBar::calculatePosition(float innerContainerMeasure, float scrollViewMeasure, float innerContainerPosition, float outOfBoundaryValue, float length)
|
||||
{
|
||||
float denominatorValue = innerContainerMeasure - scrollViewMeasure;
|
||||
if(outOfBoundaryValue != 0)
|
||||
{
|
||||
denominatorValue += fabs(outOfBoundaryValue);
|
||||
}
|
||||
|
||||
float positionRatio = 0;
|
||||
if(denominatorValue != 0)
|
||||
{
|
||||
positionRatio = innerContainerPosition / denominatorValue;
|
||||
positionRatio = MAX(positionRatio, 0);
|
||||
positionRatio = MIN(positionRatio, 1);
|
||||
}
|
||||
float position = (scrollViewMeasure - length - 2 * _marginForLength) * positionRatio + _marginForLength;
|
||||
if(_direction == ScrollView::Direction::VERTICAL)
|
||||
{
|
||||
return Vec2(_parent->getContentSize().width - _marginFromBoundary, position);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Vec2(position, _marginFromBoundary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,178 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2015 Neo Kim (neo.kim@neofect.com)
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UISCROLLVIEWBAR_H__
|
||||
#define __UISCROLLVIEWBAR_H__
|
||||
|
||||
#include "ui/UIScrollView.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
/**
|
||||
* @addtogroup ui
|
||||
* @{
|
||||
*/
|
||||
|
||||
class Sprite;
|
||||
|
||||
namespace ui {
|
||||
|
||||
/**
|
||||
* Scroll bar being attached to ScrollView layout container.
|
||||
*/
|
||||
class CC_GUI_DLL ScrollViewBar : public ProtectedNode
|
||||
{
|
||||
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
* @js ctor
|
||||
* @lua new
|
||||
*/
|
||||
ScrollViewBar(ScrollView* parent, ScrollView::Direction direction);
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ScrollViewBar();
|
||||
|
||||
/**
|
||||
* Create a ScrollView with its parent ScrollView and direction.
|
||||
* @return A ScrollViewBar instance.
|
||||
*/
|
||||
static ScrollViewBar* create(ScrollView* parent, ScrollView::Direction direction);
|
||||
|
||||
/**
|
||||
* @brief Set the scroll bar position from the left-bottom corner (horizontal) or right-top corner (vertical).
|
||||
*
|
||||
* @param positionFromCorner The position from the left-bottom corner (horizontal) or right-top corner (vertical).
|
||||
*/
|
||||
void setPositionFromCorner(const Vec2& positionFromCorner);
|
||||
|
||||
/**
|
||||
* @brief Get the scroll bar position from the left-bottom corner (horizontal) or right-top corner (vertical).
|
||||
*
|
||||
* @return positionFromCorner
|
||||
*/
|
||||
Vec2 getPositionFromCorner() const;
|
||||
|
||||
/**
|
||||
* @brief Set the scroll bar's width
|
||||
*
|
||||
* @param width The scroll bar's width
|
||||
*/
|
||||
void setWidth(float width);
|
||||
|
||||
/**
|
||||
* @brief Get the scroll bar's width
|
||||
*
|
||||
* @return the scroll bar's width
|
||||
*/
|
||||
float getWidth() const;
|
||||
|
||||
/**
|
||||
* @brief Set scroll bar auto hide state
|
||||
*
|
||||
* @param scroll bar auto hide state
|
||||
*/
|
||||
void setAutoHideEnabled(bool autoHideEnabled);
|
||||
|
||||
/**
|
||||
* @brief Query scroll bar auto hide state
|
||||
*
|
||||
* @return True if scroll bar auto hide is enabled, false otherwise.
|
||||
*/
|
||||
bool isAutoHideEnabled() const { return _autoHideEnabled; }
|
||||
|
||||
/**
|
||||
* @brief Set scroll bar auto hide time
|
||||
*
|
||||
* @param scroll bar auto hide time
|
||||
*/
|
||||
void setAutoHideTime(float autoHideTime) { _autoHideTime = autoHideTime; }
|
||||
|
||||
/**
|
||||
* @brief Get the scroll bar's auto hide time
|
||||
*
|
||||
* @return the scroll bar's auto hide time
|
||||
*/
|
||||
float getAutoHideTime() const { return _autoHideTime; }
|
||||
|
||||
/**
|
||||
* @brief This is called by parent ScrollView when the parent is scrolled. Don't call this directly.
|
||||
*
|
||||
* @param amount how much the inner container of ScrollView is out of boundary
|
||||
*/
|
||||
virtual void onScrolled(const Vec2& outOfBoundary);
|
||||
|
||||
/**
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
virtual void update(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* @brief This is called by parent ScrollView when a touch is began. Don't call this directly.
|
||||
*/
|
||||
void onTouchBegan();
|
||||
|
||||
/**
|
||||
* @brief This is called by parent ScrollView when a touch is ended. Don't call this directly.
|
||||
*/
|
||||
void onTouchEnded();
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
virtual bool init() override;
|
||||
|
||||
private:
|
||||
float calculateLength(float innerContainerMeasure, float scrollViewMeasure, float outOfBoundaryValue);
|
||||
Vec2 calculatePosition(float innerContainerMeasure, float scrollViewMeasure, float innerContainerPosition, float outOfBoundaryValue, float actualLength);
|
||||
|
||||
void updateLength(float length);
|
||||
|
||||
ScrollView* _parent;
|
||||
ScrollView::Direction _direction;
|
||||
|
||||
Sprite* _upperHalfCircle;
|
||||
Sprite* _lowerHalfCircle;
|
||||
Sprite* _body;
|
||||
|
||||
float _marginFromBoundary;
|
||||
float _marginForLength;
|
||||
|
||||
bool _touching;
|
||||
|
||||
bool _autoHideEnabled;
|
||||
float _autoHideTime;
|
||||
float _autoHideRemainingTime;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
// end of ui group
|
||||
/// @}
|
||||
NS_CC_END
|
||||
|
||||
#endif /* defined(__UISCROLLVIEWBAR_H__) */
|
|
@ -783,7 +783,9 @@ void Widget::propagateTouchEvent(cocos2d::ui::Widget::TouchEventType event, coco
|
|||
Widget* widgetParent = getWidgetParent();
|
||||
if (widgetParent)
|
||||
{
|
||||
widgetParent->_hittedByCamera = _hittedByCamera;
|
||||
widgetParent->interceptTouchEvent(event, sender, touch);
|
||||
widgetParent->_hittedByCamera = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -974,7 +976,9 @@ void Widget::interceptTouchEvent(cocos2d::ui::Widget::TouchEventType event, coco
|
|||
Widget* widgetParent = getWidgetParent();
|
||||
if (widgetParent)
|
||||
{
|
||||
widgetParent->_hittedByCamera = _hittedByCamera;
|
||||
widgetParent->interceptTouchEvent(event,sender,touch);
|
||||
widgetParent->_hittedByCamera = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<ClCompile Include="..\UIRichText.cpp" />
|
||||
<ClCompile Include="..\UIScale9Sprite.cpp" />
|
||||
<ClCompile Include="..\UIScrollView.cpp" />
|
||||
<ClCompile Include="..\UIScrollViewBar.cpp" />
|
||||
<ClCompile Include="..\UISlider.cpp" />
|
||||
<ClCompile Include="..\UIText.cpp" />
|
||||
<ClCompile Include="..\UITextAtlas.cpp" />
|
||||
|
|
|
@ -122,6 +122,9 @@
|
|||
<ClCompile Include="..\UIScrollView.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIScrollViewBar.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIListView.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -152,7 +152,7 @@ void ParticleSystem3D::removeAllAffector()
|
|||
|
||||
Particle3DAffector* ParticleSystem3D::getAffector(int index)
|
||||
{
|
||||
CCASSERT(index < _affectors.size(), "wrong index");
|
||||
CCASSERT(index < (int)_affectors.size(), "wrong index");
|
||||
return _affectors[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ void PUOnQuotaObserver::postUpdateObserver(float deltaTime)
|
|||
}
|
||||
|
||||
//_result = particleTechnique->getNumberOfEmittedParticles(_particleTypeToObserve) >= quota;
|
||||
_result = static_cast<PUParticleSystem3D *>(_particleSystem)->getAliveParticleCount() >= quota;
|
||||
_result = static_cast<PUParticleSystem3D *>(_particleSystem)->getAliveParticleCount() >= (int)quota;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ void PUOnQuotaObserver::postUpdateObserver(float deltaTime)
|
|||
+ static_cast<PUParticleSystem3D *>(_particleSystem)->getEmittedEmitterQuota()
|
||||
+ static_cast<PUParticleSystem3D *>(_particleSystem)->getEmittedSystemQuota();
|
||||
//_result = particleTechnique->getNumberOfEmittedParticles() >= quota;
|
||||
_result = static_cast<PUParticleSystem3D *>(_particleSystem)->getAliveParticleCount() >= quota;
|
||||
_result = static_cast<PUParticleSystem3D *>(_particleSystem)->getAliveParticleCount() >= (int)quota;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1212,6 +1212,8 @@
|
|||
"cocos/ui/UIScale9Sprite.h",
|
||||
"cocos/ui/UIScrollView.cpp",
|
||||
"cocos/ui/UIScrollView.h",
|
||||
"cocos/ui/UIScrollViewBar.cpp",
|
||||
"cocos/ui/UIScrollViewBar.h",
|
||||
"cocos/ui/UISlider.cpp",
|
||||
"cocos/ui/UISlider.h",
|
||||
"cocos/ui/UIText.cpp",
|
||||
|
|
|
@ -391,11 +391,6 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
TargetAttributes = {
|
||||
1D6058900D05DD3D006BFB54 = {
|
||||
DevelopmentTeam = MDDB52YB8L;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloCpp" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
|
|
@ -539,11 +539,6 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
TargetAttributes = {
|
||||
A922753C1517C094001B78AA = {
|
||||
DevelopmentTeam = MDDB52YB8L;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = A92275371517C094001B78AA /* Build configuration list for PBXProject "HelloJavascript" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
|
|
@ -190,34 +190,6 @@
|
|||
remoteGlobalIDString = A07A4D641783777C0073F6A7;
|
||||
remoteInfo = "cocos2dx iOS";
|
||||
};
|
||||
9FFEB9B71A6AB8810095C43A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9FFEB9B21A6AB8810095C43A /* libsimulator.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 9F7214351A5C271F00DAED06;
|
||||
remoteInfo = "libsimulator Mac";
|
||||
};
|
||||
9FFEB9B91A6AB8810095C43A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9FFEB9B21A6AB8810095C43A /* libsimulator.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 9F7214851A5C28BA00DAED06;
|
||||
remoteInfo = "libsimulator iOS";
|
||||
};
|
||||
9FFEB9BB1A6AB8940095C43A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9FFEB9B21A6AB8810095C43A /* libsimulator.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9F7214341A5C271F00DAED06;
|
||||
remoteInfo = "libsimulator Mac";
|
||||
};
|
||||
9FFEB9BD1A6AB89B0095C43A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9FFEB9B21A6AB8810095C43A /* libsimulator.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9F7214841A5C28BA00DAED06;
|
||||
remoteInfo = "libsimulator iOS";
|
||||
};
|
||||
1AC6FB57180E9ACB004C840B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 1AC6FB34180E9ACB004C840B /* cocos2d_libs.xcodeproj */;
|
||||
|
@ -246,6 +218,34 @@
|
|||
remoteGlobalIDString = A07A4FB4178387730073F6A7;
|
||||
remoteInfo = "CocosDenshion iOS";
|
||||
};
|
||||
9FFEB9B71A6AB8810095C43A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9FFEB9B21A6AB8810095C43A /* libsimulator.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 9F7214351A5C271F00DAED06;
|
||||
remoteInfo = "libsimulator Mac";
|
||||
};
|
||||
9FFEB9B91A6AB8810095C43A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9FFEB9B21A6AB8810095C43A /* libsimulator.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 9F7214851A5C28BA00DAED06;
|
||||
remoteInfo = "libsimulator iOS";
|
||||
};
|
||||
9FFEB9BB1A6AB8940095C43A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9FFEB9B21A6AB8810095C43A /* libsimulator.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9F7214341A5C271F00DAED06;
|
||||
remoteInfo = "libsimulator Mac";
|
||||
};
|
||||
9FFEB9BD1A6AB89B0095C43A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9FFEB9B21A6AB8810095C43A /* libsimulator.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9F7214841A5C28BA00DAED06;
|
||||
remoteInfo = "libsimulator iOS";
|
||||
};
|
||||
C037820618BF76AF00FE4F13 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = C037820118BF76AF00FE4F13 /* cocos2d_js_bindings.xcodeproj */;
|
||||
|
@ -563,8 +563,6 @@
|
|||
A92275401517C094001B78AA /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA4E718219EB6E4600932425 /* GameController.framework */,
|
||||
BA4E718019EB6E3E00932425 /* MediaPlayer.framework */,
|
||||
87D4C4441AB2187000F68C44 /* Security.framework */,
|
||||
9F20C9E11A5BBE85006FB50B /* Security.framework */,
|
||||
D6B061231803AB9F0077942B /* CoreMotion.framework */,
|
||||
|
@ -691,11 +689,6 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
TargetAttributes = {
|
||||
A922753C1517C094001B78AA = {
|
||||
DevelopmentTeam = MDDB52YB8L;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = A92275371517C094001B78AA /* Build configuration list for PBXProject "HelloJavascript" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
@ -780,20 +773,6 @@
|
|||
path = "libcocos2dx-extensions iOS.a";
|
||||
remoteRef = 1AC6FB57180E9ACB004C840B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
9FFEB9B81A6AB8810095C43A /* libsimulator Mac.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libsimulator Mac.a";
|
||||
remoteRef = 9FFEB9B71A6AB8810095C43A /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
9FFEB9BA1A6AB8810095C43A /* libsimulator iOS.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libsimulator iOS.a";
|
||||
remoteRef = 9FFEB9B91A6AB8810095C43A /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
1AC6FB5A180E9ACB004C840B /* libchipmunk iOS.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
|
@ -816,6 +795,20 @@
|
|||
remoteRef = 1AC6FB5D180E9ACB004C840B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
9FFEB9B81A6AB8810095C43A /* libsimulator Mac.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libsimulator Mac.a";
|
||||
remoteRef = 9FFEB9B71A6AB8810095C43A /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
9FFEB9BA1A6AB8810095C43A /* libsimulator iOS.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libsimulator iOS.a";
|
||||
remoteRef = 9FFEB9B91A6AB8810095C43A /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
C037820718BF76AF00FE4F13 /* libjscocos2d Mac.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
|
@ -903,18 +896,8 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9FD1E6B61A51361B0009A6C5 /* PlayerFileDialogServiceMac.mm in Sources */,
|
||||
3E12D1E61957FB18002FF0FD /* common.cc in Sources */,
|
||||
9FD1E6B51A51361B0009A6C5 /* PlayerEditBoxServiceMac.mm in Sources */,
|
||||
9FD1E6EE1A5169230009A6C5 /* AppLang.cpp in Sources */,
|
||||
9FD1E6B21A51361B0009A6C5 /* ConsoleWindowController.m in Sources */,
|
||||
3E12D1E81957FB18002FF0FD /* once.cc in Sources */,
|
||||
9FD1E6ED1A5169230009A6C5 /* AppEvent.cpp in Sources */,
|
||||
3E12D1E01957FB18002FF0FD /* message_lite.cc in Sources */,
|
||||
3E12D1D61957FB18002FF0FD /* extension_set.cc in Sources */,
|
||||
C00FD4B51938628E00C6382D /* PlayDisable_png.cpp in Sources */,
|
||||
AB9079D519E931D80033128B /* ConsoleCommand.cpp in Sources */,
|
||||
3E12D1EA1957FB18002FF0FD /* stringprintf.cc in Sources */,
|
||||
C06C37891918E81100617BED /* ConfigParser.cpp in Sources */,
|
||||
9FD1E6B71A51361B0009A6C5 /* PlayerMac.mm in Sources */,
|
||||
509D4A8117EBB24E00697056 /* AppDelegate.cpp in Sources */,
|
||||
9FD1E6BA1A51361B0009A6C5 /* PlayerTaskServiceMac.mm in Sources */,
|
||||
|
@ -969,16 +952,6 @@
|
|||
name = "cocos2dx iOS";
|
||||
targetProxy = 1A67682E180E9C110076BC67 /* PBXContainerItemProxy */;
|
||||
};
|
||||
9FFEB9BC1A6AB8940095C43A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "libsimulator Mac";
|
||||
targetProxy = 9FFEB9BB1A6AB8940095C43A /* PBXContainerItemProxy */;
|
||||
};
|
||||
9FFEB9BE1A6AB89B0095C43A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "libsimulator iOS";
|
||||
targetProxy = 9FFEB9BD1A6AB89B0095C43A /* PBXContainerItemProxy */;
|
||||
};
|
||||
1A676831180E9C110076BC67 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "cocos2dx-extensions iOS";
|
||||
|
@ -994,6 +967,16 @@
|
|||
name = "CocosDenshion iOS";
|
||||
targetProxy = 1A676834180E9C110076BC67 /* PBXContainerItemProxy */;
|
||||
};
|
||||
9FFEB9BC1A6AB8940095C43A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "libsimulator Mac";
|
||||
targetProxy = 9FFEB9BB1A6AB8940095C43A /* PBXContainerItemProxy */;
|
||||
};
|
||||
9FFEB9BE1A6AB89B0095C43A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "libsimulator iOS";
|
||||
targetProxy = 9FFEB9BD1A6AB89B0095C43A /* PBXContainerItemProxy */;
|
||||
};
|
||||
C037820B18BF77BC00FE4F13 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "jsbindings iOS";
|
||||
|
|
|
@ -518,11 +518,6 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
TargetAttributes = {
|
||||
F293B3C715EB7BE500256477 = {
|
||||
DevelopmentTeam = MDDB52YB8L;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = F293B3C215EB7BE500256477 /* Build configuration list for PBXProject "HelloLua" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
|
|
@ -71,7 +71,7 @@ bool UIListViewTest_Vertical::init()
|
|||
(backgroundSize.height - listView->getContentSize().height) / 2.0f));
|
||||
listView->addEventListener((ui::ListView::ccListViewCallback)CC_CALLBACK_2(UIListViewTest_Vertical::selectedItemEvent, this));
|
||||
listView->addEventListener((ui::ListView::ccScrollViewCallback)CC_CALLBACK_2(UIListViewTest_Vertical::selectedItemEventScrollView,this));
|
||||
|
||||
listView->setScrollBarPositionFromCorner(Vec2(7, 7));
|
||||
_uiLayer->addChild(listView);
|
||||
|
||||
|
||||
|
@ -268,6 +268,7 @@ bool UIListViewTest_Horizontal::init()
|
|||
(widgetSize.height - backgroundSize.height) / 2.0f +
|
||||
(backgroundSize.height - listView->getContentSize().height) / 2.0f));
|
||||
listView->addEventListener((ui::ListView::ccListViewCallback)CC_CALLBACK_2(UIListViewTest_Horizontal::selectedItemEvent, this));
|
||||
listView->setScrollBarPositionFromCorner(Vec2(7, 7));
|
||||
_uiLayer->addChild(listView);
|
||||
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ bool UIScrollViewTest_Vertical::init()
|
|||
(backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
|
||||
(widgetSize.height - backgroundSize.height) / 2.0f +
|
||||
(backgroundSize.height - scrollView->getContentSize().height) / 2.0f));
|
||||
scrollView->setScrollBarWidth(4);
|
||||
scrollView->setScrollBarPositionFromCorner(Vec2(2, 2));
|
||||
scrollView->setScrollBarColor(Color3B::WHITE);
|
||||
_uiLayer->addChild(scrollView);
|
||||
|
||||
ImageView* imageView = ImageView::create("cocosui/ccicon.png");
|
||||
|
@ -127,6 +130,8 @@ bool UIScrollViewTest_Horizontal::init()
|
|||
scrollView->setDirection(ui::ScrollView::Direction::HORIZONTAL);
|
||||
scrollView->setContentSize(Size(280.0f, 150.0f));
|
||||
scrollView->setInnerContainerSize(scrollView->getContentSize());
|
||||
scrollView->setScrollBarPositionFromCorner(Vec2(4, 4));
|
||||
scrollView->setScrollBarColor(Color3B::YELLOW);
|
||||
Size backgroundSize = background->getContentSize();
|
||||
scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
|
||||
(backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
|
||||
|
@ -210,6 +215,8 @@ bool UIScrollViewTest_Both::init()
|
|||
scrollView->setBackGroundImageScale9Enabled(true);
|
||||
scrollView->setBackGroundImage("cocosui/green_edit.png");
|
||||
scrollView->setContentSize(Size(210, 122.5));
|
||||
scrollView->setScrollBarWidth(4);
|
||||
scrollView->setScrollBarPositionFromCorner(Vec2(6, 6));
|
||||
Size backgroundSize = background->getContentSize();
|
||||
scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
|
||||
(backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
|
||||
|
@ -254,7 +261,7 @@ bool UIScrollViewTest_ScrollToPercentBothDirection::init()
|
|||
_uiLayer->addChild(_displayValueLabel);
|
||||
|
||||
// Add the alert
|
||||
Text* alert = Text::create("ScrollView scroll to percent both directrion","fonts/Marker Felt.ttf",20);
|
||||
Text* alert = Text::create("ScrollView scroll to percent both direction without scroll bar","fonts/Marker Felt.ttf",20);
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 4.5));
|
||||
_uiLayer->addChild(alert);
|
||||
|
@ -269,6 +276,7 @@ bool UIScrollViewTest_ScrollToPercentBothDirection::init()
|
|||
sc->setDirection(ui::ScrollView::Direction::BOTH);
|
||||
sc->setInnerContainerSize(Size(480, 320));
|
||||
sc->setContentSize(Size(100,100));
|
||||
sc->setScrollBarEnabled(false);
|
||||
Size backgroundSize = background->getContentSize();
|
||||
sc->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
|
||||
(backgroundSize.width - sc->getContentSize().width) / 2.0f,
|
||||
|
@ -309,7 +317,7 @@ bool UIScrollViewTest_ScrollToPercentBothDirection_Bounce::init()
|
|||
_uiLayer->addChild(_displayValueLabel);
|
||||
|
||||
// Add the alert
|
||||
Text* alert = Text::create("ScrollView scroll to percent both directrion bounce","fonts/Marker Felt.ttf",20);
|
||||
Text* alert = Text::create("ScrollView scroll to percent both direction bounce","fonts/Marker Felt.ttf",20);
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 4.5));
|
||||
_uiLayer->addChild(alert);
|
||||
|
@ -325,6 +333,9 @@ bool UIScrollViewTest_ScrollToPercentBothDirection_Bounce::init()
|
|||
sc->setDirection(ui::ScrollView::Direction::BOTH);
|
||||
sc->setInnerContainerSize(Size(480, 320));
|
||||
sc->setContentSize(Size(100,100));
|
||||
sc->setScrollBarPositionFromCornerForHorizontal(Vec2(5, sc->getContentSize().height - 5));
|
||||
sc->setScrollBarPositionFromCornerForVertical(Vec2(sc->getContentSize().width - 5, 5));
|
||||
sc->setScrollBarAutoHideEnabled(false);
|
||||
Size backgroundSize = background->getContentSize();
|
||||
sc->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
|
||||
(backgroundSize.width - sc->getContentSize().width) / 2.0f,
|
||||
|
@ -378,12 +389,15 @@ bool UIScrollViewNestTest::init()
|
|||
// Create the scrollview by vertical
|
||||
ui::ScrollView* scrollView = ui::ScrollView::create();
|
||||
scrollView->setContentSize(Size(280.0f, 150.0f));
|
||||
scrollView->setDirection(ui::ScrollView::Direction::BOTH);
|
||||
scrollView->setDirection(ui::ScrollView::Direction::VERTICAL);
|
||||
scrollView->setScrollBarPositionFromCorner(Vec2(4, 4));
|
||||
Size backgroundSize = background->getContentSize();
|
||||
scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
|
||||
(backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
|
||||
(widgetSize.height - backgroundSize.height) / 2.0f +
|
||||
(backgroundSize.height - scrollView->getContentSize().height) / 2.0f));
|
||||
scrollView->setScrollBarPositionFromCornerForVertical(Vec2(scrollView->getContentSize().width - 4, 4));
|
||||
scrollView->setScrollBarColor(Color3B::BLUE);
|
||||
_uiLayer->addChild(scrollView);
|
||||
|
||||
ImageView* imageView = ImageView::create("cocosui/ccicon.png");
|
||||
|
@ -413,7 +427,7 @@ bool UIScrollViewNestTest::init()
|
|||
|
||||
|
||||
|
||||
// Create the scrollview by horizontal
|
||||
// Create the scrollview by both
|
||||
ui::ScrollView* sc = ui::ScrollView::create();
|
||||
sc->setBackGroundColor(Color3B::GREEN);
|
||||
sc->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
|
||||
|
@ -424,6 +438,7 @@ bool UIScrollViewNestTest::init()
|
|||
sc->setPropagateTouchEvents(false);
|
||||
sc->setPosition(Vec2(180,100));
|
||||
sc->scrollToPercentBothDirection(Vec2(50, 50), 1, true);
|
||||
sc->setScrollBarPositionFromCorner(Vec2(4, 4));
|
||||
ImageView* iv = ImageView::create("cocosui/Hello.png");
|
||||
iv->setPosition(Vec2(240, 160));
|
||||
sc->addChild(iv);
|
||||
|
@ -436,6 +451,10 @@ bool UIScrollViewNestTest::init()
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// UIScrollViewRotated
|
||||
|
||||
UIScrollViewRotated::UIScrollViewRotated()
|
||||
|
@ -473,13 +492,15 @@ bool UIScrollViewRotated::init()
|
|||
// Create the scrollview by vertical
|
||||
ui::ScrollView* scrollView = ui::ScrollView::create();
|
||||
scrollView->setContentSize(Size(280.0f, 150.0f));
|
||||
scrollView->setDirection(ui::ScrollView::Direction::BOTH);
|
||||
scrollView->setDirection(ui::ScrollView::Direction::VERTICAL);
|
||||
Size backgroundSize = background->getContentSize();
|
||||
scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
|
||||
(backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
|
||||
(widgetSize.height - backgroundSize.height) / 2.0f +
|
||||
(backgroundSize.height - scrollView->getContentSize().height) / 2.0f + 100) );
|
||||
scrollView->setRotation(45);
|
||||
scrollView->setScrollBarPositionFromCorner(Vec2(4, 4));
|
||||
scrollView->setScrollBarColor(Color3B::WHITE);
|
||||
_uiLayer->addChild(scrollView);
|
||||
|
||||
ImageView* imageView = ImageView::create("cocosui/ccicon.png");
|
||||
|
|
|
@ -45,6 +45,7 @@ class CocosLibsCompiler(object):
|
|||
self.clean = args.clean
|
||||
self.build_win = args.win
|
||||
self.build_mac = args.mac
|
||||
self.build_ios = args.ios
|
||||
self.build_android = args.android
|
||||
self.disable_strip = args.disable_strip
|
||||
self.repo_x = args.repo_x
|
||||
|
@ -53,6 +54,7 @@ class CocosLibsCompiler(object):
|
|||
if args.all:
|
||||
self.build_win = True
|
||||
self.build_mac = True
|
||||
self.build_ios = True
|
||||
self.build_android = True
|
||||
|
||||
if args.app_abi is None:
|
||||
|
@ -87,7 +89,7 @@ class CocosLibsCompiler(object):
|
|||
self.clean_libs()
|
||||
if self.build_win:
|
||||
self.compile_win()
|
||||
if self.build_mac:
|
||||
if self.build_mac or self.build_ios:
|
||||
self.compile_mac_ios()
|
||||
if self.build_android:
|
||||
self.compile_android()
|
||||
|
@ -229,36 +231,38 @@ class CocosLibsCompiler(object):
|
|||
xcode_proj_info = self.cfg_info[CocosLibsCompiler.KEY_XCODE_PROJS_INFO]
|
||||
|
||||
XCODE_CMD_FMT = "xcodebuild -project \"%s\" -configuration Release -target \"%s\" %s CONFIGURATION_BUILD_DIR=%s"
|
||||
ios_out_dir = os.path.join(self.lib_dir, "ios")
|
||||
mac_out_dir = os.path.join(self.lib_dir, "mac")
|
||||
ios_sim_libs_dir = os.path.join(ios_out_dir, "simulator")
|
||||
ios_dev_libs_dir = os.path.join(ios_out_dir, "device")
|
||||
for key in xcode_proj_info.keys():
|
||||
proj_path = os.path.join(self.repo_x, key)
|
||||
ios_out_dir = os.path.join(self.lib_dir, "ios")
|
||||
mac_out_dir = os.path.join(self.lib_dir, "mac")
|
||||
ios_sim_libs_dir = os.path.join(ios_out_dir, "simulator")
|
||||
ios_dev_libs_dir = os.path.join(ios_out_dir, "device")
|
||||
|
||||
target = xcode_proj_info[key][CocosLibsCompiler.KEY_XCODE_TARGETS]
|
||||
|
||||
# compile ios simulator
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s iOS" % target, "-sdk iphonesimulator ARCHS=\"i386 x86_64\" VALID_ARCHS=\"i386 x86_64\"", ios_sim_libs_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile ios simulator fail")
|
||||
return retVal
|
||||
if self.build_mac:
|
||||
# compile mac
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s Mac" % target, "", mac_out_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile mac fail")
|
||||
return retVal
|
||||
|
||||
# compile ios device
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s iOS" % target, "-sdk iphoneos", ios_dev_libs_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile ios device fail")
|
||||
return retVal
|
||||
if self.build_ios:
|
||||
# compile ios simulator
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s iOS" % target, "-sdk iphonesimulator ARCHS=\"i386 x86_64\" VALID_ARCHS=\"i386 x86_64\"", ios_sim_libs_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile ios simulator fail")
|
||||
return retVal
|
||||
|
||||
# compile mac
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s Mac" % target, "", mac_out_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile mac fail")
|
||||
return retVal
|
||||
# compile ios device
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s iOS" % target, "-sdk iphoneos", ios_dev_libs_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile ios device fail")
|
||||
return retVal
|
||||
|
||||
if self.build_ios:
|
||||
# generate fat libs for iOS
|
||||
for lib in os.listdir(ios_sim_libs_dir):
|
||||
sim_lib = os.path.join(ios_sim_libs_dir, lib)
|
||||
|
@ -272,10 +276,12 @@ class CocosLibsCompiler(object):
|
|||
utils_cocos.rmdir(ios_sim_libs_dir)
|
||||
utils_cocos.rmdir(ios_dev_libs_dir)
|
||||
|
||||
if not self.disable_strip:
|
||||
# strip the libs
|
||||
if not self.disable_strip:
|
||||
# strip the libs
|
||||
if self.build_ios:
|
||||
ios_strip_cmd = "xcrun -sdk iphoneos strip -S %s/*.a" % ios_out_dir
|
||||
utils_cocos.execute_command(ios_strip_cmd)
|
||||
if self.build_mac:
|
||||
mac_strip_cmd = "xcrun strip -S %s/*.a" % mac_out_dir
|
||||
utils_cocos.execute_command(mac_strip_cmd)
|
||||
|
||||
|
@ -378,7 +384,8 @@ if __name__ == "__main__":
|
|||
parser.add_argument('-c', dest='clean', action="store_true", help='clean libs folder')
|
||||
parser.add_argument('-all', dest='all', action="store_true", help='compile all platform')
|
||||
parser.add_argument('--win', dest='win', action="store_true", help='compile windows platform')
|
||||
parser.add_argument('--mac', dest='mac', action="store_true", help='compile mac platform')
|
||||
parser.add_argument('--mac', dest='mac', action="store_true", help='compile Mac platform')
|
||||
parser.add_argument('--ios', dest='ios', action="store_true", help='compile iOS platform')
|
||||
parser.add_argument('--android', dest='android', action="store_true",help='complile android platform')
|
||||
parser.add_argument('--dis-strip', "--disable-strip", dest='disable_strip', action="store_true", help='Disable the strip of the generated libs.')
|
||||
parser.add_argument('--vs', dest='vs_version', type=int, help='visual studio version, such as 2013.', default=None)
|
||||
|
|
|
@ -102,16 +102,12 @@ def main():
|
|||
exit_code = 1
|
||||
|
||||
# #clean workspace, we don't won't clean the repository
|
||||
# if remote_build == 1:
|
||||
# os.system("cd " + workspace)
|
||||
# os.system("git reset --hard")
|
||||
# os.system("git clean -xdf -f")
|
||||
# else:
|
||||
# print "local build, no need to cleanup"
|
||||
#remove stats module
|
||||
os.system("cd " + workspace)
|
||||
os.system("rm tools/cocos2d-console/bin/cocos_stat.py")
|
||||
os.system("rm tools/cocos2d-console/bin/cocos_stat.pyc")
|
||||
if remote_build == 1:
|
||||
os.system("cd " + workspace)
|
||||
os.system("git reset --hard")
|
||||
os.system("git clean -xdf -f")
|
||||
else:
|
||||
print "local build, no need to cleanup"
|
||||
|
||||
return(exit_code)
|
||||
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
#Cocos2D-X runtime project daily build
|
||||
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
if('branch' in os.environ):
|
||||
branch = os.environ['branch']
|
||||
else:
|
||||
branch = 'v4-develop'
|
||||
|
||||
if('WORKSPACE' in os.environ):
|
||||
workspace = os.environ['WORKSPACE']
|
||||
else:
|
||||
workspace = "."
|
||||
|
||||
if('NODE_NAME' in os.environ):
|
||||
node_name = os.environ['NODE_NAME']
|
||||
else:
|
||||
node_name = 'win32'
|
||||
|
||||
if('language' in os.environ):
|
||||
language = os.environ['language']
|
||||
else:
|
||||
language = 'lua'
|
||||
|
||||
# for local debugging purpose, you could change the value to 0 and run
|
||||
# this scripts in your local machine
|
||||
remote_build = 1
|
||||
|
||||
def download_3rd_library():
|
||||
#run download-deps.py
|
||||
print("prepare to downloading ...")
|
||||
os.system('python download-deps.py -r no')
|
||||
|
||||
|
||||
def sync_remote_repo():
|
||||
#reset path to workspace root
|
||||
os.system("cd " + workspace)
|
||||
|
||||
#pull latest code
|
||||
os.system("git fetch origin " + branch)
|
||||
os.system("git checkout " + branch)
|
||||
os.system("git merge origin/" + branch)
|
||||
#clean workspace
|
||||
print "Before checkout: git clean -xdf -f"
|
||||
os.system("git clean -xdf -f")
|
||||
|
||||
#update submodule
|
||||
git_update_submodule = "git submodule update --init --force"
|
||||
ret = os.system(git_update_submodule)
|
||||
if(ret != 0):
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
def gen_scripting_bindings():
|
||||
# Generate binding glue codes
|
||||
if(branch == 'v3' or branch == 'v4-develop'):
|
||||
ret = os.system("python tools/jenkins-scripts/slave-scripts/gen_jsb.py")
|
||||
if(ret != 0):
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
def do_build_slaves():
|
||||
jenkins_script_path = "tools" + os.sep + "jenkins-scripts" + os.sep + "slave-scripts" + os.sep + "runtime" + os.sep
|
||||
|
||||
if(branch == 'v3' or branch == 'v4-develop'):
|
||||
slave_build_scripts = ""
|
||||
if(node_name == 'android') or (node_name == 'android_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "android-build.sh " + language
|
||||
elif(node_name == 'win32' or node_name == 'win32_win7' or node_name == 'win32_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "win32-build.bat " + language
|
||||
elif(node_name == 'windows-universal' or node_name == 'windows-universal_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "windows-universal.bat " + language
|
||||
elif(node_name == 'ios_mac' or node_name == 'ios' or node_name == 'ios_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "ios-build.sh " + language
|
||||
elif(node_name == 'mac' or node_name == 'mac_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "mac-build.sh " + language
|
||||
elif(node_name == 'linux_centos' or node_name == 'linux' or node_name == 'linux_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "linux-build.sh " + language
|
||||
elif(node_name == 'wp8'):
|
||||
if(branch != 'v4'):
|
||||
slave_build_scripts = jenkins_script_path + "wp8-v3.bat"
|
||||
|
||||
ret = os.system(slave_build_scripts)
|
||||
|
||||
#get build result
|
||||
print "build finished and return " + str(ret)
|
||||
return ret
|
||||
|
||||
|
||||
def main():
|
||||
if remote_build == 1:
|
||||
#syntronize local git repository with remote and merge the PR
|
||||
sync_remote_repo()
|
||||
#copy check_current_3rd_libs
|
||||
download_3rd_library()
|
||||
#generate jsb and luabindings
|
||||
gen_scripting_bindings()
|
||||
|
||||
#start build jobs on each slave
|
||||
ret = do_build_slaves()
|
||||
|
||||
exit_code = 1
|
||||
if ret == 0:
|
||||
exit_code = 0
|
||||
else:
|
||||
exit_code = 1
|
||||
|
||||
#clean workspace, we don't won't clean the repository
|
||||
if remote_build == 1:
|
||||
os.system("cd " + workspace)
|
||||
os.system("git reset --hard")
|
||||
os.system("git clean -xdf -f")
|
||||
else:
|
||||
print "local build, no need to cleanup"
|
||||
|
||||
return(exit_code)
|
||||
|
||||
# -------------- main --------------
|
||||
if __name__ == '__main__':
|
||||
sys_ret = 0
|
||||
try:
|
||||
sys_ret = main()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
sys_ret = 1
|
||||
finally:
|
||||
sys.exit(sys_ret)
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
mycocos=tools/cocos2d-console/bin/cocos
|
||||
$mycocos new -l $1 -t runtime
|
||||
if [ $1 = "cpp" ];then
|
||||
projectname="MyCppGame"
|
||||
elif [ $1 = "lua" ];then
|
||||
projectname="MyLuaGame"
|
||||
elif [ $1 = "js" ];then
|
||||
projectname="MyJSGame"
|
||||
fi
|
||||
|
||||
$mycocos compile -p android -s $projectname --android-studio -j4 --ndk-mode release --compile-script 0
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
mycocos=tools/cocos2d-console/bin/cocos
|
||||
$mycocos new -l $1 -t runtime
|
||||
|
||||
if [ $1 = "cpp" ];then
|
||||
schemename="MyCppGame-mobile"
|
||||
projectpath="MyCppGame/proj.ios_mac/MyCppGame.xcodeproj"
|
||||
elif [ $1 = "lua" ];then
|
||||
schemename="MyLuaGame-mobile"
|
||||
projectpath="MyLuaGame/frameworks/runtime-src/proj.ios_mac/MyLuaGame.xcodeproj"
|
||||
elif [ $1 = "js" ];then
|
||||
schemename="MyJSGame-mobile"
|
||||
projectpath="MyJSGame/frameworks/runtime-src/proj.ios_mac/MyJSGame.xcodeproj"
|
||||
fi
|
||||
|
||||
echo "start building..."
|
||||
xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" clean | xcpretty
|
||||
xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
|
||||
#the following commands must not be removed
|
||||
xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
mycocos=tools/cocos2d-console/bin/cocos
|
||||
$mycocos new -l $1
|
||||
|
||||
if [ $1 = "cpp" ]; then
|
||||
projectname="MyCppGame"
|
||||
elif [ $1 = "lua" ]; then
|
||||
projectname="MyLuaGame"
|
||||
elif [ $1 = "js" ]; then
|
||||
projectname="MyJSGame"
|
||||
fi
|
||||
|
||||
$mycocos compile -p linux -s $projectname -m release -j4 --compile-script 0
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
mycocos=tools/cocos2d-console/bin/cocos
|
||||
$mycocos new -l $1 -t runtime
|
||||
|
||||
if [ $1 = "cpp" ];then
|
||||
schemename="MyCppGame-desktop"
|
||||
projectpath="MyCppGame/proj.ios_mac/MyCppGame.xcodeproj"
|
||||
elif [ $1 = "lua" ];then
|
||||
schemename="MyLuaGame-desktop"
|
||||
projectpath="MyLuaGame/frameworks/runtime-src/proj.ios_mac/MyLuaGame.xcodeproj"
|
||||
elif [ $1 = "js" ];then
|
||||
schemename="MyJSGame-desktop"
|
||||
projectpath="MyJSGame/frameworks/runtime-src/proj.ios_mac/MyJSGame.xcodeproj"
|
||||
fi
|
||||
|
||||
xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" clean | xcpretty
|
||||
xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
|
||||
#the following commands must not be removed
|
||||
xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
|
|
@ -0,0 +1,14 @@
|
|||
@echo on
|
||||
|
||||
set mycocos=tools/cocos2d-console/bin/cocos.bat
|
||||
set language=%1
|
||||
call %mycocos% new -l %language% -t runtime
|
||||
|
||||
set projectname=
|
||||
if "%language%"=="cpp" set projectname=MyCppGame/proj.win32/MyCppGame.sln
|
||||
if "%language%"=="lua" set projectname=MyLuaGame/frameworks/runtime-src/proj.win32/MyLuaGame.sln
|
||||
if "%language%"=="js" set projectname=MyJSGame/frameworks/runtime-src/proj.win32/MyJSGame.sln
|
||||
|
||||
echo %projectname%
|
||||
call "%VS120COMNTOOLS%vsvars32.bat"
|
||||
msbuild %projectname% /t:Build /p:Platform="Win32" /p:Configuration="Release" /m
|
|
@ -0,0 +1,14 @@
|
|||
@echo on
|
||||
|
||||
set mycocos=tools/cocos2d-console/bin/cocos.bat
|
||||
set language=%1
|
||||
call %mycocos% new -l %language%
|
||||
|
||||
set projectname=
|
||||
if "%language%"=="cpp" set projectname=MyCppGame/proj.win8.1-universal/MyCppGame.sln
|
||||
if "%language%"=="lua" set projectname=MyLuaGame/frameworks/runtime-src/proj.win8.1-universal/MyLuaGame.sln
|
||||
if "%language%"=="js" set projectname=MyJSGame/frameworks/runtime-src/proj.win8.1-universal/MyJSGame.sln
|
||||
|
||||
echo %projectname%
|
||||
call "%VS120COMNTOOLS%vsvars32.bat"
|
||||
msbuild %projectname% /t:Build /p:Platform="Win32" /p:Configuration="Release" /m
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
mycocos=tools/cocos2d-console/bin/cocos
|
||||
$mycocos new -l $1
|
||||
if [ $1 = "cpp" ];then
|
||||
projectname="MyCppGame"
|
||||
elif [ $1 = "lua" ];then
|
||||
projectname="MyLuaGame"
|
||||
elif [ $1 = "js" ];then
|
||||
projectname="MyJSGame"
|
||||
fi
|
||||
|
||||
$mycocos compile -p android -s $projectname --android-studio -j4 --ndk-mode release --compile-script 0
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
mycocos=tools/cocos2d-console/bin/cocos
|
||||
$mycocos new -l $1
|
||||
|
||||
if [ $1 = "cpp" ];then
|
||||
schemename="MyCppGame-mobile"
|
||||
projectpath="MyCppGame/proj.ios_mac/MyCppGame.xcodeproj"
|
||||
cocos_project_path="MyCppGame"
|
||||
elif [ $1 = "lua" ];then
|
||||
schemename="MyLuaGame-mobile"
|
||||
projectpath="MyLuaGame/frameworks/runtime-src/proj.ios_mac/MyLuaGame.xcodeproj"
|
||||
cocos_project_path="MyLuaGame"
|
||||
elif [ $1 = "js" ];then
|
||||
schemename="MyJSGame-mobile"
|
||||
projectpath="MyJSGame/frameworks/runtime-src/proj.ios_mac/MyJSGame.xcodeproj"
|
||||
cocos_project_path="MyJSGame"
|
||||
fi
|
||||
|
||||
echo "start building..."
|
||||
cocos compile -p ios -s $cocos_project_path | xcpretty
|
||||
cocos compile -p ios -s $cocos_project_path
|
||||
# xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" clean | xcpretty
|
||||
# xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
|
||||
# #the following commands must not be removed
|
||||
# xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
mycocos=tools/cocos2d-console/bin/cocos
|
||||
$mycocos new -l $1
|
||||
|
||||
if [ $1 = "cpp" ]; then
|
||||
projectname="MyCppGame"
|
||||
elif [ $1 = "lua" ]; then
|
||||
projectname="MyLuaGame"
|
||||
elif [ $1 = "js" ]; then
|
||||
projectname="MyJSGame"
|
||||
fi
|
||||
|
||||
$mycocos compile -p linux -s $projectname -m release -j4 --compile-script 0
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
mycocos=tools/cocos2d-console/bin/cocos
|
||||
$mycocos new -l $1
|
||||
|
||||
if [ $1 = "cpp" ];then
|
||||
schemename="MyCppGame-desktop"
|
||||
projectpath="MyCppGame/proj.ios_mac/MyCppGame.xcodeproj"
|
||||
cocos_project_path="MyCppGame"
|
||||
elif [ $1 = "lua" ];then
|
||||
schemename="MyLuaGame-desktop"
|
||||
projectpath="MyLuaGame/frameworks/runtime-src/proj.ios_mac/MyLuaGame.xcodeproj"
|
||||
cocos_project_path="MyLuaGame"
|
||||
elif [ $1 = "js" ];then
|
||||
schemename="MyJSGame-desktop"
|
||||
projectpath="MyJSGame/frameworks/runtime-src/proj.ios_mac/MyJSGame.xcodeproj"
|
||||
cocos_project_path="MyJSGame"
|
||||
fi
|
||||
|
||||
cocos compile -p mac -s $cocos_project_path | xcpretty
|
||||
cocos compile -p mac -s $cocos_project_path
|
||||
|
||||
# xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" clean | xcpretty
|
||||
# xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
|
||||
# #the following commands must not be removed
|
||||
# xcodebuild -project $projectpath -target "${schemename}" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
|
|
@ -0,0 +1,14 @@
|
|||
@echo on
|
||||
|
||||
set mycocos=tools/cocos2d-console/bin/cocos.bat
|
||||
set language=%1
|
||||
call %mycocos% new -l %language%
|
||||
|
||||
set projectname=
|
||||
if "%language%"=="cpp" set projectname=MyCppGame/proj.win32/MyCppGame.sln
|
||||
if "%language%"=="lua" set projectname=MyLuaGame/frameworks/runtime-src/proj.win32/MyLuaGame.sln
|
||||
if "%language%"=="js" set projectname=MyJSGame/frameworks/runtime-src/proj.win32/MyJSGame.sln
|
||||
|
||||
echo %projectname%
|
||||
call "%VS120COMNTOOLS%vsvars32.bat"
|
||||
msbuild %projectname% /t:Build
|
|
@ -0,0 +1,14 @@
|
|||
@echo on
|
||||
|
||||
set mycocos=tools/cocos2d-console/bin/cocos.bat
|
||||
set language=%1
|
||||
call %mycocos% new -l %language%
|
||||
|
||||
set projectname=
|
||||
if "%language%"=="cpp" set projectname=MyCppGame/proj.win8.1-universal/MyCppGame.sln
|
||||
if "%language%"=="lua" set projectname=MyLuaGame/frameworks/runtime-src/proj.win8.1-universal/MyLuaGame.sln
|
||||
if "%language%"=="js" set projectname=MyJSGame/frameworks/runtime-src/proj.win8.1-universal/MyJSGame.sln
|
||||
|
||||
echo %projectname%
|
||||
call "%VS120COMNTOOLS%vsvars32.bat"
|
||||
msbuild %projectname% /t:Build
|
|
@ -1,13 +1,9 @@
|
|||
#Cocos2D-X templates daily build scripts
|
||||
#Cocos2D-X template project daily build
|
||||
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
# for local debugging purpose, you could change the value to 0 and run
|
||||
# this scripts in your local machine
|
||||
remote_build = 1
|
||||
|
||||
if('branch' in os.environ):
|
||||
branch = os.environ['branch']
|
||||
else:
|
||||
|
@ -21,93 +17,89 @@ else:
|
|||
if('NODE_NAME' in os.environ):
|
||||
node_name = os.environ['NODE_NAME']
|
||||
else:
|
||||
node_name = 'mac'
|
||||
node_name = 'windows-universal'
|
||||
|
||||
if('build_mode' in os.environ):
|
||||
build_mode = os.environ['build_mode']
|
||||
if('language' in os.environ):
|
||||
language = os.environ['language']
|
||||
else:
|
||||
build_mode = "debug"
|
||||
language = 'cpp'
|
||||
|
||||
#valide build_type are 'template' and 'runtime'
|
||||
if('build_type' in os.environ):
|
||||
build_type = os.environ['build_type']
|
||||
else:
|
||||
build_type = 'template'
|
||||
# for local debugging purpose, you could change the value to 0 and run
|
||||
# this scripts in your local machine
|
||||
remote_build = 1
|
||||
|
||||
default_templates_types = ["cpp", "lua", "js"]
|
||||
runtime_templates_types = ["lua", "js"]
|
||||
default_templates_names = ["test_cpp", "test_lua", "test_js"]
|
||||
runtime_template_names = ["test_rt_lua", "test_rt_js"]
|
||||
|
||||
def do_clean_up():
|
||||
for name in default_templates_names:
|
||||
commands = 'rm -rf ' + name
|
||||
os.system(commands)
|
||||
for name in runtime_template_names:
|
||||
commands = 'rm -rf ' + name
|
||||
os.system(commands)
|
||||
def download_3rd_library():
|
||||
#run download-deps.py
|
||||
print("prepare to downloading ...")
|
||||
os.system('python download-deps.py -r no')
|
||||
|
||||
|
||||
def build_templates(mode, templates, is_runtime):
|
||||
ret = 0
|
||||
def sync_remote_repo():
|
||||
#reset path to workspace root
|
||||
os.system("cd " + workspace)
|
||||
|
||||
#pull latest code
|
||||
os.system("git fetch origin " + branch)
|
||||
os.system("git checkout " + branch)
|
||||
os.system("git merge origin/" + branch)
|
||||
#clean workspace
|
||||
print "Before checkout: git clean -xdf -f"
|
||||
os.system("git clean -xdf -f")
|
||||
|
||||
#update submodule
|
||||
git_update_submodule = "git submodule update --init --force"
|
||||
ret = os.system(git_update_submodule)
|
||||
if(ret != 0):
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
def gen_scripting_bindings():
|
||||
# Generate binding glue codes
|
||||
if(branch == 'v3' or branch == 'v4-develop'):
|
||||
do_clean_up()
|
||||
test_project_prefix = " test_"
|
||||
if is_runtime:
|
||||
test_project_prefix = " test_rt_"
|
||||
ret = os.system("python tools/jenkins-scripts/slave-scripts/gen_jsb.py")
|
||||
if(ret != 0):
|
||||
sys.exit(ret)
|
||||
|
||||
#build for default templates
|
||||
for type in templates:
|
||||
#create project
|
||||
create_project_commands = "cocos new -l " + type
|
||||
if is_runtime:
|
||||
create_project_commands += " -t runtime " + test_project_prefix + type
|
||||
else:
|
||||
create_project_commands += test_project_prefix + type
|
||||
create_ret = os.system(create_project_commands)
|
||||
|
||||
#create project failed
|
||||
if create_ret != 0:
|
||||
return 1
|
||||
def do_build_slaves():
|
||||
jenkins_script_path = "tools" + os.sep + "jenkins-scripts" + os.sep + "slave-scripts" + os.sep + "templates" + os.sep
|
||||
|
||||
ret += create_ret
|
||||
#compile
|
||||
compile_project_commands = "cocos compile -p " + node_name + " -s " + test_project_prefix + type + " --compile-script 0"
|
||||
build_mode_args = " -m "
|
||||
if node_name == "android":
|
||||
build_mode_args = " --ndk-mode "
|
||||
build_mode_args += mode
|
||||
if(branch == 'v3' or branch == 'v4-develop'):
|
||||
slave_build_scripts = ""
|
||||
if(node_name == 'android') or (node_name == 'android_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "android-build.sh " + language
|
||||
elif(node_name == 'win32' or node_name == 'win32_win7' or node_name == 'win32_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "win32-build.bat " + language
|
||||
elif(node_name == 'windows-universal' or node_name == 'windows-universal_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "windows-universal.bat " + language
|
||||
elif(node_name == 'ios_mac' or node_name == 'ios' or node_name == 'ios_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "ios-build.sh " + language
|
||||
elif(node_name == 'mac' or node_name == 'mac_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "mac-build.sh " + language
|
||||
elif(node_name == 'linux_centos' or node_name == 'linux' or node_name == 'linux_bak'):
|
||||
slave_build_scripts = jenkins_script_path + "linux-build.sh " + language
|
||||
elif(node_name == 'wp8'):
|
||||
if(branch != 'v4'):
|
||||
slave_build_scripts = jenkins_script_path + "wp8-v3.bat"
|
||||
|
||||
if node_name == "windows-universal":
|
||||
#run wp8.1 and windows 8.1
|
||||
# lua & js don't have runtime template
|
||||
if is_runtime:
|
||||
continue
|
||||
wp_ret = os.system("cocos compile -p wp8_1 " + build_mode_args + " -s " + test_project_prefix + type + " --compile-script 0")
|
||||
winrt_ret = os.system("cocos compile -p metro " + build_mode_args + " -s " + test_project_prefix + type + " --compile-script 0")
|
||||
ret += wp_ret
|
||||
ret += winrt_ret
|
||||
else:
|
||||
if node_name == "android":
|
||||
compile_project_commands += " --app-abi armeabi:armeabi-v7a:x86 "
|
||||
if node_name == "linux" and is_runtime:
|
||||
continue
|
||||
compile_ret = os.system(compile_project_commands + build_mode_args)
|
||||
ret += compile_ret
|
||||
ret = os.system(slave_build_scripts)
|
||||
|
||||
#get build result
|
||||
print "build finished and return " + str(ret)
|
||||
return ret
|
||||
|
||||
|
||||
def main():
|
||||
#start build jobs on each slave
|
||||
default_build_type = default_templates_types
|
||||
default_flag = False
|
||||
if build_type == "runtime":
|
||||
default_build_type = runtime_templates_types
|
||||
default_flag = True
|
||||
ret = build_templates(build_mode, default_build_type, default_flag)
|
||||
if remote_build == 1:
|
||||
#syntronize local git repository with remote and merge the PR
|
||||
sync_remote_repo()
|
||||
#copy check_current_3rd_libs
|
||||
download_3rd_library()
|
||||
#generate jsb and luabindings
|
||||
gen_scripting_bindings()
|
||||
|
||||
print "build finished and return " + str(ret)
|
||||
#start build jobs on each slave
|
||||
ret = do_build_slaves()
|
||||
|
||||
exit_code = 1
|
||||
if ret == 0:
|
||||
|
@ -115,6 +107,14 @@ def main():
|
|||
else:
|
||||
exit_code = 1
|
||||
|
||||
#clean workspace, we don't won't clean the repository
|
||||
if remote_build == 1:
|
||||
os.system("cd " + workspace)
|
||||
os.system("git reset --hard")
|
||||
os.system("git clean -xdf -f")
|
||||
else:
|
||||
print "local build, no need to cleanup"
|
||||
|
||||
return(exit_code)
|
||||
|
||||
# -------------- main --------------
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
#include "navmesh/jsb_cocos2dx_navmesh_manual.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#include "jsb_cocos2dx_experimental_video_auto.hpp"
|
||||
#include "experimental/jsb_cocos2dx_experimental_video_manual.h"
|
||||
#include "jsb_cocos2dx_experimental_webView_auto.hpp"
|
||||
#include "experimental/jsb_cocos2dx_experimental_webView_manual.h"
|
||||
#endif
|
||||
|
||||
|
@ -97,7 +99,9 @@ int js_module_register()
|
|||
#endif
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
sc->addRegisterCallback(register_all_cocos2dx_experimental_video);
|
||||
sc->addRegisterCallback(register_all_cocos2dx_experimental_video_manual);
|
||||
sc->addRegisterCallback(register_all_cocos2dx_experimental_webView);
|
||||
sc->addRegisterCallback(register_all_cocos2dx_experimental_webView_manual);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue