mirror of https://github.com/axmolengine/axmol.git
commit
4d0adf4435
|
@ -431,7 +431,7 @@ void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimme
|
|||
void Sprite::debugDraw(bool on)
|
||||
{
|
||||
if (_batchNode) {
|
||||
log("Sprite doesn't support denbug draw when using SpriteBatchNode");
|
||||
log("Sprite doesn't support debug draw when using SpriteBatchNode");
|
||||
return ;
|
||||
}
|
||||
DrawNode* draw = getChildByName<DrawNode*>("debugDraw");
|
||||
|
|
|
@ -36,8 +36,12 @@ NS_CC_BEGIN
|
|||
|
||||
int Device::getDPI()
|
||||
{
|
||||
//TODO: return correct DPI
|
||||
return 160;
|
||||
NSScreen *screen = [NSScreen mainScreen];
|
||||
NSDictionary *description = [screen deviceDescription];
|
||||
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
|
||||
CGSize displayPhysicalSize = CGDisplayScreenSize([[description objectForKey:@"NSScreenNumber"] unsignedIntValue]);
|
||||
|
||||
return ((displayPixelSize.width / displayPhysicalSize.width) * 25.4f);
|
||||
}
|
||||
|
||||
void Device::setAccelerometerEnabled(bool isEnabled)
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
name: "Rotation",
|
||||
handle: function(options){
|
||||
var frame = new ccs.RotationFrame();
|
||||
var rotation = options["Rotation"];
|
||||
var rotation = options["Rotation"] || options["Value"] || 0;
|
||||
frame.setRotation(rotation);
|
||||
return frame;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,9 @@
|
|||
var visible = getParam(json["VisibleForFrame"], true);
|
||||
node.setVisible(visible);
|
||||
|
||||
setContentSize(node, json["Size"]);
|
||||
var size = json["Size"];
|
||||
if(size)
|
||||
setContentSize(node, size);
|
||||
|
||||
if (json["Alpha"] != null)
|
||||
node.setOpacity(json["Alpha"]);
|
||||
|
@ -118,9 +120,7 @@
|
|||
extensionData.setCustomProperty(customProperty);
|
||||
extensionData.setActionTag(actionTag);
|
||||
if (node.getComponent("ComExtensionData"))
|
||||
{
|
||||
node.removeComponent("ComExtensionData");
|
||||
}
|
||||
node.addComponent(extensionData);
|
||||
|
||||
node.setCascadeColorEnabled(true);
|
||||
|
@ -294,9 +294,7 @@
|
|||
extensionData.setCustomProperty(customProperty);
|
||||
extensionData.setActionTag(actionTag);
|
||||
if (widget.getComponent("ComExtensionData"))
|
||||
{
|
||||
widget.removeComponent("ComExtensionData");
|
||||
}
|
||||
widget.addComponent(extensionData);
|
||||
|
||||
var rotationSkewX = json["RotationSkewX"];
|
||||
|
|
|
@ -81,7 +81,7 @@ AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::stri
|
|||
_fileUtils = FileUtils::getInstance();
|
||||
_updateState = State::UNCHECKED;
|
||||
|
||||
_downloader = std::make_shared<Downloader>();
|
||||
_downloader = std::shared_ptr<Downloader>(new Downloader);
|
||||
_downloader->setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
|
||||
_downloader->_onError = std::bind(&AssetsManagerEx::onError, this, std::placeholders::_1);
|
||||
_downloader->_onProgress = std::bind(&AssetsManagerEx::onProgress,
|
||||
|
|
|
@ -392,6 +392,7 @@ void Downloader::downloadToBufferSync(const std::string &srcUrl, unsigned char *
|
|||
void Downloader::downloadToBuffer(const std::string &srcUrl, const std::string &customId, const StreamData &buffer, const ProgressData &data)
|
||||
{
|
||||
std::weak_ptr<Downloader> ptr = shared_from_this();
|
||||
std::shared_ptr<Downloader> shared = ptr.lock();
|
||||
CURL *curl = curl_easy_init();
|
||||
if (!curl)
|
||||
{
|
||||
|
@ -463,6 +464,7 @@ void Downloader::downloadSync(const std::string &srcUrl, const std::string &stor
|
|||
void Downloader::download(const std::string &srcUrl, const std::string &customId, const FileDescriptor &fDesc, const ProgressData &data)
|
||||
{
|
||||
std::weak_ptr<Downloader> ptr = shared_from_this();
|
||||
std::shared_ptr<Downloader> shared = ptr.lock();
|
||||
CURL *curl = curl_easy_init();
|
||||
if (!curl)
|
||||
{
|
||||
|
@ -524,6 +526,7 @@ void Downloader::batchDownloadSync(const DownloadUnits &units, const std::string
|
|||
{
|
||||
// Make sure downloader won't be released
|
||||
std::weak_ptr<Downloader> ptr = shared_from_this();
|
||||
std::shared_ptr<Downloader> shared = ptr.lock();
|
||||
|
||||
if (units.size() != 0)
|
||||
{
|
||||
|
|
|
@ -152,6 +152,9 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
#endif
|
||||
sc->start();
|
||||
sc->runScript("script/jsb_boot.js");
|
||||
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
|
||||
sc->enableDebugger();
|
||||
#endif
|
||||
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
ScriptingCore::getInstance()->runScript("main.js");
|
||||
|
|
|
@ -68,13 +68,16 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
jsRuntime->startWithDebugger();
|
||||
}
|
||||
#else
|
||||
js_module_register();
|
||||
ScriptingCore* sc = ScriptingCore::getInstance();
|
||||
sc->start();
|
||||
sc->runScript("script/jsb_boot.js");
|
||||
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
ScriptingCore::getInstance()->runScript("main.js");
|
||||
js_module_register();
|
||||
ScriptingCore* sc = ScriptingCore::getInstance();
|
||||
sc->start();
|
||||
sc->runScript("script/jsb_boot.js");
|
||||
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
|
||||
sc->enableDebugger();
|
||||
#endif
|
||||
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
ScriptingCore::getInstance()->runScript("main.js");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f3768083be951e019a2983703847e05b2e284e7d
|
||||
Subproject commit 99ea6cb519c1b11567985684d0d08d2205ae5607
|
|
@ -3,6 +3,7 @@
|
|||
#include "ConfigParser.h"
|
||||
#include "cocostudio/CocoStudio.h"
|
||||
#include "ui/UIHelper.h"
|
||||
#include "tinyxml2/tinyxml2.h"
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
|
@ -58,6 +59,34 @@ void RuntimeCCSImpl::loadCSDProject(const std::string& file)
|
|||
node->setContentSize(frameSize);
|
||||
ui::Helper::doLayout(node);
|
||||
|
||||
std::string inFullpath = FileUtils::getInstance()->fullPathForFilename(file).c_str();
|
||||
std::string content = FileUtils::getInstance()->getStringFromFile(file);
|
||||
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
|
||||
document->Parse(content.c_str());
|
||||
const tinyxml2::XMLElement* rootElement = document->RootElement();
|
||||
const tinyxml2::XMLElement* element = rootElement->FirstChildElement();
|
||||
|
||||
if(element)
|
||||
{
|
||||
if (strcmp("PropertyGroup", element->Name()) == 0)
|
||||
{
|
||||
const tinyxml2::XMLAttribute* attribute = element->FirstAttribute();
|
||||
if (attribute)
|
||||
{
|
||||
std::string csdType = attribute->Name();
|
||||
if (csdType.compare("Type") == 0)
|
||||
{
|
||||
std::string csdValue = attribute->Value();
|
||||
if (csdValue.compare("Skeleton") == 0 || csdValue.compare("Node") == 0)
|
||||
{
|
||||
node->setPosition(cocos2d::Vec2(frameSize.width / 2.0f, frameSize.height / 2.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Director::getInstance()->getRunningScene())
|
||||
{
|
||||
auto scene = Scene::create();
|
||||
|
|
Loading…
Reference in New Issue