mirror of https://github.com/axmolengine/axmol.git
sync code from default template
This commit is contained in:
parent
c34eedae1c
commit
86416e73ca
Binary file not shown.
|
@ -38,10 +38,6 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
initRuntime();
|
||||
#endif
|
||||
|
||||
if (!ConfigParser::getInstance()->isInit()) {
|
||||
ConfigParser::getInstance()->readConfig();
|
||||
}
|
||||
|
||||
// initialize director
|
||||
auto director = Director::getInstance();
|
||||
auto glview = director->getOpenGLView();
|
||||
|
@ -57,10 +53,6 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
director->setOpenGLView(glview);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// set FPS. the default value is 1.0/60 if you don't call this
|
||||
director->setAnimationInterval(1.0 / 60);
|
||||
|
||||
auto engine = LuaEngine::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
|
@ -98,4 +90,3 @@ void AppDelegate::applicationWillEnterForeground()
|
|||
|
||||
SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#ifndef __APP_DELEGATE_H__
|
||||
#define __APP_DELEGATE_H__
|
||||
|
||||
#include "CCApplication.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
|
|
|
@ -12,18 +12,13 @@ ConfigParser *ConfigParser::getInstance(void)
|
|||
if (!s_sharedInstance)
|
||||
{
|
||||
s_sharedInstance = new ConfigParser();
|
||||
s_sharedInstance->readConfig();
|
||||
}
|
||||
return s_sharedInstance;
|
||||
}
|
||||
|
||||
bool ConfigParser::isInit()
|
||||
{
|
||||
return _isInit;
|
||||
}
|
||||
|
||||
void ConfigParser::readConfig()
|
||||
{
|
||||
_isInit = true;
|
||||
_isWindowTop = false;
|
||||
_consolePort = 6010;
|
||||
_uploadPort = 6020;
|
||||
|
@ -107,7 +102,7 @@ void ConfigParser::readConfig()
|
|||
|
||||
}
|
||||
|
||||
ConfigParser::ConfigParser(void):_isInit(false),_isLandscape(true)
|
||||
ConfigParser::ConfigParser(void):_isLandscape(true)
|
||||
{
|
||||
_initViewSize.setSize(960,640);
|
||||
_viewName = "HelloLua";
|
||||
|
|
|
@ -40,7 +40,6 @@ public:
|
|||
int getUploadPort();
|
||||
bool isLanscape();
|
||||
bool isWindowTop();
|
||||
bool isInit();
|
||||
|
||||
private:
|
||||
ConfigParser(void);
|
||||
|
@ -50,7 +49,6 @@ private:
|
|||
string _viewName;
|
||||
string _entryfile;
|
||||
bool _isLandscape;
|
||||
bool _isInit;
|
||||
bool _isWindowTop;
|
||||
int _consolePort;
|
||||
int _uploadPort;
|
||||
|
|
|
@ -1,27 +1,30 @@
|
|||
#ifndef __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__
|
||||
#define __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__
|
||||
|
||||
#include "network/lua_cocos2dx_network_manual.h"
|
||||
#include "cocosdenshion/lua_cocos2dx_cocosdenshion_manual.h"
|
||||
#include "network/lua_cocos2dx_network_manual.h"
|
||||
#include "cocosbuilder/lua_cocos2dx_cocosbuilder_manual.h"
|
||||
#include "cocostudio/lua_cocos2dx_coco_studio_manual.hpp"
|
||||
#include "extension/lua_cocos2dx_extension_manual.h"
|
||||
#include "ui/lua_cocos2dx_ui_manual.hpp"
|
||||
#include "spine/lua_cocos2dx_spine_manual.hpp"
|
||||
#include "3d/lua_cocos2dx_3d_manual.h"
|
||||
|
||||
#include "audioengine/lua_cocos2dx_audioengine_manual.h"
|
||||
|
||||
int lua_module_register(lua_State* L)
|
||||
{
|
||||
//Dont' change the module register order unless you know what your are doing
|
||||
register_network_module(L);
|
||||
register_cocosdenshion_module(L);
|
||||
register_network_module(L);
|
||||
register_cocosbuilder_module(L);
|
||||
register_cocostudio_module(L);
|
||||
register_ui_moudle(L);
|
||||
register_extension_module(L);
|
||||
register_spine_module(L);
|
||||
register_cocos3d_module(L);
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||
register_audioengine_module(L);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1160,10 +1160,7 @@ bool initRuntime()
|
|||
LuaStack* stack = engine->getLuaStack();
|
||||
register_runtime_override_function(stack->getLuaState());
|
||||
luaopen_debugger(engine->getLuaStack()->getLuaState());
|
||||
|
||||
if (!ConfigParser::getInstance()->isInit()) {
|
||||
ConfigParser::getInstance()->readConfig();
|
||||
}
|
||||
|
||||
static ConsoleCustomCommand *g_customCommand;
|
||||
g_customCommand = new ConsoleCustomCommand();
|
||||
g_customCommand->init();
|
||||
|
|
|
@ -8,17 +8,11 @@
|
|||
"copy_resources": [
|
||||
{
|
||||
"from": "../../../src",
|
||||
"to": "src",
|
||||
"exclude": [
|
||||
"*.gz"
|
||||
]
|
||||
"to": "src"
|
||||
},
|
||||
{
|
||||
"from": "../../../res",
|
||||
"to": "res",
|
||||
"exclude": [
|
||||
"*.gz"
|
||||
]
|
||||
"to": "res"
|
||||
}
|
||||
],
|
||||
"must_copy_resources": [
|
||||
|
|
|
@ -6,7 +6,8 @@ LOCAL_MODULE := cocos2dlua_shared
|
|||
|
||||
LOCAL_MODULE_FILENAME := libcocos2dlua
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
LOCAL_SRC_FILES := hellolua/main.cpp \
|
||||
hellolua/Runtime_android.cpp \
|
||||
../../Classes/protobuf-lite/google/protobuf/io/coded_stream.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/stubs/common.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/extension_set.cc \
|
||||
|
@ -29,9 +30,7 @@ LOCAL_SRC_FILES := \
|
|||
../../Classes/runtime/lua_debugger.c \
|
||||
../../Classes/VisibleRect.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../Classes/ConfigParser.cpp \
|
||||
lua/Runtime_android.cpp \
|
||||
lua/main.cpp
|
||||
../../Classes/ConfigParser.cpp
|
||||
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
|
@ -45,4 +44,3 @@ LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
|
|||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,scripting/lua-bindings/proj.android)
|
||||
|
||||
|
|
|
@ -6,21 +6,6 @@
|
|||
using namespace std;
|
||||
using namespace cocos2d;
|
||||
|
||||
string getSDCardPath()
|
||||
{
|
||||
JniMethodInfo t;
|
||||
string sdcardPath("");
|
||||
|
||||
if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lua/AppActivity", "getSDCardPath", "()Ljava/lang/String;")) {
|
||||
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
sdcardPath = JniHelper::jstring2string(str);
|
||||
t.env->DeleteLocalRef(str);
|
||||
}
|
||||
return sdcardPath;
|
||||
|
||||
}
|
||||
|
||||
string getIPAddress()
|
||||
{
|
||||
JniMethodInfo t;
|
|
@ -19,10 +19,6 @@ extern "C"
|
|||
{
|
||||
bool Java_org_cocos2dx_lua_AppActivity_nativeIsLandScape(JNIEnv *env, jobject thisz)
|
||||
{
|
||||
if (!ConfigParser::getInstance()->isInit())
|
||||
{
|
||||
ConfigParser::getInstance()->readConfig();
|
||||
}
|
||||
return ConfigParser::getInstance()->isLanscape();
|
||||
}
|
||||
|
|
@ -45,22 +45,18 @@ import android.net.NetworkInfo;
|
|||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
// The name of .so is specified in AndroidMenifest.xml. NativityActivity will load it automatically for you.
|
||||
// You can use "System.loadLibrary()" to load other .so files.
|
||||
|
||||
public class AppActivity extends Cocos2dxActivity{
|
||||
|
||||
static String hostIPAdress="0.0.0.0";
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if(nativeIsLandScape()) {
|
||||
|
@ -128,14 +124,6 @@ public class AppActivity extends Cocos2dxActivity{
|
|||
return hostIPAdress;
|
||||
}
|
||||
|
||||
public static String getSDCardPath() {
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
String strSDCardPathString = Environment.getExternalStorageDirectory().getPath();
|
||||
return strSDCardPathString;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static native boolean nativeIsLandScape();
|
||||
private static native boolean nativeIsDebug();
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#import "AppDelegate.h"
|
||||
#import "RootViewController.h"
|
||||
#import "platform/ios/CCEAGLView-ios.h"
|
||||
#include "ConfigParser.h"
|
||||
|
||||
@implementation AppController
|
||||
|
||||
|
@ -48,9 +47,7 @@ static AppDelegate s_sharedApplication;
|
|||
cocos2d::GLViewImpl::convertAttrs();
|
||||
|
||||
// Override point for customization after application launch.
|
||||
|
||||
ConfigParser::getInstance()->readConfig();
|
||||
|
||||
|
||||
// Add the view controller's view to the window and display.
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#import "RootViewController.h"
|
||||
#import "cocos2d.h"
|
||||
#import "CCEAGLView.h"
|
||||
#import "platform/ios/CCEAGLView-ios.h"
|
||||
#include "ConfigParser.h"
|
||||
|
||||
@implementation RootViewController
|
||||
|
|
|
@ -39,7 +39,6 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
|||
|
||||
// create the application instance
|
||||
AppDelegate app;
|
||||
|
||||
int ret = Application::getInstance()->run();
|
||||
|
||||
#ifdef USE_WIN32_CONSOLE
|
||||
|
|
|
@ -21,6 +21,15 @@ local function main()
|
|||
-- avoid memory leak
|
||||
collectgarbage("setpause", 100)
|
||||
collectgarbage("setstepmul", 5000)
|
||||
|
||||
-- initialize director
|
||||
local director = cc.Director:getInstance()
|
||||
|
||||
--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)
|
||||
|
||||
cc.FileUtils:getInstance():addSearchPath("src")
|
||||
cc.FileUtils:getInstance():addSearchPath("res")
|
||||
|
|
Loading…
Reference in New Issue