mirror of https://github.com/axmolengine/axmol.git
Some fixes after using ndk r16 clang to build android projects (#18531)
* [android] Fixes warning in UrlAudioPlayer.cpp and CCUserDefault-android.cpp * Don't write 'using namespace std;' in header files. * Uses std::unordered_map instead of std::map for Particle3D module. * Updates external/config.json to v3-deps-141 * Continue to replace `gnustl_static` to `c++_static` for templates and test projects. * Updates CCConsole.h/.cpp to resolve the following issue on Android: jni/../../../../../cocos/base/CCConsole.cpp:321:28: required from here /Users/james/Software/android/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/utility:506:63: error: incomplete type 'std::__ndk1::is_move_assignable<cocos2d::Console::Command>' used in nested name specifier is_move_assignable<first_type>::value && ^ make: *** [obj/local/arm64-v8a/objs-debug/cocos2dx_internal_static/base/CCConsole.o] Error 1 * Fixes a memory leak while addCommand and other minor changes. * Updates tolua/cocos2dx.ini, don't bind Console::Command * Adds CC_DLL for Console::Command * Reverts tolua/cocos2dx.ini and ignore Console::[add Command addSubCommand getSubCommand delSubCommand]. * Ignores Console::getCommand.
This commit is contained in:
parent
5151dfd6f9
commit
d21af3b981
|
@ -69,7 +69,7 @@ UrlAudioPlayer::UrlAudioPlayer(SLEngineItf engineItf, SLObjectItf outputMixObjec
|
||||||
|
|
||||||
__playerContainerMutex.lock();
|
__playerContainerMutex.lock();
|
||||||
__playerContainer.push_back(this);
|
__playerContainer.push_back(this);
|
||||||
ALOGV("Current UrlAudioPlayer instance count: %d", __playerContainer.size());
|
ALOGV("Current UrlAudioPlayer instance count: %d", (int)__playerContainer.size());
|
||||||
__playerContainerMutex.unlock();
|
__playerContainerMutex.unlock();
|
||||||
|
|
||||||
_callerThreadId = callerThreadUtils->getCallerThreadId();
|
_callerThreadId = callerThreadUtils->getCallerThreadId();
|
||||||
|
|
|
@ -311,42 +311,134 @@ const std::string& Console::Utility::getPrompt()
|
||||||
// Command code
|
// Command code
|
||||||
//
|
//
|
||||||
|
|
||||||
void Console::Command::addCallback(const Callback& callback_)
|
Console::Command::Command()
|
||||||
|
: _callback(nullptr)
|
||||||
{
|
{
|
||||||
callback = callback_;
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::Command::Command(const std::string& name, const std::string& help)
|
||||||
|
: _name(name)
|
||||||
|
, _help(help)
|
||||||
|
, _callback(nullptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::Command::Command(const std::string& name, const std::string& help, const Callback& callback)
|
||||||
|
: _name(name)
|
||||||
|
, _help(help)
|
||||||
|
, _callback(callback)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::Command::Command(const Command& o)
|
||||||
|
{
|
||||||
|
*this = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::Command::Command(Command&& o)
|
||||||
|
{
|
||||||
|
*this = std::move(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::Command::~Command()
|
||||||
|
{
|
||||||
|
for (const auto& e : _subCommands)
|
||||||
|
{
|
||||||
|
delete e.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::Command& Console::Command::operator=(const Command& o)
|
||||||
|
{
|
||||||
|
if (this != &o)
|
||||||
|
{
|
||||||
|
_name = o._name;
|
||||||
|
_help = o._help;
|
||||||
|
_callback = o._callback;
|
||||||
|
|
||||||
|
for (const auto& e : _subCommands)
|
||||||
|
delete e.second;
|
||||||
|
|
||||||
|
_subCommands.clear();
|
||||||
|
for (const auto& e : o._subCommands)
|
||||||
|
{
|
||||||
|
Command* subCommand = e.second;
|
||||||
|
auto newCommand = new (std::nothrow) Command(*subCommand);
|
||||||
|
_subCommands[e.first] = newCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::Command& Console::Command::operator=(Command&& o)
|
||||||
|
{
|
||||||
|
if (this != &o)
|
||||||
|
{
|
||||||
|
_name = std::move(o._name);
|
||||||
|
_help = std::move(o._help);
|
||||||
|
_callback = std::move(o._callback);
|
||||||
|
o._callback = nullptr;
|
||||||
|
|
||||||
|
for (const auto& e : _subCommands)
|
||||||
|
delete e.second;
|
||||||
|
|
||||||
|
_subCommands.clear();
|
||||||
|
_subCommands = std::move(o._subCommands);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::Command::addCallback(const Callback& callback)
|
||||||
|
{
|
||||||
|
_callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::Command::addSubCommand(const Command& subCmd)
|
void Console::Command::addSubCommand(const Command& subCmd)
|
||||||
{
|
{
|
||||||
subCommands[subCmd.name] = subCmd;
|
auto iter = _subCommands.find(subCmd._name);
|
||||||
|
if (iter != _subCommands.end())
|
||||||
|
{
|
||||||
|
delete iter->second;
|
||||||
|
_subCommands.erase(iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
Command* cmd = new (std::nothrow) Command();
|
||||||
|
*cmd = subCmd;
|
||||||
|
_subCommands[subCmd._name] = cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Console::Command* Console::Command::getSubCommand(const std::string& subCmdName) const
|
const Console::Command* Console::Command::getSubCommand(const std::string& subCmdName) const
|
||||||
{
|
{
|
||||||
auto it = subCommands.find(subCmdName);
|
auto it = _subCommands.find(subCmdName);
|
||||||
if(it != subCommands.end()) {
|
if(it != _subCommands.end()) {
|
||||||
auto& subCmd = it->second;
|
auto& subCmd = it->second;
|
||||||
return &subCmd;
|
return subCmd;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::Command::delSubCommand(const std::string& subCmdName)
|
void Console::Command::delSubCommand(const std::string& subCmdName)
|
||||||
{
|
{
|
||||||
auto it = subCommands.find(subCmdName);
|
auto iter = _subCommands.find(subCmdName);
|
||||||
if(it != subCommands.end()) {
|
if (iter != _subCommands.end()) {
|
||||||
subCommands.erase(it);
|
delete iter->second;
|
||||||
|
_subCommands.erase(iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::Command::commandHelp(int fd, const std::string& /*args*/)
|
void Console::Command::commandHelp(int fd, const std::string& /*args*/)
|
||||||
{
|
{
|
||||||
if (! help.empty()) {
|
if (! _help.empty()) {
|
||||||
Console::Utility::mydprintf(fd, "%s\n", help.c_str());
|
Console::Utility::mydprintf(fd, "%s\n", _help.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! subCommands.empty()) {
|
if (! _subCommands.empty()) {
|
||||||
sendHelp(fd, subCommands, "");
|
sendHelp(fd, _subCommands, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,18 +458,18 @@ void Console::Command::commandGeneric(int fd, const std::string& args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// find sub command
|
// find sub command
|
||||||
auto it = subCommands.find(key);
|
auto it = _subCommands.find(key);
|
||||||
if (it != subCommands.end()) {
|
if (it != _subCommands.end()) {
|
||||||
auto subCmd = it->second;
|
auto subCmd = it->second;
|
||||||
if (subCmd.callback) {
|
if (subCmd->_callback) {
|
||||||
subCmd.callback(fd, args);
|
subCmd->_callback(fd, args);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// can not find
|
// can not find
|
||||||
if (callback) {
|
if (_callback) {
|
||||||
callback(fd, args);
|
_callback(fd, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,6 +505,9 @@ Console::Console()
|
||||||
Console::~Console()
|
Console::~Console()
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
|
for (auto& e : _commands)
|
||||||
|
delete e.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Console::listenOnTCP(int port)
|
bool Console::listenOnTCP(int port)
|
||||||
|
@ -530,21 +625,29 @@ void Console::stop()
|
||||||
|
|
||||||
void Console::addCommand(const Command& cmd)
|
void Console::addCommand(const Command& cmd)
|
||||||
{
|
{
|
||||||
_commands[cmd.name] = cmd;
|
Command* newCommand = new (std::nothrow) Command(cmd);
|
||||||
|
auto iter = _commands.find(cmd.getName());
|
||||||
|
if (iter != _commands.end())
|
||||||
|
{
|
||||||
|
delete iter->second;
|
||||||
|
_commands.erase(iter);
|
||||||
|
}
|
||||||
|
_commands[cmd.getName()] = newCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::addSubCommand(const std::string& cmdName, const Command& subCmd)
|
void Console::addSubCommand(const std::string& cmdName, const Command& subCmd)
|
||||||
{
|
{
|
||||||
auto it = _commands.find(cmdName);
|
auto it = _commands.find(cmdName);
|
||||||
if(it != _commands.end()) {
|
if (it != _commands.end())
|
||||||
|
{
|
||||||
auto& cmd = it->second;
|
auto& cmd = it->second;
|
||||||
addSubCommand(cmd, subCmd);
|
addSubCommand(*cmd, subCmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::addSubCommand(Command& cmd, const Command& subCmd)
|
void Console::addSubCommand(Command& cmd, const Command& subCmd)
|
||||||
{
|
{
|
||||||
cmd.subCommands[subCmd.name] = subCmd;
|
cmd.addSubCommand(subCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Console::Command* Console::getCommand(const std::string& cmdName)
|
const Console::Command* Console::getCommand(const std::string& cmdName)
|
||||||
|
@ -552,7 +655,7 @@ const Console::Command* Console::getCommand(const std::string& cmdName)
|
||||||
auto it = _commands.find(cmdName);
|
auto it = _commands.find(cmdName);
|
||||||
if(it != _commands.end()) {
|
if(it != _commands.end()) {
|
||||||
auto& cmd = it->second;
|
auto& cmd = it->second;
|
||||||
return &cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -562,7 +665,7 @@ const Console::Command* Console::getSubCommand(const std::string& cmdName, const
|
||||||
auto it = _commands.find(cmdName);
|
auto it = _commands.find(cmdName);
|
||||||
if(it != _commands.end()) {
|
if(it != _commands.end()) {
|
||||||
auto& cmd = it->second;
|
auto& cmd = it->second;
|
||||||
return getSubCommand(cmd, subCmdName);
|
return getSubCommand(*cmd, subCmdName);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -576,6 +679,7 @@ void Console::delCommand(const std::string& cmdName)
|
||||||
{
|
{
|
||||||
auto it = _commands.find(cmdName);
|
auto it = _commands.find(cmdName);
|
||||||
if(it != _commands.end()) {
|
if(it != _commands.end()) {
|
||||||
|
delete it->second;
|
||||||
_commands.erase(it);
|
_commands.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,7 +689,7 @@ void Console::delSubCommand(const std::string& cmdName, const std::string& subCm
|
||||||
auto it = _commands.find(cmdName);
|
auto it = _commands.find(cmdName);
|
||||||
if(it != _commands.end()) {
|
if(it != _commands.end()) {
|
||||||
auto& cmd = it->second;
|
auto& cmd = it->second;
|
||||||
delSubCommand(cmd, subCmdName);
|
delSubCommand(*cmd, subCmdName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,7 +959,7 @@ bool Console::parseCommand(int fd)
|
||||||
|
|
||||||
}
|
}
|
||||||
auto cmd = it->second;
|
auto cmd = it->second;
|
||||||
cmd.commandGeneric(fd, args2);
|
cmd->commandGeneric(fd, args2);
|
||||||
}else if(strcmp(buf, "\r\n") != 0) {
|
}else if(strcmp(buf, "\r\n") != 0) {
|
||||||
const char err[] = "Unknown command. Type 'help' for options\n";
|
const char err[] = "Unknown command. Type 'help' for options\n";
|
||||||
Console::Utility::sendToConsole(fd, err, strlen(err));
|
Console::Utility::sendToConsole(fd, err, strlen(err));
|
||||||
|
@ -1480,21 +1584,21 @@ void Console::printFileUtils(int fd)
|
||||||
Console::Utility::sendPrompt(fd);
|
Console::Utility::sendPrompt(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::sendHelp(int fd, const std::map<std::string, Command>& commands, const char* msg)
|
void Console::sendHelp(int fd, const std::unordered_map<std::string, Command*>& commands, const char* msg)
|
||||||
{
|
{
|
||||||
Console::Utility::sendToConsole(fd, msg, strlen(msg));
|
Console::Utility::sendToConsole(fd, msg, strlen(msg));
|
||||||
for(auto& it : commands)
|
for(auto& it : commands)
|
||||||
{
|
{
|
||||||
auto command = it.second;
|
auto command = it.second;
|
||||||
if (command.help.empty()) continue;
|
if (command->getHelp().empty()) continue;
|
||||||
|
|
||||||
Console::Utility::mydprintf(fd, "\t%s", command.name.c_str());
|
Console::Utility::mydprintf(fd, "\t%s", command->getName().c_str());
|
||||||
ssize_t tabs = strlen(command.name.c_str()) / 8;
|
ssize_t tabs = strlen(command->getName().c_str()) / 8;
|
||||||
tabs = 3 - tabs;
|
tabs = 3 - tabs;
|
||||||
for(int j=0;j<tabs;j++){
|
for(int j=0;j<tabs;j++){
|
||||||
Console::Utility::mydprintf(fd, "\t");
|
Console::Utility::mydprintf(fd, "\t");
|
||||||
}
|
}
|
||||||
Console::Utility::mydprintf(fd,"%s\n", command.help.c_str());
|
Console::Utility::mydprintf(fd,"%s\n", command->getHelp().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ typedef SSIZE_T ssize_t;
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <unordered_map>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -110,17 +110,29 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Command Struct */
|
/** Command Struct */
|
||||||
struct Command {
|
class CC_DLL Command
|
||||||
|
{
|
||||||
|
public:
|
||||||
using Callback = std::function<void(int fd, const std::string& args)>;
|
using Callback = std::function<void(int fd, const std::string& args)>;
|
||||||
std::string name;
|
|
||||||
std::string help;
|
|
||||||
Callback callback{nullptr};
|
|
||||||
std::map<std::string, Command> subCommands;
|
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
Command() {}
|
Command();
|
||||||
Command(std::string name_, std::string help_) : name(name_), help(help_) {};
|
Command(const std::string& name, const std::string& help);
|
||||||
Command(std::string name_, std::string help_, Callback callback_) : name(name_), help(help_), callback(callback_) {};
|
Command(const std::string& name, const std::string& help, const Callback& callback);
|
||||||
|
|
||||||
|
/** Copy constructor */
|
||||||
|
Command(const Command& o);
|
||||||
|
|
||||||
|
/** Move constructor */
|
||||||
|
Command(Command&& o);
|
||||||
|
|
||||||
|
/** Destructor */
|
||||||
|
~Command();
|
||||||
|
|
||||||
|
/** Copy operator */
|
||||||
|
Command& operator=(const Command& o);
|
||||||
|
|
||||||
|
/** Move operator */
|
||||||
|
Command& operator=(Command&& o);
|
||||||
|
|
||||||
/** add callback */
|
/** add callback */
|
||||||
void addCallback(const Callback& callback);
|
void addCallback(const Callback& callback);
|
||||||
|
@ -139,6 +151,19 @@ public:
|
||||||
|
|
||||||
/** generic command handler */
|
/** generic command handler */
|
||||||
void commandGeneric(int fd, const std::string& args);
|
void commandGeneric(int fd, const std::string& args);
|
||||||
|
|
||||||
|
/** Gets the name of the current command */
|
||||||
|
const std::string& getName() const { return _name; }
|
||||||
|
|
||||||
|
/** Gets the help information of the current command */
|
||||||
|
const std::string& getHelp() const { return _help; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _name;
|
||||||
|
std::string _help;
|
||||||
|
|
||||||
|
Callback _callback;
|
||||||
|
std::unordered_map<std::string, Command*> _subCommands;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
|
@ -252,7 +277,7 @@ protected:
|
||||||
bool _endThread;
|
bool _endThread;
|
||||||
bool _isIpv6Server;
|
bool _isIpv6Server;
|
||||||
|
|
||||||
std::map<std::string, Command> _commands;
|
std::unordered_map<std::string, Command*> _commands;
|
||||||
|
|
||||||
// strings generated by cocos2d sent to the remote console
|
// strings generated by cocos2d sent to the remote console
|
||||||
bool _sendDebugStrings;
|
bool _sendDebugStrings;
|
||||||
|
@ -271,7 +296,7 @@ private:
|
||||||
void printFileUtils(int fd);
|
void printFileUtils(int fd);
|
||||||
|
|
||||||
/** send help message to console */
|
/** send help message to console */
|
||||||
static void sendHelp(int fd, const std::map<std::string, Command>& commands, const char* msg);
|
static void sendHelp(int fd, const std::unordered_map<std::string, Command*>& commands, const char* msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -389,7 +389,7 @@ Data UserDefault::getDataForKey(const char* pKey, const Data& defaultValue)
|
||||||
if (encodedDefaultData)
|
if (encodedDefaultData)
|
||||||
free(encodedDefaultData);
|
free(encodedDefaultData);
|
||||||
|
|
||||||
CCLOG("ENCODED STRING: --%s--%d", encodedStr.c_str(), encodedStr.length());
|
CCLOG("ENCODED STRING: --%s--%d", encodedStr.c_str(), (int)encodedStr.length());
|
||||||
|
|
||||||
unsigned char * decodedData = NULL;
|
unsigned char * decodedData = NULL;
|
||||||
int decodedDataLen = base64Decode((unsigned char*)encodedStr.c_str(), (unsigned int)encodedStr.length(), &decodedData);
|
int decodedDataLen = base64Decode((unsigned char*)encodedStr.c_str(), (unsigned int)encodedStr.length(), &decodedData);
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct CC_DLL Particle3D
|
||||||
float depth;//Own depth
|
float depth;//Own depth
|
||||||
|
|
||||||
//user defined property
|
//user defined property
|
||||||
std::map<std::string, void*> userDefs;
|
std::unordered_map<std::string, void*> userDefs;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
#include "extensions/Particle3D/PU/CCPUVelocityMatchingAffectorTranslator.h"
|
#include "extensions/Particle3D/PU/CCPUVelocityMatchingAffectorTranslator.h"
|
||||||
#include "extensions/Particle3D/PU/CCPUVortexAffectorTranslator.h"
|
#include "extensions/Particle3D/PU/CCPUVortexAffectorTranslator.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class PUAffectorManager
|
class PUAffectorManager
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "extensions/Particle3D/PU/CCPUBehaviour.h"
|
#include "extensions/Particle3D/PU/CCPUBehaviour.h"
|
||||||
#include "extensions/Particle3D/PU/CCPUSlaveBehaviourTranslator.h"
|
#include "extensions/Particle3D/PU/CCPUSlaveBehaviourTranslator.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class PUBehaviourManager
|
class PUBehaviourManager
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "extensions/Particle3D/PU/CCPUAffector.h"
|
#include "extensions/Particle3D/PU/CCPUAffector.h"
|
||||||
#include "base/ccTypes.h"
|
#include "base/ccTypes.h"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "extensions/Particle3D/PU/CCPUSlaveEmitterTranslator.h"
|
#include "extensions/Particle3D/PU/CCPUSlaveEmitterTranslator.h"
|
||||||
#include "extensions/Particle3D/PU/CCPUSphereSurfaceEmitterTranslator.h"
|
#include "extensions/Particle3D/PU/CCPUSphereSurfaceEmitterTranslator.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class PUEmitterManager
|
class PUEmitterManager
|
||||||
|
|
|
@ -215,7 +215,7 @@ class CC_DLL PUParticleSystem3D : public ParticleSystem3D
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef std::map<std::string, ParticlePool> ParticlePoolMap;
|
typedef std::unordered_map<std::string, ParticlePool> ParticlePoolMap;
|
||||||
|
|
||||||
static const float DEFAULT_WIDTH;
|
static const float DEFAULT_WIDTH;
|
||||||
static const float DEFAULT_HEIGHT;
|
static const float DEFAULT_HEIGHT;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "math/CCMath.h"
|
#include "math/CCMath.h"
|
||||||
#include "extensions/Particle3D/PU/CCPUBillboardChain.h"
|
#include "extensions/Particle3D/PU/CCPUBillboardChain.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -163,7 +164,7 @@ protected:
|
||||||
|
|
||||||
// fast lookup node->chain index
|
// fast lookup node->chain index
|
||||||
// we use positional map too because that can be useful
|
// we use positional map too because that can be useful
|
||||||
typedef std::map<const Node*, size_t> NodeToChainSegmentMap;
|
typedef std::unordered_map<const Node*, size_t> NodeToChainSegmentMap;
|
||||||
NodeToChainSegmentMap _nodeToSegMap;
|
NodeToChainSegmentMap _nodeToSegMap;
|
||||||
|
|
||||||
/// Total length of trail in world units
|
/// Total length of trail in world units
|
||||||
|
|
|
@ -80,7 +80,7 @@ void PUObjectAbstractNode::setVariable(const std::string &inName, const std::str
|
||||||
|
|
||||||
std::pair<bool,std::string> PUObjectAbstractNode::getVariable(const std::string &inName) const
|
std::pair<bool,std::string> PUObjectAbstractNode::getVariable(const std::string &inName) const
|
||||||
{
|
{
|
||||||
std::map<std::string,std::string>::const_iterator i = _env.find(inName);
|
std::unordered_map<std::string,std::string>::const_iterator i = _env.find(inName);
|
||||||
if(i != _env.end())
|
if(i != _env.end())
|
||||||
return std::make_pair(true, i->second);
|
return std::make_pair(true, i->second);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ std::pair<bool,std::string> PUObjectAbstractNode::getVariable(const std::string
|
||||||
return std::make_pair(false, "");
|
return std::make_pair(false, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
const map<std::string,std::string> &PUObjectAbstractNode::getVariables() const
|
const std::unordered_map<std::string,std::string> &PUObjectAbstractNode::getVariables() const
|
||||||
{
|
{
|
||||||
return _env;
|
return _env;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ void PUScriptCompiler::visit(PUConcreteNode *node)
|
||||||
impl->file = node->file;
|
impl->file = node->file;
|
||||||
impl->abstract = false;
|
impl->abstract = false;
|
||||||
|
|
||||||
list<PUConcreteNode*> temp;
|
std::list<PUConcreteNode*> temp;
|
||||||
temp.push_back(node);
|
temp.push_back(node);
|
||||||
for(const auto& child : node->children)
|
for(const auto& child : node->children)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#include "base/CCRef.h"
|
#include "base/CCRef.h"
|
||||||
#include "extensions/Particle3D/PU/CCPUScriptParser.h"
|
#include "extensions/Particle3D/PU/CCPUScriptParser.h"
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
/** This enum holds the types of the possible abstract nodes */
|
/** This enum holds the types of the possible abstract nodes */
|
||||||
|
@ -74,7 +77,7 @@ public:
|
||||||
class CC_DLL PUObjectAbstractNode : public PUAbstractNode
|
class CC_DLL PUObjectAbstractNode : public PUAbstractNode
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::map<std::string,std::string> _env;
|
std::unordered_map<std::string,std::string> _env;
|
||||||
public:
|
public:
|
||||||
std::string name, cls;
|
std::string name, cls;
|
||||||
std::vector<std::string> bases;
|
std::vector<std::string> bases;
|
||||||
|
@ -93,7 +96,7 @@ public:
|
||||||
void addVariable(const std::string &name);
|
void addVariable(const std::string &name);
|
||||||
void setVariable(const std::string &name, const std::string &value);
|
void setVariable(const std::string &name, const std::string &value);
|
||||||
std::pair<bool,std::string> getVariable(const std::string &name) const;
|
std::pair<bool,std::string> getVariable(const std::string &name) const;
|
||||||
const std::map<std::string,std::string> &getVariables() const;
|
const std::unordered_map<std::string,std::string> &getVariables() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** This abstract node represents a script property */
|
/** This abstract node represents a script property */
|
||||||
|
@ -134,7 +137,7 @@ private:
|
||||||
bool isNameExcluded(const std::string &cls, PUAbstractNode *parent);
|
bool isNameExcluded(const std::string &cls, PUAbstractNode *parent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::map<std::string,unsigned int> IdMap;
|
typedef std::unordered_map<std::string,unsigned int> IdMap;
|
||||||
|
|
||||||
static PUScriptCompiler* Instance();
|
static PUScriptCompiler* Instance();
|
||||||
|
|
||||||
|
@ -144,7 +147,7 @@ public:
|
||||||
|
|
||||||
void convertToAST(const PUConcreteNodeList &nodes,PUAbstractNodeList &aNodes);
|
void convertToAST(const PUConcreteNodeList &nodes,PUAbstractNodeList &aNodes);
|
||||||
|
|
||||||
std::map<std::string,std::string> env;
|
std::unordered_map<std::string,std::string> env;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PUScriptCompiler();
|
PUScriptCompiler();
|
||||||
|
@ -154,7 +157,7 @@ private:
|
||||||
void visit(PUConcreteNode *node);
|
void visit(PUConcreteNode *node);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::map<std::string, PUAbstractNodeList> _compiledScripts;
|
std::unordered_map<std::string, PUAbstractNodeList> _compiledScripts;
|
||||||
PUAbstractNode *_current;
|
PUAbstractNode *_current;
|
||||||
PUAbstractNodeList *_nodes;
|
PUAbstractNodeList *_nodes;
|
||||||
PUParticleSystem3D *_PUParticleSystem3D;
|
PUParticleSystem3D *_PUParticleSystem3D;
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "extensions/Particle3D/PU/CCPUObserverTranslator.h"
|
#include "extensions/Particle3D/PU/CCPUObserverTranslator.h"
|
||||||
#include "extensions/Particle3D/PU/CCPUBehaviourTranslator.h"
|
#include "extensions/Particle3D/PU/CCPUBehaviourTranslator.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
class PUMaterialCache;
|
class PUMaterialCache;
|
||||||
class PUTranslateManager
|
class PUTranslateManager
|
||||||
|
|
|
@ -322,7 +322,7 @@ NS_CC_BEGIN
|
||||||
// @remarks
|
// @remarks
|
||||||
// Use objectspace for the vectors and only transform as soon as a particle is emitted.
|
// Use objectspace for the vectors and only transform as soon as a particle is emitted.
|
||||||
// */
|
// */
|
||||||
// list<Vec3>::iterator iterator = mSpawnPositionList.end();
|
// std::list<Vec3>::iterator iterator = mSpawnPositionList.end();
|
||||||
// Vec3 start = startVector;
|
// Vec3 start = startVector;
|
||||||
// if (lengthIncrement > 0.0f)
|
// if (lengthIncrement > 0.0f)
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "v3-deps-139",
|
"version": "v3-deps-141",
|
||||||
"zip_file_size": "136974507",
|
"zip_file_size": "136974507",
|
||||||
"repo_name": "cocos2d-x-3rd-party-libs-bin",
|
"repo_name": "cocos2d-x-3rd-party-libs-bin",
|
||||||
"repo_parent": "https://github.com/cocos2d/",
|
"repo_parent": "https://github.com/cocos2d/",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
APP_STL := gnustl_static
|
APP_STL := c++_static
|
||||||
|
|
||||||
# Uncomment this line to compile to armeabi-v7a, your application will run faster but support less devices
|
# Uncomment this line to compile to armeabi-v7a, your application will run faster but support less devices
|
||||||
#APP_ABI := armeabi-v7a
|
#APP_ABI := armeabi-v7a
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
APP_STL := gnustl_static
|
APP_STL := c++_static
|
||||||
|
|
||||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -Wno-extern-c-compat
|
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -Wno-extern-c-compat
|
||||||
APP_LDFLAGS := -latomic
|
APP_LDFLAGS := -latomic
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
APP_STL := gnustl_static
|
APP_STL := c++_static
|
||||||
|
|
||||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
|
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
|
||||||
APP_LDFLAGS := -latomic
|
APP_LDFLAGS := -latomic
|
||||||
|
|
|
@ -114,7 +114,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
|
||||||
TMXTiledMap::[getPropertiesForGID],
|
TMXTiledMap::[getPropertiesForGID],
|
||||||
EventCustom::[getUserData setUserData],
|
EventCustom::[getUserData setUserData],
|
||||||
Component::[serialize],
|
Component::[serialize],
|
||||||
Console::[addCommand],
|
Console::[addCommand addSubCommand getSubCommand delSubCommand getCommand],
|
||||||
ParallaxNode::[(s|g)etParallaxArray],
|
ParallaxNode::[(s|g)etParallaxArray],
|
||||||
TileMapAtlas::[(s|g)etTGAInfo],
|
TileMapAtlas::[(s|g)etTGAInfo],
|
||||||
GLProgramState::[setVertexAttribCallback setUniformCallback setVertexAttribPointer],
|
GLProgramState::[setVertexAttribCallback setUniformCallback setVertexAttribPointer],
|
||||||
|
|
Loading…
Reference in New Issue