mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into issue_9586
This commit is contained in:
commit
8bc68395de
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCAsyncTaskPool.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "platform/CCImage.h"
|
||||
|
@ -49,10 +50,27 @@ int ccNextPOT(int x)
|
|||
namespace utils
|
||||
{
|
||||
/**
|
||||
* Capture screen implementation, don't use it directly.
|
||||
*/
|
||||
* Capture screen implementation, don't use it directly.
|
||||
*/
|
||||
void onCaptureScreen(const std::function<void(bool, const std::string&)>& afterCaptured, const std::string& filename)
|
||||
{
|
||||
static bool startedCapture = false;
|
||||
|
||||
if (startedCapture)
|
||||
{
|
||||
CCLOG("Screen capture is already working");
|
||||
if (afterCaptured)
|
||||
{
|
||||
afterCaptured(false, filename);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
startedCapture = true;
|
||||
}
|
||||
|
||||
|
||||
auto glView = Director::getInstance()->getOpenGLView();
|
||||
auto frameSize = glView->getFrameSize();
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
|
||||
|
@ -87,7 +105,7 @@ void onCaptureScreen(const std::function<void(bool, const std::string&)>& afterC
|
|||
memcpy(flippedBuffer.get() + (height - row - 1) * width * 4, buffer.get() + row * width * 4, width * 4);
|
||||
}
|
||||
|
||||
std::shared_ptr<Image> image(new Image);
|
||||
Image* image = new (std::nothrow) Image;
|
||||
if (image)
|
||||
{
|
||||
image->initWithRawData(flippedBuffer.get(), width * height * 4, width, height, 8);
|
||||
|
@ -100,15 +118,36 @@ void onCaptureScreen(const std::function<void(bool, const std::string&)>& afterC
|
|||
CCASSERT(filename.find("/") == std::string::npos, "The existence of a relative path is not guaranteed!");
|
||||
outputFile = FileUtils::getInstance()->getWritablePath() + filename;
|
||||
}
|
||||
succeed = image->saveToFile(outputFile);
|
||||
}
|
||||
}while(0);
|
||||
|
||||
// Save image in AsyncTaskPool::TaskType::TASK_IO thread, and call afterCaptured in mainThread
|
||||
static bool succeedSaveToFile = false;
|
||||
std::function<void(void*)> mainThread = [afterCaptured, outputFile](void* param)
|
||||
{
|
||||
if (afterCaptured)
|
||||
{
|
||||
afterCaptured(succeedSaveToFile, outputFile);
|
||||
}
|
||||
startedCapture = false;
|
||||
};
|
||||
|
||||
AsyncTaskPool::getInstance()->enqueue(AsyncTaskPool::TaskType::TASK_IO, mainThread, (void*)NULL, [image, outputFile]()
|
||||
{
|
||||
succeedSaveToFile = image->saveToFile(outputFile);
|
||||
delete image;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("Malloc Image memory failed!");
|
||||
if (afterCaptured)
|
||||
{
|
||||
afterCaptured(succeed, outputFile);
|
||||
}
|
||||
startedCapture = false;
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Capture screen interface
|
||||
*/
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -62,7 +62,7 @@ OnSimpleStickListener, OnAccListener, OnGyroListener, OnStateListener, GameContr
|
|||
public void onCreate(Context context) {
|
||||
mContext = context;
|
||||
|
||||
mControllerService = Controller.getControllerService();
|
||||
mControllerService = Controller.getControllerService(context);
|
||||
if (mControllerService != null) {
|
||||
mControllerService.setControllerServiceListener(this);
|
||||
mControllerService.setStateListener(this);
|
||||
|
@ -70,7 +70,7 @@ OnSimpleStickListener, OnAccListener, OnGyroListener, OnStateListener, GameContr
|
|||
mControllerService.setSimpleStickListener(this);
|
||||
//mControllerService.setAccListener(this);
|
||||
//mControllerService.setGyroListener(this);
|
||||
mControllerService.setEnableLR2(true);
|
||||
mControllerService.setEnableL2R2(true);
|
||||
mControllerService.setAutoKeyUpMode(false);
|
||||
|
||||
mControllerService.checkNibiruInstall(mContext, false);
|
||||
|
@ -114,11 +114,11 @@ OnSimpleStickListener, OnAccListener, OnGyroListener, OnStateListener, GameContr
|
|||
if( !mControllerService.hasDeviceConnected() ){
|
||||
Bundle bun = new Bundle();
|
||||
bun.putBoolean(ControllerService.FLAG_IS_SHOW_GAMEPAD_TIP, false);
|
||||
try {
|
||||
/*try {
|
||||
mControllerService.showDeviceManagerUI(mContext, bun);
|
||||
} catch (ControllerServiceException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,14 +35,6 @@ public class GameControllerOuya implements GameControllerDelegate{
|
|||
|
||||
public void onCreate(Context context) {
|
||||
OuyaController.init(context);
|
||||
/*GameControllerAdapter.addRunnableToFrameStartList(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
OuyaController.startOfFrame();
|
||||
}
|
||||
|
||||
});*/
|
||||
}
|
||||
|
||||
private float mOldLeftThumbstickX = 0.0f;
|
||||
|
|
|
@ -6085,6 +6085,18 @@ str
|
|||
return map_object;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getFileSize
|
||||
* @param {String} arg0
|
||||
* @return {long}
|
||||
*/
|
||||
getFileSize : function (
|
||||
str
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getValueMapFromData
|
||||
* @param {char} arg0
|
||||
|
@ -6122,15 +6134,17 @@ array
|
|||
},
|
||||
|
||||
/**
|
||||
* @method getFileSize
|
||||
* @method writeStringToFile
|
||||
* @param {String} arg0
|
||||
* @return {long}
|
||||
* @param {String} arg1
|
||||
* @return {bool}
|
||||
*/
|
||||
getFileSize : function (
|
||||
writeStringToFile : function (
|
||||
str,
|
||||
str
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -6167,6 +6181,20 @@ bool
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method writeValueVectorToFile
|
||||
* @param {Array} arg0
|
||||
* @param {String} arg1
|
||||
* @return {bool}
|
||||
*/
|
||||
writeValueVectorToFile : function (
|
||||
array,
|
||||
str
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isFileExist
|
||||
* @param {String} arg0
|
||||
|
@ -6213,6 +6241,20 @@ str
|
|||
return ;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method writeValueMapToFile
|
||||
* @param {map_object} arg0
|
||||
* @param {String} arg1
|
||||
* @return {bool}
|
||||
*/
|
||||
writeValueMapToFile : function (
|
||||
map,
|
||||
str
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setWritablePath
|
||||
* @param {String} arg0
|
||||
|
|
|
@ -17212,6 +17212,28 @@ bool js_cocos2dx_FileUtils_getValueMapFromFile(JSContext *cx, uint32_t argc, jsv
|
|||
JS_ReportError(cx, "js_cocos2dx_FileUtils_getValueMapFromFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_FileUtils_getFileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getFileSize : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getFileSize : Error processing arguments");
|
||||
long ret = cobj->getFileSize(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = long_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_FileUtils_getFileSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_FileUtils_getValueMapFromData(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -17278,26 +17300,28 @@ bool js_cocos2dx_FileUtils_setSearchPaths(JSContext *cx, uint32_t argc, jsval *v
|
|||
JS_ReportError(cx, "js_cocos2dx_FileUtils_setSearchPaths : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_FileUtils_getFileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
bool js_cocos2dx_FileUtils_writeStringToFile(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getFileSize : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_writeStringToFile : Invalid Native Object");
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
std::string arg1;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getFileSize : Error processing arguments");
|
||||
long ret = cobj->getFileSize(arg0);
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_writeStringToFile : Error processing arguments");
|
||||
bool ret = cobj->writeStringToFile(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = long_to_jsval(cx, ret);
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_FileUtils_getFileSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
JS_ReportError(cx, "js_cocos2dx_FileUtils_writeStringToFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_FileUtils_setSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
@ -17380,6 +17404,30 @@ bool js_cocos2dx_FileUtils_addSearchPath(JSContext *cx, uint32_t argc, jsval *vp
|
|||
JS_ReportError(cx, "js_cocos2dx_FileUtils_addSearchPath : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_FileUtils_writeValueVectorToFile(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_writeValueVectorToFile : Invalid Native Object");
|
||||
if (argc == 2) {
|
||||
cocos2d::ValueVector arg0;
|
||||
std::string arg1;
|
||||
ok &= jsval_to_ccvaluevector(cx, args.get(0), &arg0);
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_writeValueVectorToFile : Error processing arguments");
|
||||
bool ret = cobj->writeValueVectorToFile(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_FileUtils_writeValueVectorToFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_FileUtils_isFileExist(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -17464,6 +17512,30 @@ bool js_cocos2dx_FileUtils_getSuitableFOpen(JSContext *cx, uint32_t argc, jsval
|
|||
JS_ReportError(cx, "js_cocos2dx_FileUtils_getSuitableFOpen : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_FileUtils_writeValueMapToFile(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_writeValueMapToFile : Invalid Native Object");
|
||||
if (argc == 2) {
|
||||
cocos2d::ValueMap arg0;
|
||||
std::string arg1;
|
||||
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_writeValueMapToFile : Error processing arguments");
|
||||
bool ret = cobj->writeValueMapToFile(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_FileUtils_writeValueMapToFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_FileUtils_setWritablePath(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -17685,17 +17757,20 @@ void js_register_cocos2dx_FileUtils(JSContext *cx, JS::HandleObject global) {
|
|||
JS_FN("getSearchPaths", js_cocos2dx_FileUtils_getSearchPaths, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("writeToFile", js_cocos2dx_FileUtils_writeToFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getValueMapFromFile", js_cocos2dx_FileUtils_getValueMapFromFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getFileSize", js_cocos2dx_FileUtils_getFileSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getValueMapFromData", js_cocos2dx_FileUtils_getValueMapFromData, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("removeDirectory", js_cocos2dx_FileUtils_removeDirectory, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setSearchPaths", js_cocos2dx_FileUtils_setSearchPaths, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getFileSize", js_cocos2dx_FileUtils_getFileSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("writeStringToFile", js_cocos2dx_FileUtils_writeStringToFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setSearchResolutionsOrder", js_cocos2dx_FileUtils_setSearchResolutionsOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("addSearchResolutionsOrder", js_cocos2dx_FileUtils_addSearchResolutionsOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("addSearchPath", js_cocos2dx_FileUtils_addSearchPath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("writeValueVectorToFile", js_cocos2dx_FileUtils_writeValueVectorToFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isFileExist", js_cocos2dx_FileUtils_isFileExist, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("purgeCachedEntries", js_cocos2dx_FileUtils_purgeCachedEntries, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("fullPathFromRelativeFile", js_cocos2dx_FileUtils_fullPathFromRelativeFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getSuitableFOpen", js_cocos2dx_FileUtils_getSuitableFOpen, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("writeValueMapToFile", js_cocos2dx_FileUtils_writeValueMapToFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setWritablePath", js_cocos2dx_FileUtils_setWritablePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setPopupNotify", js_cocos2dx_FileUtils_setPopupNotify, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isDirectoryExist", js_cocos2dx_FileUtils_isDirectoryExist, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
|
|
@ -926,17 +926,20 @@ bool js_cocos2dx_FileUtils_getValueVectorFromFile(JSContext *cx, uint32_t argc,
|
|||
bool js_cocos2dx_FileUtils_getSearchPaths(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_writeToFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_getValueMapFromFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_getFileSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_getValueMapFromData(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_removeDirectory(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_setSearchPaths(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_getFileSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_writeStringToFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_setSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_addSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_addSearchPath(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_writeValueVectorToFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_isFileExist(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_purgeCachedEntries(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_fullPathFromRelativeFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_getSuitableFOpen(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_writeValueMapToFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_setWritablePath(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_setPopupNotify(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_FileUtils_isDirectoryExist(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
-- @return FileUtils#FileUtils self (return value: cc.FileUtils)
|
||||
|
||||
--------------------------------
|
||||
-- Checks whether to pop up a message box when failed to load an image. <br>
|
||||
-- Checks whether to pop up a message box when failed to load an image.<br>
|
||||
-- return True if pop up a message box when failed to load an image, false if not.
|
||||
-- @function [parent=#FileUtils] isPopupNotify
|
||||
-- @param self
|
||||
|
@ -150,7 +150,10 @@
|
|||
-- @return array_table#array_table ret (return value: array_table)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- write a ValueMap into a plist file<br>
|
||||
-- param dict the ValueMap want to save<br>
|
||||
-- param fullPath The full path to the file you want to save a string<br>
|
||||
-- return bool
|
||||
-- @function [parent=#FileUtils] writeToFile
|
||||
-- @param self
|
||||
-- @param #map_table dict
|
||||
|
@ -168,7 +171,18 @@
|
|||
-- @return map_table#map_table ret (return value: map_table)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- Retrieve the file size.<br>
|
||||
-- note If a relative path was passed in, it will be inserted a default root path at the beginning.<br>
|
||||
-- param filepath The path of the file, it could be a relative or absolute path.<br>
|
||||
-- return The file size.
|
||||
-- @function [parent=#FileUtils] getFileSize
|
||||
-- @param self
|
||||
-- @param #string filepath
|
||||
-- @return long#long ret (return value: long)
|
||||
|
||||
--------------------------------
|
||||
-- Converts the contents of a file to a ValueMap.<br>
|
||||
-- This method is used internally.
|
||||
-- @function [parent=#FileUtils] getValueMapFromData
|
||||
-- @param self
|
||||
-- @param #char filedata
|
||||
|
@ -205,14 +219,15 @@
|
|||
-- @return FileUtils#FileUtils self (return value: cc.FileUtils)
|
||||
|
||||
--------------------------------
|
||||
-- Retrieve the file size.<br>
|
||||
-- note If a relative path was passed in, it will be inserted a default root path at the beginning.<br>
|
||||
-- param filepath The path of the file, it could be a relative or absolute path.<br>
|
||||
-- return The file size.
|
||||
-- @function [parent=#FileUtils] getFileSize
|
||||
-- write a string into a file<br>
|
||||
-- param dataStr the string want to save<br>
|
||||
-- param fullPath The full path to the file you want to save a string<br>
|
||||
-- return bool True if write success
|
||||
-- @function [parent=#FileUtils] writeStringToFile
|
||||
-- @param self
|
||||
-- @param #string filepath
|
||||
-- @return long#long ret (return value: long)
|
||||
-- @param #string dataStr
|
||||
-- @param #string fullPath
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- Sets the array that contains the search order of the resources.<br>
|
||||
|
@ -245,6 +260,17 @@
|
|||
-- @param #bool front
|
||||
-- @return FileUtils#FileUtils self (return value: cc.FileUtils)
|
||||
|
||||
--------------------------------
|
||||
-- write ValueVector into a plist file<br>
|
||||
-- param vecData the ValueVector want to save<br>
|
||||
-- param fullPath The full path to the file you want to save a string<br>
|
||||
-- return bool
|
||||
-- @function [parent=#FileUtils] writeValueVectorToFile
|
||||
-- @param self
|
||||
-- @param #array_table vecData
|
||||
-- @param #string fullPath
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- Checks whether a file exists.<br>
|
||||
-- note If a relative path was passed in, it will be inserted a default root path at the beginning.<br>
|
||||
|
@ -284,6 +310,17 @@
|
|||
-- @param #string filenameUtf8
|
||||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
-- write ValueMap into a plist file<br>
|
||||
-- param dict the ValueMap want to save<br>
|
||||
-- param fullPath The full path to the file you want to save a string<br>
|
||||
-- return bool
|
||||
-- @function [parent=#FileUtils] writeValueMapToFile
|
||||
-- @param self
|
||||
-- @param #map_table dict
|
||||
-- @param #string fullPath
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- Sets writable path.
|
||||
-- @function [parent=#FileUtils] setWritablePath
|
||||
|
|
|
@ -27207,6 +27207,56 @@ int lua_cocos2dx_FileUtils_getValueMapFromFile(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_getFileSize(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::FileUtils* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_getFileSize'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
std::string arg0;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.FileUtils:getFileSize");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_getFileSize'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
long ret = cobj->getFileSize(arg0);
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:getFileSize",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_getFileSize'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_getValueMapFromData(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -27360,7 +27410,7 @@ int lua_cocos2dx_FileUtils_setSearchPaths(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_getFileSize(lua_State* tolua_S)
|
||||
int lua_cocos2dx_FileUtils_writeStringToFile(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::FileUtils* cobj = nullptr;
|
||||
|
@ -27380,32 +27430,35 @@ int lua_cocos2dx_FileUtils_getFileSize(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_getFileSize'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_writeStringToFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
if (argc == 2)
|
||||
{
|
||||
std::string arg0;
|
||||
std::string arg1;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.FileUtils:getFileSize");
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.FileUtils:writeStringToFile");
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.FileUtils:writeStringToFile");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_getFileSize'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_writeStringToFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
long ret = cobj->getFileSize(arg0);
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
bool ret = cobj->writeStringToFile(arg0, arg1);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:getFileSize",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:writeStringToFile",argc, 2);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_getFileSize'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_writeStringToFile'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -27594,6 +27647,59 @@ int lua_cocos2dx_FileUtils_addSearchPath(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_writeValueVectorToFile(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::FileUtils* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_writeValueVectorToFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 2)
|
||||
{
|
||||
cocos2d::ValueVector arg0;
|
||||
std::string arg1;
|
||||
|
||||
ok &= luaval_to_ccvaluevector(tolua_S, 2, &arg0, "cc.FileUtils:writeValueVectorToFile");
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.FileUtils:writeValueVectorToFile");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_writeValueVectorToFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->writeValueVectorToFile(arg0, arg1);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:writeValueVectorToFile",argc, 2);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_writeValueVectorToFile'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_isFileExist(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -27794,6 +27900,59 @@ int lua_cocos2dx_FileUtils_getSuitableFOpen(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_writeValueMapToFile(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::FileUtils* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_writeValueMapToFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 2)
|
||||
{
|
||||
cocos2d::ValueMap arg0;
|
||||
std::string arg1;
|
||||
|
||||
ok &= luaval_to_ccvaluemap(tolua_S, 2, &arg0, "cc.FileUtils:writeValueMapToFile");
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.FileUtils:writeValueMapToFile");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_writeValueMapToFile'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->writeValueMapToFile(arg0, arg1);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:writeValueMapToFile",argc, 2);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_writeValueMapToFile'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_FileUtils_setWritablePath(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -28230,17 +28389,20 @@ int lua_register_cocos2dx_FileUtils(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getSearchPaths",lua_cocos2dx_FileUtils_getSearchPaths);
|
||||
tolua_function(tolua_S,"writeToFile",lua_cocos2dx_FileUtils_writeToFile);
|
||||
tolua_function(tolua_S,"getValueMapFromFile",lua_cocos2dx_FileUtils_getValueMapFromFile);
|
||||
tolua_function(tolua_S,"getFileSize",lua_cocos2dx_FileUtils_getFileSize);
|
||||
tolua_function(tolua_S,"getValueMapFromData",lua_cocos2dx_FileUtils_getValueMapFromData);
|
||||
tolua_function(tolua_S,"removeDirectory",lua_cocos2dx_FileUtils_removeDirectory);
|
||||
tolua_function(tolua_S,"setSearchPaths",lua_cocos2dx_FileUtils_setSearchPaths);
|
||||
tolua_function(tolua_S,"getFileSize",lua_cocos2dx_FileUtils_getFileSize);
|
||||
tolua_function(tolua_S,"writeStringToFile",lua_cocos2dx_FileUtils_writeStringToFile);
|
||||
tolua_function(tolua_S,"setSearchResolutionsOrder",lua_cocos2dx_FileUtils_setSearchResolutionsOrder);
|
||||
tolua_function(tolua_S,"addSearchResolutionsOrder",lua_cocos2dx_FileUtils_addSearchResolutionsOrder);
|
||||
tolua_function(tolua_S,"addSearchPath",lua_cocos2dx_FileUtils_addSearchPath);
|
||||
tolua_function(tolua_S,"writeValueVectorToFile",lua_cocos2dx_FileUtils_writeValueVectorToFile);
|
||||
tolua_function(tolua_S,"isFileExist",lua_cocos2dx_FileUtils_isFileExist);
|
||||
tolua_function(tolua_S,"purgeCachedEntries",lua_cocos2dx_FileUtils_purgeCachedEntries);
|
||||
tolua_function(tolua_S,"fullPathFromRelativeFile",lua_cocos2dx_FileUtils_fullPathFromRelativeFile);
|
||||
tolua_function(tolua_S,"getSuitableFOpen",lua_cocos2dx_FileUtils_getSuitableFOpen);
|
||||
tolua_function(tolua_S,"writeValueMapToFile",lua_cocos2dx_FileUtils_writeValueMapToFile);
|
||||
tolua_function(tolua_S,"setWritablePath",lua_cocos2dx_FileUtils_setWritablePath);
|
||||
tolua_function(tolua_S,"setPopupNotify",lua_cocos2dx_FileUtils_setPopupNotify);
|
||||
tolua_function(tolua_S,"isDirectoryExist",lua_cocos2dx_FileUtils_isDirectoryExist);
|
||||
|
|
|
@ -2064,6 +2064,9 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
support_lr2=1
|
||||
sdk=nibiru
|
|
@ -9,6 +9,8 @@
|
|||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
@ -30,6 +32,16 @@
|
|||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.nibiru.lib.controller.InfoActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
|
||||
<service android:name="com.nibiru.lib.utils.NibiruControllerService" android:process=":controller" >
|
||||
<intent-filter>
|
||||
<action android:name="com.nibiru.controller.service" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -38,7 +38,8 @@ public class AppActivity extends GameControllerActivity {
|
|||
|
||||
//Manually specify an adapter.
|
||||
this.connectController(DRIVERTYPE_NIBIRU);
|
||||
this.connectController(DRIVERTYPE_MOGA);
|
||||
//Nibiru SDK have already integrated with MOGA service.
|
||||
//this.connectController(DRIVERTYPE_MOGA);
|
||||
this.connectController(DRIVERTYPE_OUYA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon">
|
||||
|
@ -31,6 +33,16 @@
|
|||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.nibiru.lib.controller.InfoActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
|
||||
<service android:name="com.nibiru.lib.utils.NibiruControllerService" android:process=":controller" >
|
||||
<intent-filter>
|
||||
<action android:name="com.nibiru.controller.service" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
</application>
|
||||
<supports-screens android:anyDensity="true"
|
||||
android:smallScreens="true"
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
append_str=' \'
|
||||
|
||||
list_alldir()
|
||||
{
|
||||
for file in $1/*
|
||||
do
|
||||
if [ -f $file ]; then
|
||||
echo $file$append_str | grep .cpp
|
||||
fi
|
||||
|
||||
if [ -d $file ]; then
|
||||
list_alldir $file
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
list_alldir "$1"
|
||||
else
|
||||
list_alldir "."
|
||||
fi
|
|
@ -38,7 +38,8 @@ public class AppActivity extends GameControllerActivity {
|
|||
|
||||
//Manually specify an adapter.
|
||||
this.connectController(DRIVERTYPE_NIBIRU);
|
||||
this.connectController(DRIVERTYPE_MOGA);
|
||||
//Nibiru SDK have already integrated with MOGA service.
|
||||
//this.connectController(DRIVERTYPE_MOGA);
|
||||
this.connectController(DRIVERTYPE_OUYA);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue