背景和头像缺失
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/jniLibs
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.cocos2dx.hellolua"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
|
||||
<!-- Tell Cocos2dxActivity the name of our .so -->
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="cocos2dlua" />
|
||||
|
||||
<activity
|
||||
android:name="org.cocos2dx.lua.AppActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,49 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "22.0.1"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.cocos2dx.hellolua"
|
||||
minSdkVersion 10
|
||||
targetSdkVersion 22
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
java.srcDir "src"
|
||||
res.srcDir "res"
|
||||
jniLibs.srcDir "libs"
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
assets.srcDir "assets"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
release {
|
||||
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||
storeFile file(RELEASE_STORE_FILE)
|
||||
storePassword RELEASE_STORE_PASSWORD
|
||||
keyAlias RELEASE_KEY_ALIAS
|
||||
keyPassword RELEASE_KEY_PASSWORD
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile project(':libcocos2dx')
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := cocos2dlua_shared
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcocos2dlua
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
../../../Classes/AppDelegate.cpp \
|
||||
../../../Classes/ide-support/SimpleConfigParser.cpp \
|
||||
../../../Classes/ide-support/RuntimeLuaImpl.cpp \
|
||||
../../../Classes/ide-support/lua_debugger.c \
|
||||
hellolua/main.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
|
||||
|
||||
# _COCOS_HEADER_ANDROID_BEGIN
|
||||
# _COCOS_HEADER_ANDROID_END
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
|
||||
LOCAL_STATIC_LIBRARIES += cocos2d_simulator_static
|
||||
|
||||
# _COCOS_LIB_ANDROID_BEGIN
|
||||
# _COCOS_LIB_ANDROID_END
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,scripting/lua-bindings/proj.android)
|
||||
$(call import-module,tools/simulator/libsimulator/proj.android)
|
||||
|
||||
# _COCOS_LIB_IMPORT_ANDROID_BEGIN
|
||||
# _COCOS_LIB_IMPORT_ANDROID_END
|
||||
@@ -0,0 +1,13 @@
|
||||
APP_STL := gnustl_static
|
||||
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
|
||||
APP_LDFLAGS := -latomic
|
||||
|
||||
|
||||
ifeq ($(NDK_DEBUG),1)
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
|
||||
APP_OPTIM := debug
|
||||
else
|
||||
APP_CPPFLAGS += -DNDEBUG
|
||||
APP_OPTIM := release
|
||||
endif
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "AppDelegate.h"
|
||||
#include "cocos2d.h"
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include "ide-support/SimpleConfigParser.h"
|
||||
#include "ide-support/CodeIDESupport.h"
|
||||
|
||||
#define LOG_TAG "main"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
void cocos_android_app_init (JNIEnv* env) {
|
||||
LOGD("cocos_android_app_init");
|
||||
AppDelegate *pAppDelegate = new AppDelegate();
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
bool Java_org_cocos2dx_lua_AppActivity_nativeIsLandScape(JNIEnv *env, jobject thisz)
|
||||
{
|
||||
return SimpleConfigParser::getInstance()->isLanscape();
|
||||
}
|
||||
|
||||
bool Java_org_cocos2dx_lua_AppActivity_nativeIsDebug(JNIEnv *env, jobject thisz)
|
||||
{
|
||||
#if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">HelloLua</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,127 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2015 Chukong Technologies Inc.
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
package org.cocos2dx.lua;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
public class AppActivity extends Cocos2dxActivity{
|
||||
|
||||
static String hostIPAdress = "0.0.0.0";
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if(nativeIsLandScape()) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
} else {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||
}
|
||||
|
||||
//2.Set the format of window
|
||||
|
||||
// Check the wifi is opened when the native is debug.
|
||||
if(nativeIsDebug())
|
||||
{
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
if(!isNetworkConnected())
|
||||
{
|
||||
AlertDialog.Builder builder=new AlertDialog.Builder(this);
|
||||
builder.setTitle("Warning");
|
||||
builder.setMessage("Please open WIFI for debuging...");
|
||||
builder.setPositiveButton("OK",new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
|
||||
finish();
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
builder.setNegativeButton("Cancel", null);
|
||||
builder.setCancelable(true);
|
||||
builder.show();
|
||||
}
|
||||
hostIPAdress = getHostIpAddress();
|
||||
}
|
||||
}
|
||||
private boolean isNetworkConnected() {
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm != null) {
|
||||
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
|
||||
ArrayList networkTypes = new ArrayList();
|
||||
networkTypes.add(ConnectivityManager.TYPE_WIFI);
|
||||
try {
|
||||
networkTypes.add(ConnectivityManager.class.getDeclaredField("TYPE_ETHERNET").getInt(null));
|
||||
} catch (NoSuchFieldException nsfe) {
|
||||
}
|
||||
catch (IllegalAccessException iae) {
|
||||
throw new RuntimeException(iae);
|
||||
}
|
||||
if (networkInfo != null && networkTypes.contains(networkInfo.getType())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getHostIpAddress() {
|
||||
WifiManager wifiMgr = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
|
||||
int ip = wifiInfo.getIpAddress();
|
||||
return ((ip & 0xFF) + "." + ((ip >>>= 8) & 0xFF) + "." + ((ip >>>= 8) & 0xFF) + "." + ((ip >>>= 8) & 0xFF));
|
||||
}
|
||||
|
||||
public static String getLocalIpAddress() {
|
||||
return hostIPAdress;
|
||||
}
|
||||
|
||||
private static native boolean nativeIsLandScape();
|
||||
private static native boolean nativeIsDebug();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user