Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
ffd5602
fixed compile errors with wwise 2015.1.6.
kakyoism Apr 27, 2016
dfac86f
Workaround for Issue #3: android compiler error with Wwise 2015.1.6.
kakyoism Apr 27, 2016
93ee7ea
Fixed crash on Android when initilaizing Wwise.
kakyoism Apr 28, 2016
79ff147
Merge.
kakyoism Apr 28, 2016
278aab0
Cleaned up debug code.
kakyoism Apr 28, 2016
9fbb3b0
Fixed build for Wwise 2016.1:
kakyoism Jul 3, 2016
e277ab6
Fixed build instructions for clarity.
kakyoism Jul 3, 2016
2ef0a24
Fixed README to match this cocos sample. The previous version is for …
kakyoism Jul 3, 2016
a9a093a
Fixed: Windows build pipeline for Wwise 2017.1
akchina Jan 18, 2018
9a5db40
Fixed: plugin registration errors
kakyoism Feb 2, 2018
1c9ddfa
Fixed: Undesired double-entry of scene init causing bank loading fail…
kakyoism Feb 2, 2018
7d300a9
Fixed: Release build (VS2017 upgrade).
kakyoism Feb 2, 2018
6a21dd4
Fixed: No sound when voices are visiable in voice monitor and voice g…
kakyoism Feb 2, 2018
8f21998
Refactor: Removed all derivatives (soundbanks).
kakyoism Feb 2, 2018
9019e66
Refactor: Further removed derivatives (soundbanks).
kakyoism Feb 2, 2018
a19a1ef
BreakingChange: Simplified folder structure for better installation UX.
kakyoism Feb 3, 2018
fa4e9d8
Refactor: Simplified Windows build pipeline
kakyoism Feb 3, 2018
5f98961
tmp: added files forgotten to check in.
kakyoism Feb 3, 2018
7d2a14b
cygwin git checkin to fix long-path errors.
Feb 3, 2018
f476eaf
Ignored more VS deriviatives (Debug.Win32).
Feb 3, 2018
08270fc
Refactor: Removed redundant platform header.
Feb 3, 2018
18589b3
Refactor: Removed files not supposed to be SCM'ed.
Feb 3, 2018
dd69712
Refactor: Removed files not supposed to be SCM'ed.
Feb 3, 2018
f287ac1
added more ignore patterns.
Feb 3, 2018
53c43c5
Refactor: Renamed demo code folder.
Feb 3, 2018
6b6f0b5
Added more ignore patterns.
Feb 3, 2018
cc7e2ee
Refactor: Removed files unsupposed to be SCM'ed.
kakyoism Feb 3, 2018
e231c78
Fixed: path names of "Classes" in Xcode project.
kakyoism Feb 3, 2018
5d36704
Fixed: Build settings for Mac
kakyoism Feb 4, 2018
c2d8422
Fixed: Mac build.
kakyoism Feb 4, 2018
793f818
Fixed: Upgraded Cocos to 3.16 prebuilt version (github) and built for…
kakyoism Feb 4, 2018
cd69938
Fixed: iOS build
kakyoism Feb 4, 2018
6a5a90e
removed redundant files; buildfix: added wrongly ignored header.
kakyoism Feb 4, 2018
cbe9d4d
added missing files.
kakyoism Feb 4, 2018
de1985b
added missing files
kakyoism Feb 4, 2018
199c8fa
added missing files
kakyoism Feb 4, 2018
465a207
stop tracking libs.
kakyoism Feb 4, 2018
2422902
added missing files
kakyoism Feb 4, 2018
d9c9e33
added missing files.
kakyoism Feb 4, 2018
e2ffa92
added missing files.
kakyoism Feb 4, 2018
926688a
added missing files.
kakyoism Feb 4, 2018
a4f6d4a
added missing files.
kakyoism Feb 4, 2018
a887f60
Fixed: Windows build after upgrading Cocos to 3.16.
Feb 5, 2018
7df6ac4
Refactor: Windows: Removed unused vcproj from solution.
Feb 5, 2018
542d829
Fixed: Mac build
kakyoism Feb 5, 2018
ebb38e7
Fixed: iOS build after upgrading to Cocos
kakyoism Feb 5, 2018
34097f9
Added: Android platform header for Cocos demo.
kakyoism Feb 5, 2018
c1e62dc
Added: metadata required for Android.
Feb 5, 2018
5f6b770
Fixed: Android build after upgrading to Cocos
Feb 6, 2018
19a3cb4
Fixed: Android build
Feb 6, 2018
9c53bfb
Updated gitignore.
Feb 6, 2018
94d7bec
Refactor: removed files not supposed to be SCM'ed.
Feb 6, 2018
bf676c7
Fixed: Android demo, now runs normally.
Feb 6, 2018
4ee385e
Refactor: Cleaned up makefile.
Feb 6, 2018
3c4502e
Refactor: Removed useless files.
Feb 6, 2018
7bd5098
Refactor: Simplified code branching
kakyoism Feb 6, 2018
d82f137
Refactor: Further simplified preprocessor branching for Mac.
kakyoism Feb 6, 2018
f4bcd27
Refactor: Used proper cross-platform coding.
kakyoism Feb 6, 2018
9d64de3
Refactor: Apply same cross-platform change to Windows.
Feb 6, 2018
e69502e
Fixed: Crash when ESC out of Footstep scene.
kakyoism Feb 6, 2018
580f2e9
Refactor: Further fixed cross-platform screen orientation code.
kakyoism Feb 6, 2018
58916cf
Refactor: Apply screen orientation change to Android.
Feb 6, 2018
a2bf5fc
Merge branch 'master' of https://github.com/kakyoism/cocos2dx-Integra…
kakyoism Feb 6, 2018
b33469f
Fixed: Crash when clicking on play button in BGM scene.
Feb 6, 2018
b2702b6
Enabled BGM scene for all.
kakyoism Feb 6, 2018
2151fb9
Fixed: Assert in BGM
Feb 7, 2018
179b526
Cleaned up unused variables.
kakyoism Feb 7, 2018
075da75
Refactor: Separating Windows-specific code from WwiseWrapper for clar…
Feb 7, 2018
7e4319d
Refactor: Moved things to where they should be.
Feb 7, 2018
a62be9a
Refactor: In progress: Separate platform-specific engine life-cycle c…
Feb 7, 2018
e7210e2
Refactor: Separated Android-specific engine lifecycle management.
Feb 7, 2018
5c69c59
Breaking change: Moved old jumble of all platform wrapper into platfo…
Feb 8, 2018
d981170
Refactor: Simplified public interface of wrapper.
Feb 8, 2018
5369aaf
Refactor: Further simplifeid Android code.
Feb 8, 2018
b7dae6c
Refactor: Use proper abstraction level in Scene update calls.
Feb 8, 2018
11473d8
Fixed: Adjusted Update call sequences.
Feb 8, 2018
f74de2e
Refactor: Removed useless namespace.
Feb 8, 2018
9aaf88f
Fixed: Windows build against the breaking cross-platform change.
Feb 8, 2018
b3d7c42
Breaking change: Prepare to refactor iOS/Mac WwiseWrapper.
kakyoism Feb 8, 2018
d9e1394
Fixed: Mac build against breaking cross-platform change.
kakyoism Feb 8, 2018
e8f4a48
Fixed: iOS build against breaking cross-platform change.
kakyoism Feb 8, 2018
8fdcf3b
Refactor: Cleaned up Android code.
Feb 8, 2018
d662bf7
Fixed: Crash due to keeping iOS app alive.
kakyoism Feb 8, 2018
4f69dc3
Merge branch 'master' of https://github.com/kakyoism/cocos2dx-Integra…
kakyoism Feb 8, 2018
27a7fa3
Refactor: Minimized preprocessor branching for Android.
Feb 8, 2018
69ee072
Merge branch 'master' of https://github.com/kakyoism/cocos2dx-Integra…
Feb 8, 2018
392515d
Refactor.
Feb 8, 2018
b8c4c9b
Refactor: Used proper cross-platform switching.
Feb 8, 2018
f653d3a
Build fix.
kakyoism Feb 8, 2018
d20b089
Refactor: Moved logging code for Android into platform scope.
Feb 8, 2018
01fdb37
Refactor: Extract common Wwise lifecycle code
Feb 8, 2018
7e54021
Refactor: Separated common from platform-specifc for Windows.
Feb 8, 2018
a5c5e31
Fixed: Line ending.
Feb 8, 2018
a82a3f4
Fixed: Line endings and log-tag.
Feb 8, 2018
86c1581
Refactor: Separated cross-platform code from platform-specific code, …
kakyoism Feb 8, 2018
3bb3682
Merge branch 'master' of https://github.com/kakyoism/cocos2dx-Integra…
Feb 8, 2018
d068a70
Updated documentation.
kakyoism Feb 8, 2018
95ba7b0
Added: Documentation.
kakyoism Feb 9, 2018
aa7afcd
Removed redundant docs.
kakyoism Feb 9, 2018
e8e7d0b
improved docs.
kakyoism Feb 23, 2018
ccb4616
fixed docs.
Mar 5, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .cocos-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"engine_version": "cocos2d-x-3.16",
"project_type": "cpp"
}
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*.tlog
*.log
*.bak
*.a
*.d
*.o
bin/*
proj.android/assets
proj.android/bin
proj.android/libs
proj.android/obj
proj.android/objs-debug
proj.ios_mac/IntegrationDemo-cocos.xcodeproj/xcuserdata/*
proj.ios_mac/IntegrationDemo-cocos.xcodeproj/*.xcworkspace/*
proj.ios_mac/ios/Debug-iphoneos
proj.ios_mac/ios/Release-iphoneos
proj.ios_mac/mac/Debug/
proj.ios_mac/mac/Release/
proj.win32/.vs/*
proj.win32/Debug.win32/
proj.win32/Release.win32/
cocos2d/cocos/editor-support/spine/proj.win32/Debug.win32/
cocos2d/cocos/editor-support/spine/proj.win32/Release.win32/
cocos2d/external/Box2D/proj.win32/Debug.win32/
cocos2d/external/Box2D/proj.win32/Release.win32/
cocos2d/external/bullet/proj.win32/Debug.win32/
cocos2d/external/bullet/proj.win32/Release.win32/
cocos2d/external/recast/proj.win32/Debug.win32/
cocos2d/external/recast/proj.win32/Release.win32/
cocos2d/cocos/2d/Debug.win32/
cocos2d/cocos/2d/Release.win32/
cocos2d/build/cocos2d_libs.xcodeproj/xcuserdata
49 changes: 0 additions & 49 deletions Android/Platform.h

This file was deleted.

172 changes: 172 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#/****************************************************************************
# Copyright (c) 2013-2014 cocos2d-x.org
#
# http://www.cocos2d-x.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
cmake_policy(SET CMP0017 NEW)

cmake_minimum_required(VERSION 2.8)

set(APP_NAME MyGame)
project (${APP_NAME})

set(COCOS2D_ROOT ${CMAKE_SOURCE_DIR}/cocos2d)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${COCOS2D_ROOT}/cmake/Modules/")
include(CocosBuildHelpers)

# libcocos2d
set(BUILD_CPP_TESTS OFF CACHE BOOL "turn off build cpp-tests")
set(BUILD_LUA_LIBS OFF CACHE BOOL "turn off build lua related targets")
set(BUILD_JS_LIBS OFF CACHE BOOL "turn off build js related targets")
add_subdirectory(${COCOS2D_ROOT})

# Some macro definitions
if(WINDOWS)
if(BUILD_SHARED_LIBS)
ADD_DEFINITIONS (-D_USRDLL -D_EXPORT_DLL_ -D_USEGUIDLL -D_USREXDLL -D_USRSTUDIODLL)
else()
ADD_DEFINITIONS (-DCC_STATIC)
endif()

ADD_DEFINITIONS (-DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32 -D_WIN32)
set(PLATFORM_FOLDER win32)
elseif(MACOSX OR APPLE)
ADD_DEFINITIONS (-DCC_TARGET_OS_MAC)
ADD_DEFINITIONS (-DUSE_FILE32API)
set(PLATFORM_FOLDER mac)
elseif(LINUX)
ADD_DEFINITIONS(-DLINUX)
set(PLATFORM_FOLDER linux)
elseif(ANDROID)
ADD_DEFINITIONS (-DUSE_FILE32API)
set(PLATFORM_FOLDER android)
else()
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
endif()


# Compiler options
if(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710
-wd4514 -wd4056 -wd4996 -wd4099)
else()
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations -Wno-reorder")
if(CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif(MSVC)



set(PLATFORM_SPECIFIC_SRC)
set(PLATFORM_SPECIFIC_HEADERS)
if(MACOSX OR APPLE)
set(PLATFORM_SPECIFIC_SRC
proj.ios_mac/ios/main.m
proj.ios_mac/ios/RootViewController.mm
proj.ios_mac/ios/AppController.mm
)
set(PLATFORM_SPECIFIC_HEADERS
proj.ios_mac/ios/RootViewController.h
proj.ios_mac/ios/AppController.h
)
elseif(LINUX) #assume linux
set(PLATFORM_SPECIFIC_SRC
proj.linux/main.cpp
)
elseif ( WIN32 )
set(PLATFORM_SPECIFIC_SRC
proj.win32/main.cpp
)
set(PLATFORM_SPECIFIC_HEADERS
proj.win32/main.h
proj.win32/resource.h
)
endif()

include_directories(
/usr/local/include/GLFW
/usr/include/GLFW
${COCOS2D_ROOT}/cocos
${COCOS2D_ROOT}/cocos/platform
${COCOS2D_ROOT}/cocos/audio/include/
Classes
)
if ( WIN32 )
include_directories(
${COCOS2D_ROOT}/external/glfw3/include/win32
${COCOS2D_ROOT}/external/win32-specific/gles/include/OGLES
)
endif( WIN32 )

set(GAME_SRC
Classes/AppDelegate.cpp
Classes/HelloWorldScene.cpp
${PLATFORM_SPECIFIC_SRC}
)

set(GAME_HEADERS
Classes/AppDelegate.h
Classes/HelloWorldScene.h
${PLATFORM_SPECIFIC_HEADERS}
)

if(GAME_HEADERS)
if ( WIN32 )
add_executable(${APP_NAME} WIN32 ${GAME_SRC} ${GAME_HEADERS})
else()
add_executable(${APP_NAME} ${GAME_SRC} ${GAME_HEADERS})
endif ( WIN32 )
else()
if ( WIN32 )
add_executable(${APP_NAME} WIN32 ${GAME_SRC})
else()
add_executable(${APP_NAME} ${GAME_SRC})
endif ( WIN32 )
endif()

target_link_libraries(${APP_NAME} cocos2d)

set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin")

set_target_properties(${APP_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")

if ( WIN32 )
#also copying dlls to binary directory for the executable to run
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy ${COCOS2D_ROOT}/external/win32-specific/gles/prebuilt/glew32.dll ${APP_BIN_DIR}/${CMAKE_BUILD_TYPE}
COMMAND ${CMAKE_COMMAND} -E copy ${COCOS2D_ROOT}/external/win32-specific/zlib/prebuilt/zlib1.dll ${APP_BIN_DIR}/${CMAKE_BUILD_TYPE}
)
else()
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
)

endif()
117 changes: 117 additions & 0 deletions Classes/AppDelegate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#include "AppDelegate.h"
#include "SceneMain.h"
#include "PlatformCocos.h"
#include "WwiseWrapper.h"

#if __APPLE__
#include "TargetConditionals.h"
#endif

USING_NS_CC;

//static cocos2d::Size designResolutionSize = cocos2d::Size(640, 960); //h
static cocos2d::Size designResolutionSize = g_isLandscape ? cocos2d::Size(1024, 960) : cocos2d::Size(480, 320); //h
static cocos2d::Size smallResolutionSize = cocos2d::Size(480, 320);
static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024, 768);
static cocos2d::Size largeResolutionSize = cocos2d::Size(2048, 1536);
int g_menu_ix = 0;
int g_menu_sub_ix = 0;

#ifdef AK_APPLE
bool g_bEnableMicDemo = false;
#endif

AppDelegate::AppDelegate()
{

}

AppDelegate::~AppDelegate()
{
Wwise::Instance().Term();
}

//if you want a different context,just modify the value of glContextAttrs
//it will takes effect on all platforms
void AppDelegate::initGLContextAttrs()
{
//set OpenGL context attributions,now can only set six attributions:
//red,green,blue,alpha,depth,stencil
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};

GLView::setGLContextAttrs(glContextAttrs);
}

// If you want to use packages manager to install more packages,
// don't modify or remove this function
static int register_all_packages()
{
return 0; //flag for packages manager
}

bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
glview = GLViewImpl::createWithRect("IntegrationDemo", cocos2d::Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
glview = GLViewImpl::create("IntegrationDemo");
#endif
director->setOpenGLView(glview);
}

// turn on display FPS
director->setDisplayStats(true);

// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);

// Set the design resolution
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
cocos2d::Size frameSize = glview->getFrameSize();
// if the frame's height is larger than the height of medium size.
if (frameSize.height > mediumResolutionSize.height)
{
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is larger than the height of small size.
else if (frameSize.height > smallResolutionSize.height)
{
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is smaller than the height of medium size.
else
{
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
}

register_all_packages();

Wwise::Instance().Init();
// create a scene. it's an autorelease object
auto scene = SceneMain::createScene();

// run
director->runWithScene(scene);

return true;
}

// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {
Director::getInstance()->stopAnimation();

// if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
Director::getInstance()->startAnimation();

// if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
}
Loading