├── .cocos-project.json ├── .gitattributes ├── .gitignore ├── CMakeLists.txt ├── Classes ├── AppDelegate.cpp ├── AppDelegate.h ├── GameScene.cpp ├── GameScene.h ├── SimulateGame.cpp ├── SimulateGame.h ├── Tile.cpp ├── Tile.h └── common.h ├── Resources ├── background.png ├── fonts │ ├── Abberancy.ttf │ ├── cyril.ttf │ └── tahoma.ttf └── item.png ├── proj.android ├── .classpath ├── .cproject ├── .project ├── .settings │ ├── org.eclipse.cdt.codan.core.prefs │ ├── org.eclipse.cdt.core.prefs │ └── org.eclipse.ltk.core.refactoring.prefs ├── AndroidManifest.xml ├── ant.properties ├── build-cfg.json ├── build.xml ├── build_native.py ├── jni │ ├── Android.mk │ ├── Application.mk │ └── hellocpp │ │ └── main.cpp ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-ldpi │ │ └── icon.png │ ├── drawable-mdpi │ │ └── icon.png │ └── values │ │ └── strings.xml └── src │ └── org │ └── cocos2dx │ └── cpp │ └── AppActivity.java ├── proj.ios_mac ├── Cocos2048.xcodeproj │ └── project.pbxproj ├── ios │ ├── AppController.h │ ├── AppController.mm │ ├── Default-568h@2x.png │ ├── Default-667h@2x.png │ ├── Default-736h@3x.png │ ├── Default.png │ ├── Default@2x.png │ ├── Icon-100.png │ ├── Icon-114.png │ ├── Icon-120.png │ ├── Icon-144.png │ ├── Icon-152.png │ ├── Icon-29.png │ ├── Icon-40.png │ ├── Icon-50.png │ ├── Icon-57.png │ ├── Icon-58.png │ ├── Icon-72.png │ ├── Icon-76.png │ ├── Icon-80.png │ ├── Info.plist │ ├── RootViewController.h │ ├── RootViewController.mm │ └── main.m └── mac │ ├── Icon.icns │ ├── Info.plist │ └── main.cpp ├── proj.linux └── main.cpp ├── proj.win32 ├── Cocos2048.opensdf ├── Cocos2048.sln ├── Cocos2048.v12.suo ├── Cocos2048.vcxproj ├── Cocos2048.vcxproj.filters ├── Cocos2048.vcxproj.user ├── build-cfg.json ├── game.aps ├── game.rc ├── main.cpp ├── main.h ├── res │ └── game.ico └── resource.h ├── proj.win8.1-universal ├── App.Shared │ ├── App.xaml │ ├── App.xaml.cpp │ ├── App.xaml.h │ ├── Cocos2048.Shared.vcxitems │ ├── Cocos2048.Shared.vcxitems.filters │ ├── Cocos2dRenderer.cpp │ ├── Cocos2dRenderer.h │ ├── OpenGLES.cpp │ ├── OpenGLES.h │ ├── OpenGLESPage.xaml │ ├── OpenGLESPage.xaml.cpp │ ├── OpenGLESPage.xaml.h │ ├── pch.cpp │ └── pch.h ├── App.Windows │ ├── Assets │ │ ├── Logo.scale-100.png │ │ ├── SmallLogo.scale-100.png │ │ ├── SplashScreen.scale-100.png │ │ └── StoreLogo.scale-100.png │ ├── Cocos2048.Windows.vcxproj │ ├── Cocos2048.Windows.vcxproj.filters │ ├── Cocos2048.Windows_TemporaryKey.pfx │ └── Package.appxmanifest ├── App.WindowsPhone │ ├── Assets │ │ ├── Logo.scale-240.png │ │ ├── SmallLogo.scale-240.png │ │ ├── SplashScreen.scale-240.png │ │ ├── Square71x71Logo.scale-240.png │ │ ├── StoreLogo.scale-240.png │ │ └── WideLogo.scale-240.png │ ├── Cocos2048.WindowsPhone.vcxproj │ ├── Cocos2048.WindowsPhone.vcxproj.filters │ └── Package.appxmanifest └── Cocos2048.sln ├── proj.wp8-xaml ├── App │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ │ ├── AlignmentGrid.png │ │ ├── ApplicationIcon.png │ │ └── Tiles │ │ │ ├── FlipCycleTileLarge.png │ │ │ ├── FlipCycleTileMedium.png │ │ │ ├── FlipCycleTileSmall.png │ │ │ ├── IconicTileMediumLarge.png │ │ │ └── IconicTileSmall.png │ ├── Cocos2048.csproj │ ├── EditBox.xaml │ ├── EditBox.xaml.cs │ ├── LocalizedStrings.cs │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Properties │ │ ├── AppManifest.xml │ │ ├── AssemblyInfo.cs │ │ └── WMAppManifest.xml │ ├── Resources │ │ ├── AppResources.Designer.cs │ │ └── AppResources.resx │ └── SplashScreenImage.jpg ├── AppComponent │ ├── Cocos2048Component.vcxproj │ ├── Cocos2048Component.vcxproj.filters │ └── src │ │ ├── Cocos2dRenderer.cpp │ │ ├── Cocos2dRenderer.h │ │ ├── Direct3DContentProvider.cpp │ │ ├── Direct3DContentProvider.h │ │ ├── Direct3DInterop.cpp │ │ ├── Direct3DInterop.h │ │ ├── DirectXBase.cpp │ │ ├── DirectXBase.h │ │ ├── DirectXHelper.h │ │ ├── EditBoxEvent.cpp │ │ ├── EditBoxEvent.h │ │ ├── pch.cpp │ │ └── pch.h └── Cocos2048.sln └── readme.md /.cocos-project.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_type": "cpp" 3 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | 30 | # ========================= 31 | # Operating System Files 32 | # ========================= 33 | 34 | # OSX 35 | # ========================= 36 | 37 | .DS_Store 38 | .AppleDouble 39 | .LSOverride 40 | 41 | # Thumbnails 42 | ._* 43 | 44 | # Files that might appear on external disk 45 | .Spotlight-V100 46 | .Trashes 47 | 48 | # Directories potentially created on remote AFP share 49 | .AppleDB 50 | .AppleDesktop 51 | Network Trash Folder 52 | Temporary Items 53 | .apdisk 54 | 55 | # Windows 56 | # ========================= 57 | 58 | # Windows image file caches 59 | Thumbs.db 60 | ehthumbs.db 61 | 62 | # Folder config file 63 | Desktop.ini 64 | 65 | # Recycle Bin used on file shares 66 | $RECYCLE.BIN/ 67 | 68 | # Windows Installer files 69 | *.cab 70 | *.msi 71 | *.msm 72 | *.msp 73 | 74 | # Windows shortcuts 75 | *.lnk 76 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #/**************************************************************************** 2 | # Copyright (c) 2013-2014 cocos2d-x.org 3 | # 4 | # http://www.cocos2d-x.org 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # ****************************************************************************/ 24 | cmake_policy(SET CMP0017 NEW) 25 | 26 | cmake_minimum_required(VERSION 2.8) 27 | 28 | set(APP_NAME MyGame) 29 | project (${APP_NAME}) 30 | 31 | set(COCOS2D_ROOT ${CMAKE_SOURCE_DIR}/cocos2d) 32 | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${COCOS2D_ROOT}/cmake/Modules/") 34 | include(CocosBuildHelpers) 35 | 36 | # libcocos2d 37 | set(BUILD_CPP_TESTS OFF CACHE BOOL "turn off build cpp-tests") 38 | set(BUILD_LUA_LIBS OFF CACHE BOOL "turn off build lua-tests") 39 | add_subdirectory(${COCOS2D_ROOT}) 40 | 41 | # Some macro definitions 42 | if(WINDOWS) 43 | if(BUILD_SHARED_LIBS) 44 | ADD_DEFINITIONS (-D_USRDLL -D_EXPORT_DLL_ -D_USEGUIDLL -D_USREXDLL -D_USRSTUDIODLL) 45 | else() 46 | ADD_DEFINITIONS (-DCC_STATIC) 47 | endif() 48 | 49 | ADD_DEFINITIONS (-DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32 -D_WIN32) 50 | set(PLATFORM_FOLDER win32) 51 | elseif(MACOSX OR APPLE) 52 | ADD_DEFINITIONS (-DCC_TARGET_OS_MAC) 53 | ADD_DEFINITIONS (-DUSE_FILE32API) 54 | set(PLATFORM_FOLDER mac) 55 | elseif(LINUX) 56 | ADD_DEFINITIONS(-DLINUX) 57 | set(PLATFORM_FOLDER linux) 58 | elseif(ANDROID) 59 | ADD_DEFINITIONS (-DUSE_FILE32API) 60 | set(PLATFORM_FOLDER android) 61 | else() 62 | message( FATAL_ERROR "Unsupported platform, CMake will exit" ) 63 | endif() 64 | 65 | 66 | # Compiler options 67 | if(MSVC) 68 | ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS 69 | -wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710 70 | -wd4514 -wd4056 -wd4996 -wd4099) 71 | else() 72 | set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1") 73 | set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) 74 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -std=c99") 75 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder") 76 | if(CLANG) 77 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") 78 | endif() 79 | endif(MSVC) 80 | 81 | 82 | 83 | set(PLATFORM_SPECIFIC_SRC) 84 | set(PLATFORM_SPECIFIC_HEADERS) 85 | if(MACOSX OR APPLE) 86 | set(PLATFORM_SPECIFIC_SRC 87 | proj.ios_mac/ios/main.m 88 | proj.ios_mac/ios/RootViewController.mm 89 | proj.ios_mac/ios/AppController.mm 90 | ) 91 | set(PLATFORM_SPECIFIC_HEADERS 92 | proj.ios_mac/ios/RootViewController.h 93 | proj.ios_mac/ios/AppController.h 94 | ) 95 | elseif(LINUX) #assume linux 96 | set(PLATFORM_SPECIFIC_SRC 97 | proj.linux/main.cpp 98 | ) 99 | elseif ( WIN32 ) 100 | set(PLATFORM_SPECIFIC_SRC 101 | proj.win32/main.cpp 102 | ) 103 | set(PLATFORM_SPECIFIC_HEADERS 104 | proj.win32/main.h 105 | proj.win32/resource.h 106 | ) 107 | endif() 108 | 109 | include_directories( 110 | /usr/local/include/GLFW 111 | /usr/include/GLFW 112 | ${COCOS2D_ROOT}/cocos 113 | Classes 114 | ) 115 | 116 | set(GAME_SRC 117 | Classes/AppDelegate.cpp 118 | Classes/HelloWorldScene.cpp 119 | ${PLATFORM_SPECIFIC_SRC} 120 | ) 121 | 122 | set(GAME_HEADERS 123 | Classes/AppDelegate.h 124 | Classes/HelloWorldScene.h 125 | ${PLATFORM_SPECIFIC_HEADERS} 126 | ) 127 | 128 | if(GAME_HEADERS) 129 | add_executable(${APP_NAME} ${GAME_SRC} ${GAME_HEADERS}) 130 | else() 131 | add_executable(${APP_NAME} ${GAME_SRC}) 132 | endif() 133 | 134 | target_link_libraries(${APP_NAME} cocos2d) 135 | 136 | set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin") 137 | 138 | set_target_properties(${APP_NAME} PROPERTIES 139 | RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}") 140 | 141 | if ( WIN32 ) 142 | #also copying dlls to binary directory for the executable to run 143 | pre_build(${APP_NAME} 144 | COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources 145 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources 146 | COMMAND ${CMAKE_COMMAND} -E copy ${COCOS2D_ROOT}/external/win32-specific/gles/prebuilt/glew32.dll ${APP_BIN_DIR}/${CMAKE_BUILD_TYPE} 147 | COMMAND ${CMAKE_COMMAND} -E copy ${COCOS2D_ROOT}/external/win32-specific/zlib/prebuilt/zlib1.dll ${APP_BIN_DIR}/${CMAKE_BUILD_TYPE} 148 | ) 149 | else() 150 | pre_build(${APP_NAME} 151 | COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources 152 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources 153 | ) 154 | 155 | endif() 156 | -------------------------------------------------------------------------------- /Classes/AppDelegate.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GameScene.h" 3 | 4 | USING_NS_CC; 5 | 6 | AppDelegate::AppDelegate() { 7 | 8 | } 9 | 10 | AppDelegate::~AppDelegate() 11 | { 12 | } 13 | 14 | //if you want a different context,just modify the value of glContextAttrs 15 | //it will takes effect on all platforms 16 | void AppDelegate::initGLContextAttrs() 17 | { 18 | //set OpenGL context attributions,now can only set six attributions: 19 | //red,green,blue,alpha,depth,stencil 20 | GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8}; 21 | 22 | GLView::setGLContextAttrs(glContextAttrs); 23 | } 24 | 25 | bool AppDelegate::applicationDidFinishLaunching() { 26 | // initialize director 27 | auto director = Director::getInstance(); 28 | auto glview = director->getOpenGLView(); 29 | if(!glview) { 30 | glview = GLViewImpl::create("My 2048"); 31 | glview->setFrameSize(640*0.8, 960*0.8); 32 | director->setOpenGLView(glview); 33 | glview->setDesignResolutionSize(360, 640, ResolutionPolicy::NO_BORDER); 34 | } 35 | 36 | // turn on display FPS 37 | director->setDisplayStats(false); 38 | 39 | // set FPS. the default value is 1.0/60 if you don't call this 40 | director->setAnimationInterval(1.0 / 60); 41 | 42 | // create a scene. it's an autorelease object 43 | auto scene = GameScene::createScene(); 44 | 45 | // run 46 | director->runWithScene(scene); 47 | 48 | return true; 49 | } 50 | 51 | // This function will be called when the app is inactive. When comes a phone call,it's be invoked too 52 | void AppDelegate::applicationDidEnterBackground() { 53 | Director::getInstance()->stopAnimation(); 54 | 55 | // if you use SimpleAudioEngine, it must be pause 56 | // SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); 57 | } 58 | 59 | // this function will be called when the app is active again 60 | void AppDelegate::applicationWillEnterForeground() { 61 | Director::getInstance()->startAnimation(); 62 | 63 | // if you use SimpleAudioEngine, it must resume here 64 | // SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); 65 | } 66 | -------------------------------------------------------------------------------- /Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #ifndef _APP_DELEGATE_H_ 2 | #define _APP_DELEGATE_H_ 3 | 4 | #include "cocos2d.h" 5 | 6 | /** 7 | @brief The cocos2d Application. 8 | 9 | The reason for implement as private inheritance is to hide some interface call by Director. 10 | */ 11 | class AppDelegate : private cocos2d::Application 12 | { 13 | public: 14 | AppDelegate(); 15 | virtual ~AppDelegate(); 16 | 17 | virtual void initGLContextAttrs(); 18 | 19 | /** 20 | @brief Implement Director and Scene init code here. 21 | @return true Initialize success, app continue. 22 | @return false Initialize failed, app terminate. 23 | */ 24 | virtual bool applicationDidFinishLaunching(); 25 | 26 | /** 27 | @brief The function be called when the application enter background 28 | @param the pointer of the application 29 | */ 30 | virtual void applicationDidEnterBackground(); 31 | 32 | /** 33 | @brief The function be called when the application enter foreground 34 | @param the pointer of the application 35 | */ 36 | virtual void applicationWillEnterForeground(); 37 | }; 38 | 39 | #endif // _APP_DELEGATE_H_ 40 | 41 | -------------------------------------------------------------------------------- /Classes/GameScene.h: -------------------------------------------------------------------------------- 1 | #ifndef __GAME_SCENE_H__ 2 | #define __GAME_SCENE_H__ 3 | 4 | #include "cocos2d.h" 5 | #include "Tile.h" 6 | #include "common.h" 7 | USING_NS_CC; 8 | 9 | class GameScene : public cocos2d::Layer 10 | { 11 | public: 12 | GameScene(){} 13 | ~GameScene(){} 14 | 15 | // there's no 'id' in cpp, so we recommend returning the class instance pointer 16 | static cocos2d::Scene* createScene(); 17 | 18 | // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone 19 | virtual bool init(); 20 | 21 | // implement the "static create()" method manually 22 | CREATE_FUNC(GameScene); 23 | 24 | private: 25 | void moveTiles(int targetRow, int col, puzzle::Tile* currTile); 26 | void mergeTiles(int targetRow, int col, puzzle::Tile* prevTile, puzzle::Tile* currTile); 27 | void operateEndCallback(int add_score); 28 | void resetGame(); 29 | void clearTiles(); 30 | void addScore(int s); 31 | bool canMove(); 32 | bool hasWin(); 33 | int getEmptySoltNum(); 34 | void showResult(); 35 | void moveAI(float f); 36 | 37 | puzzle::Tile *genRandomTile(); 38 | cocos2d::Vec2 caculateTilePos(int row, int col); 39 | void operateTiles(EMoveTo mt); 40 | void onNewGame(cocos2d::Ref *sender); 41 | void onAI(cocos2d::Ref *sender); 42 | void onTest(cocos2d::Ref* sender); 43 | 44 | bool singleTouchBegan(Touch *touch, Event *event); 45 | void singleTouchMoved(Touch *touch, Event *event); 46 | void singleTouchEnded(Touch *touch, Event *event); 47 | void singleTouchCancelled(Touch *touch, Event *event); 48 | 49 | void onKeyDown(EventKeyboard::KeyCode code, Event* event); 50 | void onKeyUp(EventKeyboard::KeyCode code, Event* event); 51 | 52 | Rect touchRect; //valid touch rect 53 | Vec2 beginPos; 54 | Vec2 endPos; 55 | //[0][0],[0][1],[0][2],[0][3] 56 | //[1][0],[1][1],[1][2],[1][3] 57 | //[2][0],[2][1],[2][2],[2][3] 58 | //[3][0],[3][1],[3][2],[3][3] 59 | puzzle::Tile *tiles[4][4]; 60 | 61 | int score = 0; 62 | int bestScore = 0; 63 | int deltaScore = 0; 64 | int moveCount = 0; 65 | Label * scoreValLabel; 66 | Label * bestValLabel; 67 | std::function resultCallback = nullptr; 68 | GameState state = GameState::prepare; 69 | }; 70 | 71 | #endif // __GAME_SCENE_H__ 72 | -------------------------------------------------------------------------------- /Classes/SimulateGame.cpp: -------------------------------------------------------------------------------- 1 | #include "SimulateGame.h" 2 | #include "cocos2d.h" 3 | SimulateGame::SimulateGame(puzzle::Tile *data[4][4], int score) 4 | { 5 | for (int i = 0; i < 4; i++) { 6 | for (int j = 0; j < 4; j++) { 7 | if (data[i][j]) { 8 | //cocos2d::log("%d", data[i][j]->getValue()); 9 | } 10 | gameData.tiles[i][j] = data[i][j] == nullptr ? 0 : data[i][j]->getValue(); 11 | } 12 | } 13 | /*for (int i = 0; i < 4; i++) { 14 | cocos2d::log("%d\t%d\t%d\t%d", gameData.tiles[i][0], gameData.tiles[i][1], gameData.tiles[i][2], gameData.tiles[i][3]); 15 | }*/ 16 | this->prevScore = score; 17 | } 18 | 19 | static bool isGameOver(int tiles[4][4]) 20 | { 21 | for (int i = 0; i < 4; i++) { 22 | for (int j = 0; j < 4; j++) { 23 | if (tiles[i][j] == 0) 24 | return false; 25 | } 26 | } 27 | for (int i = 0; i < 4; i++) { 28 | for (int j = 0; j < 4; j++) { 29 | if (i > 0 && tiles[i - 1][j]== tiles[i][j]) { 30 | return false; 31 | } 32 | if (i + 1 < 4 && tiles[i + 1][j] == tiles[i][j]) { 33 | return false; 34 | } 35 | if (j > 0 && tiles[i][j - 1] == tiles[i][j]) { 36 | return false; 37 | } 38 | if (j + 1 < 4 && tiles[i][j + 1] == tiles[i][j]) { 39 | return false; 40 | } 41 | } 42 | } 43 | return true; 44 | } 45 | 46 | static bool canWin(int tiles[4][4]) { 47 | for (int i = 0; i < 4; i++) { 48 | for (int j = 0; j < 4; j++) { 49 | if (tiles[i][j] == 2048) 50 | return true; 51 | } 52 | } 53 | return false; 54 | } 55 | 56 | bool SimulateGame::canMove(GameData& d, EMoveTo mt) 57 | { 58 | GameData temp(d); 59 | move(temp, mt); 60 | for (int i = 0; i < 4; i++) { 61 | for (int j = 0; j < 4; j++) { 62 | if (d.tiles[i][j] != temp.tiles[i][j]) 63 | return true; 64 | } 65 | } 66 | return false; 67 | } 68 | 69 | void SimulateGame::randVal(GameData &data) 70 | { 71 | int randvalue = (rand() % 10) > 8 ? 4 : 2; 72 | int randx = rand()%4; 73 | int randy = rand()%4; 74 | if (data.tiles[randx][randy] != 0) { 75 | for (int i = 0; i < 4; i++) { 76 | for (int j = 0; j < 4; j++) { 77 | if (data.tiles[i][j] == 0) 78 | data.tiles[i][j] = randvalue; 79 | } 80 | } 81 | } 82 | else { 83 | data.tiles[randx][randy] = randvalue; 84 | } 85 | } 86 | 87 | int SimulateGame::simMoveOnce(EMoveTo mt) 88 | { 89 | GameData data(this->gameData); 90 | if (!canMove(data, mt)) return 0; 91 | int cnt = 0; 92 | while (!isGameOver(data.tiles)) { 93 | move(data, mt); 94 | if (canWin(data.tiles)) { 95 | data.score += 10000; 96 | break; 97 | } 98 | mt = (EMoveTo)(rand() % 4); 99 | this->randVal(data); 100 | } 101 | return data.score == 0 ? 1 : data.score; 102 | } 103 | 104 | void SimulateGame::move(GameData &data ,EMoveTo mt) 105 | { 106 | if (mt == EMoveTo::down) { 107 | for (int col = 0; col < 4; col++) { 108 | int targetRow = 3; 109 | int prevTile = 0; 110 | for (int row = 3; row >= 0; row--) { 111 | if (data.tiles[row][col] != 0) { 112 | auto currTile = data.tiles[row][col]; 113 | if (prevTile != 0 && prevTile == currTile) { 114 | //merge 115 | //this->mergeTiles(targetRow + 1, col, prevTile, currTile); 116 | data.tiles[targetRow + 1][col] = currTile * 2; 117 | data.tiles[row][col] = 0; 118 | prevTile = 0; 119 | data.score += currTile * 2; 120 | continue; 121 | } 122 | else if (targetRow != row) { 123 | data.tiles[targetRow][col] = currTile; 124 | data.tiles[row][col] = 0; 125 | } 126 | prevTile = currTile; 127 | targetRow--; 128 | } 129 | } 130 | } 131 | } 132 | else if (mt == EMoveTo::up) { 133 | for (int col = 0; col < 4; col++) { 134 | int targetRow = 0; 135 | int prevTile = 0; 136 | for (int row = 0; row < 4; row++) { 137 | if (data.tiles[row][col] != 0) { 138 | auto currTile = data.tiles[row][col]; 139 | if (prevTile != 0 && prevTile == currTile) { 140 | //merge 141 | //this->mergeTiles(targetRow - 1, col, prevTile, currTile); 142 | data.tiles[targetRow - 1][col] = currTile * 2; 143 | data.tiles[row][col] = 0; 144 | prevTile = 0; 145 | data.score += currTile * 2; 146 | continue; 147 | } 148 | else if (targetRow != row) { 149 | data.tiles[targetRow][col] = currTile; 150 | data.tiles[row][col] = 0; 151 | } 152 | prevTile = currTile; 153 | targetRow++; 154 | } 155 | } 156 | } 157 | } 158 | else if (mt == EMoveTo::left) { 159 | for (int row = 0; row < 4; row++) { 160 | int targetCol = 0; 161 | int prevTile = 0; 162 | for (int col = 0; col < 4; col++) { 163 | if (data.tiles[row][col] != 0) { 164 | auto currTile = data.tiles[row][col]; 165 | if (prevTile != 0 && prevTile == currTile) { 166 | //merge 167 | //this->mergeTiles(row, targetCol - 1, prevTile, currTile); 168 | data.tiles[row][targetCol - 1] = currTile * 2; 169 | data.tiles[row][col] = 0; 170 | prevTile = 0; 171 | data.score += currTile * 2; 172 | continue; 173 | } 174 | else if (targetCol != col) { 175 | //this->moveTiles(row, targetCol, currTile); 176 | data.tiles[row][targetCol] = currTile; 177 | data.tiles[row][col] = 0; 178 | } 179 | prevTile = currTile; 180 | targetCol++; 181 | } 182 | } 183 | } 184 | } 185 | else if (mt == EMoveTo::right){ 186 | for (int row = 0; row < 4; row++) { 187 | int targetCol = 3; 188 | int prevTile = 0; 189 | for (int col = 3; col >= 0; col--) { 190 | if (data.tiles[row][col] != 0) { 191 | auto currTile = data.tiles[row][col]; 192 | if (prevTile != 0 && prevTile == currTile) { 193 | //merge 194 | //this->mergeTiles(row, targetCol + 1, prevTile, currTile); 195 | data.tiles[row][targetCol + 1] = currTile * 2; 196 | data.tiles[row][col] = 0; 197 | prevTile = 0; 198 | data.score += currTile * 2; 199 | continue; 200 | } 201 | else if (targetCol != col) { 202 | //this->moveTiles(row, targetCol, currTile); 203 | data.tiles[row][targetCol] = currTile; 204 | data.tiles[row][col] = 0; 205 | } 206 | prevTile = currTile; 207 | targetCol--; 208 | } 209 | } 210 | } 211 | } 212 | else { 213 | //log("error"); 214 | } 215 | } 216 | 217 | int SimulateGame::getBestDirection() 218 | { 219 | int sum[4] = { 0 }; 220 | for (int i = 0; i < 4; i++) { 221 | for (int j = 0; j < num; j++) { 222 | sum[i] += simMoveOnce((EMoveTo)i); 223 | } 224 | } 225 | 226 | int max = 0; 227 | for (int i = 0; i < 4; i++) { 228 | if (sum[i] > sum[max]) { 229 | max = i; 230 | } 231 | } 232 | if (sum[max] == 0) return -1; 233 | return max; 234 | } 235 | 236 | -------------------------------------------------------------------------------- /Classes/SimulateGame.h: -------------------------------------------------------------------------------- 1 | #ifndef _Simulate_Game_h 2 | #define _Simulate_Game_h 3 | #include "Tile.h" 4 | #include "common.h" 5 | #define DEFAULT_NUM 3000 6 | struct GameData{ 7 | int score = 0; 8 | int tiles[4][4]; 9 | GameData() :score(0) {} 10 | GameData(const GameData& gd):score(0) { 11 | for (int i = 0; i < 4; i++) { 12 | for (int j = 0; j < 4; j++) { 13 | tiles[i][j] = gd.tiles[i][j]; 14 | } 15 | } 16 | } 17 | }; 18 | 19 | class SimulateGame { 20 | public: 21 | SimulateGame(puzzle::Tile* data[4][4], int score); 22 | ~SimulateGame() {} 23 | void setSimulateTimes(int n) { num = n; } 24 | int getBestDirection(); 25 | private: 26 | void randVal(GameData &data); 27 | bool canMove(GameData &d, EMoveTo mt); 28 | void move(GameData &data ,EMoveTo mt); 29 | int simMoveOnce(EMoveTo to); 30 | int getScore(); 31 | GameState state = GameState::running; 32 | GameData gameData; 33 | int prevScore = 0; 34 | int num = DEFAULT_NUM; 35 | }; 36 | 37 | #endif -------------------------------------------------------------------------------- /Classes/Tile.cpp: -------------------------------------------------------------------------------- 1 | #include "Tile.h" 2 | #include "common.h" 3 | USING_NS_CC; 4 | namespace puzzle{ 5 | static const Color3B tile_color[] = { 6 | Color3B(220, 210, 200),//0 7 | Color3B(240, 230, 220),//2 8 | Color3B(240, 230, 200),//4 9 | Color3B(240, 170, 120),//8 10 | Color3B(240, 180, 120),//16 11 | Color3B(240, 140, 90),//32 12 | Color3B(240, 120, 90),//64 13 | Color3B(240, 90, 60),//128 14 | Color3B(230, 80, 40),//256 15 | Color3B(240, 60, 40),//512 16 | Color3B(240, 200, 70),//1024 17 | Color3B(230, 230, 0),//2048 18 | Color3B(10, 90, 170)//4096 19 | }; 20 | static int color_index(int val) 21 | { 22 | int exp = 0; 23 | while (val > 1) { 24 | val = val / 2; 25 | exp++; 26 | } 27 | return exp; 28 | } 29 | 30 | Tile* Tile::create(int val) 31 | { 32 | auto tile = new Tile(); 33 | if (tile != nullptr && tile->init(val)) { 34 | tile->autorelease(); 35 | return tile; 36 | } 37 | CC_SAFE_DELETE(tile); 38 | return nullptr; 39 | } 40 | 41 | void Tile::setPosition(const cocos2d::Vec2& pos) 42 | { 43 | position = pos; 44 | this->image->setPosition(pos); 45 | } 46 | 47 | void Tile::setColor(const Color3B & color) 48 | { 49 | //CCNode::setColor(color); 50 | image->setColor(color); 51 | } 52 | 53 | void Tile::setValue(int val) 54 | { 55 | value = val; 56 | if (val == 0) { 57 | valueText->setString(""); 58 | } 59 | else { 60 | char temp[20]; 61 | sprintf(temp, "%d", val); 62 | valueText->setString(temp); 63 | } 64 | 65 | if (val > 100) 66 | valueText->setScaleX(0.85f); 67 | else if (val > 1000) 68 | valueText->setScaleX(0.7f); 69 | else if (val > 10000) 70 | valueText->setScaleX(0.55f); 71 | else { 72 | valueText->setScaleX(1.0f); 73 | } 74 | if (val > 4) { 75 | valueText->setColor(Color3B(255, 255, 255)); 76 | } 77 | else { 78 | valueText->setColor(Color3B(60, 60, 60)); 79 | } 80 | image->setColor(tile_color[color_index(val)]); 81 | } 82 | 83 | bool Tile::init(int val) 84 | { 85 | if (!Node::init()) return false; 86 | image = Sprite::create("item.png"); 87 | this->addChild(image); 88 | valueText = Label::createWithTTF(std::string(1, '0' + val), TILE_FONT_NAME, 36); 89 | valueText->setPosition(Vec2(image->getContentSize().width/2, image->getContentSize().height/2)); 90 | this->image->addChild(valueText); 91 | this->setValue(val); 92 | return true; 93 | } 94 | 95 | void Tile::onEnter() 96 | { 97 | Node::onEnter(); 98 | if (value != 0) { 99 | this->image->setScale(0.7); 100 | auto scaleToAction = ScaleTo::create(0.1, 1.0); 101 | this->image->runAction(scaleToAction); 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /Classes/Tile.h: -------------------------------------------------------------------------------- 1 | #ifndef _2048_TILE_H_ 2 | #define _2048_TILE_H_ 3 | 4 | #include "cocos2d.h" 5 | 6 | namespace puzzle{ 7 | 8 | class Tile : public cocos2d::Node { 9 | public: 10 | static Tile* create(int val); 11 | static Tile* create() { return create(0); } 12 | virtual void onEnter() override; 13 | virtual void setPosition(const cocos2d::Vec2& pos) override; 14 | virtual void setPosition(float x, float y) override { this->setPosition(cocos2d::Vec2(x, y)); } 15 | virtual const cocos2d::Vec2& getPosition() const override { return position; } 16 | virtual void setColor(const cocos2d::Color3B& color) override; 17 | void setValue(int val); 18 | int getValue() const { return value; } 19 | 20 | private: 21 | bool init(int val); 22 | 23 | cocos2d::Vec2 position; 24 | cocos2d::Sprite *image = nullptr; 25 | cocos2d::Label *valueText = nullptr; 26 | int value = 0; 27 | bool marge = false; 28 | }; 29 | } 30 | #endif -------------------------------------------------------------------------------- /Classes/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _2048_common_h 2 | #define _2048_common_h 3 | 4 | #define GAME_FONT_NAME "fonts/tahoma.ttf" 5 | #define TILE_FONT_NAME "fonts/tahoma.ttf" 6 | #define SCORE_FONT_NAME "fonts/tahoma.ttf" 7 | 8 | enum class EMoveTo{ 9 | left, 10 | right, 11 | up, 12 | down 13 | }; 14 | 15 | enum class GameState{ 16 | prepare, 17 | running, 18 | moving, 19 | gameover, 20 | win 21 | }; 22 | 23 | 24 | #endif -------------------------------------------------------------------------------- /Resources/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/Resources/background.png -------------------------------------------------------------------------------- /Resources/fonts/Abberancy.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/Resources/fonts/Abberancy.ttf -------------------------------------------------------------------------------- /Resources/fonts/cyril.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/Resources/fonts/cyril.ttf -------------------------------------------------------------------------------- /Resources/fonts/tahoma.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/Resources/fonts/tahoma.ttf -------------------------------------------------------------------------------- /Resources/item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/Resources/item.png -------------------------------------------------------------------------------- /proj.android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /proj.android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Cocos2048 4 | 5 | 6 | libcocos2dx 7 | 8 | 9 | 10 | com.android.ide.eclipse.adt.ResourceManagerBuilder 11 | 12 | 13 | 14 | 15 | com.android.ide.eclipse.adt.PreCompilerBuilder 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javabuilder 21 | 22 | 23 | 24 | 25 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 26 | clean,full,incremental, 27 | 28 | 29 | ?children? 30 | ?children?=?name?=entry\\\\\\\|\\\|\|?name?=outputEntries\|| 31 | 32 | 33 | ?name? 34 | 35 | 36 | 37 | org.eclipse.cdt.make.core.append_environment 38 | true 39 | 40 | 41 | org.eclipse.cdt.make.core.autoBuildTarget 42 | all 43 | 44 | 45 | org.eclipse.cdt.make.core.buildArguments 46 | ${ProjDirPath}/build_native.py -b release 47 | 48 | 49 | org.eclipse.cdt.make.core.buildCommand 50 | python 51 | 52 | 53 | org.eclipse.cdt.make.core.buildLocation 54 | ${ProjDirPath} 55 | 56 | 57 | org.eclipse.cdt.make.core.cleanBuildTarget 58 | clean 59 | 60 | 61 | org.eclipse.cdt.make.core.contents 62 | org.eclipse.cdt.make.core.activeConfigSettings 63 | 64 | 65 | org.eclipse.cdt.make.core.enableAutoBuild 66 | false 67 | 68 | 69 | org.eclipse.cdt.make.core.enableCleanBuild 70 | true 71 | 72 | 73 | org.eclipse.cdt.make.core.enableFullBuild 74 | true 75 | 76 | 77 | org.eclipse.cdt.make.core.fullBuildTarget 78 | all 79 | 80 | 81 | org.eclipse.cdt.make.core.stopOnError 82 | true 83 | 84 | 85 | org.eclipse.cdt.make.core.useDefaultBuildCmd 86 | false 87 | 88 | 89 | 90 | 91 | com.android.ide.eclipse.adt.ApkBuilder 92 | 93 | 94 | 95 | 96 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 97 | full,incremental, 98 | 99 | 100 | 101 | 102 | 103 | com.android.ide.eclipse.adt.AndroidNature 104 | org.eclipse.jdt.core.javanature 105 | org.eclipse.cdt.core.cnature 106 | org.eclipse.cdt.core.ccnature 107 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 108 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 109 | 110 | 111 | 112 | Classes 113 | 2 114 | $%7BPARENT-1-PROJECT_LOC%7D/Classes 115 | 116 | 117 | cocos2d 118 | 2 119 | $%7BPARENT-1-PROJECT_LOC%7D/cocos2d 120 | 121 | 122 | libcocos2d 123 | 2 124 | PARENT-1-PROJECT_LOC/cocos2d/cocos/platform/android/java/src 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /proj.android/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/project/0.1230402123/append=true 3 | environment/project/0.1230402123/appendContributed=true 4 | -------------------------------------------------------------------------------- /proj.android/.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /proj.android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /proj.android/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /proj.android/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "ndk_module_path" :[ 3 | "../cocos2d", 4 | "../cocos2d/cocos", 5 | "../cocos2d/external" 6 | ], 7 | "copy_resources": [ 8 | { 9 | "from": "../Resources", 10 | "to": "" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /proj.android/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 40 | 41 | 42 | 43 | 47 | 48 | 60 | 61 | 62 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /proj.android/build_native.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # build_native.py 3 | # Build native codes 4 | 5 | 6 | import sys 7 | import os, os.path 8 | import shutil 9 | from optparse import OptionParser 10 | 11 | def get_num_of_cpu(): 12 | ''' The build process can be accelerated by running multiple concurrent job processes using the -j-option. 13 | ''' 14 | try: 15 | import multiprocessing 16 | return multiprocessing.cpu_count() 17 | except Exception: 18 | print "Can't know cpuinfo, use default 1 cpu" 19 | return 1 20 | 21 | def check_environment_variables_sdk(): 22 | ''' Checking the environment ANDROID_SDK_ROOT, which will be used for building 23 | ''' 24 | 25 | try: 26 | SDK_ROOT = os.environ['ANDROID_SDK_ROOT'] 27 | except Exception: 28 | print "ANDROID_SDK_ROOT not defined. Please define ANDROID_SDK_ROOT in your environment" 29 | sys.exit(1) 30 | 31 | return SDK_ROOT 32 | 33 | def check_environment_variables(): 34 | ''' Checking the environment NDK_ROOT, which will be used for building 35 | ''' 36 | 37 | try: 38 | NDK_ROOT = os.environ['NDK_ROOT'] 39 | except Exception: 40 | print "NDK_ROOT not defined. Please define NDK_ROOT in your environment" 41 | sys.exit(1) 42 | 43 | return NDK_ROOT 44 | 45 | def select_toolchain_version(): 46 | 47 | ndk_root = check_environment_variables() 48 | if os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.9")): 49 | os.environ['NDK_TOOLCHAIN_VERSION'] = '4.9' 50 | print "The Selected NDK toolchain version was 4.9 !" 51 | elif os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.8")): 52 | os.environ['NDK_TOOLCHAIN_VERSION'] = '4.8' 53 | print "The Selected NDK toolchain version was 4.8 !" 54 | else: 55 | print "Couldn't find the gcc toolchain." 56 | exit(1) 57 | 58 | def do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode): 59 | 60 | ndk_path = os.path.join(ndk_root, "ndk-build") 61 | 62 | num_of_cpu = get_num_of_cpu() 63 | 64 | app_android_root = app_android_root.replace(' ', '\\ ') 65 | if ndk_build_param == None: 66 | command = '%s -j%d -C %s NDK_DEBUG=%d' % (ndk_path, num_of_cpu, app_android_root, build_mode=='debug') 67 | else: 68 | command = '%s -j%d -C %s NDK_DEBUG=%d %s' % (ndk_path, num_of_cpu, app_android_root, build_mode=='debug', ' '.join(str(e) for e in ndk_build_param)) 69 | if os.system(command) != 0: 70 | raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!") 71 | elif android_platform is not None: 72 | sdk_tool_path = os.path.join(sdk_root, "tools/android") 73 | cocoslib_path = os.path.join(cocos_root, "cocos/platform/android/java") 74 | command = '%s update lib-project -t %s -p %s' % (sdk_tool_path,android_platform,cocoslib_path) 75 | if os.system(command) != 0: 76 | raise Exception("update cocos lib-project [ " + cocoslib_path + " ] fails!") 77 | command = '%s update project -t %s -p %s -s' % (sdk_tool_path,android_platform,app_android_root) 78 | if os.system(command) != 0: 79 | raise Exception("update project [ " + app_android_root + " ] fails!") 80 | buildfile_path = os.path.join(app_android_root, "build.xml") 81 | command = 'ant clean %s -f %s -Dsdk.dir=%s' % (build_mode,buildfile_path,sdk_root) 82 | os.system(command) 83 | 84 | def copy_files(src, dst): 85 | 86 | for item in os.listdir(src): 87 | path = os.path.join(src, item) 88 | # Android can not package the file that ends with ".gz" 89 | if not item.startswith('.') and not item.endswith('.gz') and os.path.isfile(path): 90 | shutil.copy(path, dst) 91 | if os.path.isdir(path): 92 | new_dst = os.path.join(dst, item) 93 | os.mkdir(new_dst) 94 | copy_files(path, new_dst) 95 | 96 | def copy_resources(app_android_root): 97 | 98 | # remove app_android_root/assets if it exists 99 | assets_dir = os.path.join(app_android_root, "assets") 100 | if os.path.isdir(assets_dir): 101 | shutil.rmtree(assets_dir) 102 | 103 | # copy resources 104 | os.mkdir(assets_dir) 105 | resources_dir = os.path.join(app_android_root, "../Resources") 106 | if os.path.isdir(resources_dir): 107 | copy_files(resources_dir, assets_dir) 108 | 109 | def build(ndk_build_param,android_platform,build_mode): 110 | 111 | ndk_root = check_environment_variables() 112 | sdk_root = None 113 | select_toolchain_version() 114 | 115 | current_dir = os.path.dirname(os.path.realpath(__file__)) 116 | cocos_root = os.path.join(current_dir, "../cocos2d") 117 | 118 | app_android_root = current_dir 119 | copy_resources(app_android_root) 120 | 121 | if android_platform is not None: 122 | sdk_root = check_environment_variables_sdk() 123 | if android_platform.isdigit(): 124 | android_platform = 'android-'+android_platform 125 | else: 126 | print 'please use vaild android platform' 127 | exit(1) 128 | 129 | if build_mode is None: 130 | build_mode = 'debug' 131 | elif build_mode != 'release': 132 | build_mode = 'debug' 133 | 134 | do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode) 135 | 136 | # -------------- main -------------- 137 | if __name__ == '__main__': 138 | 139 | parser = OptionParser() 140 | parser.add_option("-n", "--ndk", dest="ndk_build_param", help='parameter for ndk-build', action="append") 141 | parser.add_option("-p", "--platform", dest="android_platform", 142 | help='parameter for android-update.Without the parameter,the script just build dynamic library for project. Valid android-platform are:[10|11|12|13|14|15|16|17|18|19]') 143 | parser.add_option("-b", "--build", dest="build_mode", 144 | help='the build mode for java project,debug[default] or release.Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html') 145 | (opts, args) = parser.parse_args() 146 | 147 | print "We will remove this script next version,you should use cocos console to build android project.\n" 148 | 149 | build(opts.ndk_build_param,opts.android_platform,opts.build_mode) 150 | -------------------------------------------------------------------------------- /proj.android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | $(call import-add-path,$(LOCAL_PATH)/../../cocos2d) 6 | $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external) 7 | $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos) 8 | 9 | LOCAL_MODULE := cocos2dcpp_shared 10 | 11 | LOCAL_MODULE_FILENAME := libcocos2dcpp 12 | 13 | LOCAL_SRC_FILES := hellocpp/main.cpp \ 14 | ../../Classes/AppDelegate.cpp \ 15 | ../../Classes/HelloWorldScene.cpp 16 | 17 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes 18 | 19 | LOCAL_STATIC_LIBRARIES := cocos2dx_static 20 | 21 | include $(BUILD_SHARED_LIBRARY) 22 | 23 | $(call import-module,.) 24 | -------------------------------------------------------------------------------- /proj.android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := gnustl_static 2 | 3 | APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char 4 | APP_LDFLAGS := -latomic 5 | 6 | 7 | ifeq ($(NDK_DEBUG),1) 8 | APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 9 | APP_OPTIM := debug 10 | else 11 | APP_CPPFLAGS += -DNDEBUG 12 | APP_OPTIM := release 13 | endif 14 | -------------------------------------------------------------------------------- /proj.android/jni/hellocpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "cocos2d.h" 3 | #include "platform/android/jni/JniHelper.h" 4 | #include 5 | #include 6 | 7 | #define LOG_TAG "main" 8 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) 9 | 10 | using namespace cocos2d; 11 | 12 | void cocos_android_app_init (JNIEnv* env, jobject thiz) { 13 | LOGD("cocos_android_app_init"); 14 | AppDelegate *pAppDelegate = new AppDelegate(); 15 | } 16 | -------------------------------------------------------------------------------- /proj.android/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /proj.android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-10 12 | 13 | android.library.reference.1=../cocos2d/cocos/platform/android/java 14 | -------------------------------------------------------------------------------- /proj.android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Cocos2048 4 | 5 | -------------------------------------------------------------------------------- /proj.android/src/org/cocos2dx/cpp/AppActivity.java: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2008-2010 Ricardo Quesada 3 | Copyright (c) 2010-2012 cocos2d-x.org 4 | Copyright (c) 2011 Zynga Inc. 5 | Copyright (c) 2013-2014 Chukong Technologies Inc. 6 | 7 | http://www.cocos2d-x.org 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ****************************************************************************/ 27 | package org.cocos2dx.cpp; 28 | 29 | import org.cocos2dx.lib.Cocos2dxActivity; 30 | 31 | public class AppActivity extends Cocos2dxActivity { 32 | } 33 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/AppController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class RootViewController; 4 | 5 | @interface AppController : NSObject { 6 | UIWindow *window; 7 | } 8 | 9 | @property(nonatomic, readonly) RootViewController* viewController; 10 | 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/AppController.mm: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2010 cocos2d-x.org 3 | 4 | http://www.cocos2d-x.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | ****************************************************************************/ 24 | 25 | #import "AppController.h" 26 | #import "platform/ios/CCEAGLView-ios.h" 27 | #import "cocos2d.h" 28 | #import "AppDelegate.h" 29 | #import "RootViewController.h" 30 | 31 | @implementation AppController 32 | 33 | #pragma mark - 34 | #pragma mark Application lifecycle 35 | 36 | // cocos2d application instance 37 | static AppDelegate s_sharedApplication; 38 | 39 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 40 | 41 | cocos2d::Application *app = cocos2d::Application::getInstance(); 42 | app->initGLContextAttrs(); 43 | cocos2d::GLViewImpl::convertAttrs(); 44 | 45 | // Override point for customization after application launch. 46 | 47 | // Add the view controller's view to the window and display. 48 | window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; 49 | 50 | // Init the CCEAGLView 51 | CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds] 52 | pixelFormat: (NSString*)cocos2d::GLViewImpl::_pixelFormat 53 | depthFormat: cocos2d::GLViewImpl::_depthFormat 54 | preserveBackbuffer: NO 55 | sharegroup: nil 56 | multiSampling: NO 57 | numberOfSamples: 0 ]; 58 | 59 | // Use RootViewController manage CCEAGLView 60 | _viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; 61 | _viewController.wantsFullScreenLayout = YES; 62 | _viewController.view = eaglView; 63 | 64 | // Set RootViewController to window 65 | if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0) 66 | { 67 | // warning: addSubView doesn't work on iOS6 68 | [window addSubview: _viewController.view]; 69 | } 70 | else 71 | { 72 | // use this method on ios6 73 | [window setRootViewController:_viewController]; 74 | } 75 | 76 | [window makeKeyAndVisible]; 77 | 78 | [[UIApplication sharedApplication] setStatusBarHidden:true]; 79 | 80 | // IMPORTANT: Setting the GLView should be done after creating the RootViewController 81 | cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); 82 | cocos2d::Director::getInstance()->setOpenGLView(glview); 83 | 84 | app->run(); 85 | 86 | return YES; 87 | } 88 | 89 | 90 | - (void)applicationWillResignActive:(UIApplication *)application { 91 | /* 92 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 93 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 94 | */ 95 | //We don't need to call this method any more. It will interupt user defined game pause&resume logic 96 | /* cocos2d::Director::getInstance()->pause(); */ 97 | } 98 | 99 | - (void)applicationDidBecomeActive:(UIApplication *)application { 100 | /* 101 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 102 | */ 103 | //We don't need to call this method any more. It will interupt user defined game pause&resume logic 104 | /* cocos2d::Director::getInstance()->resume(); */ 105 | } 106 | 107 | - (void)applicationDidEnterBackground:(UIApplication *)application { 108 | /* 109 | Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 110 | If your application supports background execution, called instead of applicationWillTerminate: when the user quits. 111 | */ 112 | cocos2d::Application::getInstance()->applicationDidEnterBackground(); 113 | } 114 | 115 | - (void)applicationWillEnterForeground:(UIApplication *)application { 116 | /* 117 | Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. 118 | */ 119 | cocos2d::Application::getInstance()->applicationWillEnterForeground(); 120 | } 121 | 122 | - (void)applicationWillTerminate:(UIApplication *)application { 123 | /* 124 | Called when the application is about to terminate. 125 | See also applicationDidEnterBackground:. 126 | */ 127 | } 128 | 129 | 130 | #pragma mark - 131 | #pragma mark Memory management 132 | 133 | - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { 134 | /* 135 | Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. 136 | */ 137 | } 138 | 139 | 140 | - (void)dealloc { 141 | [window release]; 142 | [super dealloc]; 143 | } 144 | 145 | 146 | @end 147 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Default-568h@2x.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Default-667h@2x.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Default-736h@3x.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Default.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Default@2x.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-100.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-114.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-120.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-144.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-152.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-29.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-40.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-50.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-57.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-58.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-72.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-76.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/ios/Icon-80.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | Icon-57.png 13 | CFBundleIconFiles 14 | 15 | Icon-29 16 | Icon-80 17 | Icon-58 18 | Icon-120 19 | Icon.png 20 | Icon@2x.png 21 | Icon-57.png 22 | Icon-114.png 23 | Icon-72.png 24 | Icon-144.png 25 | 26 | CFBundleIconFiles~ipad 27 | 28 | Icon-29 29 | Icon-50 30 | Icon-58 31 | Icon-80 32 | Icon-40 33 | Icon-100 34 | Icon-152 35 | Icon-76 36 | Icon-120 37 | Icon.png 38 | Icon@2x.png 39 | Icon-57.png 40 | Icon-114.png 41 | Icon-72.png 42 | Icon-144.png 43 | 44 | CFBundleIdentifier 45 | com.booirror.puzzle 46 | CFBundleInfoDictionaryVersion 47 | 6.0 48 | CFBundleName 49 | ${PRODUCT_NAME} 50 | CFBundlePackageType 51 | APPL 52 | CFBundleShortVersionString 53 | 54 | CFBundleSignature 55 | ???? 56 | CFBundleVersion 57 | 1.0 58 | UILaunchImages 59 | 60 | 61 | UILaunchImageMinimumOSVersion 62 | 8.0 63 | UILaunchImageName 64 | Default 65 | UILaunchImageOrientation 66 | Portrait 67 | UILaunchImageSize 68 | {320, 480} 69 | 70 | 71 | UILaunchImageMinimumOSVersion 72 | 8.0 73 | UILaunchImageName 74 | Default 75 | UILaunchImageOrientation 76 | Landscape 77 | UILaunchImageSize 78 | {320, 480} 79 | 80 | 81 | UILaunchImageMinimumOSVersion 82 | 8.0 83 | UILaunchImageName 84 | Default-568h 85 | UILaunchImageOrientation 86 | Portrait 87 | UILaunchImageSize 88 | {320, 568} 89 | 90 | 91 | UILaunchImageMinimumOSVersion 92 | 8.0 93 | UILaunchImageName 94 | Default-568h 95 | UILaunchImageOrientation 96 | Landscape 97 | UILaunchImageSize 98 | {320, 568} 99 | 100 | 101 | UILaunchImageMinimumOSVersion 102 | 8.0 103 | UILaunchImageName 104 | Default-667h 105 | UILaunchImageOrientation 106 | Portrait 107 | UILaunchImageSize 108 | {375, 667} 109 | 110 | 111 | UILaunchImageMinimumOSVersion 112 | 8.0 113 | UILaunchImageName 114 | Default-667h 115 | UILaunchImageOrientation 116 | Landscape 117 | UILaunchImageSize 118 | {375, 667} 119 | 120 | 121 | UILaunchImageMinimumOSVersion 122 | 8.0 123 | UILaunchImageName 124 | Default-736h 125 | UILaunchImageOrientation 126 | Portrait 127 | UILaunchImageSize 128 | {414, 736} 129 | 130 | 131 | UILaunchImageMinimumOSVersion 132 | 8.0 133 | UILaunchImageName 134 | Default-736h 135 | UILaunchImageOrientation 136 | Landscape 137 | UILaunchImageSize 138 | {414, 736} 139 | 140 | 141 | LSRequiresIPhoneOS 142 | 143 | UIAppFonts 144 | 145 | UIPrerenderedIcon 146 | 147 | UISupportedInterfaceOrientations 148 | 149 | UIInterfaceOrientationLandscapeRight 150 | UIInterfaceOrientationLandscapeLeft 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/RootViewController.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2013 cocos2d-x.org 3 | Copyright (c) 2013-2014 Chukong Technologies Inc. 4 | 5 | http://www.cocos2d-x.org 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ****************************************************************************/ 25 | 26 | #import 27 | 28 | 29 | @interface RootViewController : UIViewController { 30 | 31 | } 32 | - (BOOL) prefersStatusBarHidden; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/RootViewController.mm: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2013 cocos2d-x.org 3 | Copyright (c) 2013-2014 Chukong Technologies Inc. 4 | 5 | http://www.cocos2d-x.org 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ****************************************************************************/ 25 | 26 | #import "RootViewController.h" 27 | #import "cocos2d.h" 28 | #import "platform/ios/CCEAGLView-ios.h" 29 | 30 | @implementation RootViewController 31 | 32 | /* 33 | // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. 34 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 35 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 36 | // Custom initialization 37 | } 38 | return self; 39 | } 40 | */ 41 | 42 | /* 43 | // Implement loadView to create a view hierarchy programmatically, without using a nib. 44 | - (void)loadView { 45 | } 46 | */ 47 | 48 | /* 49 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 50 | - (void)viewDidLoad { 51 | [super viewDidLoad]; 52 | } 53 | 54 | */ 55 | // Override to allow orientations other than the default portrait orientation. 56 | // This method is deprecated on ios6 57 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 58 | return UIInterfaceOrientationIsLandscape( interfaceOrientation ); 59 | } 60 | 61 | // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead 62 | - (NSUInteger) supportedInterfaceOrientations{ 63 | #ifdef __IPHONE_6_0 64 | return UIInterfaceOrientationMaskAllButUpsideDown; 65 | #endif 66 | } 67 | 68 | - (BOOL) shouldAutorotate { 69 | return YES; 70 | } 71 | 72 | - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 73 | [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; 74 | 75 | auto glview = cocos2d::Director::getInstance()->getOpenGLView(); 76 | 77 | if (glview) 78 | { 79 | CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView(); 80 | 81 | if (eaglview) 82 | { 83 | CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]); 84 | cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height); 85 | } 86 | } 87 | } 88 | 89 | //fix not hide status on ios7 90 | - (BOOL)prefersStatusBarHidden 91 | { 92 | return YES; 93 | } 94 | 95 | - (void)didReceiveMemoryWarning { 96 | // Releases the view if it doesn't have a superview. 97 | [super didReceiveMemoryWarning]; 98 | 99 | // Release any cached data, images, etc that aren't in use. 100 | } 101 | 102 | - (void)viewDidUnload { 103 | [super viewDidUnload]; 104 | // Release any retained subviews of the main view. 105 | // e.g. self.myOutlet = nil; 106 | } 107 | 108 | 109 | - (void)dealloc { 110 | [super dealloc]; 111 | } 112 | 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main(int argc, char *argv[]) { 4 | 5 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 6 | int retVal = UIApplicationMain(argc, argv, nil, @"AppController"); 7 | [pool release]; 8 | return retVal; 9 | } 10 | -------------------------------------------------------------------------------- /proj.ios_mac/mac/Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.ios_mac/mac/Icon.icns -------------------------------------------------------------------------------- /proj.ios_mac/mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | Icon 11 | CFBundleIdentifier 12 | com.booirror.puzzle 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSApplicationCategoryType 26 | public.app-category.games 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | NSHumanReadableCopyright 30 | Copyright © 2013. All rights reserved. 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /proj.ios_mac/mac/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2010 cocos2d-x.org 3 | 4 | http://www.cocos2d-x.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | ****************************************************************************/ 24 | 25 | #include "AppDelegate.h" 26 | #include "cocos2d.h" 27 | 28 | USING_NS_CC; 29 | 30 | int main(int argc, char *argv[]) 31 | { 32 | AppDelegate app; 33 | return Application::getInstance()->run(); 34 | } 35 | -------------------------------------------------------------------------------- /proj.linux/main.cpp: -------------------------------------------------------------------------------- 1 | #include "../Classes/AppDelegate.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | USING_NS_CC; 9 | 10 | int main(int argc, char **argv) 11 | { 12 | // create the application instance 13 | AppDelegate app; 14 | return Application::getInstance()->run(); 15 | } 16 | -------------------------------------------------------------------------------- /proj.win32/Cocos2048.opensdf: -------------------------------------------------------------------------------- 1 | adminBOOIRROR-PC -------------------------------------------------------------------------------- /proj.win32/Cocos2048.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cocos2048", "Cocos2048.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} 7 | EndProjectSection 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos2d\cocos\2d\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\cocos2d\external\Box2D\proj.win32\libbox2d.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos2d\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Win32 = Debug|Win32 18 | Release|Win32 = Release|Win32 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.ActiveCfg = Debug|Win32 22 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32 23 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32 24 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32 25 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32 26 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32 27 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32 28 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32 29 | {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.ActiveCfg = Debug|Win32 30 | {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.Build.0 = Debug|Win32 31 | {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32 32 | {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32 33 | {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.ActiveCfg = Debug|Win32 34 | {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32 35 | {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32 36 | {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32 37 | EndGlobalSection 38 | GlobalSection(SolutionProperties) = preSolution 39 | HideSolutionNode = FALSE 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /proj.win32/Cocos2048.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win32/Cocos2048.v12.suo -------------------------------------------------------------------------------- /proj.win32/Cocos2048.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {84a8ebd7-7cf0-47f6-b75e-d441df67da40} 6 | 7 | 8 | {715254bc-d70b-4ec5-bf29-467dd3ace079} 9 | 10 | 11 | {bb6c862e-70e9-49d9-81b7-3829a6f50471} 12 | 13 | 14 | 15 | 16 | win32 17 | 18 | 19 | src 20 | 21 | 22 | src 23 | 24 | 25 | src 26 | 27 | 28 | src 29 | 30 | 31 | 32 | 33 | win32 34 | 35 | 36 | src 37 | 38 | 39 | src 40 | 41 | 42 | src 43 | 44 | 45 | src 46 | 47 | 48 | src 49 | 50 | 51 | 52 | 53 | resource 54 | 55 | 56 | -------------------------------------------------------------------------------- /proj.win32/Cocos2048.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(ProjectDir)..\Resources 5 | WindowsLocalDebugger 6 | 7 | 8 | $(ProjectDir)..\Resources 9 | WindowsLocalDebugger 10 | 11 | -------------------------------------------------------------------------------- /proj.win32/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "copy_resources": [ 3 | { 4 | "from": "../Resources", 5 | "to": "" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /proj.win32/game.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win32/game.aps -------------------------------------------------------------------------------- /proj.win32/game.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define APSTUDIO_HIDDEN_SYMBOLS 11 | #include "windows.h" 12 | #undef APSTUDIO_HIDDEN_SYMBOLS 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (U.S.) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | #ifdef _WIN32 21 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 22 | #pragma code_page(1252) 23 | #endif //_WIN32 24 | 25 | #ifdef APSTUDIO_INVOKED 26 | ///////////////////////////////////////////////////////////////////////////// 27 | // 28 | // TEXTINCLUDE 29 | // 30 | 31 | 1 TEXTINCLUDE 32 | BEGIN 33 | "resource.h\0" 34 | END 35 | 36 | #endif // APSTUDIO_INVOKED 37 | 38 | ///////////////////////////////////////////////////////////////////////////// 39 | // 40 | // Icon 41 | // 42 | 43 | // Icon with lowest ID value placed first to ensure application icon 44 | // remains consistent on all systems. 45 | GLFW_ICON ICON "res\\game.ico" 46 | 47 | ///////////////////////////////////////////////////////////////////////////// 48 | // 49 | // Version 50 | // 51 | 52 | VS_VERSION_INFO VERSIONINFO 53 | FILEVERSION 1,0,0,1 54 | PRODUCTVERSION 1,0,0,1 55 | FILEFLAGSMASK 0x3fL 56 | #ifdef _DEBUG 57 | FILEFLAGS 0x1L 58 | #else 59 | FILEFLAGS 0x0L 60 | #endif 61 | FILEOS 0x4L 62 | FILETYPE 0x2L 63 | FILESUBTYPE 0x0L 64 | BEGIN 65 | BLOCK "StringFileInfo" 66 | BEGIN 67 | BLOCK "040904B0" 68 | BEGIN 69 | VALUE "CompanyName", "\0" 70 | VALUE "FileDescription", "game Module\0" 71 | VALUE "FileVersion", "1, 0, 0, 1\0" 72 | VALUE "InternalName", "game\0" 73 | VALUE "LegalCopyright", "Copyright \0" 74 | VALUE "OriginalFilename", "game.exe\0" 75 | VALUE "ProductName", "game Module\0" 76 | VALUE "ProductVersion", "1, 0, 0, 1\0" 77 | END 78 | END 79 | BLOCK "VarFileInfo" 80 | BEGIN 81 | VALUE "Translation", 0x0409, 0x04B0 82 | END 83 | END 84 | 85 | ///////////////////////////////////////////////////////////////////////////// 86 | #endif // !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 87 | -------------------------------------------------------------------------------- /proj.win32/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "AppDelegate.h" 3 | #include "cocos2d.h" 4 | 5 | USING_NS_CC; 6 | 7 | int APIENTRY _tWinMain(HINSTANCE hInstance, 8 | HINSTANCE hPrevInstance, 9 | LPTSTR lpCmdLine, 10 | int nCmdShow) 11 | { 12 | UNREFERENCED_PARAMETER(hPrevInstance); 13 | UNREFERENCED_PARAMETER(lpCmdLine); 14 | 15 | // create the application instance 16 | AppDelegate app; 17 | return Application::getInstance()->run(); 18 | } 19 | -------------------------------------------------------------------------------- /proj.win32/main.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAIN_H__ 2 | #define __MAIN_H__ 3 | 4 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 5 | 6 | // Windows Header Files: 7 | #include 8 | #include 9 | 10 | // C RunTime Header Files 11 | #include "CCStdC.h" 12 | 13 | #endif // __MAIN_H__ 14 | -------------------------------------------------------------------------------- /proj.win32/res/game.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win32/res/game.ico -------------------------------------------------------------------------------- /proj.win32/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by game.RC 4 | // 5 | 6 | #define IDS_PROJNAME 100 7 | #define IDR_TESTJS 100 8 | 9 | #define ID_FILE_NEW_WINDOW 32771 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NEXT_RESOURCE_VALUE 201 16 | #define _APS_NEXT_CONTROL_VALUE 1000 17 | #define _APS_NEXT_SYMED_VALUE 101 18 | #define _APS_NEXT_COMMAND_VALUE 32775 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | cpp_tests 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/App.xaml.cpp: -------------------------------------------------------------------------------- 1 | #include "App.xaml.h" 2 | #include "OpenGLESPage.xaml.h" 3 | 4 | using namespace cocos2d; 5 | 6 | App::App() 7 | { 8 | InitializeComponent(); 9 | } 10 | 11 | void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) 12 | { 13 | if (mPage == nullptr) 14 | { 15 | mPage = ref new OpenGLESPage(&mOpenGLES); 16 | } 17 | 18 | // Place the page in the current window and ensure that it is active. 19 | Windows::UI::Xaml::Window::Current->Content = mPage; 20 | Windows::UI::Xaml::Window::Current->Activate(); 21 | } 22 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/App.xaml.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "app.g.h" 4 | #include "OpenGLES.h" 5 | #include "openglespage.xaml.h" 6 | 7 | namespace cocos2d 8 | { 9 | ref class App sealed 10 | { 11 | public: 12 | App(); 13 | virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; 14 | 15 | private: 16 | OpenGLESPage^ mPage; 17 | OpenGLES mOpenGLES; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/Cocos2048.Shared.vcxitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | e956c24b-f04e-47bf-bf00-746681ae1301 7 | {a3ad93e4-0b2f-4c58-9181-69bed2e42e3e} 8 | Cocos2048 9 | 10 | 11 | 12 | %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) 13 | 14 | 15 | 16 | 17 | Designer 18 | 19 | 20 | 21 | 22 | $(MSBuildThisFileDirectory)App.xaml 23 | 24 | 25 | 26 | 27 | $(MSBuildThisFileDirectory)OpenGLESPage.xaml 28 | 29 | 30 | 31 | 32 | 33 | $(MSBuildThisFileDirectory)App.xaml 34 | 35 | 36 | Create 37 | 38 | 39 | 40 | $(MSBuildThisFileDirectory)OpenGLESPage.xaml 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | <_CustomResource Include="$(MSBuildThisFileDirectory)..\..\Resources\**\*"> 49 | Assets\Resources\%(RecursiveDir)%(FileName)%(Extension) 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/Cocos2048.Shared.vcxitems.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Classes 10 | 11 | 12 | Classes 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {38ad799c-8c3c-44a2-8e41-516c8f62f556} 24 | 25 | 26 | 27 | 28 | Classes 29 | 30 | 31 | Classes 32 | 33 | 34 | Classes 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/Cocos2dRenderer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #include "Cocos2dRenderer.h" 20 | #include "AppDelegate.h" 21 | #include "CCGLViewImpl-winrt.h" 22 | #include "CCApplication.h" 23 | #include "cocos2d.h" 24 | #include "renderer/CCTextureCache.h" 25 | 26 | // These are used by the shader compilation methods. 27 | #include 28 | #include 29 | #include 30 | 31 | using namespace Platform; 32 | using namespace Windows::UI::Core; 33 | using namespace Windows::UI::Xaml::Controls; 34 | using namespace Windows::Graphics::Display; 35 | 36 | USING_NS_CC; 37 | 38 | 39 | Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, CoreDispatcher^ dispatcher, Panel^ panel) 40 | : m_app(nullptr) 41 | , m_width(width) 42 | , m_height(height) 43 | , m_dpi(dpi) 44 | , m_dispatcher(dispatcher) 45 | , m_panel(panel) 46 | { 47 | m_app = new AppDelegate(); 48 | } 49 | 50 | Cocos2dRenderer::~Cocos2dRenderer() 51 | { 52 | delete m_app; 53 | } 54 | 55 | void Cocos2dRenderer::Resume() 56 | { 57 | auto director = cocos2d::Director::getInstance(); 58 | auto glview = director->getOpenGLView(); 59 | 60 | if (!glview) 61 | { 62 | GLViewImpl* glview = GLViewImpl::create("Test Cpp"); 63 | glview->setDispatcher(m_dispatcher.Get()); 64 | glview->setPanel(m_panel.Get()); 65 | glview->Create(static_cast(m_width), static_cast(m_height), m_dpi, DisplayOrientations::Landscape); 66 | director->setOpenGLView(glview); 67 | CCApplication::getInstance()->run(); 68 | } 69 | else 70 | { 71 | Application::getInstance()->applicationWillEnterForeground(); 72 | } 73 | } 74 | 75 | void Cocos2dRenderer::Pause() 76 | { 77 | if (Director::getInstance()->getOpenGLView()) { 78 | Application::getInstance()->applicationDidEnterBackground(); 79 | //cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND); 80 | //cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent); 81 | } 82 | } 83 | 84 | void Cocos2dRenderer::DeviceLost() 85 | { 86 | Pause(); 87 | 88 | auto director = cocos2d::Director::getInstance(); 89 | if (director->getOpenGLView()) { 90 | cocos2d::GL::invalidateStateCache(); 91 | cocos2d::GLProgramCache::getInstance()->reloadDefaultGLPrograms(); 92 | cocos2d::DrawPrimitives::init(); 93 | cocos2d::VolatileTextureMgr::reloadAllTextures(); 94 | 95 | cocos2d::EventCustom recreatedEvent(EVENT_RENDERER_RECREATED); 96 | director->getEventDispatcher()->dispatchEvent(&recreatedEvent); 97 | director->setGLDefaultValues(); 98 | 99 | Application::getInstance()->applicationWillEnterForeground(); 100 | cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND); 101 | cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent); 102 | } 103 | } 104 | 105 | 106 | 107 | void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi) 108 | { 109 | if (width != m_width || height != m_height) 110 | { 111 | m_width = width; 112 | m_height = height; 113 | GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast(width), static_cast(height)); 114 | } 115 | 116 | if (dpi != m_dpi) 117 | { 118 | m_dpi = dpi; 119 | GLViewImpl::sharedOpenGLView()->SetDPI(m_dpi); 120 | } 121 | 122 | GLViewImpl::sharedOpenGLView()->ProcessEvents(); 123 | GLViewImpl::sharedOpenGLView()->Render(); 124 | } 125 | 126 | void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args) 127 | { 128 | GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args); 129 | } 130 | 131 | void Cocos2dRenderer::QueueKeyBoardEvent(cocos2d::Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e) 132 | { 133 | //GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, e); 134 | } 135 | 136 | 137 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/Cocos2dRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | #pragma once 19 | 20 | #include 21 | 22 | #include "cocos2d.h" 23 | 24 | 25 | class AppDelegate; 26 | 27 | namespace cocos2d 28 | { 29 | class Cocos2dRenderer 30 | { 31 | public: 32 | Cocos2dRenderer( int width, int height, float dpi, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); 33 | ~Cocos2dRenderer(); 34 | void Draw(GLsizei width, GLsizei height, float dpi); 35 | void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); 36 | void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e); 37 | void Pause(); 38 | void Resume(); 39 | void DeviceLost(); 40 | 41 | private: 42 | 43 | int m_width; 44 | int m_height; 45 | float m_dpi; 46 | 47 | // The AppDelegate for the Cocos2D app 48 | AppDelegate* m_app; 49 | Platform::Agile m_dispatcher; 50 | Platform::Agile m_panel; 51 | }; 52 | } -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/OpenGLES.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | // OpenGL ES includes 22 | #include 23 | #include 24 | 25 | // EGL includes 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class OpenGLES 32 | { 33 | public: 34 | OpenGLES(); 35 | ~OpenGLES(); 36 | 37 | EGLSurface CreateSurface(Windows::UI::Xaml::Controls::SwapChainPanel^ panel, const Windows::Foundation::Size* renderSurfaceSize); 38 | void DestroySurface(const EGLSurface surface); 39 | void MakeCurrent(const EGLSurface surface); 40 | EGLBoolean SwapBuffers(const EGLSurface surface); 41 | void Reset(); 42 | 43 | private: 44 | void Initialize(); 45 | void Cleanup(); 46 | 47 | private: 48 | EGLDisplay mEglDisplay; 49 | EGLContext mEglContext; 50 | EGLConfig mEglConfig; 51 | }; 52 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/OpenGLESPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/OpenGLESPage.xaml.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "OpenGLES.h" 22 | #include "OpenGLESPage.g.h" 23 | #include 24 | 25 | #include "Cocos2dRenderer.h" 26 | 27 | namespace cocos2d 28 | { 29 | public ref class OpenGLESPage sealed 30 | { 31 | public: 32 | OpenGLESPage(); 33 | virtual ~OpenGLESPage(); 34 | 35 | internal: 36 | OpenGLESPage(OpenGLES* openGLES); 37 | 38 | private: 39 | void OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); 40 | void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); 41 | void OnSwapChainPanelSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); 42 | void GetSwapChainPanelSize(GLsizei* width, GLsizei* height); 43 | void CreateRenderSurface(); 44 | void DestroyRenderSurface(); 45 | void RecoverFromLostDevice(); 46 | void StartRenderLoop(); 47 | void StopRenderLoop(); 48 | 49 | OpenGLES* mOpenGLES; 50 | std::shared_ptr m_renderer; 51 | 52 | Windows::Foundation::Size mSwapChainPanelSize; 53 | Concurrency::critical_section mSwapChainPanelSizeCriticalSection; 54 | 55 | Windows::Foundation::Size mCustomRenderSurfaceSize; 56 | bool mUseCustomRenderSurfaceSize; 57 | 58 | EGLSurface mRenderSurface; // This surface is associated with a swapChainPanel on the page 59 | Concurrency::critical_section mRenderSurfaceCriticalSection; 60 | Windows::Foundation::IAsyncAction^ mRenderLoopWorker; 61 | 62 | // Track user input on a background worker thread. 63 | Windows::Foundation::IAsyncAction^ m_inputLoopWorker; 64 | Windows::UI::Core::CoreIndependentInputSource^ m_coreInput; 65 | 66 | // Independent input handling functions. 67 | void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 68 | void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 69 | void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 70 | 71 | float m_dpi; 72 | bool m_deviceLost; 73 | 74 | }; 75 | } 76 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/pch.h: -------------------------------------------------------------------------------- 1 | // 2 | // pch.h 3 | // Header for standard system include files. 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | #include "cocos2d.h" 12 | #include "cocos-ext.h" 13 | 14 | 15 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Assets/Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.Windows/Assets/Logo.scale-100.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Assets/SmallLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.Windows/Assets/SmallLogo.scale-100.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Assets/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.Windows/Assets/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Assets/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.Windows/Assets/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Cocos2048.Windows.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {1a9fa652-867e-41d2-8588-962f108d2d8f} 6 | bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Assets 18 | 19 | 20 | Assets 21 | 22 | 23 | Assets 24 | 25 | 26 | Assets 27 | 28 | 29 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Cocos2048.Windows_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.Windows/Cocos2048.Windows_TemporaryKey.pfx -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Cocos2048.Windows 6 | dalestam 7 | Assets\StoreLogo.png 8 | 9 | 10 | 6.3.0 11 | 6.3.0 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/Logo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.WindowsPhone/Assets/Logo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/SmallLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.WindowsPhone/Assets/SmallLogo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/SplashScreen.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.WindowsPhone/Assets/SplashScreen.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/Square71x71Logo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.WindowsPhone/Assets/Square71x71Logo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/StoreLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.WindowsPhone/Assets/StoreLogo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/WideLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.win8.1-universal/App.WindowsPhone/Assets/WideLogo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Cocos2048.WindowsPhone.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | ARM 7 | 8 | 9 | Debug 10 | Win32 11 | 12 | 13 | Release 14 | ARM 15 | 16 | 17 | Release 18 | Win32 19 | 20 | 21 | 22 | {396fe85e-bb05-4b92-bccb-f89aed4ea41a} 23 | cocos2d 24 | en-US 25 | 12.0 26 | true 27 | Windows Phone 28 | 8.1 29 | 30 | 31 | 32 | Application 33 | true 34 | v120_wp81 35 | 36 | 37 | Application 38 | true 39 | v120_wp81 40 | 41 | 42 | Application 43 | false 44 | true 45 | v120_wp81 46 | 47 | 48 | Application 49 | false 50 | true 51 | v120_wp81 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | True 83 | arm 84 | 85 | 86 | 87 | /bigobj /Zm200 %(AdditionalOptions) 88 | 4453;28204;4756;%(DisableSpecificWarnings) 89 | pch.h 90 | ../../Classes;%(AdditionalIncludeDirectories) 91 | 92 | 93 | 94 | 95 | /bigobj /Zm200 %(AdditionalOptions) 96 | 4453;28204;4756;%(DisableSpecificWarnings) 97 | pch.h 98 | ../../Classes;%(AdditionalIncludeDirectories) 99 | 100 | 101 | 102 | 103 | /bigobj /Zm200 %(AdditionalOptions) 104 | 4453;28204;4756;%(DisableSpecificWarnings) 105 | pch.h 106 | ../../Classes;%(AdditionalIncludeDirectories) 107 | 108 | 109 | 110 | 111 | /bigobj /Zm200 %(AdditionalOptions) 112 | 4453;28204;4756;%(DisableSpecificWarnings) 113 | pch.h 114 | ../../Classes;%(AdditionalIncludeDirectories) 115 | 116 | 117 | 118 | 119 | Designer 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | {22f3b9df-1209-4574-8331-003966f562bf} 133 | 134 | 135 | {cc1da216-a80d-4be4-b309-acb6af313aff} 136 | 137 | 138 | {22f798d8-bfff-4754-996f-a5395343d5ec} 139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Cocos2048.WindowsPhone.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c8beb60d-689b-4aaa-9749-99bd3e2dcf75} 6 | bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png 7 | 8 | 9 | Assets 10 | 11 | 12 | Assets 13 | 14 | 15 | Assets 16 | 17 | 18 | Assets 19 | 20 | 21 | Assets 22 | 23 | 24 | Assets 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Cocos2048.WindowsPhone 7 | dalestam 8 | Assets\StoreLogo.png 9 | 10 | 11 | 6.3.1 12 | 6.3.1 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /proj.wp8-xaml/App/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /proj.wp8-xaml/App/Assets/AlignmentGrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.wp8-xaml/App/Assets/AlignmentGrid.png -------------------------------------------------------------------------------- /proj.wp8-xaml/App/Assets/ApplicationIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.wp8-xaml/App/Assets/ApplicationIcon.png -------------------------------------------------------------------------------- /proj.wp8-xaml/App/Assets/Tiles/FlipCycleTileLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.wp8-xaml/App/Assets/Tiles/FlipCycleTileLarge.png -------------------------------------------------------------------------------- /proj.wp8-xaml/App/Assets/Tiles/FlipCycleTileMedium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.wp8-xaml/App/Assets/Tiles/FlipCycleTileMedium.png -------------------------------------------------------------------------------- /proj.wp8-xaml/App/Assets/Tiles/FlipCycleTileSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.wp8-xaml/App/Assets/Tiles/FlipCycleTileSmall.png -------------------------------------------------------------------------------- /proj.wp8-xaml/App/Assets/Tiles/IconicTileMediumLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.wp8-xaml/App/Assets/Tiles/IconicTileMediumLarge.png -------------------------------------------------------------------------------- /proj.wp8-xaml/App/Assets/Tiles/IconicTileSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/booirror/game-2048/19d2ca8f05112ed787979d52eb9d8fffe8769245/proj.wp8-xaml/App/Assets/Tiles/IconicTileSmall.png -------------------------------------------------------------------------------- /proj.wp8-xaml/App/Cocos2048.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | {83CC88FE-7E79-4E1E-A129-742987130B5C} 9 | {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 10 | Library 11 | Properties 12 | cocos2d 13 | Cocos2048 14 | WindowsPhone 15 | v8.0 16 | $(TargetFrameworkVersion) 17 | true 18 | 19 | 20 | true 21 | true 22 | Cocos2048_$(Configuration)_$(Platform).xap 23 | Properties\AppManifest.xml 24 | cocos2d.App 25 | true 26 | 11.0 27 | true 28 | 29 | 30 | true 31 | full 32 | false 33 | Bin\Debug 34 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE 35 | true 36 | true 37 | prompt 38 | 4 39 | 40 | 41 | pdbonly 42 | true 43 | Bin\Release 44 | TRACE;SILVERLIGHT;WINDOWS_PHONE 45 | true 46 | true 47 | prompt 48 | 4 49 | 50 | 51 | true 52 | full 53 | false 54 | Bin\x86\Debug 55 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE 56 | true 57 | true 58 | prompt 59 | 4 60 | 61 | 62 | pdbonly 63 | true 64 | Bin\x86\Release 65 | TRACE;SILVERLIGHT;WINDOWS_PHONE 66 | true 67 | true 68 | prompt 69 | 4 70 | 71 | 72 | true 73 | full 74 | false 75 | Bin\ARM\Debug 76 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE 77 | true 78 | true 79 | prompt 80 | 4 81 | 82 | 83 | pdbonly 84 | true 85 | Bin\ARM\Release 86 | TRACE;SILVERLIGHT;WINDOWS_PHONE 87 | true 88 | true 89 | prompt 90 | 4 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | True 100 | True 101 | AppResources.resx 102 | 103 | 104 | 105 | 106 | Assets\Resources\fonts\Marker Felt.ttf 107 | PreserveNewest 108 | 109 | 110 | 111 | Designer 112 | 113 | 114 | 115 | 116 | Assets\Resources\CloseNormal.png 117 | 118 | 119 | Assets\Resources\CloseSelected.png 120 | 121 | 122 | Assets\Resources\HelloWorld.png 123 | 124 | 125 | 126 | PreserveNewest 127 | 128 | 129 | PreserveNewest 130 | 131 | 132 | PreserveNewest 133 | 134 | 135 | PreserveNewest 136 | 137 | 138 | PreserveNewest 139 | 140 | 141 | PreserveNewest 142 | 143 | 144 | 145 | 146 | 147 | Cocos2048Component 148 | 149 | 150 | 151 | 152 | PublicResXFileCodeGenerator 153 | AppResources.Designer.cs 154 | 155 | 156 | 157 | 158 | MSBuild:Compile 159 | Designer 160 | 161 | 162 | MSBuild:Compile 163 | Designer 164 | 165 | 166 | MSBuild:Compile 167 | Designer 168 | 169 | 170 | 171 | 172 | 173 | 181 | 182 | -------------------------------------------------------------------------------- /proj.wp8-xaml/App/EditBox.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 |