├── .bookignore ├── .gitignore ├── LANGS.md ├── README.md ├── book.json ├── config ├── README.md └── cocos2d-x.org │ ├── book.json │ ├── en │ ├── _layouts │ │ └── website │ │ │ ├── header.html │ │ │ └── page.html │ ├── book.json │ └── styles │ │ └── website.css │ └── zh │ ├── _layouts │ └── website │ │ ├── header.html │ │ └── page.html │ ├── book.json │ └── styles │ └── website.css ├── en ├── 3d │ ├── 3d-img │ │ ├── 9_1.png │ │ ├── 9_10.png │ │ ├── 9_2.png │ │ ├── 9_3.png │ │ ├── 9_4.png │ │ ├── 9_4_0.png │ │ ├── 9_6.png │ │ ├── 9_7.png │ │ ├── 9_8_1.png │ │ ├── 9_8_2.png │ │ ├── 9_9_1.png │ │ ├── 9_9_2.png │ │ ├── 9_9_3.png │ │ ├── 9_9_4.png │ │ ├── AABB.png │ │ ├── BillBoard.png │ │ ├── Cubemap.jpg │ │ ├── OBB.png │ │ ├── OrthographicCamera.png │ │ ├── PerspectiveCamera.png │ │ ├── Ray.png │ │ ├── Skybox.png │ │ ├── particle1.png │ │ ├── particle2.png │ │ ├── particle3.png │ │ ├── particle4.png │ │ └── quad.png │ ├── advanced.md │ ├── animation.md │ ├── camera.md │ ├── cubemap.md │ ├── index.md │ ├── lighting.md │ ├── skybox.md │ ├── sprite3d.md │ ├── terminology.md │ ├── terrain.md │ └── tools.md ├── README.md ├── SUMMARY.md ├── _layouts │ └── website │ │ ├── header.html │ │ └── page.html ├── about │ ├── about-img │ │ └── codeblock.png │ ├── getting_started.md │ ├── help.md │ ├── how.md │ ├── index.md │ ├── learn.md │ └── why.md ├── actions │ ├── actions-img │ │ ├── Sequence.psd │ │ ├── Spawn.psd │ │ ├── easing-functions.png │ │ ├── i0.png │ │ ├── i1.png │ │ ├── i2.png │ │ ├── i3.png │ │ ├── i4.png │ │ ├── i5.png │ │ ├── i6.png │ │ ├── i7.png │ │ ├── sequence.png │ │ ├── spawn.png │ │ ├── spawn_in_a_sequence.png │ │ └── spawn_in_a_sequence.psd │ ├── basic.md │ ├── getting_started.md │ ├── index.md │ ├── sequence_internals.md │ └── sequences.md ├── advanced_topics │ ├── advanced_topics-img │ │ ├── brick.jpg │ │ ├── file_system_access.md │ │ ├── geometry.jpg │ │ └── model.jpg │ ├── filesystem.md │ ├── index.md │ ├── networking.md │ ├── oppo.md │ ├── optimizing.md │ ├── shaders.md │ └── sqlite.md ├── audio │ ├── advanced.md │ ├── engines.md │ ├── getting_started.md │ ├── index.md │ ├── operations.md │ └── playing.md ├── basic_concepts │ ├── actions.md │ ├── basic_concepts-img │ │ ├── 2_sequence_scaled.png │ │ ├── 2n_annotated_scaled.png │ │ ├── 2n_level1_action_end.png │ │ ├── 2n_level1_action_end_rotation.png │ │ ├── 2n_level1_action_end_scale.png │ │ ├── 2n_level1_action_start.png │ │ ├── 2n_level1_anchorpoint_05_05.png │ │ ├── 2n_level1_anchorpoint_0_0.png │ │ ├── 2n_level1_anchorpoint_1_1.png │ │ ├── 2n_main.png │ │ ├── 2n_mainScene-sceneGraph.png │ │ ├── 2n_main_sprites_nodes.png │ │ ├── 2n_parent.png │ │ ├── 2n_parent_rotation.png │ │ ├── 2n_parent_scaled.png │ │ ├── Blue_Front1.png │ │ ├── LightBlue_Front1.png │ │ ├── White_Front1.png │ │ ├── ZigzagForest_Square.png │ │ ├── ZigzagGrass_Mud_Round.png │ │ ├── in-order-walk.png │ │ ├── layers.png │ │ ├── layers.psd │ │ ├── mainScene-sceneGraph.psd │ │ ├── scenes.png │ │ ├── smallSpacer.png │ │ └── tree.jpg │ ├── director.md │ ├── getting_started.md │ ├── index.md │ ├── logging.md │ ├── parent_child.md │ ├── scene.md │ ├── sequences.md │ └── sprites.md ├── book.json ├── editors_and_tools │ ├── cocos-img │ │ ├── all_projects.png │ │ ├── cocos-structure-v1.0-160116.png │ │ ├── creating_a_new_project.png │ │ └── main_window.png │ ├── cocos.md │ ├── cocosCLTool.md │ ├── creator_to_cocos2dx-img │ │ ├── build_dialog.png │ │ ├── dialog_options.png │ │ ├── folder_structure.png │ │ └── project_menu.png │ ├── creator_to_cocos2dx.md │ ├── index.md │ └── prebuilt_libraries.md ├── event_dispatcher │ ├── accelerometer.md │ ├── custom.md │ ├── getting_started.md │ ├── index.md │ ├── keyboard.md │ ├── mouse.md │ ├── priority.md │ ├── registering.md │ ├── touch.md │ └── types.md ├── faq │ ├── Android-Studio_cmake_ninja.png │ ├── android.md │ ├── cmake.md │ ├── index.md │ ├── linux.md │ ├── macos.md │ ├── re-target-errors.jpeg │ └── windows.md ├── index.md ├── installation │ ├── Android-Eclipse-img │ │ ├── image2.png │ │ ├── image3.png │ │ ├── image4.png │ │ ├── image5.png │ │ └── image6.png │ ├── Android-Eclipse.md │ ├── Android-Studio-img │ │ ├── allow_haxm.png │ │ ├── build_cpp_tests.png │ │ ├── change_release_lua_tests.png │ │ ├── debug_cpp_tests.png │ │ ├── gradle_modify.png │ │ ├── quick_fix_install.png │ │ ├── sdkmanager.png │ │ ├── sdkmanager_1.png │ │ ├── sdkmanager_2.png │ │ ├── sdkmanager_at_startup.png │ │ ├── sign_and_encrypt.png │ │ └── toolbar_sdkmanager_1.png │ ├── Android-Studio.md │ ├── Android-VisualStudio-img │ │ ├── 1.png │ │ └── 2.png │ ├── Android-VisualStudio.md │ ├── Android-terminal-img │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── android-cl-tools.png │ │ ├── android-list-targets1.png │ │ ├── buildsuccess.png │ │ ├── osx-android-list-targets.png │ │ ├── osx-android-sdk-manager-tools.png │ │ ├── osx-android-sdk-manager.png │ │ ├── osx-java.png │ │ ├── setuppy01.png │ │ ├── setuppy02.png │ │ ├── setuppy03.png │ │ ├── unzip.png │ │ ├── unzipping.png │ │ ├── win-step1.png │ │ ├── win-step10.png │ │ ├── win-step11.png │ │ ├── win-step12.png │ │ ├── win-step2.png │ │ ├── win-step3.png │ │ ├── win-step4.png │ │ ├── win-step5.png │ │ ├── win-step6.png │ │ ├── win-step7.png │ │ ├── win-step8.png │ │ └── win-step9.png │ ├── Android-terminal.md │ ├── CMake-Guide.md │ ├── Linux-img │ │ └── 1.png │ ├── Linux.md │ ├── OSX.md │ ├── Tizen-img │ │ ├── cpp-tests.png │ │ ├── double_click_installer.png │ │ ├── ide-build-1.png │ │ ├── ide-build-2.png │ │ ├── ide-build-3.png │ │ ├── ide-import-1.png │ │ ├── ide-import-2.png │ │ ├── ide-import-3.png │ │ ├── ide.png │ │ ├── installing.png │ │ ├── prompt_update_manager.png │ │ ├── ready_to_install.png │ │ └── updating_update_manager.png │ ├── Tizen.md │ ├── Windows-Phone-img │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ └── 6.png │ ├── Windows-Phone.md │ ├── Windows-img │ │ ├── 1.png │ │ ├── 2.png │ │ └── 3.png │ ├── Windows.md │ ├── iOS-img │ │ ├── contents.png │ │ ├── iPhoneXSafeArea.png │ │ ├── unzip.png │ │ └── unzipping.png │ ├── iOS.md │ ├── index.md │ └── prerequisites.md ├── other_node_types │ ├── getting_started.md │ ├── index.md │ ├── other_node_types-img │ │ ├── particle1.png │ │ ├── particle2.png │ │ ├── particle3.png │ │ ├── particle4.png │ │ ├── particle5.png │ │ ├── particle6.png │ │ ├── particle7.png │ │ ├── tilemap1.png │ │ └── tilemap2.png │ ├── parallax.md │ ├── particles.md │ └── tilemap.md ├── physics │ ├── collisions.md │ ├── concepts.md │ ├── debugging.md │ ├── getting_started.md │ ├── index.md │ ├── physics-img │ │ ├── CollisionFiltering.gif │ │ ├── CollisionProcessing.gif │ │ ├── CorrelationSprite.gif │ │ ├── RayTest.gif │ │ ├── joints.PNG │ │ ├── rectQuery1.gif │ │ └── rectQuery2.gif │ └── queries.md ├── scenes │ ├── creating.md │ ├── getting_started.md │ ├── index.md │ ├── scenes-img │ │ ├── 5_1.png │ │ ├── 5_10.jpg │ │ ├── 5_11.jpg │ │ ├── 5_2.png │ │ ├── 5_3.png │ │ ├── 5_4.jpg │ │ ├── 5_5.png │ │ ├── 5_6.jpeg │ │ ├── 5_7.png │ │ ├── 5_8.png │ │ └── 5_9.jpeg │ └── transitioning.md ├── scripting │ ├── index.md │ └── script_component.md ├── sprites │ ├── creating.md │ ├── getting_started.md │ ├── index.md │ ├── manipulation.md │ ├── polygon.md │ ├── spriteframe_cache.md │ ├── sprites-img │ │ ├── 3_1.png │ │ ├── i1.png │ │ ├── i10.png │ │ ├── i11.png │ │ ├── i2.png │ │ ├── i3.png │ │ ├── i4.png │ │ ├── i5.png │ │ ├── i6.png │ │ ├── i7.png │ │ ├── i8.png │ │ ├── i9.png │ │ ├── polygonsprite.png │ │ ├── spritesheet.png │ │ └── spritesheet.psd │ └── spritesheets.md ├── styles │ ├── jquery-1.10.2.min.js │ ├── jquery.cookie.min.js │ ├── scripts.js │ ├── website.css │ └── website.less ├── tutorials │ ├── all-about-sprites │ │ └── index.md │ ├── index.md │ ├── storing-game-data │ │ └── index.md │ └── youre-on-camera │ │ └── index.md └── ui_components │ ├── buttons.md │ ├── checkboxes.md │ ├── getting_started.md │ ├── index.md │ ├── labels.md │ ├── loading_bar.md │ ├── menus.md │ ├── sliders.md │ ├── textfields.md │ └── ui_components-img │ ├── Button_Disable.png │ ├── Button_Normal.png │ ├── Button_Press.png │ ├── Button_example.png │ ├── CheckBoxNode_Disable.png │ ├── CheckBoxNode_Normal.png │ ├── CheckBox_Disable.png │ ├── CheckBox_Normal.png │ ├── CheckBox_Press.png │ ├── Checkbox_example.png │ ├── LabelBMFont.png │ ├── LabelTTF.png │ ├── LabelTTFWithConfig.png │ ├── LabelWithGlow.png │ ├── LabelWithOutline.png │ ├── LabelWithShadow.png │ ├── LabelWithSystemFont.png │ ├── LoadingBarFile.png │ ├── LoadingBar_example.png │ ├── SliderNode_Disable.png │ ├── SliderNode_Normal.png │ ├── SliderNode_Press.png │ ├── Slider_Back.png │ ├── Slider_PressBar.png │ ├── Slider_example.png │ ├── TextField_example.png │ ├── TextField_example_keyboard.png │ └── menu.png ├── index.html.en ├── package.json ├── redirect-creator.html.en ├── redirect.html.en ├── release_notes ├── cocos-creator │ ├── v1.0.0 │ │ ├── 5e094cd93e6df20b.png │ │ ├── aaad36fca8ee82ba.png │ │ ├── cf84c7fd94662682.png │ │ ├── e2111e1c1903d928.png │ │ ├── f83c83d8f3e12256.png │ │ └── v1.0.0.md │ ├── v1.0.3 │ │ └── v1.0.3.md │ ├── v1.1.1 │ │ ├── 0a645b1f5590a709.jpg │ │ ├── 5e094cd93e6df20b.png │ │ ├── 715de315b8e4d235.jpg │ │ ├── c80bbccc845e6825.jpg │ │ └── v1.1.1.md │ ├── v1.1.2 │ │ ├── 0a645b1f5590a709.jpg │ │ ├── 5e094cd93e6df20b.png │ │ ├── 715de315b8e4d235.jpg │ │ ├── c80bbccc845e6825.jpg │ │ └── v1.1.2.md │ ├── v1.10.1 │ │ └── v1.10.1.md │ ├── v1.10.2 │ │ └── v1.10.2.md │ ├── v1.2.0 │ │ ├── 04a003b7548644fe.jpg │ │ ├── 0d8d2f28392c1d7d.gif │ │ ├── 494f9ee0583a7b2d.jpg │ │ ├── 4bd7fdf2caa92f34.jpg │ │ ├── 4f974266b8cfc41e.png │ │ ├── 5e094cd93e6df20b.png │ │ ├── c92f8e90299b07ba.png │ │ └── v1.2.0.md │ ├── v1.2.1 │ │ ├── 5e094cd93e6df20b.png │ │ └── v1.2.1.md │ ├── v1.2.2 │ │ ├── 5e094cd93e6df20b.png │ │ └── v1.2.2.md │ ├── v1.3.0 │ │ ├── 164137ab2674e953201b7f46cf12aca80c96df38.png │ │ ├── 4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg │ │ ├── 5e094cd93e6df20b.png │ │ ├── 80dfe00626626ec0abc28b839647c46fadbadc2b.jpg │ │ ├── bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg │ │ ├── e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png │ │ └── v1.3.0.md │ ├── v1.3.1 │ │ ├── 164137ab2674e953201b7f46cf12aca80c96df38.png │ │ ├── 4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg │ │ ├── 5e094cd93e6df20b.png │ │ ├── 80dfe00626626ec0abc28b839647c46fadbadc2b.jpg │ │ ├── bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg │ │ ├── e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png │ │ └── v1.3.1.md │ ├── v1.3.2 │ │ ├── 164137ab2674e953201b7f46cf12aca80c96df38.png │ │ ├── 4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg │ │ ├── 5e094cd93e6df20b.png │ │ ├── 80dfe00626626ec0abc28b839647c46fadbadc2b.jpg │ │ ├── bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg │ │ ├── e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png │ │ └── v1.3.2.md │ ├── v1.3.3 │ │ ├── 164137ab2674e953201b7f46cf12aca80c96df38.png │ │ ├── 4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg │ │ ├── 5e094cd93e6df20b.png │ │ ├── 80dfe00626626ec0abc28b839647c46fadbadc2b.jpg │ │ ├── bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg │ │ ├── e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png │ │ └── v1.3.3.md │ ├── v1.4.0 │ │ ├── 5e094cd93e6df20b.png │ │ ├── a599d7541368fd870e1d30d10d30a99cc141b5ac.gif │ │ ├── c5eae2d4c079ca26b5ffadac4ccf5da425108fe4.jpg │ │ ├── cb50b7fea0ce137a7b2b80396d8225050eee3fc1_2_608x500.jpg │ │ └── v1.4.0.md │ ├── v1.6.2 │ │ └── v1.6.2.md │ ├── v1.7.0 │ │ ├── 5e094cd93e6df20b.png │ │ └── v1.7.0.md │ ├── v1.7.2 │ │ └── v1.7.2.md │ ├── v1.9.0 │ │ ├── ce4acfd9e9b5aa553eed5291afcb3a4cf6f6ab3c_2_690x471.jpg │ │ └── v1.9.md │ ├── v1.9.1 │ │ └── v1.9.1.md │ ├── v1.9.2 │ │ └── v1.9.2.md │ ├── v1.9.3 │ │ └── v1.9.3.md │ ├── v2.0.0 │ │ └── v2.0.0.md │ ├── v2.0.2 │ │ └── v2.0.2.md │ ├── v2.0.4 │ │ ├── e9cfeb9542d69b73e1db694aa2abe4b639be31b5.jpeg │ │ └── v2.0.4.md │ ├── v2.0.5 │ │ └── v2.0.5.md │ ├── v2.0.6 │ │ └── v2.0.6.md │ ├── v2.0.7 │ │ └── v2.0.7.md │ ├── v2.0.8 │ │ └── v2.0.8.md │ ├── v2.0.9 │ │ ├── s_37139874B14595506173FAFBA5A8940D8F22E79506816B4BCD08BDDACC9CF8A3_1550049670008_image.png │ │ ├── s_37139874B14595506173FAFBA5A8940D8F22E79506816B4BCD08BDDACC9CF8A3_1550051516233_image.png │ │ └── v2.0.9.md │ └── v2.1.0 │ │ ├── 26ace32fcb53e9aa4679a723b08c879e1514c376.png │ │ ├── 53aa4edf4aeebbf248b170301fa41c4842a9dee9.png │ │ ├── 9dfca1c23dea20cd123da113d0323bd07b98d94e.png │ │ ├── b5ff9d1aa18074ee861d4f910629f18b166c6225.png │ │ ├── e9f4bb2c1f77a432452ef5bd03aa6849f0765f6e_2_491x500.png │ │ └── v2.1.0.md └── cocos2d-x │ ├── v3.10.md │ ├── v3.11.1.md │ ├── v3.11.md │ ├── v3.12.md │ ├── v3.13.1.md │ ├── v3.13.md │ ├── v3.14.1.md │ ├── v3.14.md │ ├── v3.15.1.md │ ├── v3.15.md │ ├── v3.16.md │ ├── v3.17.1.md │ ├── v3.17.2.md │ └── v3.17.md └── zh ├── 3d ├── advanced.md ├── animation.md ├── camera.md ├── cubemap.md ├── index.md ├── lighting.md ├── skybox.md ├── sprite3d.md ├── terrain.md └── tools.md ├── README.md ├── SUMMARY.md ├── _layouts └── website │ ├── header.html │ └── page.html ├── about ├── help.md ├── how.md ├── index.md ├── learn.md └── res │ ├── codeblock.png │ └── powerbycocos.png ├── actions ├── basic.md ├── index.md ├── sequence_internals.md └── sequences.md ├── advanced_topics ├── filesystem.md ├── index.md ├── networking.md ├── oppo.md ├── optimizing.md ├── shaders.md └── sqlite.md ├── audio ├── advanced.md ├── engines.md ├── index.md ├── operations.md └── playing.md ├── basic_concepts ├── actions.md ├── director.md ├── index.md ├── logging.md ├── parent_child.md ├── scene.md ├── sequences.md └── sprites.md ├── book.json ├── editors_and_tools ├── cocosCLTool.md ├── creator_to_cocos2dx.md └── prebuilt_libraries.md ├── event_dispatcher ├── accelerometer.md ├── custom.md ├── index.md ├── keyboard.md ├── mouse.md ├── priority.md ├── registering.md ├── touch.md └── types.md ├── faq ├── Android-Studio_cmake_ninja.png ├── android.md ├── cmake.md ├── index.md ├── linux.md ├── macos.md ├── re-target-errors.jpeg └── windows.md ├── index.md ├── installation ├── Android-Eclipse.md ├── Android-Studio-img │ ├── Import-project.png │ ├── bar-AVD-Manager.png │ ├── bar-Run.png │ ├── choose-device-definition.png │ ├── cpp-tests-success.png │ └── select-image.png ├── Android-Studio.md ├── Android-terminal.md ├── CMake-Guide.md ├── IOS.md ├── Linux-img │ └── ubuntu-cpp-tests.png ├── Linux.md ├── OSX.md ├── Windows-img │ ├── cpp-tests-win32-debug-breakpoint.png │ ├── cpp-tests-win32-debug-trace.png │ ├── cpp-tests-win32-run.png │ └── cpp-tests-win32-solution.png ├── Windows.md ├── iOS-img │ ├── ios-install-run.png │ ├── macOS-debug.png │ └── macOS-install-run.png └── index.md ├── other_node_types ├── index.md ├── parallax.md ├── particles.md └── tilemap.md ├── physics ├── collisions.md ├── concepts.md ├── debugging.md ├── index.md └── queries.md ├── scenes ├── creating.md ├── index.md └── transitioning.md ├── scripting └── index.md ├── sprites ├── creating.md ├── index.md ├── manipulation.md ├── polygon.md ├── spriteframe_cache.md └── spritesheets.md ├── styles ├── website.css └── website.less └── ui_components ├── buttons.md ├── checkboxes.md ├── index.md ├── labels.md ├── loading_bar.md ├── menus.md ├── sliders.md └── textfields.md /.bookignore: -------------------------------------------------------------------------------- 1 | config/ 2 | gulpfile.js 3 | .markdownlint.json 4 | package.json 5 | .gitignore 6 | .bookignore 7 | README.md 8 | 9 | build.sh 10 | redirect-creator.html.en 11 | redirect.html.en 12 | REWRITE.TXT 13 | index.html.en 14 | deploy_cron.sh 15 | deploy_all.sh 16 | deploy_production.sh 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | node_modules/ 4 | output/ 5 | .vscode/ 6 | _book/ 7 | 8 | *.epub 9 | *.pdf 10 | *.mobi 11 | 12 | package-lock.json 13 | 14 | *.log 15 | *.tar.gz 16 | -------------------------------------------------------------------------------- /LANGS.md: -------------------------------------------------------------------------------- 1 | - [English](/en) 2 | - [简体中文](/zh) -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "-lunr", 4 | "-search", 5 | "github-issue-feedback-language-custom", 6 | "search-title", 7 | "anchorjs", 8 | "toggle-chapters", 9 | "sharing" 10 | ], 11 | "styles": { 12 | "website": "./styles/website.css" 13 | }, 14 | "pluginsConfig": { 15 | "github-issue-feedback-language-custom": { 16 | "repo": "cocos-creator/creator-docs", 17 | "branch": "master" 18 | }, 19 | "search": { 20 | "maxIndexSize": 1000000000 21 | }, 22 | "lunr": { 23 | "maxIndexSize": 1000000000 24 | }, 25 | "sharing": { 26 | "douban": false, 27 | "facebook": true, 28 | "google": false, 29 | "hatenaBookmark": false, 30 | "instapaper": false, 31 | "line": false, 32 | "linkedin": false, 33 | "messenger": false, 34 | "pocket": false, 35 | "qq": true, 36 | "qzone": false, 37 | "stumbleupon": false, 38 | "twitter": true, 39 | "viber": false, 40 | "vk": false, 41 | "weibo": true, 42 | "whatsapp": false, 43 | "all": [ 44 | "facebook", "google", "twitter", 45 | "weibo" 46 | ] 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /config/README.md: -------------------------------------------------------------------------------- 1 | # why need config 2 | 3 | Cocos website exists: 4 | 5 | 1. English: `//cocos2d-x.org/` 6 | 1. 中文:`//www.cocos.com/` 7 | 8 | the gitbook be published twice, links are different on both. So add the config to adapt this. 9 | 10 | ## how to change 11 | 12 | Config of the master branch will be for cocos.com, if you need to change config to cocos2d-x.org, only need run: 13 | 14 | ```sh 15 | cd to docs root dir 16 | > cp -rf config/cocos2d-x.org/ ./ 17 | ``` 18 | -------------------------------------------------------------------------------- /config/cocos2d-x.org/book.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "-lunr", 4 | "-search", 5 | "github-issue-feedback-language-custom", 6 | "search-title", 7 | "anchorjs", 8 | "toggle-chapters", 9 | "sharing" 10 | ], 11 | "styles": { 12 | "website": "./styles/website.css" 13 | }, 14 | "pluginsConfig": { 15 | "github-issue-feedback-language-custom": { 16 | "repo": "cocos-creator/creator-docs", 17 | "branch": "master" 18 | }, 19 | "search": { 20 | "maxIndexSize": 1000000000 21 | }, 22 | "lunr": { 23 | "maxIndexSize": 1000000000 24 | }, 25 | "sharing": { 26 | "douban": false, 27 | "facebook": true, 28 | "google": false, 29 | "hatenaBookmark": false, 30 | "instapaper": false, 31 | "line": false, 32 | "linkedin": false, 33 | "messenger": false, 34 | "pocket": false, 35 | "qq": true, 36 | "qzone": false, 37 | "stumbleupon": false, 38 | "twitter": true, 39 | "viber": false, 40 | "vk": false, 41 | "weibo": true, 42 | "whatsapp": false, 43 | "all": [ 44 | "facebook", "google", "twitter", 45 | "weibo" 46 | ] 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /config/cocos2d-x.org/en/book.json: -------------------------------------------------------------------------------- 1 | { 2 | "structure": { 3 | "summary": "SUMMARY.md", 4 | "readme": "index.md" 5 | }, 6 | "variables": { 7 | "products": [ 8 | { 9 | "name": "API Reference", 10 | "link": "https://docs.cocos2d-x.org/api-ref/index.html" 11 | }, 12 | { 13 | "name": "Cocos Creator", 14 | "links": [ 15 | { 16 | "name": "Manual", 17 | "link": "https://docs.cocos2d-x.org/creator/manual/" 18 | }, 19 | { 20 | "name": "API", 21 | "link": "https://docs.cocos2d-x.org/creator/api/" 22 | } 23 | ] 24 | } 25 | ], 26 | "version": [ 27 | { 28 | "name": "3.x", 29 | "links": [ 30 | { 31 | "name": "3.x", 32 | "link": "https://docs.cocos2d-x.org/cocos2d-x/v3/en/" 33 | }, 34 | { 35 | "name": "4.x", 36 | "link": "https://docs.cocos2d-x.org/cocos2d-x/v4/en/" 37 | } 38 | ] 39 | } 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /en/3d/3d-img/9_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_1.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_10.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_2.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_3.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_4.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_4_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_4_0.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_6.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_7.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_8_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_8_1.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_8_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_8_2.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_9_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_9_1.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_9_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_9_2.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_9_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_9_3.png -------------------------------------------------------------------------------- /en/3d/3d-img/9_9_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/9_9_4.png -------------------------------------------------------------------------------- /en/3d/3d-img/AABB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/AABB.png -------------------------------------------------------------------------------- /en/3d/3d-img/BillBoard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/BillBoard.png -------------------------------------------------------------------------------- /en/3d/3d-img/Cubemap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/Cubemap.jpg -------------------------------------------------------------------------------- /en/3d/3d-img/OBB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/OBB.png -------------------------------------------------------------------------------- /en/3d/3d-img/OrthographicCamera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/OrthographicCamera.png -------------------------------------------------------------------------------- /en/3d/3d-img/PerspectiveCamera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/PerspectiveCamera.png -------------------------------------------------------------------------------- /en/3d/3d-img/Ray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/Ray.png -------------------------------------------------------------------------------- /en/3d/3d-img/Skybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/Skybox.png -------------------------------------------------------------------------------- /en/3d/3d-img/particle1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/particle1.png -------------------------------------------------------------------------------- /en/3d/3d-img/particle2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/particle2.png -------------------------------------------------------------------------------- /en/3d/3d-img/particle3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/particle3.png -------------------------------------------------------------------------------- /en/3d/3d-img/particle4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/particle4.png -------------------------------------------------------------------------------- /en/3d/3d-img/quad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/3d/3d-img/quad.png -------------------------------------------------------------------------------- /en/3d/cubemap.md: -------------------------------------------------------------------------------- 1 | ## Cubemap Texture 2 | A __cube map texture__ is a collection of six separate square textures that are 3 | put onto the faces of an imaginary cube. Most often they are used to display 4 | infinitely far away reflections on objects, similar to how __sky box__ displays 5 | far away scenery in the background. This is what an expanded cube map might look 6 | like: 7 | 8 | ![](3d-img/Cubemap.jpg) 9 | 10 | In Cocos2d-x, you can create a __cube map texture__ in this way: 11 | 12 | ```cpp 13 | // create a textureCube object with six texture assets 14 | auto textureCube = TextureCube::create("skybox/left.jpg", "skybox/right.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg"); 15 | 16 | // set cube map texture parameters 17 | Texture2D::TexParams tRepeatParams; 18 | tRepeatParams.magFilter = GL_NEAREST; 19 | tRepeatParams.minFilter = GL_NEAREST; 20 | tRepeatParams.wrapS = GL_MIRRORED_REPEAT; 21 | tRepeatParams.wrapT = GL_MIRRORED_REPEAT; 22 | textureCube->setTexParameters(tRepeatParams); 23 | 24 | // create and set our custom shader 25 | auto shader = GLProgram::createWithFilenames("cube_map.vert", "cube_map.frag"); 26 | auto _state = GLProgramState::create(shader); 27 | 28 | // bind cube map texture to uniform 29 | state->setUniformTexture("u_cubeTex", textureCube); 30 | ``` 31 | -------------------------------------------------------------------------------- /en/3d/index.md: -------------------------------------------------------------------------------- 1 | ## 3D 2 | You probably started with Cocos2d-x and know it as a 2D game engine. Starting 3 | with version 3, 3D features are being added and refined. 3D gaming is a huge 4 | market and Cocos2d-x is adding all the features you need for 3D development. 3D 5 | development might be new to you and use some terminology that you are unfamiliar 6 | with. There are also additional software tools that you need to become familiar 7 | with. Let's jump right in and get our feet wet. 8 | -------------------------------------------------------------------------------- /en/3d/skybox.md: -------------------------------------------------------------------------------- 1 | ## Skybox 2 | `Skybox` is a wrapper around your entire scene that shows what the world looks 3 | like beyond your geometry. You might use a `Skybox` to simulate infinite sky, 4 | mountains and other phenomena. 5 | 6 | ![](3d-img/Skybox.png) 7 | 8 | Creating a `Skybox`: 9 | 10 | ```cpp 11 | // create a Skybox object 12 | auto box = Skybox::create(); 13 | 14 | // set textureCube for Skybox 15 | box->setTexture(_textureCube); 16 | 17 | // attached to scene 18 | _scene->addChild(box); 19 | ``` 20 | -------------------------------------------------------------------------------- /en/README.md: -------------------------------------------------------------------------------- 1 | # Cocos2d-x-docs README 2 | -------------------------------------------------------------------------------- /en/_layouts/website/header.html: -------------------------------------------------------------------------------- 1 | {% extends template.self %} 2 | {% block book_header %} 3 | 23 | 33 | {% endblock %} 34 | -------------------------------------------------------------------------------- /en/about/about-img/codeblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/about/about-img/codeblock.png -------------------------------------------------------------------------------- /en/about/help.md: -------------------------------------------------------------------------------- 1 | ## Where to get help 2 | * [__Forums__](https://discuss.Cocos2d-x.org) 3 | * [__Bug Tracker__](https://github.com/cocos2d/cocos2d-x/issues) 4 | * __`cpp-tests`__ project. This project is our basis for testing. Use this project to learn how we implement the functionality of the engine. This project is located in __Cocos2d-x_root/build.__ 5 | * [__API Reference__](https://docs.cocos2d-x.org/api-ref/index.html). 6 | 7 | -------------------------------------------------------------------------------- /en/about/index.md: -------------------------------------------------------------------------------- 1 | ## What is Cocos2d-x? 2 | 3 | ## About Cocos2d-x 4 | Started in 2010, Cocos2d-x is an open source, cross-platform game engine. It is 5 | loaded with powerful features that allows developers to create spectacular games 6 | with ease. 7 | -------------------------------------------------------------------------------- /en/about/learn.md: -------------------------------------------------------------------------------- 1 | ## Learning Resources 2 | * This very guide! 3 | * [__Android Fundamentals__](https://developer.android.com/guide/components/fundamentals.html) 4 | 5 | 6 | * __Make School Tutorials__ 7 | * [__Timberman Clone__](https://www.makeschool.com/online-courses/tutorials/build-a-clone-of-timberman-in-c-with-cocos2d-x-and-cocos-studio/getting-started) 8 | * [__Game of Life__](https://www.makeschool.com/online-courses/tutorials/learn-cocos-studio-and-c-by-building-the-game-of-life/what-game-of-life) 9 | 10 | 11 | * __Games From Scratch__ 12 | * [__Cocos2d-x tutorial series__](http://www.gamefromscratch.com/page/cocos2d-x-CPP-Game-Programming-Tutorial-Series.aspx) 13 | * [__Cocos Ceator tutorial__](https://www.youtube.com/watch?v=49AC6HD1Bi0) 14 | -------------------------------------------------------------------------------- /en/about/why.md: -------------------------------------------------------------------------------- 1 | ## Why choose Cocos2d-x 2 | Why would you want to choose Cocos2d-x over other available game engines? 3 | 4 | * Modern C++ API (please refer to the modernizing done in [__version 3.0__](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md#c11-features)) 5 | 6 | * Cross-platform - desktop and mobile 7 | 8 | * Capability to test and debug your game on the desktop and then push it to a 9 | mobile or desktop target 10 | 11 | * A vast API of functionality including sprites, actions, animations, particles, 12 | transitions, timers, events (touch, keyboard, accelerometer, mouse), sound, 13 | file IO, persistence, skeletal animations, 3D 14 | -------------------------------------------------------------------------------- /en/actions/actions-img/Sequence.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/Sequence.psd -------------------------------------------------------------------------------- /en/actions/actions-img/Spawn.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/Spawn.psd -------------------------------------------------------------------------------- /en/actions/actions-img/easing-functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/easing-functions.png -------------------------------------------------------------------------------- /en/actions/actions-img/i0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/i0.png -------------------------------------------------------------------------------- /en/actions/actions-img/i1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/i1.png -------------------------------------------------------------------------------- /en/actions/actions-img/i2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/i2.png -------------------------------------------------------------------------------- /en/actions/actions-img/i3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/i3.png -------------------------------------------------------------------------------- /en/actions/actions-img/i4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/i4.png -------------------------------------------------------------------------------- /en/actions/actions-img/i5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/i5.png -------------------------------------------------------------------------------- /en/actions/actions-img/i6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/i6.png -------------------------------------------------------------------------------- /en/actions/actions-img/i7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/i7.png -------------------------------------------------------------------------------- /en/actions/actions-img/sequence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/sequence.png -------------------------------------------------------------------------------- /en/actions/actions-img/spawn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/spawn.png -------------------------------------------------------------------------------- /en/actions/actions-img/spawn_in_a_sequence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/spawn_in_a_sequence.png -------------------------------------------------------------------------------- /en/actions/actions-img/spawn_in_a_sequence.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/actions/actions-img/spawn_in_a_sequence.psd -------------------------------------------------------------------------------- /en/actions/getting_started.md: -------------------------------------------------------------------------------- 1 | ## By and To, what is the difference? 2 | You will notice that each `Action` has a __By__ and __To__ version. Why? Because 3 | they are different in what they accomplish. A __By__ is relative to the current 4 | state of the `Node`. A __To__ action is absolute, meaning it doesn't take into 5 | account the current state of the `Node`. Let's take a look at a specific example: 6 | 7 | ```cpp 8 | auto mySprite = Sprite::create("mysprite.png"); 9 | mySprite->setPosition(Vec2(200, 256)); 10 | 11 | // MoveBy - lets move the sprite by 500 on the x axis over 2 seconds 12 | // MoveBy is relative - since x = 200 + 500 move = x is now 700 after the move 13 | auto moveBy = MoveBy::create(2, Vec2(500, mySprite->getPositionY())); 14 | 15 | // MoveTo - lets move the new sprite to 300 x 256 over 2 seconds 16 | // MoveTo is absolute - The sprite gets moved to 300 x 256 regardless of 17 | // where it is located now. 18 | auto moveTo = MoveTo::create(2, Vec2(300, mySprite->getPositionY())); 19 | 20 | // Delay - create a small delay 21 | auto delay = DelayTime::create(1); 22 | 23 | auto seq = Sequence::create(moveBy, delay, moveTo, nullptr); 24 | 25 | mySprite->runAction(seq); 26 | ``` 27 | 28 | ![](actions-img/i0.png "") 29 | -------------------------------------------------------------------------------- /en/actions/index.md: -------------------------------------------------------------------------------- 1 | ## Actions 2 | `Action` objects are just like they sound. They make a `Node` perform a change 3 | to its properties. `Action` objects allow the transformation of `Node` properties in time. Any object with a base class of `Node` can have `Action` objects performed on it. As an example, you can move a `Sprite` from one position to another and do it over a span of time. 4 | 5 | Example of `MoveTo` and `MoveBy` actions: 6 | 7 | ```cpp 8 | // Move sprite to position 50,10 in 2 seconds. 9 | auto moveTo = MoveTo::create(2, Vec2(50, 10)); 10 | mySprite1->runAction(moveTo); 11 | 12 | // Move sprite 20 points to right in 2 seconds 13 | auto moveBy = MoveBy::create(2, Vec2(20,0)); 14 | mySprite2->runAction(moveBy); 15 | ``` 16 | 17 | [Let's get started with Actions!](getting_started.md) -------------------------------------------------------------------------------- /en/advanced_topics/advanced_topics-img/brick.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/advanced_topics/advanced_topics-img/brick.jpg -------------------------------------------------------------------------------- /en/advanced_topics/advanced_topics-img/geometry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/advanced_topics/advanced_topics-img/geometry.jpg -------------------------------------------------------------------------------- /en/advanced_topics/advanced_topics-img/model.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/advanced_topics/advanced_topics-img/model.jpg -------------------------------------------------------------------------------- /en/advanced_topics/index.md: -------------------------------------------------------------------------------- 1 | ## Advanced Topics 2 | Wow! You are on the last chapter. Good Job! By now you should feel comfortable 3 | creating your games with Cocos2d-x. However, please realize there is no limit to 4 | what you can create. This chapter covers __advanced__ concepts. Note that this 5 | chapter gets more technical in its content and format. 6 | 7 | 8 | 9 | 24 | -------------------------------------------------------------------------------- /en/audio/engines.md: -------------------------------------------------------------------------------- 1 | ## Are your audio needs more advanced? 2 | This far we have just talked about `SimpleAudioEngine`. For most games, `SimpleAudioEngine` provides all the functionality that they need. If your audio needs move beyond what `SimpleAudioEngine` can provide, Cocos2d-x also offers a second choice called just `AudioEngine`. 3 | 4 | ### SimpleAudio Engine versus Audio Engine 5 | -------------------------------------------------------------------------------- /en/audio/getting_started.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | Your game will surely need sound! Cocos2d-x provides an audio engine called 3 | `SimpleAudioEngine`. It can be used to play background music as well as sound effects through out your game play. `SimpleAudioEngine` is a shared singleton object so you can simple call it from anywhere in your code. When creating a sample __HelloWorld__ project we do all the setup required for you, out of the box. 4 | 5 | ### Supported music formats 6 | 7 | | Platform | Supported File Formats | Notes | 8 | | ------- | ------------------- | ------ | 9 | | Android | .mp3, .mid, .ogg, .wav | All formats supported by __android.media.MediaPlayer__ can be played | 10 | | iOS | .aac, .caf, .mp3, .m4a, .wav | All formats supported by __AVAudioPlayer__ can be played | 11 | | Windows | .mid, .mp3, .wav | none | 12 | 13 | ### Supported audio formats: 14 | 15 | | Platform | Common Supported File Formats | Notes | 16 | | ------- | ------------------- | ------ | 17 | | Android | .ogg, .wav | Wav support is not perfect | 18 | | iOS | .caf, .m4a | Can play all formats supported by Cocos2d-iPhone CocosDesion | 19 | | Windows | .mid, .wav | none | 20 | -------------------------------------------------------------------------------- /en/audio/index.md: -------------------------------------------------------------------------------- 1 | ## Audio 2 | Your game will surely need sound! Cocos2d-x provides two audio engines. One API called `SimpleAudioEngine` and a more advanced API called `AudioEngine`. 3 | -------------------------------------------------------------------------------- /en/audio/operations.md: -------------------------------------------------------------------------------- 1 | ## Pausing, stopping, resuming music and sound effects 2 | After you start to play music and sound effects you might need to pause, 3 | stop or resume after certain operations. This can be done easily. 4 | 5 | ### Pause 6 | ```cpp 7 | #include "SimpleAudioEngine.h" 8 | using namespace CocosDenshion; 9 | 10 | auto audio = SimpleAudioEngine::getInstance(); 11 | 12 | // pause background music. 13 | audio->pauseBackgroundMusic(); 14 | 15 | // pause a sound effect. 16 | audio->pauseEffect(); 17 | 18 | // pause all sound effects. 19 | audio->pauseAllEffects(); 20 | ``` 21 | 22 | ### Stop 23 | ```cpp 24 | #include "SimpleAudioEngine.h" 25 | using namespace CocosDenshion; 26 | 27 | auto audio = SimpleAudioEngine::getInstance(); 28 | 29 | // stop background music. 30 | audio->stopBackgroundMusic(); 31 | 32 | // stop a sound effect. 33 | audio->stopEffect(); 34 | 35 | // stops all running sound effects. 36 | audio->stopAllEffects(); 37 | ``` 38 | 39 | ### Resume 40 | ```cpp 41 | #include "SimpleAudioEngine.h" 42 | using namespace CocosDenshion; 43 | 44 | auto audio = SimpleAudioEngine::getInstance(); 45 | 46 | // resume background music. 47 | audio->resumeBackgroundMusic(); 48 | 49 | // resume a sound effect. 50 | audio->resumeEffect(); 51 | 52 | // resume all sound effects. 53 | audio->resumeAllEffects(); 54 | ``` 55 | -------------------------------------------------------------------------------- /en/audio/playing.md: -------------------------------------------------------------------------------- 1 | ## Play background music 2 | Play an audio file for use as background music. This can be repeated 3 | continuously. 4 | 5 | ```cpp 6 | #include "SimpleAudioEngine.h" 7 | using namespace CocosDenshion; 8 | 9 | auto audio = SimpleAudioEngine::getInstance(); 10 | 11 | // set the background music and continuously play it. 12 | audio->playBackgroundMusic("mymusic.mp3", true); 13 | 14 | // set the background music and play it just once. 15 | audio->playBackgroundMusic("mymusic.mp3", false); 16 | ``` 17 | 18 | ## Play a sound effect. 19 | Play a sound effect. 20 | 21 | ```cpp 22 | #include "SimpleAudioEngine.h" 23 | using namespace CocosDenshion; 24 | 25 | auto audio = SimpleAudioEngine::getInstance(); 26 | 27 | // play a sound effect, just once. 28 | audio->playEffect("myEffect.mp3", false, 1.0f, 1.0f, 1.0f); 29 | ``` 30 | -------------------------------------------------------------------------------- /en/basic_concepts/actions.md: -------------------------------------------------------------------------------- 1 | ## Actions 2 | Creating a `Scene` and adding `Sprite` objects on the screen is only part 3 | of what we need to do. For a game to be a game we need to make things move 4 | around! `Action` objects are an integral part of every game. __Actions__ allow the 5 | transformation of `Node` objects in time space. Want to move a `Sprite` 6 | from one `Point` to another and use a callback when complete? No problem! 7 | You can even create a `Sequence` of `Action` items to be performed on a 8 | `Node`. You can change `Node` properties like position, rotation and scale. 9 | Example Actions: `MoveBy`, `Rotate`, `Scale`. All games use __Actions__. 10 | 11 | Taking a look at the [sample code](https://github.com/chukong/programmers-guide-samples) 12 | for this chapter, here are __Actions__ in work: 13 | 14 | ![](basic_concepts-img/2n_level1_action_start.png "") 15 | 16 | and after 5 seconds the sprite will move to a new position: 17 | 18 | ![](basic_concepts-img/2n_level1_action_end.png "") 19 | 20 | `Action` objects are easy to create: 21 | 22 | ```cpp 23 | auto mySprite = Sprite::create("Blue_Front1.png"); 24 | 25 | // Move a sprite 50 pixels to the right, and 10 pixels to the top over 2 seconds. 26 | auto moveBy = MoveBy::create(2, Vec2(50,10)); 27 | mySprite->runAction(moveBy); 28 | 29 | // Move a sprite to a specific location over 2 seconds. 30 | auto moveTo = MoveTo::create(2, Vec2(50,10)); 31 | mySprite->runAction(moveTo); 32 | ``` 33 | -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2_sequence_scaled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2_sequence_scaled.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_annotated_scaled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_annotated_scaled.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_level1_action_end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_level1_action_end.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_level1_action_end_rotation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_level1_action_end_rotation.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_level1_action_end_scale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_level1_action_end_scale.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_level1_action_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_level1_action_start.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_level1_anchorpoint_05_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_level1_anchorpoint_05_05.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_level1_anchorpoint_0_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_level1_anchorpoint_0_0.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_level1_anchorpoint_1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_level1_anchorpoint_1_1.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_main.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_mainScene-sceneGraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_mainScene-sceneGraph.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_main_sprites_nodes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_main_sprites_nodes.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_parent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_parent.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_parent_rotation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_parent_rotation.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/2n_parent_scaled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/2n_parent_scaled.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/Blue_Front1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/Blue_Front1.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/LightBlue_Front1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/LightBlue_Front1.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/White_Front1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/White_Front1.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/ZigzagForest_Square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/ZigzagForest_Square.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/ZigzagGrass_Mud_Round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/ZigzagGrass_Mud_Round.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/in-order-walk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/in-order-walk.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/layers.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/layers.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/layers.psd -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/mainScene-sceneGraph.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/mainScene-sceneGraph.psd -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/scenes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/scenes.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/smallSpacer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/smallSpacer.png -------------------------------------------------------------------------------- /en/basic_concepts/basic_concepts-img/tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/basic_concepts/basic_concepts-img/tree.jpg -------------------------------------------------------------------------------- /en/basic_concepts/logging.md: -------------------------------------------------------------------------------- 1 | ## Logging as a way to output messages 2 | Sometimes, when your app is running, you might wish to see messages being written 3 | to the console for informational or debug purposes. This is built into the 4 | engine, using __log()__. Example: 5 | 6 | ```cpp 7 | // a simple string 8 | log("This would be outputted to the console"); 9 | 10 | // a string and a variable 11 | string s = "My variable"; 12 | log("string is %s", s); 13 | 14 | // a double and a variable 15 | double dd = 42; 16 | log("double is %f", dd); 17 | 18 | // an integer and a variable 19 | int i = 6; 20 | log("integer is %d", i); 21 | 22 | // a float and a variable 23 | float f = 2.0f; 24 | log("float is %f", f); 25 | 26 | // a bool and a variable 27 | bool b = true; 28 | if (b == true) 29 | log("bool is true"); 30 | else 31 | log("bool is false"); 32 | ``` 33 | 34 | And, c++ users, if you prefer you can use __std::cout__ in place of __log()__, 35 | however, __log()__ might offer easier formatting of complex output. 36 | -------------------------------------------------------------------------------- /en/basic_concepts/parent_child.md: -------------------------------------------------------------------------------- 1 | ## Parent Child Relationship 2 | Cocos2d-x uses a __parent and child__ relationship. This means that properties 3 | and changes to the parent node are applied to its children. Consider a single 4 | `Sprite` and then a `Sprite` that has children: 5 | 6 | ![](basic_concepts-img/2n_parent.png "") 7 | 8 | With children, changing the rotation of the parent will also change the 9 | rotation to all children: 10 | 11 | ![](basic_concepts-img/2n_parent_rotation.png "") 12 | 13 | ```cpp 14 | auto myNode = Node::create(); 15 | 16 | // rotating by setting 17 | myNode->setRotation(50); 18 | ``` 19 | 20 | Just like with rotation, if you change the scale of the parent the children 21 | will also get scaled: 22 | 23 | ![](basic_concepts-img/2n_parent_scaled.png "") 24 | 25 | ```cpp 26 | auto myNode = Node::create(); 27 | 28 | // scaling by setting 29 | myNode->setScale(2.0); // scales uniformly by 2.0 30 | ``` 31 | 32 | Not all changes to the __parent__ are passed down to its __children__. Changing the 33 | __parent__ __anchor point__ only affects transform operations (*scale*, *position*, 34 | *rotate*, *skew*, etc...) and does not affect children positioning. In fact, children 35 | will be always added to the bottom-left (0,0) corner of its parent. 36 | -------------------------------------------------------------------------------- /en/book.json: -------------------------------------------------------------------------------- 1 | { 2 | "structure": { 3 | "summary": "SUMMARY.md", 4 | "readme": "index.md" 5 | }, 6 | "variables": { 7 | "products": [ 8 | { 9 | "name": "API Reference", 10 | "link": "https://docs.cocos2d-x.org/api-ref/index.html" 11 | }, 12 | { 13 | "name": "Cocos Creator", 14 | "links": [ 15 | { 16 | "name": "Manual", 17 | "link": "https://docs.cocos2d-x.org/creator/manual/" 18 | }, 19 | { 20 | "name": "API", 21 | "link": "https://docs.cocos2d-x.org/creator/api/" 22 | } 23 | ] 24 | } 25 | ], 26 | "version": [ 27 | { 28 | "name": "3.x", 29 | "links": [ 30 | { 31 | "name": "3.x", 32 | "link": "https://docs.cocos2d-x.org/cocos2d-x/v3/en" 33 | }, 34 | { 35 | "name": "4.x", 36 | "link": "https://docs.cocos2d-x.org/cocos2d-x/v4/en" 37 | } 38 | ] 39 | } 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /en/editors_and_tools/cocos-img/all_projects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/editors_and_tools/cocos-img/all_projects.png -------------------------------------------------------------------------------- /en/editors_and_tools/cocos-img/cocos-structure-v1.0-160116.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/editors_and_tools/cocos-img/cocos-structure-v1.0-160116.png -------------------------------------------------------------------------------- /en/editors_and_tools/cocos-img/creating_a_new_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/editors_and_tools/cocos-img/creating_a_new_project.png -------------------------------------------------------------------------------- /en/editors_and_tools/cocos-img/main_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/editors_and_tools/cocos-img/main_window.png -------------------------------------------------------------------------------- /en/editors_and_tools/creator_to_cocos2dx-img/build_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/editors_and_tools/creator_to_cocos2dx-img/build_dialog.png -------------------------------------------------------------------------------- /en/editors_and_tools/creator_to_cocos2dx-img/dialog_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/editors_and_tools/creator_to_cocos2dx-img/dialog_options.png -------------------------------------------------------------------------------- /en/editors_and_tools/creator_to_cocos2dx-img/folder_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/editors_and_tools/creator_to_cocos2dx-img/folder_structure.png -------------------------------------------------------------------------------- /en/editors_and_tools/creator_to_cocos2dx-img/project_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/editors_and_tools/creator_to_cocos2dx-img/project_menu.png -------------------------------------------------------------------------------- /en/editors_and_tools/index.md: -------------------------------------------------------------------------------- 1 | ## Editors and Tools 2 | 3 | The Cocos platform provides the following __editors and tools__ to aid in development. 4 | 5 | - [Cocos Creator](https://docs.cocos2d-x.org/creator/manual/en/) 6 | - [Creator to Cocos2d-x tool](creator_to_cocos2dx.md) 7 | - [Cocos Command-line tool](cocosCLTool.md) 8 | - [Cocos GUI (**Deprecated**)](cocos.md) 9 | -------------------------------------------------------------------------------- /en/event_dispatcher/accelerometer.md: -------------------------------------------------------------------------------- 1 | ## Accelerometer events 2 | Some mobile devices come equipped with an accelerometer. An accelerometer is a 3 | sensor that measures g-force as well as changes in direction. A use case would 4 | be needing to move your phone back and forth, perhaps to simulate a balancing act. 5 | Cocos2d-x also supports these events and creating them is simple. 6 | Before using accelerometer events, you need to enable them on the device: 7 | 8 | ```cpp 9 | Device::setAccelerometerEnabled(true); 10 | ``` 11 | 12 | ```cpp 13 | // creating an accelerometer event 14 | auto listener = EventListenerAcceleration::create(CC_CALLBACK_2( 15 | AccelerometerTest::onAcceleration, this)); 16 | 17 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); 18 | 19 | // Implementation of the accelerometer callback function prototype 20 | void AccelerometerTest::onAcceleration(Acceleration* acc, Event* event) 21 | { 22 | // Processing logic here 23 | } 24 | ``` 25 | -------------------------------------------------------------------------------- /en/event_dispatcher/custom.md: -------------------------------------------------------------------------------- 1 | ## Custom Events 2 | The event types above are defined by the system, and the events (such as touch 3 | screen, keyboard response etc) are triggered by the system automatically. In 4 | addition, you can make your own custom events which are not triggered by the system, 5 | but by your code, as follows: 6 | 7 | ```cpp 8 | _listener = EventListenerCustom::create("game_custom_event1", [=](EventCustom* event){ 9 | std::string str("Custom event 1 received, "); 10 | char* buf = static_cast(event->getUserData()); 11 | str += buf; 12 | str += " times"; 13 | statusLabel->setString(str.c_str()); 14 | }); 15 | 16 | _eventDispatcher->addEventListenerWithSceneGraphPriority(_listener, this); 17 | ``` 18 | 19 | A custom event listener has been defined above, with a response method, and added 20 | to the event dispatcher. So how is the event handler triggered? Check it out: 21 | 22 | ```cpp 23 | static int count = 0; 24 | ++count; 25 | 26 | char* buf[10]; 27 | sprintf(buf, "%d", count); 28 | 29 | EventCustom event("game_custom_event1"); 30 | event.setUserData(buf); 31 | 32 | _eventDispatcher->dispatchEvent(&event); 33 | ``` 34 | 35 | The above example creates an EventCustom object and sets its UserData. It is then 36 | dispatched manually with `_eventDispatcher->dispatchEvent(&event)`. This triggers 37 | the event handler defined previously. The handler is called immediately so a local 38 | stack variable can be used as the UserData. 39 | -------------------------------------------------------------------------------- /en/event_dispatcher/getting_started.md: -------------------------------------------------------------------------------- 1 | ## What is the EventDispatch mechanism? 2 | __EventDispatch__ is a mechanism for responding to user events. 3 | 4 | The basics: 5 | 6 | * Event listeners encapsulate your event processing code. 7 | * Event dispatcher notifies listeners of user events. 8 | * Event objects contain information about the event. 9 | -------------------------------------------------------------------------------- /en/event_dispatcher/index.md: -------------------------------------------------------------------------------- 1 | ## Event Dispatcher 2 | Cocos2d-x provides a mecanism for handling __touch__, __keyboard__, __mouse__ and __custom__ events for user input and game play mechanics. 3 | -------------------------------------------------------------------------------- /en/event_dispatcher/keyboard.md: -------------------------------------------------------------------------------- 1 | ## Keyboard events 2 | For desktop games, you might want find using keyboard mechanics useful. 3 | Cocos2d-x supports keyboard events. Just like with touch events above, 4 | keyboard events are easy to create. 5 | 6 | ```cpp 7 | // creating a keyboard event listener 8 | auto listener = EventListenerKeyboard::create(); 9 | listener->onKeyPressed = CC_CALLBACK_2(KeyboardTest::onKeyPressed, this); 10 | listener->onKeyReleased = CC_CALLBACK_2(KeyboardTest::onKeyReleased, this); 11 | 12 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); 13 | 14 | // Implementation of the keyboard event callback function prototype 15 | void KeyboardTest::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event) 16 | { 17 | log("Key with keycode %d pressed", keyCode); 18 | } 19 | 20 | void KeyboardTest::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event) 21 | { 22 | log("Key with keycode %d released", keyCode); 23 | } 24 | ``` 25 | -------------------------------------------------------------------------------- /en/event_dispatcher/mouse.md: -------------------------------------------------------------------------------- 1 | ## Mouse events 2 | As it always has, Cocos2d-x supports mouse events. 3 | 4 | ```cpp 5 | _mouseListener = EventListenerMouse::create(); 6 | _mouseListener->onMouseMove = CC_CALLBACK_1(MouseTest::onMouseMove, this); 7 | _mouseListener->onMouseUp = CC_CALLBACK_1(MouseTest::onMouseUp, this); 8 | _mouseListener->onMouseDown = CC_CALLBACK_1(MouseTest::onMouseDown, this); 9 | _mouseListener->onMouseScroll = CC_CALLBACK_1(MouseTest::onMouseScroll, this); 10 | 11 | _eventDispatcher->addEventListenerWithSceneGraphPriority(_mouseListener, this); 12 | 13 | void MouseTest::onMouseDown(Event *event) 14 | { 15 | // to illustrate the event.... 16 | EventMouse* e = (EventMouse*)event; 17 | string str = "Mouse Down detected, Key: "; 18 | str += tostr(e->getMouseButton()); 19 | } 20 | 21 | void MouseTest::onMouseUp(Event *event) 22 | { 23 | // to illustrate the event.... 24 | EventMouse* e = (EventMouse*)event; 25 | string str = "Mouse Up detected, Key: "; 26 | str += tostr(e->getMouseButton()); 27 | } 28 | 29 | void MouseTest::onMouseMove(Event *event) 30 | { 31 | // to illustrate the event.... 32 | EventMouse* e = (EventMouse*)event; 33 | string str = "MousePosition X:"; 34 | str = str + tostr(e->getCursorX()) + " Y:" + tostr(e->getCursorY()); 35 | } 36 | 37 | void MouseTest::onMouseScroll(Event *event) 38 | { 39 | // to illustrate the event.... 40 | EventMouse* e = (EventMouse*)event; 41 | string str = "Mouse Scroll detected, X: "; 42 | str = str + tostr(e->getScrollX()) + " Y: " + tostr(e->getScrollY()); 43 | } 44 | ``` 45 | -------------------------------------------------------------------------------- /en/event_dispatcher/priority.md: -------------------------------------------------------------------------------- 1 | ## FixedPriority vs SceneGraphPriority 2 | The __EventDispatcher__ uses priorities to decide which listeners get delivered an event first. 3 | 4 | __Fixed Priority__ is an integer value. Event listeners with lower Priority values get to process events before event listeners with higher Priority values. 5 | 6 | __Scene Graph Priority__ is a pointer to a `Node`. Event listeners whose _Nodes_ have higher __z-order__ values (that is, are drawn on top) receive events before event listeners whose _Nodes_ have lower __z-order__ values (that is, are drawn below). This ensures that touch events, for example, get delivered front-to-back, as you would expect. 7 | 8 | Remember the __Basic Concepts__ chapter? Where we talked about the __scene graph__ and we talked about this diagram? 9 | 10 | ![](../basic_concepts/basic_concepts-img/in-order-walk.png "in-order walk") 11 | 12 | Well, when use __Scene Graph Priority__ you are actually walking this above tree 13 | backwards... __I__, __H__, __G__, __F__, __E__, __D__, __C__, __B__, __A__. If 14 | an event is triggered, __H__ would take a look and either __swallow__ it (more on this below) or let is pass through to __I__. Same thing, __I__ will either __consume__ it or let is pass through to __G__ and so on until the event either __swallowed__ it or does not get answered. 15 | -------------------------------------------------------------------------------- /en/event_dispatcher/registering.md: -------------------------------------------------------------------------------- 1 | ## Registering events with the dispatcher 2 | It is easy to register an event with the __Event Dispatcher__. Taking the sample 3 | touch event listener from above: 4 | 5 | ```cpp 6 | // Add listener 7 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, 8 | sprite1); 9 | ``` 10 | 11 | It is important to note that a touch event can only be registered once per object. 12 | If you need to use the same listener for multiple objects you should 13 | use __clone()__. 14 | 15 | ```cpp 16 | // Add listener 17 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, 18 | sprite1); 19 | 20 | // Add the same listener to multiple objects. 21 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1->clone(), 22 | sprite2); 23 | 24 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1->clone(), 25 | sprite3); 26 | ``` 27 | 28 | ## Removing events from the dispatcher 29 | An added listener can be removed with following method: 30 | 31 | ```cpp 32 | _eventDispatcher->removeEventListener(listener); 33 | ``` 34 | 35 | Although they may seem special, built-in `Node` objects use the __event dispatcher__ 36 | in the same way we have talked out. Makes sense, right? Take `Menu` for an example. 37 | When you have a `Menu` with `MenuItems` when you click them you are dispatching a 38 | event. You can also __removeEventListener()__ on built-in `Node` objects. 39 | -------------------------------------------------------------------------------- /en/event_dispatcher/types.md: -------------------------------------------------------------------------------- 1 | ## There are 5 types of event listeners. 2 | 3 | `EventListenerTouch` - responds to touch events 4 | 5 | `EventListenerKeyboard` - responds to keyboard events 6 | 7 | `EventListenerAcceleration` - responds to accelerometer events 8 | 9 | `EventListenMouse` - responds to mouse events 10 | 11 | `EventListenerCustom` - responds to custom events 12 | 13 | ## Swallowing Events 14 | When you have a listener and you want an object to accept the event it was given 15 | you must __swallow__ it. To say it another way, you __consume__ it so that it 16 | doesn't get passed to other objects in highest to lowest priority. This is easy 17 | to do. 18 | 19 | ```cpp 20 | // When "swallow touches" is true, then returning 'true' from the 21 | // onTouchBegan method will "swallow" the touch event, preventing 22 | // other listeners from using it. 23 | listener1->setSwallowTouches(true); 24 | 25 | // you should also return true in onTouchBegan() 26 | 27 | listener1->onTouchBegan = [](Touch* touch, Event* event){ 28 | // your code 29 | 30 | return true; 31 | }; 32 | ``` 33 | -------------------------------------------------------------------------------- /en/faq/Android-Studio_cmake_ninja.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/faq/Android-Studio_cmake_ninja.png -------------------------------------------------------------------------------- /en/faq/android.md: -------------------------------------------------------------------------------- 1 | ## Android 2 | 3 | ### generateJsonModelDebug FAILED 4 | To solve this issue, please import the project into __Android Studio__, click 5 | `Build/Refresh Linked C++ Projects`. 6 | 7 | ### Android Studio uses the __ninja__ build system 8 | __Android Studio__, itself, uses __ninja__ to build native codes. There is __ninja__ binary under __Cmake__ folder. If __Android Studio__ cannot find __ninja__ on __Windows__, it is the __Android Studio__ issue. You should set an environment variable that specifies the path to __ninja__: 9 | 10 | ![](Android-Studio_cmake_ninja.png) 11 | 12 | [__ninja binaries__](https://github.com/ninja-build/ninja/releases) are available as is [__ninja documentation__](https://ninja-build.org/). -------------------------------------------------------------------------------- /en/faq/cmake.md: -------------------------------------------------------------------------------- 1 | ## CMake 2 | 3 | ### CMake PIE 4 | It may be necessary to add the following line to __CMakeLists.txt__ if a __can not be used when making a PIE object;__ compiler is thrown: 5 | ```sh 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie -fexceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder") 7 | ``` -------------------------------------------------------------------------------- /en/faq/index.md: -------------------------------------------------------------------------------- 1 | ## F.A.Q Of Commonly Asked Technical Questions 2 | 3 | - [Android](android.md) 4 | - [CMake](cmake.md) 5 | - [Linux](linux.md) 6 | - [MacOS](macos.md) 7 | - [Windows](windows.md) 8 | -------------------------------------------------------------------------------- /en/faq/linux.md: -------------------------------------------------------------------------------- 1 | ## Linux 2 | 3 | ### FMOD issues 4 | Some users report issues with __libfmod__. If you encounter issues, please reference this post: [Error while building for linux: libfmod.so.6](https://discuss.cocos2d-x.org/t/error-while-building-for-linux-libfmod-so-6/26553/31?u=doyoque) 5 | 6 | ### CMake PIE 7 | It may be necessary to add the following line to __CMakeLists.txt__ if a __can not be used when making a PIE object;__ compiler is thrown: 8 | ```sh 9 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie -fexceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder") 10 | ``` -------------------------------------------------------------------------------- /en/faq/macos.md: -------------------------------------------------------------------------------- 1 | ## MacOS 2 | 3 | ### XCode PNG Compression issue 4 | It is possible that your PNG images contain incorrect color profiles. You can 5 | convert color profiles using __ImageMagick__ and the following 6 | command: 7 | 8 | ```sh 9 | find . -type f -name "*.png" -exec convert {} \; 10 | ``` 11 | -------------------------------------------------------------------------------- /en/faq/re-target-errors.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/faq/re-target-errors.jpeg -------------------------------------------------------------------------------- /en/index.md: -------------------------------------------------------------------------------- 1 | # Cocos2d-x v3 Docs 2 | 3 | ## Q4 2019 r.3 4 | ======= 5 | 6 | __Authors:__ SlackMoehrle, Minggo, Walzer, Jare 7 | 8 | __Special Thanks:__ To our users! Without you there is no reason to even write this guide. 9 | 10 | Please provide feedback for this guide on [GitHub](https://github.com/cocos2d/cocos2d-x-docs) 11 | 12 | For offline viewing, you can download a copy of our: 13 | 14 | For offline viewing, you can download a copy of our: 15 | 16 | - [Creator 1.9](https://docs.cocos2d-x.org/creator_1.9_docs.tar.gz) 17 | - [Creator 1.10](https://docs.cocos2d-x.org/creator_1.10_docs.tar.gz) 18 | - [Creator 2.0](https://docs.cocos2d-x.org/creator_2.0_docs.tar.gz) 19 | - [Creator 2.1](https://docs.cocos2d-x.org/creator_2.1_docs.tar.gz) 20 | - [Creator 2.2](https://docs.cocos2d-x.org/creator_2.2_docs.tar.gz) 21 | - [deprecated legacy documentation](https://docs.cocos2d-x.org/manual.tar.gz) 22 | - [deprecated WIKI](https://docs.cocos2d-x.org/wiki.tar.gz) 23 | - [Cocos2d-x Latest API Reference](https://docs.cocos2d-x.org/current-api-reference.tar.gz) -------------------------------------------------------------------------------- /en/installation/Android-Eclipse-img/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Eclipse-img/image2.png -------------------------------------------------------------------------------- /en/installation/Android-Eclipse-img/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Eclipse-img/image3.png -------------------------------------------------------------------------------- /en/installation/Android-Eclipse-img/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Eclipse-img/image4.png -------------------------------------------------------------------------------- /en/installation/Android-Eclipse-img/image5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Eclipse-img/image5.png -------------------------------------------------------------------------------- /en/installation/Android-Eclipse-img/image6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Eclipse-img/image6.png -------------------------------------------------------------------------------- /en/installation/Android-Eclipse.md: -------------------------------------------------------------------------------- 1 | # Android with Eclipse Installation and Setup 2 | 3 | ### Deprecated Document. Cocos2d-x V3.15 or less is the last supported version. 4 | 5 | ## Prerequisites 6 | * Completed the **[Android Command-Line Instructions](Android-terminal.md)** 7 | 8 | * Eclipse ADT Bundle [http://www.eclipse.org/downloads/](http://www.eclipse.org/downloads/) 9 | 10 | ## Open the proj.android project with Eclipse. 11 | 12 | * Launch Eclipse 13 | 14 | * Right click your mouse at the empty area of the __Package Explorer__ and choose 15 | __Import__. 16 | 17 | * Choose __Existing Android Code Into Workspace__ from the pop up dialog and Click 18 | __Next__. 19 | 20 | ![](Android-Eclipse-img/image2.png) 21 | 22 | * Click the __Browse__ button to choose the directory of __CPP-Tests__ `proj.android` 23 | and Click __Ok__. 24 | 25 | ![](Android-Eclipse-img/image3.png) 26 | 27 | * Click __Finish__. 28 | 29 | ## Import Libcocos2dx Project 30 | * Same steps as above only using the path of the __libcocos2dx__ project is 31 | __**your own game project folder**/cocos/2d/platform/android/java__. 32 | 33 | ![](Android-Eclipse-img/image5.png) 34 | 35 | ## Build and Run the Android Project 36 | * Connect your Android phone with __USB remote debugging__ option enabled. 37 | 38 | * Make sure your computer can recognize your phone (you might need to install 39 | drivers for your specific phone) 40 | 41 | * Right click on the project and choose __Run as__ -> __Android Application__. 42 | 43 | ![](Android-Eclipse-img/image6.png) 44 | -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/allow_haxm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/allow_haxm.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/build_cpp_tests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/build_cpp_tests.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/change_release_lua_tests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/change_release_lua_tests.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/debug_cpp_tests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/debug_cpp_tests.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/gradle_modify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/gradle_modify.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/quick_fix_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/quick_fix_install.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/sdkmanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/sdkmanager.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/sdkmanager_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/sdkmanager_1.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/sdkmanager_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/sdkmanager_2.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/sdkmanager_at_startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/sdkmanager_at_startup.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/sign_and_encrypt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/sign_and_encrypt.png -------------------------------------------------------------------------------- /en/installation/Android-Studio-img/toolbar_sdkmanager_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-Studio-img/toolbar_sdkmanager_1.png -------------------------------------------------------------------------------- /en/installation/Android-VisualStudio-img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-VisualStudio-img/1.png -------------------------------------------------------------------------------- /en/installation/Android-VisualStudio-img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-VisualStudio-img/2.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/1.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/2.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/3.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/android-cl-tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/android-cl-tools.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/android-list-targets1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/android-list-targets1.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/buildsuccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/buildsuccess.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/osx-android-list-targets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/osx-android-list-targets.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/osx-android-sdk-manager-tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/osx-android-sdk-manager-tools.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/osx-android-sdk-manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/osx-android-sdk-manager.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/osx-java.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/osx-java.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/setuppy01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/setuppy01.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/setuppy02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/setuppy02.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/setuppy03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/setuppy03.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/unzip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/unzip.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/unzipping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/unzipping.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step1.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step10.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step11.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step12.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step2.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step3.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step4.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step5.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step6.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step7.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step8.png -------------------------------------------------------------------------------- /en/installation/Android-terminal-img/win-step9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Android-terminal-img/win-step9.png -------------------------------------------------------------------------------- /en/installation/Linux-img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Linux-img/1.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/cpp-tests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/cpp-tests.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/double_click_installer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/double_click_installer.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/ide-build-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/ide-build-1.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/ide-build-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/ide-build-2.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/ide-build-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/ide-build-3.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/ide-import-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/ide-import-1.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/ide-import-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/ide-import-2.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/ide-import-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/ide-import-3.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/ide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/ide.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/installing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/installing.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/prompt_update_manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/prompt_update_manager.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/ready_to_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/ready_to_install.png -------------------------------------------------------------------------------- /en/installation/Tizen-img/updating_update_manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Tizen-img/updating_update_manager.png -------------------------------------------------------------------------------- /en/installation/Windows-Phone-img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-Phone-img/1.png -------------------------------------------------------------------------------- /en/installation/Windows-Phone-img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-Phone-img/2.png -------------------------------------------------------------------------------- /en/installation/Windows-Phone-img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-Phone-img/3.png -------------------------------------------------------------------------------- /en/installation/Windows-Phone-img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-Phone-img/4.png -------------------------------------------------------------------------------- /en/installation/Windows-Phone-img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-Phone-img/5.png -------------------------------------------------------------------------------- /en/installation/Windows-Phone-img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-Phone-img/6.png -------------------------------------------------------------------------------- /en/installation/Windows-img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-img/1.png -------------------------------------------------------------------------------- /en/installation/Windows-img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-img/2.png -------------------------------------------------------------------------------- /en/installation/Windows-img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/Windows-img/3.png -------------------------------------------------------------------------------- /en/installation/iOS-img/contents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/iOS-img/contents.png -------------------------------------------------------------------------------- /en/installation/iOS-img/iPhoneXSafeArea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/iOS-img/iPhoneXSafeArea.png -------------------------------------------------------------------------------- /en/installation/iOS-img/unzip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/iOS-img/unzip.png -------------------------------------------------------------------------------- /en/installation/iOS-img/unzipping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/installation/iOS-img/unzipping.png -------------------------------------------------------------------------------- /en/installation/index.md: -------------------------------------------------------------------------------- 1 | # Software Installations 2 | Cocos2d-x can be installed on OS X, Windows, Linux for development with the ability to deploy to iOS, Android, OS X, Windows and even game consoles. 3 | 4 | See **[Installation Prerequisites](prerequisites.md)** 5 | 6 | - [Android Studio](Android-Studio.md) 7 | - [Android Command-line (**Deprecated**)](Android-terminal.md) 8 | - [Android Eclipse (**Deprecated**)](Android-Eclipse.md) 9 | - [Android Visual Studio (**Deprecated**)](Android-VisualStudio.md) 10 | - [iOS](iOS.md) 11 | - [Linux](Linux.md) 12 | - [macOS](OSX.md) 13 | - [Tizen (**Deprecated**)](Tizen.md) 14 | - [Windows](Windows.md) 15 | - [Windows Phone (**Deprecated**)](Windows-Phone.md) 16 | -------------------------------------------------------------------------------- /en/other_node_types/getting_started.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | You are using `Sprite`, `Label` and `Action` objects in your game and it is making progress. Besides the basic `Node` types described in previous chapters, Cocos2d-x also provides more advanced `Node` types to help build special functionality. Perhaps you want to make a __tile-based__ game? Or maybe a __2d side scroller__? Or maybe you want to add particle effects to your game? Cocos2d-x provides `Node` objects to help you accomplish these goals! 3 | -------------------------------------------------------------------------------- /en/other_node_types/index.md: -------------------------------------------------------------------------------- 1 | ## Other Node Types 2 | Besides `Node`, you can add more advanced objects that are derived from `Node`. 3 | -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/particle1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/particle1.png -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/particle2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/particle2.png -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/particle3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/particle3.png -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/particle4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/particle4.png -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/particle5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/particle5.png -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/particle6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/particle6.png -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/particle7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/particle7.png -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/tilemap1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/tilemap1.png -------------------------------------------------------------------------------- /en/other_node_types/other_node_types-img/tilemap2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/other_node_types/other_node_types-img/tilemap2.png -------------------------------------------------------------------------------- /en/other_node_types/tilemap.md: -------------------------------------------------------------------------------- 1 | ## TileMap 2 | __TileMaps__ are maps made up of __tiles__. Each _tile_ can have independent behavior. 3 | __TileMaps__ are stored in an XML-based map format called `TMX`. `TMX` was originally 4 | designed for tile-based maps but is also suitable for more generic game levels 5 | due to its support for various object types. `TMX` objects are easy to create: 6 | 7 | ```cpp 8 | // reading in a tiled map. 9 | auto map = TMXTiledMap::create("TileMap.tmx"); 10 | addChild(map, 0, 99); // with a tag of '99' 11 | ``` 12 | 13 | Tile-based maps can have many layers, determined by a 14 | __z-order__. You can access a specific layer by it's name: 15 | 16 | ```cpp 17 | // how to get a specific layer 18 | auto map = TMXTiledMap::create("TileMap.tmx"); 19 | auto layer = map->getLayer("Layer0"); 20 | auto tile = layer->getTileAt(Vec2(1, 63)); 21 | ``` 22 | 23 | Each tile has a unique position and id. This makes it very easy to cherry pick 24 | specific tiles. You can access any tile by its id: 25 | 26 | ```cpp 27 | // to obtain a specific tiles id 28 | unsigned int gid = layer->getTileGIDAt(Vec2(0, 63)); 29 | ``` 30 | 31 | Example tiled-map layouts: 32 | 33 | ![](other_node_types-img/tilemap1.png "timemap1") 34 | 35 | ![](other_node_types-img/tilemap2.png "timemap2") 36 | 37 | How do you make a tiled-map? There are many tools that do this. [Tiled](http://mapeditor.org) 38 | is a popular tool. It is actively developed and has a great user community. The 39 | screen-shots above are actual __Tiled__ projects. 40 | -------------------------------------------------------------------------------- /en/physics/debugging.md: -------------------------------------------------------------------------------- 1 | ## Debugging Physics Body and Shapes 2 | If you ever wish to have red boxes drawn around your __physics bodies__ to aid in debugging, simple add these 2 lines to your core, where it makes sense to you. Perhaps `AppDelegate` is a good place? You can add the following code: 3 | 4 | ```cpp 5 | Director::getInstance()->getRunningScene()->getPhysics3DWorld()->setDebugDrawEnable(true); 6 | Director::getInstance()->getRunningScene()->setPhysics3DDebugCamera(cameraObjecct); 7 | ``` 8 | 9 | ## Disabling Physics 10 | Using the built-in __physics engine__ is a good idea. It is solid and advanced. However, if you wish to use an alternative __physics engine__ you can. All you need 11 | to do is disabling __CC_USE_PHYSICS__ in __base/ccConfig.h__. 12 | -------------------------------------------------------------------------------- /en/physics/index.md: -------------------------------------------------------------------------------- 1 | ## Physics 2 | Your game is coming along nicely. You have `Sprite` objects, gameplay mechanics and your coding efforts are paying off. You are starting to feel like your game 3 | is playable. What do you do when you realize your game needs to simulate real world situations? You know, __collision detection__, __gravity__, __elasticity__ and __friction__. Yes, you guessed it! This chapter is on __physics__ and the use of a __physics engine__. Let's explore the *when*, *wheres* and *whys* of using a __physics engine__. 4 | -------------------------------------------------------------------------------- /en/physics/physics-img/CollisionFiltering.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/physics/physics-img/CollisionFiltering.gif -------------------------------------------------------------------------------- /en/physics/physics-img/CollisionProcessing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/physics/physics-img/CollisionProcessing.gif -------------------------------------------------------------------------------- /en/physics/physics-img/CorrelationSprite.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/physics/physics-img/CorrelationSprite.gif -------------------------------------------------------------------------------- /en/physics/physics-img/RayTest.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/physics/physics-img/RayTest.gif -------------------------------------------------------------------------------- /en/physics/physics-img/joints.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/physics/physics-img/joints.PNG -------------------------------------------------------------------------------- /en/physics/physics-img/rectQuery1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/physics/physics-img/rectQuery1.gif -------------------------------------------------------------------------------- /en/physics/physics-img/rectQuery2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/physics/physics-img/rectQuery2.gif -------------------------------------------------------------------------------- /en/scenes/creating.md: -------------------------------------------------------------------------------- 1 | ## Creating a Scene 2 | It is very easy to create a `Scene` 3 | 4 | ```cpp 5 | auto myScene = Scene::create(); 6 | ``` 7 | 8 | ## Remember the Scene Graph? 9 | In __Chapter 2__ of this guide we learned about a __scene graph__ and how it affects 10 | the drawing of our game. The important thing to remember is that this defines 11 | the drawing order of the GUI elements. Also remember __z-order__! 12 | 13 | ## A Simple Scene 14 | Lets's build a simple `Scene`. Remember that Cocos2d-x uses a __right handed 15 | coordinate system__. This means that our _0,0_ coordinate is at the bottom left 16 | corner of the screen/display. When you start positioning your game elements this 17 | is where you should start your calculations from. Let's create a simple `Scene` 18 | and add a few elements to it: 19 | 20 | ```cpp 21 | auto dirs = Director::getInstance(); 22 | Size visibleSize = dirs->getVisibleSize(); 23 | 24 | auto myScene = Scene::create(); 25 | 26 | auto label1 = Label::createWithTTF("My Game", "Marker Felt.ttf", 36); 27 | label1->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2)); 28 | 29 | myScene->addChild(label1); 30 | 31 | auto sprite1 = Sprite::create("mysprite.png"); 32 | sprite1->setPosition(Vec2(100, 100)); 33 | 34 | myScene->addChild(sprite1); 35 | ``` 36 | 37 | When we run this code we shall see a simple `Scene` that contains a `Label` and 38 | a `Sprite`. It doesn't do much but it's a start. 39 | -------------------------------------------------------------------------------- /en/scenes/getting_started.md: -------------------------------------------------------------------------------- 1 | ## What is a Scene? 2 | A `Scene` is a container that holds `Sprites`, `Labels`, `Nodes` and other 3 | objects that your game needs. A `Scene` is responsible for running game logic and rendering the content on a per-frame basis. You need at least one `Scene` to start your game. You can think of this like a movie. The `Scene` is what is running and users see what is happening in real-time. You can have any number of `Scene` objects in your game and transition through them easily. Cocos2d-x provides __scene transitions__ and you can even have __scene transitions__ with cool effects. 4 | -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_1.png -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_10.jpg -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_11.jpg -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_2.png -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_3.png -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_4.jpg -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_5.png -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_6.jpeg -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_7.png -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_8.png -------------------------------------------------------------------------------- /en/scenes/scenes-img/5_9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/scenes/scenes-img/5_9.jpeg -------------------------------------------------------------------------------- /en/scripting/index.md: -------------------------------------------------------------------------------- 1 | ## Scripting 2 | Cocos2d-x provides a simple mechanism for using __Lua and JavaScript__ scripting inside of your game. 3 | -------------------------------------------------------------------------------- /en/sprites/getting_started.md: -------------------------------------------------------------------------------- 1 | ## What are Sprites 2 | A Sprite is a 2D image that can be animated or transformed by changing its 3 | properties, including __rotation__, __position__, __scale__, __color__, etc. 4 | -------------------------------------------------------------------------------- /en/sprites/index.md: -------------------------------------------------------------------------------- 1 | ## Sprites 2 | Cocos2d-x provides `Sprite` these are images for almost everyhing your game requires. 3 | -------------------------------------------------------------------------------- /en/sprites/spriteframe_cache.md: -------------------------------------------------------------------------------- 1 | ## Creating a Sprite from SpriteFrameCache 2 | This creates a `Sprite` by pulling it from the `SpriteFrameCache`. 3 | 4 | ```cpp 5 | // Our .plist file has names for each of the sprites in it. We'll grab 6 | // the sprite named, "mysprite" from the sprite sheet: 7 | auto mysprite = Sprite::createWithSpriteFrameName("mysprite.png"); 8 | ``` 9 | 10 | ![](sprites-img/i3.png "") 11 | 12 | ### Creating a Sprite from a SpriteFrame 13 | Another way to create the same `Sprite` is by fetching the `SpriteFrame` from the 14 | `SpriteFrameCache`, and then creating the `Sprite` with the `SpriteFrame`. Example: 15 | 16 | ```cpp 17 | // this is equivalent to the previous example, 18 | // but it is created by retrieving the SpriteFrame from the cache. 19 | auto newspriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("Blue_Front1.png"); 20 | auto newSprite = Sprite::createWithSpriteFrame(newspriteFrame); 21 | ``` 22 | 23 | ![](sprites-img/i3.png "") 24 | -------------------------------------------------------------------------------- /en/sprites/sprites-img/3_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/3_1.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i1.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i10.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i11.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i2.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i3.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i4.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i5.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i6.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i7.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i8.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/i9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/i9.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/polygonsprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/polygonsprite.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/spritesheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/spritesheet.png -------------------------------------------------------------------------------- /en/sprites/sprites-img/spritesheet.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/sprites/sprites-img/spritesheet.psd -------------------------------------------------------------------------------- /en/styles/jquery.cookie.min.js: -------------------------------------------------------------------------------- 1 | /*! jquery.cookie v1.4.1 | MIT */ 2 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}); -------------------------------------------------------------------------------- /en/styles/scripts.js: -------------------------------------------------------------------------------- 1 | 2 | $(function() { 3 | var key = "Cocos2d-x_pg_lang"; 4 | var switch_lang = function(l) { 5 | $('.langs li a').removeClass('selected'); 6 | $('#'+l).addClass('selected'); 7 | $('.tab_content').hide(); 8 | $('.'+l).show(); 9 | $.cookie(key, l); 10 | } 11 | $('.langs li a').click(function() {switch_lang(this.id);return false;}); 12 | var c = $.cookie(key); 13 | if (typeof c == 'undefined') c='tab-cpp'; 14 | switch_lang(c); 15 | }); 16 | -------------------------------------------------------------------------------- /en/tutorials/all-about-sprites/index.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/tutorials/all-about-sprites/index.md -------------------------------------------------------------------------------- /en/tutorials/index.md: -------------------------------------------------------------------------------- 1 | # Cocos2d-x Mini Tutorials 2 | Get started with particular areas of the __Cocos Engine__ by reading any one our mini tutorials. 3 | 4 | - [Storing Game Data](storing-game-data/index.md) 5 | -------------------------------------------------------------------------------- /en/ui_components/index.md: -------------------------------------------------------------------------------- 1 | ## UI Components 2 | Taking a look at the common apps you might use, I bet that you can spot UI 3 | widgets without necessarily knowing what they are. They aren't specific to games, every application probably uses a few widgets. What does __UI__ stand for? What do __UI__ widgets do? Oh so many questions! 4 | -------------------------------------------------------------------------------- /en/ui_components/loading_bar.md: -------------------------------------------------------------------------------- 1 | ## LoadingBar 2 | Have you ever played a game where you had to wait while it loaded up all the 3 | content it needed? It probably showed you a bar, filling in as it made progress 4 | accomplishing its task. This is often referred to as a __progress bar__, __status bar__ 5 | or a __loading bar__. Creating a `LoadingBar`: 6 | 7 | ```cpp 8 | #include "ui/CocosGUI.h" 9 | 10 | auto loadingBar = LoadingBar::create("LoadingBarFile.png"); 11 | 12 | // set the direction of the loading bars progress 13 | loadingBar->setDirection(LoadingBar::Direction::RIGHT); 14 | 15 | this->addChild(loadingBar); 16 | ``` 17 | 18 | In the above example a __loading bar__ is created and we set the direction it 19 | should fill towards as progress is made. In this case to the right direction. 20 | However, you probably need to change the percentage of the `LoadingBar`. This is 21 | easily done: 22 | 23 | ```cpp 24 | #include "ui/CocosGUI.h" 25 | 26 | auto loadingBar = LoadingBar::create("LoadingBarFile.png"); 27 | loadingBar->setDirection(LoadingBar::Direction::RIGHT); 28 | 29 | // something happened, change the percentage of the loading bar 30 | loadingBar->setPercent(25); 31 | 32 | // more things happened, change the percentage again. 33 | loadingBar->setPercent(35); 34 | 35 | this->addChild(loadingBar); 36 | ``` 37 | 38 | As you can see in the above example we specify a _.png_ image for the `LoadingBar` 39 | objects texture: 40 | 41 | ![](ui_components-img/LoadingBarFile.png "") 42 | 43 | On screen a `LoadingBar` might look like this: 44 | 45 | ![](ui_components-img/LoadingBar_example.png "") 46 | -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/Button_Disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/Button_Disable.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/Button_Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/Button_Normal.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/Button_Press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/Button_Press.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/Button_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/Button_example.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/CheckBoxNode_Disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/CheckBoxNode_Disable.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/CheckBoxNode_Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/CheckBoxNode_Normal.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/CheckBox_Disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/CheckBox_Disable.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/CheckBox_Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/CheckBox_Normal.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/CheckBox_Press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/CheckBox_Press.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/Checkbox_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/Checkbox_example.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LabelBMFont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LabelBMFont.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LabelTTF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LabelTTF.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LabelTTFWithConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LabelTTFWithConfig.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LabelWithGlow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LabelWithGlow.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LabelWithOutline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LabelWithOutline.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LabelWithShadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LabelWithShadow.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LabelWithSystemFont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LabelWithSystemFont.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LoadingBarFile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LoadingBarFile.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/LoadingBar_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/LoadingBar_example.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/SliderNode_Disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/SliderNode_Disable.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/SliderNode_Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/SliderNode_Normal.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/SliderNode_Press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/SliderNode_Press.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/Slider_Back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/Slider_Back.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/Slider_PressBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/Slider_PressBar.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/Slider_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/Slider_example.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/TextField_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/TextField_example.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/TextField_example_keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/TextField_example_keyboard.png -------------------------------------------------------------------------------- /en/ui_components/ui_components-img/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/en/ui_components/ui_components-img/menu.png -------------------------------------------------------------------------------- /index.html.en: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cocos2d-x-docs", 3 | "version": "1.16", 4 | "description": "Documentation", 5 | "main": "index.js", 6 | "dependencies": { 7 | "gitment": "0.0.3" 8 | }, 9 | "devDependencies": {}, 10 | "scripts": { 11 | "build": "gitbook install && gitbook build" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/cocos2d/cocos2d-x-docs.git" 16 | }, 17 | "author": "", 18 | "license": "", 19 | "bugs": { 20 | "url": "https://github.com/cocos2d/cocos2d-x-docs/issues" 21 | }, 22 | "homepage": "https://github.com/cocos2d/cocos2d-x-docs" 23 | } 24 | -------------------------------------------------------------------------------- /redirect-creator.html.en: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /redirect.html.en: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.0.0/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.0.0/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.0.0/aaad36fca8ee82ba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.0.0/aaad36fca8ee82ba.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.0.0/cf84c7fd94662682.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.0.0/cf84c7fd94662682.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.0.0/e2111e1c1903d928.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.0.0/e2111e1c1903d928.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.0.0/f83c83d8f3e12256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.0.0/f83c83d8f3e12256.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.1.1/0a645b1f5590a709.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.1.1/0a645b1f5590a709.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.1.1/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.1.1/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.1.1/715de315b8e4d235.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.1.1/715de315b8e4d235.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.1.1/c80bbccc845e6825.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.1.1/c80bbccc845e6825.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.1.2/0a645b1f5590a709.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.1.2/0a645b1f5590a709.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.1.2/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.1.2/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.1.2/715de315b8e4d235.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.1.2/715de315b8e4d235.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.1.2/c80bbccc845e6825.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.1.2/c80bbccc845e6825.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.0/04a003b7548644fe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.0/04a003b7548644fe.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.0/0d8d2f28392c1d7d.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.0/0d8d2f28392c1d7d.gif -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.0/494f9ee0583a7b2d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.0/494f9ee0583a7b2d.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.0/4bd7fdf2caa92f34.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.0/4bd7fdf2caa92f34.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.0/4f974266b8cfc41e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.0/4f974266b8cfc41e.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.0/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.0/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.0/c92f8e90299b07ba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.0/c92f8e90299b07ba.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.1/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.1/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.2.2/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.2.2/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.0/164137ab2674e953201b7f46cf12aca80c96df38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.0/164137ab2674e953201b7f46cf12aca80c96df38.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.0/4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.0/4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.0/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.0/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.0/80dfe00626626ec0abc28b839647c46fadbadc2b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.0/80dfe00626626ec0abc28b839647c46fadbadc2b.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.0/bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.0/bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.0/e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.0/e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.1/164137ab2674e953201b7f46cf12aca80c96df38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.1/164137ab2674e953201b7f46cf12aca80c96df38.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.1/4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.1/4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.1/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.1/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.1/80dfe00626626ec0abc28b839647c46fadbadc2b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.1/80dfe00626626ec0abc28b839647c46fadbadc2b.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.1/bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.1/bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.1/e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.1/e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.2/164137ab2674e953201b7f46cf12aca80c96df38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.2/164137ab2674e953201b7f46cf12aca80c96df38.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.2/4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.2/4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.2/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.2/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.2/80dfe00626626ec0abc28b839647c46fadbadc2b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.2/80dfe00626626ec0abc28b839647c46fadbadc2b.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.2/bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.2/bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.2/e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.2/e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.3/164137ab2674e953201b7f46cf12aca80c96df38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.3/164137ab2674e953201b7f46cf12aca80c96df38.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.3/4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.3/4ce2d965bfc6f1e2e15f985a88ac656646d89499_2_690x329.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.3/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.3/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.3/80dfe00626626ec0abc28b839647c46fadbadc2b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.3/80dfe00626626ec0abc28b839647c46fadbadc2b.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.3/bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.3/bf93d28f377bdd862d0b7039ccfae0b5c06bb897.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.3.3/e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.3.3/e5f0b6e2677b4a0b27cebef7536844f38d5396d0.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.4.0/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.4.0/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.4.0/a599d7541368fd870e1d30d10d30a99cc141b5ac.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.4.0/a599d7541368fd870e1d30d10d30a99cc141b5ac.gif -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.4.0/c5eae2d4c079ca26b5ffadac4ccf5da425108fe4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.4.0/c5eae2d4c079ca26b5ffadac4ccf5da425108fe4.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.4.0/cb50b7fea0ce137a7b2b80396d8225050eee3fc1_2_608x500.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.4.0/cb50b7fea0ce137a7b2b80396d8225050eee3fc1_2_608x500.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.7.0/5e094cd93e6df20b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.7.0/5e094cd93e6df20b.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v1.9.0/ce4acfd9e9b5aa553eed5291afcb3a4cf6f6ab3c_2_690x471.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v1.9.0/ce4acfd9e9b5aa553eed5291afcb3a4cf6f6ab3c_2_690x471.jpg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.0.4/e9cfeb9542d69b73e1db694aa2abe4b639be31b5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v2.0.4/e9cfeb9542d69b73e1db694aa2abe4b639be31b5.jpeg -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.0.7/v2.0.7.md: -------------------------------------------------------------------------------- 1 | ## Cocos Creator v2.0.7 released! 2 | 3 | ### Description of changes in this version: 4 | * Improve the font loading method on the web platform and fix the problem that individual TTF fonts must be loaded for a long time #3708 5 | * Fixed an issue where audio might not play after multiple reloads #3702 6 | * Fixed an issue where calling `cc.view.setFrameSize` does not take effect on the web platform 7 | 8 | ### Also fixed the following new issues in 2.0.7: 9 | 10 | * Fix native platform WebView, VideoPlayer related issues 11 | * The __rpk path__ of the debug platform window popped up after the Huawei small game platform clicks is inconsistent with the actual 12 | * If the fast game tool is not closed, the project will be opened after the project is switched. 13 | * Fixed an error caused by the failure of loading ttf in WeChat open data domain 14 | * Fixed a problem of not generating a web-mobile folder when building a web-mobile platform 15 | * Fix ios platform empty packet compilation error (ios) 16 | 17 | ### Downloads 18 | [Cocos Creator 2.0.7 for Windows](http://cocos2d-x.org/filedown/CocosCreator_v2.0.7_win) 19 | [Cocos Creator 2.0.7 for MacOS](http://cocos2d-x.org/filedown/CocosCreator_v2.0.7_mac) 20 | 21 | ### Documentation 22 | [Cocos Creator 2.0.x Documentation](https://docs.cocos2d-x.org/creator/manual/en/) 23 | -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.0.8/v2.0.8.md: -------------------------------------------------------------------------------- 1 | ## Cocos Creator v2.0.8 released! 2 | This version is a bug fix release. Changelog: 3 | 4 | * A reset method has been added to the `cc.WXSubContextView` component to allow the user to properly reset the view size by calling this API when switching between subdomain views. [PR](https://github.com/cocos-creator/engine/pull/3718) 5 | * Fixed that on some Android WeChat 7.0.3 models, Retina will still be blurred. 6 | * Fixed frame rate instability caused by listening to Device Motion on Android WeChat 7.0.3 7 | * Fix the problem that the WeChat game sub-package will load when it does not contain any resources. 8 | * Fix an issue where BMFont is not available in WeChat open data domain 9 | * Fix RichText's use of the font tag is invalid 10 | * Fix an issue where RichText can't pass arguments when using the on tag 11 | * Fix the problem that the editor can't build a project from the command line 12 | * Adapting scene scaling issues after downgrading from Creator 2.1 to 2.0 13 | 14 | ### Downloads 15 | [Cocos Creator 2.0.8 for Windows](http://cocos2d-x.org/filedown/CocosCreator_v2.0.8_win) 16 | [Cocos Creator 2.0.8 for MacOS](http://cocos2d-x.org/filedown/CocosCreator_v2.0.8_mac) 17 | 18 | ### Documentation 19 | [Cocos Creator 2.0.x Documentation](https://docs.cocos2d-x.org/creator/manual/en/) 20 | -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.0.9/s_37139874B14595506173FAFBA5A8940D8F22E79506816B4BCD08BDDACC9CF8A3_1550049670008_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v2.0.9/s_37139874B14595506173FAFBA5A8940D8F22E79506816B4BCD08BDDACC9CF8A3_1550049670008_image.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.0.9/s_37139874B14595506173FAFBA5A8940D8F22E79506816B4BCD08BDDACC9CF8A3_1550051516233_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v2.0.9/s_37139874B14595506173FAFBA5A8940D8F22E79506816B4BCD08BDDACC9CF8A3_1550051516233_image.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.1.0/26ace32fcb53e9aa4679a723b08c879e1514c376.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v2.1.0/26ace32fcb53e9aa4679a723b08c879e1514c376.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.1.0/53aa4edf4aeebbf248b170301fa41c4842a9dee9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v2.1.0/53aa4edf4aeebbf248b170301fa41c4842a9dee9.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.1.0/9dfca1c23dea20cd123da113d0323bd07b98d94e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v2.1.0/9dfca1c23dea20cd123da113d0323bd07b98d94e.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.1.0/b5ff9d1aa18074ee861d4f910629f18b166c6225.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v2.1.0/b5ff9d1aa18074ee861d4f910629f18b166c6225.png -------------------------------------------------------------------------------- /release_notes/cocos-creator/v2.1.0/e9f4bb2c1f77a432452ef5bd03aa6849f0765f6e_2_491x500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/release_notes/cocos-creator/v2.1.0/e9f4bb2c1f77a432452ef5bd03aa6849f0765f6e_2_491x500.png -------------------------------------------------------------------------------- /release_notes/cocos2d-x/v3.14.1.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 4 | 5 | - [Cocos2d-x 3.14.1 Release Notes](#cocos2d-x-3141-release-notes) 6 | - [Misc Information](#misc-information) 7 | - [v3.14.1](#v3141) 8 | - [Bug fixed](#bug-fixed) 9 | 10 | 11 | 12 | # Cocos2d-x 3.14.1 Release Notes # 13 | 14 | # Misc Information 15 | 16 | * [Full Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG) 17 | 18 | # v3.14.1 19 | 20 | ## Bug fixed 21 | 22 | * May crash if using `Scene::createWithPhysics()` to create a scene and physics3d camera is not set 23 | * May have link error because of glfw conflict on Linux 24 | * Sprite: created from sprite frame with polygon information can not work correctly 25 | * Lua: link error with VS2015 26 | * Lua: compiling error if using `cocos compile/run -p android --android-studio` on Android 27 | 28 | Can refer to [v3.14.1 milestone](https://github.com/cocos2d/cocos2d-x/milestone/36?closed=1) for detail informations of all PRs/issues. 29 | -------------------------------------------------------------------------------- /release_notes/cocos2d-x/v3.15.1.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 4 | 5 | - [Cocos2d-x 3.15.1 Release Notes](#cocos2d-x-3151-release-notes) 6 | - [Misc Information](#misc-information) 7 | - [v3.15.1](#v3151) 8 | - [Highlights](#highlights) 9 | 10 | 11 | 12 | # Cocos2d-x 3.15.1 Release Notes # 13 | 14 | # Misc Information 15 | 16 | * [Full Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG) 17 | 18 | # v3.15.1 19 | 20 | ## Highlights 21 | 22 | * add optimization codes for Huawei devices 23 | -------------------------------------------------------------------------------- /release_notes/cocos2d-x/v3.17.1.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 4 | 5 | - [Cocos2d-x 3.17.1 Release Notes](#cocos2d-x-3171-release-notes) 6 | - [Highlights](#highlights) 7 | 8 | 9 | 10 | # Cocos2d-x 3.17.1 Release Notes # 11 | 12 | The 3.17.1 release focuses on bug fixing. 13 | 14 | ## Highlights 15 | 16 | - Fix Lua loading performance drop bug introduced in 3.17 17 | - Renderer limit glClear invoke times, reduce power consuming 18 | - optimize CMake script,fix some linking issues 19 | - Android use CMake as default PROP_BUILD_TYPE value 20 | - Android upgrade Gradle to 4.6, SDK 28, android gradle plugin 3.1.0 21 | - upgrade LuaJIT to 2.1.0-beta3, fix random crash in 3.17 Lua release mode 22 | - upgrade libwebsockets to 2.4.2 23 | - FileUtils provide thread-safe implementation and add missing cross-platform interfaces 24 | - limit Labels text length to fix render error 25 | - add Downloader binding to Lua 26 | 27 | This release contains more than 45 bugs fixed and 34 misc improvements, please refer to [ChangeLog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG) 28 | 29 | -------------------------------------------------------------------------------- /release_notes/cocos2d-x/v3.17.2.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 4 | 5 | - [Cocos2d-x 3.17.2 Release Notes](#cocos2d-x-3172-release-notes) 6 | - [Highlights](#highlights) 7 | 8 | 9 | 10 | # Cocos2d-x 3.17.2 Release Notes # 11 | 12 | Version 3.17.2 focuses on bugs fixing and performance opimization on OPPO devices. 13 | 14 | ## Highlights 15 | 16 | - Performance optimization on OPPO devices 17 | - Fixed bug that`FileUtils::listFiles()` can not work correctly if the file path starts with `assets/` on Android 18 | - Fixed crash caused by Audio on iOS 19 | - Fixed bug that `VideoPlayer` can not play video in obb file on Android 20 | 21 | More detail change log please refer to [ChangeLog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG). 22 | 23 | -------------------------------------------------------------------------------- /zh/3d/animation.md: -------------------------------------------------------------------------------- 1 | # 3D 动画 2 | 3 | 我们知道 3D 精灵对游戏很重要,也学会了如何操纵,但是可能还希望能有一些更丰富的效果。 4 | 5 | 那就添加动画吧! 6 | 7 | 要运行 3D 动画,你需要使用 `Animation3D` 和 `Animate3D` 对象,首先用 `Animation3D` 加载一个动画文件,然后使用 `Animate3D` 完成添加。 8 | 9 | 示例: 10 | 11 | ```cpp 12 | // the animation is contained in the .c3b file 13 | auto animation = Animation3D::create("orc.c3b"); 14 | 15 | // creates the Action with Animation object 16 | auto animate = Animate3D::create(animation); 17 | 18 | // runs the animation 19 | sprite->runAction(RepeatForever::create(animate)); 20 | ``` 21 | 22 | 去运行本文档的代码示例看看效果,_记住,3D 动画与 2D 动画基本相同。2D 动画可参考本文档的 [第四章](../actions/index.md)_ 23 | 24 | ## 多动画 25 | 26 | 当想同时运行多个动画时,该怎么办?你可以创建多个动画,并指定开始时间和动画长度参数,两个参数的单位都是秒。例如: 27 | 28 | ```cpp 29 | auto animation = Animation3D::create(fileName); 30 | 31 | auto runAnimate = Animate3D::create(animation, 0, 2); 32 | sprite->runAction(runAnimate); 33 | 34 | auto attackAnimate = Animate3D::create(animation, 3, 5); 35 | sprite->runAction(attackAnimate); 36 | ``` 37 | 38 | 在上面的例子中,有两个动画可以运行,第一个从动画启动时开始然后持续 2 秒,第二个在 3 秒时开始然后持续 5 秒。 39 | 40 | ## 动画速度 41 | 42 | 动画速度由一个整数控制,整数的绝对值代表动画的持续时间,整数大于零动画正序播放,整数小于零倒序播放。速度设置为 10 意味着动画在 10 秒内正序播放完。 43 | 44 | ## 动画混合 45 | 46 | 使用多个动画时,会在每个动画之间自动应用混合,混合的目的是为了创造平滑的过渡。给定两个动画 A 和 B, 动画 A 最后一小段时间的几帧会和动画 B 前一小段时间的几帧重叠,这使得动画的变化看起来很自然。默认的混合的时间是 0.1 秒,你可以使用 `Animate3D::setTransitionTime` 更改默认的混合时间。 47 | 48 | Cocos2d-x 支持关键帧之间的线性插值,这能填补曲线上的空白,确保光滑的路径。如果在模型构建时指定了其它插值方法,我们内置的工具 _fbx-conv_ 将生成额外的关键帧,这种补偿通常根据目标框架完成。 49 | _有关 fbx-conv 的更多信息,请参考本章末尾的讨论_ 50 | -------------------------------------------------------------------------------- /zh/3d/cubemap.md: -------------------------------------------------------------------------------- 1 | # 立方体纹理(TextureCube) 2 | 3 | 立方体纹理是放置在立方体各个表面上的六个单独的方形纹理的集合。大多数情况下,它们用于在物体上显示无限远的反射,类似于天空盒在背景中显示远处的风景。一个展开的立方体纹理可能是这样的: 4 | 5 | ![](../../en/3d/3d-img/Cubemap.jpg) 6 | 7 | 在 Cocos2d-x 中,这样创建立方体纹理: 8 | 9 | ```cpp 10 | // create a textureCube object with six texture assets 11 | auto textureCube = TextureCube::create("skybox/left.jpg", "skybox/right.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg"); 12 | 13 | // set cube map texture parameters 14 | Texture2D::TexParams tRepeatParams; 15 | tRepeatParams.magFilter = GL_NEAREST; 16 | tRepeatParams.minFilter = GL_NEAREST; 17 | tRepeatParams.wrapS = GL_MIRRORED_REPEAT; 18 | tRepeatParams.wrapT = GL_MIRRORED_REPEAT; 19 | textureCube->setTexParameters(tRepeatParams); 20 | 21 | // create and set our custom shader 22 | auto shader = GLProgram::createWithFilenames("cube_map.vert", "cube_map.frag"); 23 | auto _state = GLProgramState::create(shader); 24 | 25 | // bind cube map texture to uniform 26 | state->setUniformTexture("u_cubeTex", textureCube); 27 | ``` 28 | -------------------------------------------------------------------------------- /zh/3d/index.md: -------------------------------------------------------------------------------- 1 | # 3D 支持 2 | 3 | 你很可能认为 Cocos2d-x 是一个纯 2D 游戏引擎,事实上,从 3.0 版本 3D 功能就开始了添加和完善。 4 | 5 | 3D 游戏开发可能对你来说很新奇,相关的术语也还不熟悉,有什么工具也还不知道,但是别担心,让我们从术语开始一一了解。 6 | 7 | ## 术语 8 | 9 | 进行 3D 游戏开发前,先熟悉一些常用术语: 10 | 11 | * __Model(模型)__ - 可以呈现的对象。由一个一个的多边形组成,Cocos2d-x 中对应 `Sprite3D`。 12 | 13 | * __Mesh(网格)__ - 指模型的网格,由 3D 模型被划分的多边形构成。 14 | 15 | * __Texture(纹理)__ - 纹理使 3D 模型有了表现真实物体复杂表面的能力,模型的所有表面和顶点都可以被映射纹理。 16 | 17 | * __Camera(摄像机)__ - 3D 世界中的眼睛 ,通过它能获得一个角度的世界场景。同一个世界,通过设置不同的摄像机参数,可以获得不同的场景。 18 | 19 | * __Light(光照)__ - 3D 世界中的光照,通过设置光照让游戏场景看起来更真实。光照效果,会影响 3D 模型表面的明暗效果,色彩效果。 20 | 21 | > Cocos2d-x 内附带的 3D 功能已经不再更新 -------------------------------------------------------------------------------- /zh/3d/skybox.md: -------------------------------------------------------------------------------- 1 | # 天空盒(Skybox) 2 | 3 | __`天空盒(Skybox)`__ 是整个场景的一个包裹,显示了几何之外的世界。你可以使用 `Skybox` 来模拟无限的天空,山脉等现象。 4 | 5 | ![](../../en/3d/3d-img/Skybox.png) 6 | 7 | `Skybox` 的创建: 8 | 9 | ```cpp 10 | // create a Skybox object 11 | auto box = Skybox::create(); 12 | 13 | // set textureCube for Skybox 14 | box->setTexture(_textureCube); 15 | 16 | // attached to scene 17 | _scene->addChild(box); 18 | ``` 19 | -------------------------------------------------------------------------------- /zh/3d/tools.md: -------------------------------------------------------------------------------- 1 | # 常用工具 2 | 3 | ## 3D 编辑器 4 | 5 | 3D 编辑器是用于构建 3D 模型的工具集合,有商业的和免费的可用,这是其中一些受欢迎的编辑器: 6 | 7 | * [Blender (Free)](http://www.blender.org/) 8 | * [3DS Max](http://www.autodesk.com/products/3ds-max/overview) 9 | * [Cinema4D](http://www.maxon.net/products/) 10 | * [Maya](http://www.autodesk.com/products/maya/overview) 11 | 12 | 大多数 3D 编辑器都能将文件保存成通用的格式,方便文件在其它编辑器中使用,同时也方便了游戏引擎对 3D 模型的导入和使用。 13 | 14 | ## Cocos2d-x 提供的工具 15 | 16 | Cocos2d-x 提供了一个转换工具,可以将编辑器生成的通用格式转换为引擎支持的格式。 17 | 18 | ### fbx-conv 命令行 19 | 20 | __`fbx-conv`__ 允许将 _FBX_ 格式转换为 Cocos2d-x 专有格式。 _FBX_ 是最受欢迎的 3D 文件格式,被所有编辑器支持。 命令行工具默认的导出文件格式是 _.c3b_ 。 21 | 22 | 命令行的使用: 23 | 24 | ```sh 25 | fbx-conv [-a|-b|-t] FBXFile 26 | ``` 27 | 28 | 参数含义: 29 | 30 | * -?:显示帮助信息 31 | * -a:导出文本格式和二进制格式 32 | * -b:导出二进制格式 33 | * -t:导出文本格式 34 | 35 | 示例: 36 | 37 | ```sh 38 | fbx-conv -a boss.FBX 39 | ``` 40 | 41 | 工具使用注意点: 42 | 43 | * 模型需要一个至少包含一个纹理的材质 44 | * 只支持骨骼动画 45 | * 只支持一个骨骼对象,没有多个骨骼对象的支持 46 | * 您可以通过导出多个静态模型来创建一个 3D 场景 47 | * 网格顶点或索引的最大数量为 32767 48 | 49 | ## 3D 文件格式 50 | 51 | Cocos2d-x 目前支持两种 3D 文件格式: 52 | 53 | * Wavefront 对象文件:_.obj_ 文件 54 | * Cocos2d-x 专有格式:_.c3t_ ,_.c3b_ 文件 55 | 56 | 支持 Wavefront 文件格式,因为它被 3D 编辑器广泛采用,并且非常容易解析。然而,它是有缺点的,不支持诸如动画的高级功能。 57 | 58 | 另一方面,_c3t_ 和 _c3b_ 是 Cocos2d-x 专有的文件格式,允许动画,材质和其它高级3D功能。_c3t_ 是文本格式,_c3b_ 是二进制格式。开发人员进行最终的游戏发布时应使用 _c3b_ ,因为使用它性能更好。如果是想要调试文件,或是跟踪其在 Git 或任何其他版本控制系统中的更改,则应使用 _c3t_ 。 59 | 60 | > 注意:可以使用 _c3b_ 或 _c3t_ 文件,不能使用 _obj_ 文件,创建 _Animation3D_ 对象。 61 | -------------------------------------------------------------------------------- /zh/README.md: -------------------------------------------------------------------------------- 1 | # Cocos2d-x 中文文档 2 | 3 | ## 环境准备 4 | 5 | 进行文档开发,需要先准备 GitBook 环境: 6 | 7 | 1. [Node.js](https://nodejs.org/en/) 8 | 1. [npm](https://www.npmjs.com/) 一般会和 Node.js 一起安装 9 | 1. 安装 gitbook 命令行工具,运行命令 `npm install gitbook-cli -g` 10 | 1. 安装 gitbook,运行命令 `gitbook install` 11 | 12 | ## 工作流程 13 | 14 | 进行正式开发前最好能先熟悉一下 GitBook,流程如下: 15 | 16 | - Fork 文档仓库 [cocos2d-x-docs](https://github.com/cocos2d/cocos2d-x-docs) 17 | - clone 仓库到本地,进行改动 18 | - 使用 `gitbook serve` 命令测试改动在 GitBook 中的效果 19 | - 提交 pull request 到 cocos2d/cocos2d-x-docs 仓库 20 | - 我们会 review 这个 PR,并将内容合并到主仓库 21 | 22 | ## 注意事项 23 | 24 | - 改动中文文档,请将改动限制在 __zh/__ 目录 25 | - 避免使用过大的图片,过大的图片会造成加载缓慢,甚至加载失败 26 | - 文档书写规范请参考:[中文文档格式规范](https://github.com/anjuke/coding-style/blob/master/text/chinese.md) 27 | - 代码块要以一种特殊的方式包裹,可以模仿已有代码块的包裹方式. 28 | - 例如 C++ 代码块: 29 | ```html 30 | ```cpp 31 | auto mySprite = Sprite::create("mysprite.png", Rect(0,0,40,40)); 32 | ``` 33 | 34 | 文档的开发,Cocos2d-x 开源社区的建设,期待你的加入! 35 | -------------------------------------------------------------------------------- /zh/_layouts/website/header.html: -------------------------------------------------------------------------------- 1 | {% extends template.self %} 2 | {% block book_header %} 3 | 23 | 33 | {% endblock %} -------------------------------------------------------------------------------- /zh/_layouts/website/page.html: -------------------------------------------------------------------------------- 1 | {% extends template.self %} 2 | {% block book_sidebar %} 3 | 23 | {{ super() }} 24 | {% endblock %} 25 | {% block javascript %} 26 | {{ super() }} 27 | 40 | {% endblock %} -------------------------------------------------------------------------------- /zh/about/help.md: -------------------------------------------------------------------------------- 1 | # 获取帮助 2 | 3 | 在 Cocos2d-x 的使用过程中,您可以通过下面的方式获取帮助: 4 | 5 | - [Cocos 中文社区](https://forum.cocos.com/) 6 | - [Cocos2d-x GitHub](https://github.com/cocos2d/cocos2d-x) 7 | - [API 编程接口](https://docs.cocos2d-x.org/api-ref/index.html) 8 | - [Cocos引擎官方微博](http://t.sina.com.cn/cocos2dx) 9 | -------------------------------------------------------------------------------- /zh/about/index.md: -------------------------------------------------------------------------------- 1 | # 引擎优势 2 | 3 | Cocos2d-x 是 MIT 许可证下发布的一款功能强大的开源游戏引擎。 4 | 5 | 允许开发人员使用 C++、Javascript 及 Lua 三种语言来进行游戏开发。 6 | 7 | 支持所有常见平台,包括 iOS、Android、Windows、macOS、Linux。 8 | 9 | ## 引擎特性 10 | 11 | - 现代化的 C++ API 12 | - 立足于 C++ 同时支持 JavaScript/Lua 作为开发语言 13 | - 可以跨平台部署, 支持 iOS、Android、Windows、macOS 和 Linux 14 | - 可以在 PC 端完成游戏的测试,最终发布到移动端 15 | - 完善的游戏功能支持,包含精灵、动作、动画、粒子特效、场景转换、事件、文件 IO、数据持久化、骨骼动画、3D 16 | 17 | ## 市场占有 18 | 19 | Cocos2d-x 用户不仅包括个人开发者和游戏开发爱好者,还包括许多知名大公司如 Zynga、Wooga、Gamevil、Glu、GREE、Konami、TinyCo、HandyGames、IGG 及 Disney Mobile 等。 20 | 21 | 使用 Cocos2d-x 开发的许多游戏占据苹果应用商店和谷歌应用商店排行榜,同时许多公司如触控、谷歌、微软、ARM,英特尔及黑莓的工程师在 Cocos2d-x 领域也非常活跃。 22 | 23 | 在中国,每一年的手游榜单大作,Cocos2d-x 从未缺席,市场份额占 50% 以上,游戏品类覆盖从轻度休闲,热火棋牌,到横版,SLG,重度 MMO 等市面全品类。一些以 Cocos2d-x 为基础开发出的游戏如下: 24 | 25 | ![](./res/powerbycocos.png) 26 | 27 | > 您可以从 [官网页面](//www.cocos.com/download) 下载一个正式发布版本,也可以直接从 [GitHub](https://github.com/cocos2d/cocos2d-x) 克隆。无论您用 C++、JavaScript 还是 Lua 语言进行游戏开发,只需要下载这一个引擎。 -------------------------------------------------------------------------------- /zh/about/learn.md: -------------------------------------------------------------------------------- 1 | # 学习资源 2 | 3 | ## 官方资源 4 | 5 | 本文档就是最好的入门学习资源,其它一些有用的资源如下: 6 | 7 | - [Cocos官网](https://www.cocos.com/) 8 | - [中文社区](https://forum.cocos.com) 9 | - [引擎官方测试项目](https://github.com/cocos2d/cocos2d-x/tree/v3/tests) 10 | 11 | > _测试项目的编译和运行在 [环境搭建章节](../installation/index.md) 介绍_ 12 | 13 | ## 网络资源 14 | 15 | - [zilongshanren.com/categories/Cocos2d-x/](https://zilongshanren.com/categories/Cocos2d-x/) 16 | - [learnopengl-cn.github.io/](https://learnopengl-cn.github.io/) 17 | - [github.com/fusijie/Cocos-Resource](https://github.com/fusijie/Cocos-Resource) -------------------------------------------------------------------------------- /zh/about/res/codeblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/about/res/codeblock.png -------------------------------------------------------------------------------- /zh/about/res/powerbycocos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/about/res/powerbycocos.png -------------------------------------------------------------------------------- /zh/actions/index.md: -------------------------------------------------------------------------------- 1 | # 动作(Action) 2 | 3 | __动作(Action)__ 的功能就和字面含义一样,它通过改变一个 `Node` 对象的属性,让它表现出某种动作。动作对象能实时的改变 `Node` 的属性,任何一个对象只要它是 `Node` 的子类都能被改变。比如,你能通过动作对象把一个精灵从一个位置移动到另一个位置。 4 | 5 | 通过 `MoveTo` 和 `MoveBy` 方法: 6 | 7 | ```cpp 8 | // Move sprite to position 50,10 in 2 seconds. 9 | auto moveTo = MoveTo::create(2, Vec2(50, 10)); 10 | mySprite1->runAction(moveTo); 11 | 12 | // Move sprite 20 points to right in 2 seconds 13 | auto moveBy = MoveBy::create(2, Vec2(20,0)); 14 | mySprite2->runAction(moveBy); 15 | ``` 16 | 17 | ## By 和 To 的区别 18 | 19 | 你能注意到,每一个动作都会有两个方法 __By__ 和 __To__。两种方法方便你在不同的情况使用,__By__ 算的是相对于节点对象的当前位置,__To__ 算的是绝对位置,不考虑当前节点对象在哪。如果你想动作的表现是相对于 `Node` 当前位置的,就用 __By__,相对的想让动作的表现是按照坐标的绝对位置就用 __To__。看一个例子: 20 | 21 | ```cpp 22 | auto mySprite = Sprite::create("mysprite.png"); 23 | mySprite->setPosition(Vec2(200, 256)); 24 | 25 | // MoveBy - lets move the sprite by 500 on the x axis over 2 seconds 26 | // MoveBy is relative - since x = 200 + 500 move = x is now 700 after the move 27 | auto moveBy = MoveBy::create(2, Vec2(500, mySprite->getPositionY())); 28 | 29 | // MoveTo - lets move the new sprite to 300 x 256 over 2 seconds 30 | // MoveTo is absolute - The sprite gets moved to 300 x 256 regardless of 31 | // where it is located now. 32 | auto moveTo = MoveTo::create(2, Vec2(300, mySprite->getPositionY())); 33 | 34 | // Delay - create a small delay 35 | auto delay = DelayTime::create(1); 36 | 37 | auto seq = Sequence::create(moveBy, delay, moveTo, nullptr); 38 | 39 | mySprite->runAction(seq); 40 | ``` 41 | 42 | ![](../../en/actions/actions-img/i0.png "") 43 | -------------------------------------------------------------------------------- /zh/advanced_topics/index.md: -------------------------------------------------------------------------------- 1 | # 高级话题 2 | 3 | 哇!你已经读到最后一章了,干得不错! 4 | 5 | 现在对于使用 Cocos2d-x 开发游戏,你应该各方面都很清楚了。但是,务必要意识到学无止境!本章就介绍一些高级的、技术性强的东西。 6 | 7 | 8 | 9 | 24 | -------------------------------------------------------------------------------- /zh/advanced_topics/networking.md: -------------------------------------------------------------------------------- 1 | # 网络访问 2 | 3 | ## 使用 HTTP 进行网络访问 4 | 5 | 有时候我们需要从网络上获取资源数据,一种常见的解决方法就是使用 HTTP 进行网络访问。 6 | 7 | 使用 HTTP 进行网络访问有三个步骤: 8 | 9 | 1. 创建一个 HTTP 请求 `HttpRequest` 10 | 1. 通过 `setResponseCallback()` 设置一个请求完成时的回调函数 11 | 1. 使用 `HttpClient` 发送 `HttpRequest` 12 | 13 | `HttpRequest` 有四种类型:_POST_ _PUT_ _DELETE_ _UNKNOWN_。除非指定请求的类型,否则就默认 UNKNOWN。`HttpClient` 对象负责请求的发送,也负责数据的接收。 14 | 15 | 示例: 16 | 17 | ```cpp 18 | HttpRequest* request = new (std :: nothrow) HttpRequest(); 19 | request->setUrl("//just-make-this-request-failed.com"); 20 | request->setRequestType(HttpRequest::Type::GET); 21 | request->setResponseCallback(CC_CALLBACK_2 (HttpClientTest::onHttpRequestCompleted, this)); 22 | 23 | HttpClient::getInstance()->sendImmediate(request); 24 | 25 | request->release(); 26 | ``` 27 | 28 | 注意,我们通过 `setResponseCallback()` 设置请求完成时的回调函数了。这样做,在请求完成时,我们就能查看返回的数据,并提取出我们需要的。 29 | 30 | 回调函数的写法很简单,可以像这样做: 31 | 32 | ```cpp 33 | void HttpClientTest::onHttpRequestCompleted(HttpClient* sender, HttpResponse* response) 34 | { 35 | if (!response) 36 | { 37 | return; 38 | } 39 | 40 | // Dump the data 41 | std::vector* buffer = response->getResponseData(); 42 | 43 | for (unsigned int i = 0; i size (); i ++) 44 | { 45 | log ("% c", (* buffer) [i]); 46 | } 47 | } 48 | ``` 49 | -------------------------------------------------------------------------------- /zh/audio/engines.md: -------------------------------------------------------------------------------- 1 | ## Are your audio needs more advanced? 2 | 3 | This far we have just talked about `SimpleAudioEngine`. For most games, `SimpleAudioEngine` provides all the functionality that they need. If your audio needs move beyond what `SimpleAudioEngine` can provide, Cocos2d-x also offers a second choice called just `AudioEngine`. 4 | 5 | ### SimpleAudio Engine versus Audio Engine 6 | -------------------------------------------------------------------------------- /zh/audio/index.md: -------------------------------------------------------------------------------- 1 | # 音乐和音效 2 | 3 | 你的游戏肯定会需要音乐和音效!Cocos2d-x 提供了一个 __`SimpleAudioEngine`__ 类支持游戏内的音乐和音效。它可以被用来增加背景音乐,控制游戏音效。 4 | 5 | `SimpleAudioEngine` 是一个共享的单例对象,你可以在代码中的任何地方通过很简单的方式获取到。以下,我们会尽可能的为你展示它的各种使用方法。先来了解一下支持的文件格式。 6 | 7 | 支持的音乐格式: 8 | 9 | | 平台 |支持的常见文件格式| 备注 | 10 | |-------|-------------------|------| 11 | |Android|mp3, mid, ogg, wav|可以播放android.media.MediaPlayer所支持的所有格式| 12 | |iOS |aac, caf, mp3, m4a, wav|可以播放AVAudioPlayer所支持的所有格式| 13 | |Windows|mid, mp3, wav| 无| 14 | 15 | 支持的音效格式: 16 | 17 | | 平台 |支持的常见文件格式| 备注 | 18 | |-------|-------------------|------| 19 | |Android| ogg, wav|对wav的支持不完美| 20 | |iOS | caf, m4a|可以播放Cocos2d-iPhone CocosDesion所支持的所有格式| 21 | |Windows| mid, wav| 无| -------------------------------------------------------------------------------- /zh/audio/operations.md: -------------------------------------------------------------------------------- 1 | # 声音控制 2 | 3 | 开始播放音乐和音效后,你可能需要对它们进行一些控制,比如暂停、停止、恢复。这很容易完成,下面介绍: 4 | 5 | ## 暂停 6 | 7 | ```cpp 8 | #include "SimpleAudioEngine.h" 9 | using namespace CocosDenshion; 10 | 11 | auto audio = SimpleAudioEngine::getInstance(); 12 | 13 | // pause background music. 14 | audio->pauseBackgroundMusic(); 15 | 16 | // pause a sound effect. 17 | audio->pauseEffect(); 18 | 19 | // pause all sound effects. 20 | audio->pauseAllEffects(); 21 | ``` 22 | 23 | ## 停止 24 | 25 | ```cpp 26 | #include "SimpleAudioEngine.h" 27 | using namespace CocosDenshion; 28 | 29 | auto audio = SimpleAudioEngine::getInstance(); 30 | 31 | // stop background music. 32 | audio->stopBackgroundMusic(); 33 | 34 | // stop a sound effect. 35 | audio->stopEffect(); 36 | 37 | // stops all running sound effects. 38 | audio->stopAllEffects(); 39 | ``` 40 | 41 | ## 恢复 42 | 43 | ```cpp 44 | #include "SimpleAudioEngine.h" 45 | using namespace CocosDenshion; 46 | 47 | auto audio = SimpleAudioEngine::getInstance(); 48 | 49 | // resume background music. 50 | audio->resumeBackgroundMusic(); 51 | 52 | // resume a sound effect. 53 | audio->resumeEffect(); 54 | 55 | // resume all sound effects. 56 | audio->resumeAllEffects(); 57 | ``` 58 | -------------------------------------------------------------------------------- /zh/audio/playing.md: -------------------------------------------------------------------------------- 1 | # 播放背景音乐 2 | 3 | 通过下面的方式,播放一个音频文件作为背景音乐,可以控制背景音乐是否循环播放。 4 | 5 | ```cpp 6 | #include "SimpleAudioEngine.h" 7 | using namespace CocosDenshion; 8 | 9 | auto audio = SimpleAudioEngine::getInstance(); 10 | 11 | // set the background music and continuously play it. 12 | audio->playBackgroundMusic("mymusic.mp3", true); 13 | 14 | // set the background music and play it just once. 15 | audio->playBackgroundMusic("mymusic.mp3", false); 16 | ``` 17 | 18 | ## 播放音效 19 | 20 | 通过下面的方式,将一个音频文件作为音效。 21 | 22 | ```cpp 23 | #include "SimpleAudioEngine.h" 24 | using namespace CocosDenshion; 25 | 26 | auto audio = SimpleAudioEngine::getInstance(); 27 | 28 | // play a sound effect, just once. 29 | audio->playEffect("myEffect.mp3", false, 1.0f, 1.0f, 1.0f); 30 | ``` 31 | -------------------------------------------------------------------------------- /zh/basic_concepts/actions.md: -------------------------------------------------------------------------------- 1 | # 动作(Action) 2 | 3 | 创建一个场景,在场景里面增加精灵只是完成一个游戏的第一步,接下来我们要解决的问题就是,怎么让精灵动起来。__动作(Action)__ 就是用来解决这个问题的,它可以让精灵在场景中移动,如从一个点移动到另外一个点。你还可以创建一个动作 __序列(Sequence)__ ,让精灵按照这个序列做连续的动作,在动作过程中你可以改变精灵的位置,旋转角度,缩放比例等等。 4 | 5 | 在 [代码示例](https://github.com/chukong/programmers-guide-samples) 6 | 中,有对应的章节,执行效果是这样: 7 | 8 | ![](../../en/basic_concepts/basic_concepts-img/2n_level1_action_start.png "") 9 | 10 | 5s 后,精灵移动到了一个新的位置: 11 | 12 | ![](../../en/basic_concepts/basic_concepts-img/2n_level1_action_end.png "") 13 | 14 | `Action` 对象的创建: 15 | 16 | ```cpp 17 | auto mySprite = Sprite::create("Blue_Front1.png"); 18 | 19 | // Move a sprite 50 pixels to the right, and 10 pixels to the top over 2 seconds. 20 | auto moveBy = MoveBy::create(2, Vec2(50,10)); 21 | mySprite->runAction(moveBy); 22 | 23 | // Move a sprite to a specific location over 2 seconds. 24 | auto moveTo = MoveTo::create(2, Vec2(50,10)); 25 | mySprite->runAction(moveTo); 26 | ``` 27 | -------------------------------------------------------------------------------- /zh/basic_concepts/director.md: -------------------------------------------------------------------------------- 1 | # 导演(Director) 2 | 3 | Cocos2d-x 使用导演的概念,这个导演和电影制作过程中的导演一样!导演控制电影制作流程,指导团队完成各项任务。在使用 Cocos2d-x 开发游戏的过程中,你可以认为自己是执行制片人,告诉 __导演(Director)__ 该怎么办!一个常见的 `Director` 任务是控制场景替换和转换。 `Director`是一个共享的单例对象,可以在代码中的任何地方调用。 4 | 5 | 这是一个典型的游戏流程实例。当您的游戏设计好时,`Director` 就负责场景的转换: 6 | 7 | ![](../../en/basic_concepts/basic_concepts-img/scenes.png "") 8 | 9 | 你是你的游戏的导演。你决定着发生什么,何时发生,如何发生。 10 | -------------------------------------------------------------------------------- /zh/basic_concepts/index.md: -------------------------------------------------------------------------------- 1 | # 基本概念 2 | 3 | 本章假设您刚刚开始使用 Cocos2d-x,准备开始你的游戏开发之旅。不要因为自己是新手而担心,整个学习过程会很有趣。 4 | 5 | 让我们开始! 6 | 7 | 游戏引擎是一种特殊的软件,它提供游戏开发时需要的常见功能;引擎会提供许多组件,使用这些组件能缩短开发时间,让游戏开发变得更简单;专业引擎通常会能比自制引擎表现出更好的性能。游戏引擎通常会包含渲染器,2D/3D 图形元素,碰撞检测,物理引擎,声音,控制器支持,动画等部分。 8 | 9 | Cocos2d-x 就是这样的一个游戏引擎,它提供了许多易于使用的组件,有着更好的性能,还同时支持移动端和桌面端。Cocos2d-x 通过封装底层图形接口提供了易用的API,降低了游戏开发的门槛,让使用者可以专注于开发游戏,而不用关注底层的技术细节。更重要的是 Cocos2d-x 是一个完全开源的游戏引擎,这就允许您在游戏开发过程中根据实际需要,定制化引擎的功能,如果您想要一个功能但又不知如何修改,提出这个需求,全世界的开发者可以一起为您完成。 10 | 11 | 只使用 Cocos2d-x 引擎,你就能完成一款游戏的开发,因为 Cocos2d-x 提供了游戏开发所需的一切。 12 | 13 | ## 组件简介 14 | 15 | 精通 Cocos2d-x 很难,但是上手 Cocos2d-x 很容易,让我们从一些基本概念开始。 16 | 17 | 下面是一个简单的游戏界面: 18 | 19 | ![](../../en/basic_concepts/basic_concepts-img/2n_main.png "") 20 | 21 | 让我们再来看一下,分解这个游戏界面的组件构成。 22 | 23 | ![](../../en/basic_concepts/basic_concepts-img/2n_annotated_scaled.png "") 24 | 25 | 能看到一个菜单(Menu),几个精灵(Sprite),和几个标签(Label),观察一下喜欢的游戏,会发现这些组件以某种形式存在其中。 26 | -------------------------------------------------------------------------------- /zh/basic_concepts/logging.md: -------------------------------------------------------------------------------- 1 | # 日志输出 2 | 3 | 有时,在你的游戏正在运行的时候,为了了解程序的运行过程或是为了查找一个 BUG,你想看到一些运行时信息,可以! 这个需求引擎已经考虑到了,使用 `log()` 可以把信息输出到控制台,这样使用: 4 | 5 | ```cpp 6 | // a simple string 7 | log("This would be outputted to the console"); 8 | 9 | // a string and a variable 10 | string s = "My variable"; 11 | log("string is %s", s); 12 | 13 | // a double and a variable 14 | double dd = 42; 15 | log("double is %f", dd); 16 | 17 | // an integer and a variable 18 | int i = 6; 19 | log("integer is %d", i); 20 | 21 | // a float and a variable 22 | float f = 2.0f; 23 | log("float is %f", f); 24 | 25 | // a bool and a variable 26 | bool b = true; 27 | if (b == true) 28 | log("bool is true"); 29 | else 30 | log("bool is false"); 31 | 32 | ``` 33 | 34 | 对于使用 C++ 进行游戏开发的用户来说,可能想使用 `std::cout` 而不用 `log()`,实际上 `log()` 更易于使用,它格式化复杂的输出信息更简单。 -------------------------------------------------------------------------------- /zh/basic_concepts/parent_child.md: -------------------------------------------------------------------------------- 1 | # 节点关系 2 | 3 | Cocos2d-x 的 __节点关系__,是被附属和附属的关系,就像数据结构中的父子关系,如果两个节点被添加到一个父子关系中,那么父节点的属性变化会被自动应用到子节点中。想一下处于父子关系中的精灵有什么特性。 4 | 5 | ![](../../en/basic_concepts/basic_concepts-img/2n_parent.png "") 6 | 7 | 这三个精灵被添加到了一个父子关系中,当父精灵(被其它精灵附属的精灵)设置了旋转角度之后,子精灵也会自动做同样的改变: 8 | 9 | ![](../../en/basic_concepts/basic_concepts-img/2n_parent_rotation.png "") 10 | 11 | ```cpp 12 | auto myNode = Node::create(); 13 | 14 | // rotating by setting 15 | myNode->setRotation(50); 16 | ``` 17 | 18 | 和旋转角度一样,如果你改变了父精灵的缩放比例,子精灵也会做同样的改变: 19 | 20 | ![](../../en/basic_concepts/basic_concepts-img/2n_parent_scaled.png "") 21 | 22 | ```cpp 23 | auto myNode = Node::create(); 24 | 25 | // scaling by setting 26 | myNode->setScale(2.0); // scales uniformly by 2.0 27 | ``` 28 | 29 | 需要注意的是,不是所有的父节点属性都会被自动应用到子节点,如改变父节点的锚点只会影响转换效果(*比例缩放,位置变化,角度旋转,变形等*),不会影响子节点锚点,子节点的锚点总会是左下角 (0,0)。 30 | -------------------------------------------------------------------------------- /zh/basic_concepts/sequences.md: -------------------------------------------------------------------------------- 1 | # 序列(Sequence) 2 | 3 | 能在屏幕上移动精灵,是制作一个游戏所需的一切,是吗?不是的,至少要考虑一下如何执行多个 `Action`。Cocos2d-x 通过 __序列(Sequence)__ 来支持这种需求。 4 | 5 | 顾名思义,序列就是多个动作按照特定顺序的一个排列,当然反向执行这个序列也是可以的,Cocos2d-x 能很方便的完成这项工作。 6 | 7 | 让我们来看一个通过序列控制精灵移动的例子: 8 | 9 | ![](../../en/basic_concepts/basic_concepts-img/2_sequence_scaled.png "") 10 | 11 | 创建 `Sequence` : 12 | 13 | ```cpp 14 | auto mySprite = Node::create(); 15 | 16 | // move to point 50,10 over 2 seconds 17 | auto moveTo1 = MoveTo::create(2, Vec2(50,10)); 18 | 19 | // move from current position by 100,10 over 2 seconds 20 | auto moveBy1 = MoveBy::create(2, Vec2(100,10)); 21 | 22 | // move to point 150,10 over 2 seconds 23 | auto moveTo2 = MoveTo::create(2, Vec2(150,10)); 24 | 25 | // create a delay 26 | auto delay = DelayTime::create(1); 27 | 28 | mySprite->runAction(Sequence::create(moveTo1, delay, moveBy1, delay.clone(), 29 | moveTo2, nullptr)); 30 | 31 | ``` 32 | 33 | 这个例子执行了一个动作的 `Sequence` 序列,那要是想让所有的特定动作同时执行呢?Cocos2d-x 也支持!通过引擎中的 `Spawn` 对象,你能让多个动作同时被解析执行。可能不同动作的执行时间不一致,在这种情况下,他们不会同时结束。 34 | 35 | ```cpp 36 | auto myNode = Node::create(); 37 | 38 | auto moveTo1 = MoveTo::create(2, Vec2(50,10)); 39 | auto moveBy1 = MoveBy::create(2, Vec2(100,10)); 40 | auto moveTo2 = MoveTo::create(2, Vec2(150,10)); 41 | 42 | myNode->runAction(Spawn::create(moveTo1, moveBy1, moveTo2, nullptr)); 43 | 44 | ``` 45 | 46 | 为什么要有同时执行多个动作的需求呢?当然是有原因的啦!比如你的游戏角色被电了,或者在关卡结束打 boss 的时候,想一想类似的场景. 47 | -------------------------------------------------------------------------------- /zh/event_dispatcher/accelerometer.md: -------------------------------------------------------------------------------- 1 | # 加速度传感器事件 2 | 3 | 现在一些移动设备配备有加速度传感器,我们可以通过监听它的事件获取各方向的加速度。 4 | 5 | 可以设想要完成一个游戏情景:通过来回移动手机,平衡小球在手机中的位置。这种场景的完成,就需要监听加速度传感器事件。 6 | 7 | 使用加速度传感器,需要先启用 8 | 9 | ```cpp 10 | Device::setAccelerometerEnabled(true); 11 | ``` 12 | 13 | 创建加速度传感器监听器: 14 | 15 | ```cpp 16 | // creating an accelerometer event 17 | auto listener = EventListenerAcceleration::create(CC_CALLBACK_2( 18 | AccelerometerTest::onAcceleration, this)); 19 | 20 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); 21 | 22 | // Implementation of the accelerometer callback function prototype 23 | void AccelerometerTest::onAcceleration(Acceleration* acc, Event* event) 24 | { 25 | // Processing logic here 26 | } 27 | ``` 28 | -------------------------------------------------------------------------------- /zh/event_dispatcher/custom.md: -------------------------------------------------------------------------------- 1 | # 自定义事件 2 | 3 | 上述提到的事件都是系统内置的,如触摸事件,键盘事件等。此外,你可以制作自定义事件,这些事件不是由系统控制触发的,而是通过代码手动触发。 4 | 5 | 创建自定义事件监听器: 6 | 7 | ```cpp 8 | _listener = EventListenerCustom::create("game_custom_event1", [=](EventCustom* event){ 9 | std::string str("Custom event 1 received, "); 10 | char* buf = static_cast(event->getUserData()); 11 | str += buf; 12 | str += " times"; 13 | statusLabel->setString(str.c_str()); 14 | }); 15 | 16 | _eventDispatcher->addEventListenerWithSceneGraphPriority(_listener, this); 17 | ``` 18 | 19 | 上面制作了一个自定义事件监听器,并预设了响应方法。下面创建自定义事件,并手动分发: 20 | 21 | ```cpp 22 | static int count = 0; 23 | ++count; 24 | 25 | char* buf[10]; 26 | sprintf(buf, "%d", count); 27 | 28 | EventCustom event("game_custom_event1"); 29 | event.setUserData(buf); 30 | 31 | _eventDispatcher->dispatchEvent(&event); 32 | ``` 33 | 34 | 示例创建了一个自定义事件( _EventCustom_ )对象,并设置了 `UserData`,然后调用 `_eventDispatcher->dispatchEvent(&event)` 进行手动事件分发。当预先定义的事件监听器,收到此事件,将会触发对应的响应函数。响应函数中可以获取到事件分发时设置的 `UserData` 完成数据处理。 35 | 36 | > _注意: `EventCustom` 与 `EventListenerCustom` 的第一个参数事件名都是字符串 `game_custom_event1`_ 37 | -------------------------------------------------------------------------------- /zh/event_dispatcher/index.md: -------------------------------------------------------------------------------- 1 | # 事件分发机制 2 | 3 | Cocos2d-x 通过事件分发机制响应用户事件,已内置支持常见的事件如触摸事件,键盘事件等。同时提供了创建自定义事件的方法,满足我们在游戏的开发过程中,特殊的事件响应需求。 4 | 5 | ## 基本元素 6 | 7 | * 事件监听器:负责接收事件,并执行预定义的事件处理函数 8 | * 事件分发器:负责发起通知 9 | * 事件对象:记录事件的相关信息 10 | -------------------------------------------------------------------------------- /zh/event_dispatcher/keyboard.md: -------------------------------------------------------------------------------- 1 | # 键盘事件 2 | 3 | 对于桌面游戏,一般需要通过键盘做一些游戏内的控制,这时你就需要监听键盘事件。Cocos2d-x 支持键盘事件,就像上节介绍的触摸事件一样。 4 | 5 | 创建键盘事件监听器: 6 | 7 | ```cpp 8 | // creating a keyboard event listener 9 | auto listener = EventListenerKeyboard::create(); 10 | listener->onKeyPressed = CC_CALLBACK_2(KeyboardTest::onKeyPressed, this); 11 | listener->onKeyReleased = CC_CALLBACK_2(KeyboardTest::onKeyReleased, this); 12 | 13 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); 14 | 15 | // Implementation of the keyboard event callback function prototype 16 | void KeyboardTest::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event) 17 | { 18 | log("Key with keycode %d pressed", keyCode); 19 | } 20 | 21 | void KeyboardTest::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event) 22 | { 23 | log("Key with keycode %d released", keyCode); 24 | } 25 | ``` 26 | 27 | 可以看到,在使用键盘事件监听器时,可以监听两种不同的事件,每一个事件都有自己的触发时机。 28 | 29 | 两种事件及触发时机: 30 | 31 | * __`onKeyPressed`__ 按键被按下时 32 | * __`onKeyReleased`__ 按下状态的按键被放开时 33 | -------------------------------------------------------------------------------- /zh/event_dispatcher/mouse.md: -------------------------------------------------------------------------------- 1 | # 鼠标事件 2 | 3 | 就像前几节介绍的那样,Cocos2d-x 支持响应鼠标事件 4 | 5 | 创建鼠标事件监听器: 6 | 7 | ```cpp 8 | _mouseListener = EventListenerMouse::create(); 9 | _mouseListener->onMouseMove = CC_CALLBACK_1(MouseTest::onMouseMove, this); 10 | _mouseListener->onMouseUp = CC_CALLBACK_1(MouseTest::onMouseUp, this); 11 | _mouseListener->onMouseDown = CC_CALLBACK_1(MouseTest::onMouseDown, this); 12 | _mouseListener->onMouseScroll = CC_CALLBACK_1(MouseTest::onMouseScroll, this); 13 | 14 | _eventDispatcher->addEventListenerWithSceneGraphPriority(_mouseListener, this); 15 | 16 | void MouseTest::onMouseDown(Event *event) 17 | { 18 | // to illustrate the event.... 19 | EventMouse* e = (EventMouse*)event; 20 | string str = "Mouse Down detected, Key: "; 21 | str += tostr(e->getMouseButton()); 22 | } 23 | 24 | void MouseTest::onMouseUp(Event *event) 25 | { 26 | // to illustrate the event.... 27 | EventMouse* e = (EventMouse*)event; 28 | string str = "Mouse Up detected, Key: "; 29 | str += tostr(e->getMouseButton()); 30 | } 31 | 32 | void MouseTest::onMouseMove(Event *event) 33 | { 34 | // to illustrate the event.... 35 | EventMouse* e = (EventMouse*)event; 36 | string str = "MousePosition X:"; 37 | str = str + tostr(e->getCursorX()) + " Y:" + tostr(e->getCursorY()); 38 | } 39 | 40 | void MouseTest::onMouseScroll(Event *event) 41 | { 42 | // to illustrate the event.... 43 | EventMouse* e = (EventMouse*)event; 44 | string str = "Mouse Scroll detected, X: "; 45 | str = str + tostr(e->getScrollX()) + " Y: " + tostr(e->getScrollY()); 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /zh/event_dispatcher/priority.md: -------------------------------------------------------------------------------- 1 | # 优先级 2 | 3 | 事件的吞没中,我们提到了事件的传递。事件如何传递,先到哪个监听器?这是由优先级决定的。 4 | 5 | __固定值优先级__ 使用一个整形的数值,数值较低的监听器比数值较高的监听器,先接收到事件。 6 | 7 | __场景图优先级__ 是指向节点对象的指针,`z-order` 较高的节点中的监听器比 `z-order` 较低的节点中的,先接收到事件。_由于 `z-order` 较高的节点在顶部绘制,所以使用这种优先级可以确保触摸事件被正确响应_ 8 | 9 | 还记得这个场景图吗?图像绘制时,是按照 `A, B, C, D, E, F, G, H, I` 的顺序。 10 | 11 | ![](../../en/basic_concepts/basic_concepts-img/in-order-walk.png "in-order walk") 12 | 13 | 当使用 _场景图优先级_ 时,事件是按照绘制的反方向,即 `I, H, G, F, E, D, C, B, A` 传递。如果一个事件被触发,`I` 节点先接收到,如果在 `I` 节点中事件被吞没,则不会继续传递,未被吞没,事件将传递到 `H` 节点,每个节点都重复同样的逻辑,直到事件被吞没,或者传递结束,本次事件触发才完成。 14 | -------------------------------------------------------------------------------- /zh/event_dispatcher/registering.md: -------------------------------------------------------------------------------- 1 | # 进阶话题 2 | 3 | ## 注册事件监听 4 | 5 | 当我们需求多个节点对象有相同的事件响应时,可以创建一个事件监听器,然后通过 __`eventDispatcher`__,将其注册到多个对象。 6 | 7 | 以我们之前提到的触摸事件监听器为例: 8 | 9 | ```cpp 10 | // Add listener 11 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, 12 | sprite1); 13 | ``` 14 | 15 | 需要注意的是,在添加到多个对象时,需要使用 __`clone()`__ 方法。 16 | 17 | ```cpp 18 | // Add listener 19 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, 20 | sprite1); 21 | 22 | // Add the same listener to multiple objects. 23 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1->clone(), 24 | sprite2); 25 | 26 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1->clone(), 27 | sprite3); 28 | ``` 29 | 30 | ## 移除事件监听 31 | 32 | 按照下面的方法,可以将已经添加的事件监听器移除。 33 | 34 | ```cpp 35 | _eventDispatcher->removeEventListener(listener); 36 | ``` 37 | 38 | > _内置节点对象的事件分发机制,和我们上面讨论的一致,比如,当你点击带有菜单项的菜单时,也会分发一个事件。 同样的你也可以在内置节点对象上使用 `removeEventListener()` 移除事件监听。_ 39 | -------------------------------------------------------------------------------- /zh/event_dispatcher/touch.md: -------------------------------------------------------------------------------- 1 | # 触摸事件 2 | 3 | 触摸事件是手机游戏中最重要的事件,它易于创建,还能提供多种多样的功能。 4 | 5 | 让我们先了解一下什么是触摸事件,当你触摸移动设备的屏幕时,设备感受到被触摸,了解到被触摸的位置,同时取得触摸到的内容,然后你的触摸被回答。 这就是触摸事件。 6 | 7 | > 如果你希望通过触摸控制屏幕下层的对象,那可以通过 [优先级](priority.md),达成这种需求,优先级高的对象能先处理事件。 8 | 9 | 创建触摸事件监听器: 10 | 11 | ```cpp 12 | // Create a "one by one" touch event listener 13 | // (processes one touch at a time) 14 | auto listener1 = EventListenerTouchOneByOne::create(); 15 | 16 | // trigger when you push down 17 | listener1->onTouchBegan = [](Touch* touch, Event* event){ 18 | // your code 19 | return true; // if you are consuming it 20 | }; 21 | 22 | // trigger when moving touch 23 | listener1->onTouchMoved = [](Touch* touch, Event* event){ 24 | // your code 25 | }; 26 | 27 | // trigger when you let up 28 | listener1->onTouchEnded = [=](Touch* touch, Event* event){ 29 | // your code 30 | }; 31 | 32 | // Add listener 33 | _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, this); 34 | ``` 35 | 36 | 可以看到,在使用触摸事件监听器时,可以监听三种不同的事件,每一个事件都有自己触发的时机。 37 | 38 | 三种事件及其触发时机: 39 | 40 | * __`onTouchBegan`__ 开始触摸屏幕时 41 | * __`onTouchMoved`__ 触摸屏幕,同时在屏幕上移动时 42 | * __`onTouchEnded`__ 结束触摸屏幕时 43 | -------------------------------------------------------------------------------- /zh/event_dispatcher/types.md: -------------------------------------------------------------------------------- 1 | # 监听器 2 | 3 | ## 五种类型 4 | 5 | * `EventListenerTouch` - 响应触摸事件 6 | 7 | * `EventListenerKeyboard` - 响应键盘事件 8 | 9 | * `EventListenerAcceleration` - 响应加速度事件 10 | 11 | * `EventListenMouse` - 响应鼠标事件 12 | 13 | * `EventListenerCustom` - 响应自定义事件 14 | 15 | ## 事件的吞没 16 | 17 | 当你有一个监听器,已经接收到了期望的事件,这时事件应该被吞没。事件被吞没,意味着在事件的传递过程中,你消耗了此事件,事件不再向下传递。避免了下游的其它监听器获取到此事件。 18 | 19 | 设置吞没: 20 | 21 | ```cpp 22 | // When "swallow touches" is true, then returning 'true' from the 23 | // onTouchBegan method will "swallow" the touch event, preventing 24 | // other listeners from using it. 25 | listener1->setSwallowTouches(true); 26 | 27 | // you should also return true in onTouchBegan() 28 | 29 | listener1->onTouchBegan = [](Touch* touch, Event* event){ 30 | // your code 31 | 32 | return true; 33 | }; 34 | ``` 35 | -------------------------------------------------------------------------------- /zh/faq/Android-Studio_cmake_ninja.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/faq/Android-Studio_cmake_ninja.png -------------------------------------------------------------------------------- /zh/faq/android.md: -------------------------------------------------------------------------------- 1 | ## Android 2 | 3 | ### generateJsonModelDebug FAILED 4 | To solve this issue, please import the project into __Android Studio__, click 5 | `Build/Refresh Linked C++ Projects`. 6 | 7 | ### Android Studio uses the __ninja__ build system 8 | __Android Studio__, itself, uses __ninja__ to build native codes. There is __ninja__ binary under __Cmake__ folder. If __Android Studio__ cannot find __ninja__ on __Windows__, it is the __Android Studio__ issue. You should set an environment variable that specifies the path to __ninja__: 9 | 10 | ![](Android-Studio_cmake_ninja.png) 11 | 12 | [__ninja binaries__](https://github.com/ninja-build/ninja/releases) are available as is [__ninja documentation__](https://ninja-build.org/). -------------------------------------------------------------------------------- /zh/faq/cmake.md: -------------------------------------------------------------------------------- 1 | ## CMake 2 | 3 | ### CMake PIE 4 | It may be necessary to add the following line to __CMakeLists.txt__ if a __can not be used when making a PIE object;__ compiler is thrown: 5 | ```sh 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie -fexceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder") 7 | ``` -------------------------------------------------------------------------------- /zh/faq/index.md: -------------------------------------------------------------------------------- 1 | ## 解决方案常见问题 2 | 3 | - [Android](android.md) 4 | - [CMake](cmake.md) 5 | - [Linux](linux.md) 6 | - [MacOS](macos.md) 7 | - [Windows](windows.md) 8 | -------------------------------------------------------------------------------- /zh/faq/linux.md: -------------------------------------------------------------------------------- 1 | ## Linux 2 | 3 | ### FMod issues 4 | Some users report issues with __libfmod__. If you encounter issues, please reference this post: [Error while building for linux: libfmod.so.6](https://discuss.cocos2d-x.org/t/error-while-building-for-linux-libfmod-so-6/26553/31?u=doyoque) -------------------------------------------------------------------------------- /zh/faq/macos.md: -------------------------------------------------------------------------------- 1 | ## MacOS 2 | 3 | ### XCode PNG Compression issue 4 | It is possible that your PNG images contain incorrect color profiles. You can 5 | convert color profiles using __ImageMagick__ and the following 6 | command: 7 | 8 | ```sh 9 | find . -type f -name "*.png" -exec convert {} \; 10 | ``` 11 | -------------------------------------------------------------------------------- /zh/faq/re-target-errors.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/faq/re-target-errors.jpeg -------------------------------------------------------------------------------- /zh/faq/windows.md: -------------------------------------------------------------------------------- 1 | ## Windows 2 | 3 | ### Re-target the Windows SDK 4 | If you see these types of errors: 5 | 6 | ![](re-target-errors.jpeg) 7 | 8 | This is because the template project was created in an older version of Visual Studio. To fix: 9 | 10 | * **Right** click on **every project** 11 | * select **Retarget Projects** 12 | * click **Ok**. 13 | * Next, **rebuild** the project. 14 | 15 | If you create a new project in the future you will need to repeat these steps. 16 | 17 | ### Distributing a Cocos2d-x app on Windows 18 | 19 | > __Note:__ this falls outside of the realm of Cocos2d-x. Please consult Microsoft resources for assistance. 20 | 21 | If you try to run a game created with Cocos2d-x on a non-development machine, it may be required for this machine to have the __Visual Studio runtime__ installed. The easiest way is to create an installer for your game, but it is possible to do it without by installing all required pieces manually. 22 | 23 | * Use [Dependency Walker](http://www.dependencywalker.com/) to check what DLLs your game requires. 24 | 25 | * Install the required Visual Studio runtime. Microsoft has now merged VS2015, 2017 and 2019 runtimes into one, which you can find [here](https://support.microsoft.com/ms-my/help/2977003/the-latest-supported-visual-c-downloads). 26 | 27 | For the installer, check these posts: 28 | 29 | * [InnoSetup](https://discuss.cocos2d-x.org/t/please-give-me-some-pointers-advice-before-pc-release/43935/3) (also shows you a sample for how to install the VS C++ runtime using it). 30 | 31 | * Sample InnoSetup script for Cocos2d-x [here](https://discuss.cocos2d-x.org/t/exe-file-sharing/45569/6). -------------------------------------------------------------------------------- /zh/index.md: -------------------------------------------------------------------------------- 1 | # Cocos2d-x v3 用户手册 2 | 3 | ## Q3 2019 r.2 4 | ======= 5 | 6 | 欢迎使用 Cocos2d-x 用户手册,本手册包含引擎的介绍,功能组件的使用方法以及引擎在多个平台的环境搭建。能够帮助您快速上手 Cocos2d-x! 7 | 8 | ## 特别推荐 9 | 10 | - Cocos2d-x 3.17 已发布,请参阅 [版本发布说明](//www.cocos.com/1462)。 11 | - 3.17 支持全平台的 CMake 构建,请参阅 [CMake 指南](installation/CMake-Guide.md) 12 | 13 | ## 快速上手 14 | 15 | 手册通过四个部分向您介绍 Cocos2d-x:新手入门部分,可以了解到 Cocos2d-x 引擎是什么、如何学习引擎、如何参与引擎开发,以及引擎中一些基本的概念;基本功能部分,着重介绍引擎中一些基础同时核心的组件如何使用,包括精灵、动作、场景。 16 | 17 | 进阶内容部分,是对引擎更近一步的阐述,包含如何进行一些高级控制、显示一些特殊效果;环境与工具部分,包含详细的开发环境搭建教程,以及一些引擎可利用的工具,比如使用 `cocos` 命令行。以下是手册的章节索引,可以帮助您快速定位。 18 | 19 | - 新手入门:[了解引擎](about/index.md) / [基本概念](basic_concepts/index.md) 20 | - 基本功能:[精灵](sprites/index.md) / [动作](actions/index.md) / [场景](scenes/index.md) 21 | / [UI 组件](ui_components/index.md) 22 | - 进阶内容:[特殊节点对象](other_node_types/index.md) / [事件分发机制](event_dispatcher/index.md) / [3D 支持](3d/index.md) / [使用脚本](scripting/index.md) / [物理引擎](physics/index.md) / [音乐和音效](audio/index.md) / [高级话题](advanced_topics/index.md) 23 | - 环境与工具:[环境搭建](installation/index.md) / [引擎工具](editors_and_tools/cocosCLTool.md) 24 | 25 | 在手册的使用过程中,您大可不必按照目录的顺序,一章一章的阅读,完全可以跳跃,比如阅读完新手入门部分后,直接进入环境搭建章节,按照教程在自己 PC 上搭建好开发环境,完成后,一边看源码一边看手册,或许这样能有更好的学习效果。您也可以把本文档当做一个查询手册,将你想查询的直接输入到左上角的全局搜索框,回车一下,结果将立刻显现在页面中。 26 | 27 | --- 28 | 29 | ## 致谢 30 | 31 | 感谢 Cocos2d-x 的所有开发者,是你们让这个文档有了存在的意义! 32 | 33 | 本文档主要翻译自英文文档,同时参考了旧有的 Cocos2d-x 中文文档。由于引擎内容较多,逻辑较复杂,文档可能会存在一些不完善之处。在您阅读的过程中,如果发现了错误的地方,欢迎通过 [中文社区](//forum.cocos.com/c/cocos2d-x),或右下角 __Have Feedback__ 向我们反馈。 34 | 35 | > 本文档示例代码在 [GitHub](https://github.com/chukong/programmers-guide-samples) 下载 36 | -------------------------------------------------------------------------------- /zh/installation/Android-Eclipse.md: -------------------------------------------------------------------------------- 1 | # Eclipse ADT (已弃用) 2 | 3 | ## 背景 4 | 5 | 由于 Google 自 2015 年底已中止了对 ADT 的支持,希望开发者转向 Android Studio。同时 Android Studio 的功能也已日趋完善,足够我们使用它完成 Cocos2d-x 项目的全部开发流程:编码、编译、调试、发布。因此自 3.16 版本我们不再支持 ADT。 6 | 7 | 如果你是一个新手,请转向 [Android Studio](Android-Studio.md) 进行 Cocos2d-x 的环境搭建学习。如果明确有对老版本引擎的 Android 环境搭建需求,请继续阅读。 8 | 9 | ## 工具准备 10 | 11 | * 完成上一节的 **[Android 命令行](Android-terminal/index.html)**,上一节是本节的基础 12 | 13 | * 下载 Eclipse ADT [http://www.eclipse.org/downloads/](http://www.eclipse.org/downloads/) 14 | 15 | ## 导入游戏项目 16 | 17 | 1. 打开 Eclipse 18 | 19 | 1. 在 _Package Explorer_ 的空白区域鼠标右键,选择 _Import_ 20 | 21 | 1. 在弹出框中选择 _Existing Android Code Into Workspace_,点击 _Next_ 22 | 23 | ![](../../en/installation/Android-Eclipse-img/image2.png) 24 | 25 | 1. 点击 _Browse_ 按钮,进入上一节操作的 __cpp-tests__ 项目目录,进入 _proj.androi_ 子目录,点击确定 26 | 27 | ![](../../en/installation/Android-Eclipse-img/image3.png) 28 | 29 | 1. 点击 __Finish__,等待导入操作完成 30 | 31 | ## 导入库项目 32 | 33 | * 导入库项目的步骤基本与导入游戏项目一致,不同的是在 _Browse_ 步骤,选择引擎根目录下 _/cocos/platform/android/java_ 子目录。 34 | 35 | ![](../../en/installation/Android-Eclipse-img/image5.png) 36 | 37 | * 导入完成后,将库项目添加到游戏项目 Java Build Path 的 Project 中。 38 | 39 | ## 构建并运行 40 | 41 | * 将开启 USB 调试的手机,连接到电脑上。 42 | 43 | * 确保你的电脑能识别手机 _对于某些机型可能需要安装驱动_。 44 | 45 | * 右键游戏项目,选择 _Run as_,在子菜单中选择 _Android Application_。 46 | 47 | ![](../../en/installation/Android-Eclipse-img/image6.png) 48 | 49 | > 注意:本文档教程只适用于 Cocos2d-x V3.15 或更低的版本 50 | -------------------------------------------------------------------------------- /zh/installation/Android-Studio-img/Import-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Android-Studio-img/Import-project.png -------------------------------------------------------------------------------- /zh/installation/Android-Studio-img/bar-AVD-Manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Android-Studio-img/bar-AVD-Manager.png -------------------------------------------------------------------------------- /zh/installation/Android-Studio-img/bar-Run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Android-Studio-img/bar-Run.png -------------------------------------------------------------------------------- /zh/installation/Android-Studio-img/choose-device-definition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Android-Studio-img/choose-device-definition.png -------------------------------------------------------------------------------- /zh/installation/Android-Studio-img/cpp-tests-success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Android-Studio-img/cpp-tests-success.png -------------------------------------------------------------------------------- /zh/installation/Android-Studio-img/select-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Android-Studio-img/select-image.png -------------------------------------------------------------------------------- /zh/installation/IOS.md: -------------------------------------------------------------------------------- 1 | # 搭建开发环境 - iOS 2 | 3 | ## 工具准备 4 | 5 | 1. Cocos2d-x v3.17,下载后解压,下载参见:[Cocos官网页面](//www.cocos.com/download) 6 | 1. Xcode 9 下载后安装,下载参见:[Apple官网页面](https://developer.apple.com/download/more/) 7 | 8 | ## 配置步骤: 9 | 10 | 1. 打开 `cocos2d-x-3.17/build/cocos2d_tests.xcodeproj` 11 | 1. 在 Xcode 顶部工具栏选择 `cpp-tests iOS`,`iPhone 7 Plus`,点击运行,项目将自动编译运行,效果如图: 12 | 13 | ![](iOS-img/ios-install-run.png) 14 | 15 | ## 如何调试(Debug) 16 | 17 | 1. 点击代码行左侧的空白,设置断点 18 | 1. 运行 cpp-tests 19 | 1. 操作 App 触发断点,IDE 将卡在断点处,视图会自动变化,左侧导航栏可以查看运行堆栈,底部窗口可以查看变量的值: 20 | 21 | ![](iOS-img/macOS-debug.png) 22 | -------------------------------------------------------------------------------- /zh/installation/Linux-img/ubuntu-cpp-tests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Linux-img/ubuntu-cpp-tests.png -------------------------------------------------------------------------------- /zh/installation/OSX.md: -------------------------------------------------------------------------------- 1 | # 搭建开发环境 - macOS 平台 2 | 3 | ## 工具准备 4 | 5 | 1. Cocos2d-x v3.17,下载后解压,下载参见:[Cocos官网页面](//www.cocos.com/download) 6 | 1. Xcode 9 下载后安装,下载参见:[Apple官网页面](https://developer.apple.com/download/more/) 7 | 8 | ## 配置步骤 9 | 10 | 1. 打开 `cocos2d-x-3.17/build/cocos2d_tests.xcodeproj` 11 | 1. 在 Xcode 顶部工具栏选择 `cpp-tests Mac`,`My Mac`,点击运行,项目将自动编译运行,效果如图: 12 | 13 | ![](iOS-img/macOS-install-run.png) 14 | 15 | ## 如何调试(Debug) 16 | 17 | 1. 点击代码行左侧的空白,设置断点 18 | 1. 运行 cpp-tests 19 | 1. 操作 App 触发断点,IDE 将卡在断点处,视图会自动变化,左侧导航栏可以查看运行堆栈,底部窗口可以查看变量的值 20 | 21 | ![](iOS-img/macOS-debug.png) 22 | -------------------------------------------------------------------------------- /zh/installation/Windows-img/cpp-tests-win32-debug-breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Windows-img/cpp-tests-win32-debug-breakpoint.png -------------------------------------------------------------------------------- /zh/installation/Windows-img/cpp-tests-win32-debug-trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Windows-img/cpp-tests-win32-debug-trace.png -------------------------------------------------------------------------------- /zh/installation/Windows-img/cpp-tests-win32-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Windows-img/cpp-tests-win32-run.png -------------------------------------------------------------------------------- /zh/installation/Windows-img/cpp-tests-win32-solution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/Windows-img/cpp-tests-win32-solution.png -------------------------------------------------------------------------------- /zh/installation/iOS-img/ios-install-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/iOS-img/ios-install-run.png -------------------------------------------------------------------------------- /zh/installation/iOS-img/macOS-debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/iOS-img/macOS-debug.png -------------------------------------------------------------------------------- /zh/installation/iOS-img/macOS-install-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos2d/cocos2d-x-docs/68296a196b6f6fc0d1bc02dec7eb345a088f9d2e/zh/installation/iOS-img/macOS-install-run.png -------------------------------------------------------------------------------- /zh/installation/index.md: -------------------------------------------------------------------------------- 1 | # 环境搭建 2 | 3 | ## 简介 4 | 5 | 阅读本章,你能学习到 Cocos2d-x 在各个平台的环境搭建方法,_环境搭建以成功编译运行官方测试项目 `cpp-tests` 为目标_。 6 | 7 | 搭建完成,你可以通过 `cpp-tests` 学习引擎的各个功能。 8 | 9 | ## 环境要求 10 | 11 | * Mac OS X 10.7+, Xcode 8+ 12 | * Ubuntu 14.04+, CMake 3.1+ 13 | * Windows 7+, VS 2015+ 14 | * Python 2.7.5+, NOT Python 3+ 15 | * NDK r16+ is required to build Android games (tested with r16) 16 | * Android Studio 3.0+ to build Android games (tested with 3.0) 17 | * JRE or JDK 1.6+ is required for web publishing 18 | -------------------------------------------------------------------------------- /zh/other_node_types/index.md: -------------------------------------------------------------------------------- 1 | # 高级节点对象 2 | 3 | 除了 `Label`,`Sprite` 这些基本的节点对象外,Cocos2d-x 还提供了一些特殊的节点对象,来帮助构建一些高级功能。 4 | 5 | 也许你想制作一个基于瓦片地图的游戏,也许你想添加粒子效果,也许你想在游戏中添加一个 2D 滚动的边栏,别担心,这些特殊的节点对象能帮助你。 6 | -------------------------------------------------------------------------------- /zh/other_node_types/parallax.md: -------------------------------------------------------------------------------- 1 | # 视差滚动 2 | 3 | 视差滚动是指让多层背景以不同的速度移动,从而形成的立体运动效果。比如超级马里奥游戏中,角色所在地面的移动与背景天空的移动,就是一个视差滚动。Cocos2d-x 通过 __`ParallaxNode`__ 对象模拟视差滚动。可以通过序列控制移动,也可以通过监听鼠标,触摸,加速度计,键盘等事件控制移动。`ParallaxNode` 对象比常规节点对象复杂一些,因为为了呈现不同的移动速度,需要多个子节点。它类似 `Menu` 像一个容器,本身不移动,移动的是被添加进入其中的不同子节点。`ParallaxNode` 的创建: 4 | 5 | ```cpp 6 | // create ParallaxNode 7 | auto paraNode = ParallaxNode::create(); 8 | ``` 9 | 10 | 添加多个节点对象: 11 | 12 | ```cpp 13 | // create ParallaxNode 14 | auto paraNode = ParallaxNode::create(); 15 | 16 | // background image is moved at a ratio of 0.4x, 0.5y 17 | paraNode->addChild(background, -1, Vec2(0.4f,0.5f), Vec2::ZERO); 18 | 19 | // tiles are moved at a ratio of 2.2x, 1.0y 20 | paraNode->addChild(middle_layer, 1, Vec2(2.2f,1.0f), Vec2(0,-200) ); 21 | 22 | // top image is moved at a ratio of 3.0x, 2.5y 23 | paraNode->addChild(top_layer, 2, Vec2(3.0f,2.5f), Vec2(200,800) ); 24 | ``` 25 | 26 | 需要注意的是,被添加的每个 Node 对象被赋予了一个唯一的 `z-order` 顺序,以便他们堆叠在彼此之上。另外要注意 `addChild()` 调用中两个 `Vec2` 参数,第一个决定这个子节点的移动速度与父节点移动速度的比率,第二个是相对父节点 `ParallaxNode` 的偏移量。 27 | 28 | 在文本中很难展示视差滚动,请运行本文档的代码示例吧! 29 | -------------------------------------------------------------------------------- /zh/other_node_types/tilemap.md: -------------------------------------------------------------------------------- 1 | # 瓦片地图 2 | 3 | 在游戏开发过程中,我们会遇到超过屏幕大小的地图,例如在即时战略游戏中,它使得玩家可以在地图中滚动游戏画面。这类游戏通常会有丰富的背景元素,如果直接使用背景图切换的方式,需要为每个不同的场景准备一张背景图,而且每个背景图都不小,这样会造成资源浪费。 4 | 5 | 瓦片地图就是为了解决这问题而产生的。一张大的世界地图或者背景图可以由几种地形来表示,每种地形对应一张小的的图片,我们称这些小的地形图片为瓦片。把这些瓦片拼接在一起,一个完整的地图就组合出来了,这就是瓦片地图的原理。 6 | 7 | 在 Cocos2d-x 中,瓦片地图实现的是 TileMap 方案,TileMap 要求每个瓦片占据地图上一个四边形或六边形的区域。把不同的瓦片拼接在一起,就可以组成完整的地图。TileMap 使用一种基于 XML 的 TMX 格式文件。 8 | 9 | 使用 TMX 文件创建一个瓦片地图: 10 | 11 | ```cpp 12 | // reading in a tiled map. 13 | auto map = TMXTiledMap::create("TileMap.tmx"); 14 | addChild(map, 0, 99); // with a tag of '99' 15 | ``` 16 | 17 | 瓦片地图可能有许多层,通过层名获取到一个特定的层。 18 | 19 | ```cpp 20 | // how to get a specific layer 21 | auto map = TMXTiledMap::create("TileMap.tmx"); 22 | auto layer = map->getLayer("Layer0"); 23 | auto tile = layer->getTileAt(Vec2(1, 63)); 24 | ``` 25 | 26 | 每个瓦片都有独一无二的位置和 ID,这使得我们很容易选择特定的瓦片。 27 | 28 | 通过位置访问: 29 | 30 | ```cpp 31 | // to obtain a specific tiles id 32 | unsigned int gid = layer->getTileGIDAt(Vec2(0, 63)); 33 | ``` 34 | 35 | 瓦片地图布局示例: 36 | 37 | ![](../../en/other_node_types/other_node_types-img/tilemap1.png "timemap1") 38 | 39 | ![](../../en/other_node_types/other_node_types-img/tilemap2.png "timemap2") 40 | 41 | 有很多工具可以用来制作瓦片地图,[Tiled](http://mapeditor.org) 就是其中一款流行的制作工具,它有一个活跃的用户社区。推荐你去使用,上面的屏幕截图就来自 [Tiled](http://mapeditor.org) 的项目。 42 | -------------------------------------------------------------------------------- /zh/physics/debugging.md: -------------------------------------------------------------------------------- 1 | # 调试 2 | 3 | 如果你希望在刚体周围绘制红框来帮助调试,那么可以简单的将这两行添加到物理场景的初始化代码中。你当然也可以学习官方测试项目,加一个菜单,在菜单的回调函数里控制是否打开调试功能。 4 | 5 | ```cpp 6 | Director::getInstance()->getRunningScene()->getPhysics3DWorld()->setDebugDrawEnable(true); 7 | Director::getInstance()->getRunningScene()->setPhysics3DDebugCamera(cameraObjecct); 8 | ``` 9 | 10 | ## 禁用物理引擎 11 | 12 | 使用内置的物理引擎是个好的选择,它稳定又强大。不过,如果你的确想使用一些其它的物理引擎,只需要在 _base/ccConfig.h_ 文件中将 _CC_USE_PHYSICS_ 的值改为 0 禁用内置的物理引擎即可。 13 | -------------------------------------------------------------------------------- /zh/scenes/creating.md: -------------------------------------------------------------------------------- 1 | # 场景创建 2 | 3 | 创建一个场景非常简单: 4 | 5 | ```cpp 6 | auto myScene = Scene::create(); 7 | ``` 8 | 9 | ## 还记得场景图吗 10 | 11 | 第二章中我们学到了 [场景图(Scene Graph)](../basic_concepts/scene.md) 以及在游戏中它是如何生效的。要记得场景图决定了场景内节点对象的渲染顺序,也要记得 __z-order__ 是如何影响场景图的。 12 | 13 | _渲染时 `z-order` 值大的节点对象会后绘制,值小的节点对象先绘制_ 14 | 15 | ## 一个简单场景 16 | 17 | 让我们构建一个简单的场景,来学习场景的使用。记得 Cocos2d-x 用右手坐标系,也就是说坐标原点(0,0)在展示区的左下角,当你在场景里放置一些节点对象设置坐标位置时,注意左下角是坐标计算的起点。 18 | 19 | ```cpp 20 | auto dirs = Director::getInstance(); 21 | Size visibleSize = dirs->getVisibleSize(); 22 | 23 | auto myScene = Scene::create(); 24 | 25 | auto label1 = Label::createWithTTF("My Game", "Marker Felt.ttf", 36); 26 | label1->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2)); 27 | 28 | myScene->addChild(label1); 29 | 30 | auto sprite1 = Sprite::create("mysprite.png"); 31 | sprite1->setPosition(Vec2(100, 100)); 32 | 33 | myScene->addChild(sprite1); 34 | ``` 35 | 36 | 当运行这个代码的时候,我们会看到有一个场景,场景里面有一个标签和一个精灵。这虽然很简单,但这却是开发一个游戏最重要的开始! 37 | -------------------------------------------------------------------------------- /zh/scenes/index.md: -------------------------------------------------------------------------------- 1 | # 场景(Scene) 2 | 3 | __场景(Scene)__ 是一个容器,容纳游戏中的各个元素,如精灵,标签,节点对象。它负责着游戏的运行逻辑,以帧为单位渲染内容。 4 | 5 | 可以想象游戏就像一个电影,场景是观看者能看到的正在发生的情景。一个电影至少需要一个场景,一个游戏也至少需要一个 `Scene`。在使用 Cocos2d-x 进行游戏的开发中,你可以制作任意数量的场景,并在不同场景间轻松切换。 6 | -------------------------------------------------------------------------------- /zh/scenes/transitioning.md: -------------------------------------------------------------------------------- 1 | # 场景切换 2 | 3 | 开始一个新游戏,改变关卡,或结束游戏时,为了给用户不同的效果呈现,大多需要切换不同的场景。Cocos2d-x 提供了一系列方式去做这件事情 __场景切换__。 4 | 5 | ## 场景切换的方式 6 | 7 | 有很多场景切换的方式,每种都有特定的方法,让我们来看看: 8 | 9 | ```cpp 10 | auto myScene = Scene::create(); 11 | ``` 12 | 13 | __`runWithScene()`__ 用于开始游戏,加载第一个场景。只用于第一个场景! 14 | 15 | ```cpp 16 | Director::getInstance()->runWithScene(myScene); 17 | ``` 18 | 19 | __`replaceScene()`__ 使用传入的场景替换当前场景来切换画面,当前场景被释放。这是切换场景时最常用的方法。 20 | 21 | ```cpp 22 | Director::getInstance()->replaceScene(myScene); 23 | ``` 24 | 25 | __`pushScene()`__ 将当前运行中的场景暂停并压入到场景栈中,再将传入的场景设置为当前运行场景。只有存在正在运行的场景时才能调用该方法。 26 | 27 | ```cpp 28 | Director::getInstance()->pushScene(myScene); 29 | ``` 30 | 31 | __`popScene()`__ 释放当前场景,再从场景栈中弹出栈顶的场景,并将其设置为当前运行场景。如果栈为空,直接结束应用。 32 | 33 | ```cpp 34 | Director::getInstance()->popScene(); 35 | ``` 36 | 37 | ## 场景切换的效果设置 38 | 39 | 在场景切换的过程中,你可以添加一些效果: 40 | 41 | ```cpp 42 | auto myScene = Scene::create(); 43 | 44 | // Transition Fade 45 | Director::getInstance()->replaceScene(TransitionFade::create(0.5, myScene, Color3B(0,255,255))); 46 | 47 | // FlipX 48 | Director::getInstance()->replaceScene(TransitionFlipX::create(2, myScene)); 49 | 50 | // Transition Slide In 51 | Director::getInstance()->replaceScene(TransitionSlideInT::create(1, myScene) ); 52 | ``` 53 | -------------------------------------------------------------------------------- /zh/sprites/creating.md: -------------------------------------------------------------------------------- 1 | # 精灵的创建 2 | 3 | 可以使用一张图像来创建精灵,*PNG, JPEG, TIFF, WebP*, 这几个格式都可以。当然也有一些其它的方式可以创建精灵,如使用 __图集__ 创建,通过 __精灵缓存__ 创建,我们会一个一个的讨论。本节介绍通过图像创建精灵。 4 | 5 | ## 使用图像创建 6 | 7 | `Sprite` 能用一个特定的图像去创建: 8 | 9 | ```cpp 10 | auto mySprite = Sprite::create("mysprite.png"); 11 | ``` 12 | 13 | ![](../../en/sprites/sprites-img/i1.png "") 14 | 15 | 上面直接使用了 __mysprite.png__ 图像来创建精灵。精灵会使用整张图像,图像是多少的分辨率,创建出来的精灵就是多少的分辨率。比如图像是 200 x 200,`Sprite` 也是 200 x 200。 16 | 17 | ### 使用矩形 18 | 19 | 上一个例子,精灵和原始图像的尺寸一致。但是如果你想创建一个尺寸只有原始图像一部分的精灵,那你可以在创建的时候指定一个矩形,指定矩形需要四个值,初始 x 坐标,初始 y 坐标,矩形宽,矩形高。 20 | 21 | ```cpp 22 | auto mySprite = Sprite::create("mysprite.png", Rect(0,0,40,40)); 23 | ``` 24 | 25 | ![](../../en/sprites/sprites-img/i4.png "") 26 | 27 | 矩形的初始坐标,从图形的左上角开始算,即左上角的坐标是 (0, 0),不是从左下角。因此结果精灵是图像左上角的一小块,从左上角开始算起,40 x 40 的大小。 28 | 29 | 如果你没指定一个矩形,Cocos2d-x 引擎就会自动使用这个图像全部的宽和高,看下面的例子,如果你把矩形的宽高指定为图像的宽高,矩形的初始坐标指定为 (0, 0),那这就和第一种情况的效果是完全一样的。 30 | 31 | ```cpp 32 | auto mySprite = Sprite::create("mysprite.png"); 33 | 34 | auto mySprite = Sprite::create("mysprite.png", Rect(0,0,200,200)); 35 | 36 | ``` 37 | -------------------------------------------------------------------------------- /zh/sprites/index.md: -------------------------------------------------------------------------------- 1 | # 精灵(Sprite) 2 | 3 | 之前我们提到,精灵是屏幕上移动的对象,它能被控制。你喜欢玩的游戏中主角可能就是一个精灵,我知道你在想是不是每个图形对象都是一个精灵,不是的,为什么? 如果你能控制它,它才是一个精灵,如果无法控制,那就只是一个节点(Node)。 4 | 5 | 准确的说,__精灵(Sprite)__ 是一个能通过改变自身的属性:角度,位置,缩放,颜色等,变成可控制动画的 2D 图像。 6 | -------------------------------------------------------------------------------- /zh/sprites/polygon.md: -------------------------------------------------------------------------------- 1 | # 多边形精灵 2 | 3 | __多边形精灵(Polygon Sprite)__ 也是一个精灵,同样是为了展示一个可以被控制的图像,但是和普通精灵的区别是,普通精灵在绘图处理中被分为了两个三角形,多边形精灵则是被分为了一系列三角形。 4 | 5 | ## 为什么要使用多边形精灵 6 | 7 | __提高性能__! 8 | 9 | 要深入分析这个是如何提高性能的,会需要很多和像素填充率有关的技术术语。幸好本节是入门性质的文档,能让大家理解多边形精灵比普通精灵性能好就可以了,不用讨论特定宽高矩形绘制时的性能问题。 10 | 11 | ![](../../en/sprites/sprites-img/polygonsprite.png "") 12 | 13 | 注意左右两种情况的不同。 14 | 15 | 左侧,是一个典型的精灵绘制时的处理,精灵被处理成一个有两个三角形组成的矩形。 16 | 17 | 右侧,是一个多边形精灵绘制时的处理,精灵被处理成一系列小的三角形。 18 | 19 | 显然可以看到,右侧多边形精灵需要绘制的像素数量比左侧精灵需要的像素数量更小,但是由于划分了多个三角形出现了更多的顶点,由于在现代的图形处理中,一般绘制定点比绘制像素消耗的性能少。所以多边形精灵的性能更好,实际的测试结果也验证了这一点。 20 | 21 | ## AutoPolygon 22 | 23 | __`AutoPolygon`__ 是一个工具类,它可以在程序运行时,通过跟踪关键点和三角测量,将一个矩形图像划分成一系列小三角形块。 24 | 25 | 首先将图像资源传入 `AutoPolygon` 进行处理,然后我们使用它生成的对象进行精灵的创建就能得到多边形精灵。 26 | 27 | ```cpp 28 | // Generate polygon info automatically. 29 | auto pinfo = AutoPolygon::generatePolygon("filename.png"); 30 | 31 | // Create a sprite with polygon info. 32 | auto sprite = Sprite::create(pinfo); 33 | 34 | ``` 35 | -------------------------------------------------------------------------------- /zh/sprites/spriteframe_cache.md: -------------------------------------------------------------------------------- 1 | # 使用精灵缓存 2 | 3 | 精灵缓存是 Cocos2d-x 为了提高精灵的访问速度,提供的一个精灵的缓存机制。 4 | 5 | 我们可以创建一个精灵并把精灵放到精灵的缓存对象 __`SpriteFrameCache`__ 中: 6 | 7 | ```cpp 8 | // Our .plist file has names for each of the sprites in it. We'll grab 9 | // the sprite named, "mysprite" from the sprite sheet: 10 | auto mysprite = Sprite::createWithSpriteFrameName("mysprite.png"); 11 | 12 | ``` 13 | 14 | ![](../../en/sprites/sprites-img/i3.png "") 15 | 16 | 相对的,我们也可以从精灵的缓存对象 `SpriteFrameCache` 访问一个精灵,访问方法是先从缓存对象中获取对应的 `SpriteFrame`,然后从 `SpriteFrame`创建精灵,方法: 17 | 18 | ```cpp 19 | // this is equivalent to the previous example, 20 | // but it is created by retrieving the SpriteFrame from the cache. 21 | auto newspriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("Blue_Front1.png"); 22 | auto newSprite = Sprite::createWithSpriteFrame(newspriteFrame); 23 | 24 | ``` 25 | 26 | ![](../../en/sprites/sprites-img/i3.png "") 27 | -------------------------------------------------------------------------------- /zh/sprites/spritesheets.md: -------------------------------------------------------------------------------- 1 | # 使用图集 2 | 3 | __图集(Sprite Sheet)__ 是通过专门的工具将多张图片合并成一张大图,并通过 plist 等格式的文件索引的资源,使用图集比使用多个独立图像占用的磁盘空间更少,还会有更好的性能。这种方式已经是游戏行业中提高游戏性能的标准方法之一。 4 | 5 | 在使用图集时,首先将其全部加载到 `SpriteFrameCache` 中,`SpriteFrameCache` 是一个全局的缓存类,缓存了添加到其中的 `SpriteFrame` 对象,提高了精灵的访问速度。`SpriteFrame` 只加载一次,后续一直保存在 `SpriteFrameCache` 中。 6 | 7 | 示例: 8 | 9 | ![](../../en/sprites/sprites-img/3_1.png "example SpriteSheet") 10 | 11 | 单看这个图集,似乎很难分析出什么,让我们对比一下: 12 | 13 | ![](../../en/sprites/sprites-img/spritesheet.png "example SpriteSheet") 14 | 15 | 这就很容易看出来,它至少完成了将多个图像素材合为一个,同时减少了磁盘空间占用。 16 | 17 | 继续来看如何在代码中使用。 18 | 19 | ## 加载图集 20 | 21 | 获取到 `SpriteFrameCache` 的实例,把图集添加到实例中。 22 | 23 | ```cpp 24 | // load the Sprite Sheet 25 | auto spritecache = SpriteFrameCache::getInstance(); 26 | 27 | // the .plist file can be generated with any of the tools mentioned below 28 | spritecache->addSpriteFramesWithFile("sprites.plist"); 29 | 30 | ``` 31 | 32 | 这样我们就完成了,将一个图集添加到 `SpriteFrameCache` 中,现在我们就能利用这个对象创建精灵了! 33 | 34 | ## 创建图集 35 | 36 | 手动创建图集资源是一个单调乏味的过程,幸运的是有一些工具能帮助我们自动创建,下面是推荐的几个工具: 37 | 38 | * [Texture Packer](https://www.codeandweb.com/texturepacker) 39 | * [Zwoptex](https://www.zwopple.com/zwoptex/) 40 | * [ShoeBox](http://renderhjs.net/shoebox/) 41 | * [Sprite Sheet Packer](http://amakaseev.github.io/sprite-sheet-packer/) 42 | 43 | 其中 __Texture Packer__ 有一个专门为 Cocos2d-x 写的图集创建指南。[传送门](https://www.codeandweb.com/texturepacker/tutorials/animations-and-spritesheets-in-cocos2d-x) 44 | -------------------------------------------------------------------------------- /zh/ui_components/buttons.md: -------------------------------------------------------------------------------- 1 | # 按钮(Button) 2 | 3 | 按钮是什么,好像没有必要解释,我们都知道这东西是用来点击的,点击后使我们的游戏产生一些变化,比如更改了场景,触发了动作等等。按钮会拦截点击事件,事件触发时调用事先定义好的回调函数。按钮有一个正常状态,一个选择状态,还有一个不可点击状态,按钮的外观可以根据这三个状态而改变。Cocos2d-x 提供 __`Button`__ 对象支持按钮功能,创建一个按钮并定义一个回调函数很简单,记得在操作的时候要有头文件包含: `#include "ui/CocosGUI.h"`。 4 | 5 | ```cpp 6 | 7 | auto button = Button::create("normal_image.png", "selected_image.png", "disabled_image.png"); 8 | 9 | button->setTitleText("Button Text"); 10 | 11 | button->addTouchEventListener([&](Ref* sender, Widget::TouchEventType type){ 12 | switch (type) 13 | { 14 | case ui::Widget::TouchEventType::BEGAN: 15 | break; 16 | case ui::Widget::TouchEventType::ENDED: 17 | std::cout << "Button 1 clicked" << std::endl; 18 | break; 19 | default: 20 | break; 21 | } 22 | }); 23 | 24 | this->addChild(button); 25 | ``` 26 | 27 | 可以看到,我们为按钮的每个状态都指定了一个 _.png_ 图像: 28 | 29 | ![](../../en/ui_components/ui_components-img/Button_Normal.png "") ![](../../en/basic_concepts/basic_concepts-img/smallSpacer.png "") ![](../../en/ui_components/ui_components-img/Button_Press.png "") ![](../../en/basic_concepts/basic_concepts-img/smallSpacer.png "") 30 | ![](../../en/ui_components/ui_components-img/Button_Disable.png "") 31 | 32 | 在屏幕显示的时候,同一个时刻只能看到一个状态,正常显示状态像这样: 33 | 34 | ![](../../en/ui_components/ui_components-img/Button_example.png "") 35 | -------------------------------------------------------------------------------- /zh/ui_components/index.md: -------------------------------------------------------------------------------- 1 | # UI 组件 2 | 3 | UI 组件不是游戏专用的,是个应用程序都可能会用几个。看一看你常使用的应用程序,肯定能发现它有使用 UI 组件。UI 代表什么,UI 组件是做什么的? 4 | 5 | UI 代表用户界面,是 _User Interface_ 的缩写,你看到的屏幕上的东西就是用户界面。界面组件有标签,按钮,菜单,滑动条等。Cocos2d-x 提供了一套易用的 UI 组件,游戏开发过程中,你能很容易的把它们添加到游戏中。 6 | 7 | 听起来这可能很简单,但创建像 `标签(Label)` 这样的核心类实际要考虑很多问题。可以想象创建一套自定义的组件是多么的困难!当然你根本没必要这样做,因为你需要的我们都考虑到了。 8 | -------------------------------------------------------------------------------- /zh/ui_components/loading_bar.md: -------------------------------------------------------------------------------- 1 | # 进度条(LoadingBar) 2 | 3 | 如果你经常玩游戏,那肯定见过一个情景:屏幕上显示了一个进度条,提示资源正在加载中,这个条表示资源加载的进度。Cocos2d-x 提供 __`LoadingBar`__ 对象支持进度条。 4 | 5 | 创建一个进度条: 6 | 7 | ```cpp 8 | #include "ui/CocosGUI.h" 9 | 10 | auto loadingBar = LoadingBar::create("LoadingBarFile.png"); 11 | 12 | // set the direction of the loading bars progress 13 | loadingBar->setDirection(LoadingBar::Direction::RIGHT); 14 | 15 | this->addChild(loadingBar); 16 | ``` 17 | 18 | 上面的例子,我们创建了一个进度条,设置了当进度增加时,进度条向右填充。 19 | 20 | 在进度的控制中,你肯定需要改变进度条的进度. 示例: 21 | 22 | ```cpp 23 | #include "ui/CocosGUI.h" 24 | 25 | auto loadingBar = LoadingBar::create("LoadingBarFile.png"); 26 | loadingBar->setDirection(LoadingBar::Direction::RIGHT); 27 | 28 | // something happened, change the percentage of the loading bar 29 | loadingBar->setPercent(25); 30 | 31 | // more things happened, change the percentage again. 32 | loadingBar->setPercent(35); 33 | 34 | this->addChild(loadingBar); 35 | ``` 36 | 37 | 上面例子,使用的进度条图像是: 38 | 39 | ![](../../en/ui_components/ui_components-img/LoadingBarFile.png "") 40 | 41 | 在屏幕上一个满进度的进度条是这样的: 42 | 43 | ![](../../en/ui_components/ui_components-img/LoadingBar_example.png "") 44 | -------------------------------------------------------------------------------- /zh/ui_components/textfields.md: -------------------------------------------------------------------------------- 1 | # 文本框(TextField) 2 | 3 | 如果你想让参与游戏的玩家可以自定义一个昵称怎么办,在哪里输入文本?Cocos2d-x 提供 __`TextField`__ 满足这种需求。它支持触摸事件,焦点,定位内容百分比等。 4 | 5 | 创建一个文本框: 6 | 7 | ```cpp 8 | #include "ui/CocosGUI.h" 9 | 10 | auto textField = TextField::create("","Arial",30); 11 | 12 | textField->addTouchEventListener([&](Ref* sender, Widget::TouchEventType type){ 13 | std::cout << "editing a TextField" << std::endl; 14 | }); 15 | 16 | this->addChild(textField); 17 | ``` 18 | 19 | 这个例子中,创建了一个 `TextField`,指定了回调函数。 20 | 21 | 提供的文本框对象,是多功能的,能满足所有的输入需求,比如用户密码的输入,限制用户可以输入的字符数等等! 22 | 23 | 看一个例子: 24 | 25 | ```cpp 26 | #include "ui/CocosGUI.h" 27 | 28 | auto textField = TextField::create("","Arial",30); 29 | 30 | // make this TextField password enabled 31 | textField->setPasswordEnabled(true); 32 | 33 | // set the maximum number of characters the user can enter for this TextField 34 | textField->setMaxLength(10); 35 | 36 | textField->addTouchEventListener([&](Ref* sender, Widget::TouchEventType type){ 37 | std::cout << "editing a TextField" << std::endl; 38 | }); 39 | 40 | this->addChild(textField); 41 | ``` 42 | 43 | 屏幕上一个文本框是这样的: 44 | 45 | ![](../../en/ui_components/ui_components-img/TextField_example.png "") 46 | 47 | 当点击文本框,键盘就会自动调出来,此时可以输入文本: 48 | 49 | ![](../../en/ui_components/ui_components-img/TextField_example_keyboard.png "") 50 | --------------------------------------------------------------------------------