2022-06-24 16:23:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* Copyright(c) Live2D Inc. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by the Live2D Open Software license
|
|
|
|
|
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "LAppPal.hpp"
|
|
|
|
|
#include <Model/CubismMoc.hpp>
|
|
|
|
|
#include "cocos2d.h"
|
|
|
|
|
|
|
|
|
|
using namespace Csm;
|
2022-07-11 17:50:21 +08:00
|
|
|
|
USING_NS_AX;
|
2022-06-24 16:23:26 +08:00
|
|
|
|
|
|
|
|
|
csmByte* LAppPal::LoadFileAsBytes(const csmChar* filePath, csmSizeInt* outSize)
|
|
|
|
|
{
|
|
|
|
|
ssize_t size = 0;
|
|
|
|
|
csmByte* buf = FileUtils::getInstance()->getDataFromFile(filePath).takeBuffer(&size);
|
|
|
|
|
*outSize = static_cast<csmSizeInt>(size);
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LAppPal::ReleaseBytes(csmByte* byteData)
|
|
|
|
|
{
|
|
|
|
|
free(byteData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
csmFloat32 LAppPal::GetDeltaTime()
|
|
|
|
|
{
|
|
|
|
|
if(Director::getInstance() != NULL)
|
|
|
|
|
{
|
|
|
|
|
return Director::getInstance()->getDeltaTime();
|
|
|
|
|
}
|
|
|
|
|
return 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LAppPal::PrintLog(const csmChar* format, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list args;
|
|
|
|
|
csmChar buf[256];
|
|
|
|
|
va_start(args, format);
|
|
|
|
|
vsnprintf(buf, sizeof(buf), format, args); // 標準出力でレンダリング
|
2024-03-07 08:47:00 +08:00
|
|
|
|
ax::print("%s", buf); // cocos2dのログ関数で出力
|
2022-06-24 16:23:26 +08:00
|
|
|
|
va_end(args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LAppPal::PrintMessage(const csmChar* message)
|
|
|
|
|
{
|
|
|
|
|
PrintLog("%s", message);
|
|
|
|
|
}
|