mirror of https://github.com/axmolengine/axmol.git
Fix compile errors in c++17
This commit is contained in:
parent
b65b2e1892
commit
8bf4817ff7
|
@ -208,7 +208,7 @@ void GridBase::beforeDraw()
|
|||
renderer->addCommand(groupCommand);
|
||||
renderer->pushGroup(groupCommand->getRenderQueueID());
|
||||
|
||||
auto beforeDrawCommandFunc = [=, this]() -> void {
|
||||
auto beforeDrawCommandFunc = [director, renderer, this]() -> void {
|
||||
_directorProjection = director->getProjection();
|
||||
set2DProjection();
|
||||
Vec2 size = director->getWinSizeInPixels();
|
||||
|
@ -238,7 +238,7 @@ void GridBase::afterDraw(ax::Node* /*target*/)
|
|||
// renderer->setViewPort(vp.x, vp.y, vp.w, vp.h);
|
||||
// renderer->setRenderTarget(_oldRenderTarget);
|
||||
//};
|
||||
renderer->addCallbackCommand([=, this]() -> void {
|
||||
renderer->addCallbackCommand([director, renderer, this]() -> void {
|
||||
director->setProjection(_directorProjection);
|
||||
const auto& vp = Camera::getDefaultViewport();
|
||||
renderer->setViewPort(vp.x, vp.y, vp.w, vp.h);
|
||||
|
@ -263,12 +263,12 @@ void GridBase::afterDraw(ax::Node* /*target*/)
|
|||
// TODO: Director::getInstance()->setProjection(Director::getInstance()->getProjection());
|
||||
// TODO: Director::getInstance()->applyOrientation();
|
||||
//_beforeBlitCommand.func = [=]() -> void { beforeBlit(); };
|
||||
renderer->addCallbackCommand([=, this]() -> void { beforeBlit(); });
|
||||
renderer->addCallbackCommand([this]() -> void { beforeBlit(); });
|
||||
|
||||
blit();
|
||||
|
||||
//_afterBlitCommand.func = [=]() -> void { afterBlit(); };
|
||||
renderer->addCallbackCommand([=, this]() -> void { afterBlit(); });
|
||||
renderer->addCallbackCommand([this]() -> void { afterBlit(); });
|
||||
}
|
||||
|
||||
// implementation of Grid3D
|
||||
|
|
|
@ -654,7 +654,7 @@ void RenderTexture::clearColorAttachment()
|
|||
auto renderer = _director->getRenderer();
|
||||
auto beforeClearAttachmentCommand = renderer->nextCallbackCommand();
|
||||
beforeClearAttachmentCommand->init(0);
|
||||
beforeClearAttachmentCommand->func = [=, this]() -> void {
|
||||
beforeClearAttachmentCommand->func = [this, renderer]() -> void {
|
||||
_oldRenderTarget = renderer->getRenderTarget();
|
||||
renderer->setRenderTarget(_renderTarget);
|
||||
};
|
||||
|
@ -666,7 +666,7 @@ void RenderTexture::clearColorAttachment()
|
|||
// auto renderer = _director->getRenderer();
|
||||
auto afterClearAttachmentCommand = renderer->nextCallbackCommand();
|
||||
afterClearAttachmentCommand->init(0);
|
||||
afterClearAttachmentCommand->func = [=, this]() -> void { renderer->setRenderTarget(_oldRenderTarget); };
|
||||
afterClearAttachmentCommand->func = [this, renderer]() -> void { renderer->setRenderTarget(_oldRenderTarget); };
|
||||
renderer->addCommand(afterClearAttachmentCommand);
|
||||
}
|
||||
|
||||
|
|
|
@ -859,7 +859,7 @@ std::string LoadObj(std::vector<shape_t>& shapes,
|
|||
char namebuf[TINYOBJ_SSCANF_BUFFER_SIZE];
|
||||
token += 7;
|
||||
#ifdef _MSC_VER
|
||||
sscanf_s(token, "%s", namebuf, _countof(namebuf));
|
||||
sscanf_s(token, "%s", namebuf, (unsigned int)_countof(namebuf));
|
||||
#else
|
||||
sscanf(token, "%s", namebuf);
|
||||
#endif
|
||||
|
|
|
@ -517,14 +517,14 @@ bool Console::listenOnTCP(int port)
|
|||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
WSADATA wsaData;
|
||||
n = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||
#endif
|
||||
|
||||
if ((n = getaddrinfo(nullptr, serv, &hints, &res)) != 0)
|
||||
{
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
fprintf(stderr, "net_listen error for %s: %s", serv, gai_strerrorA(n));
|
||||
#else
|
||||
fprintf(stderr, "net_listen error for %s: %s", serv, gai_strerror(n));
|
||||
|
@ -561,7 +561,7 @@ bool Console::listenOnTCP(int port)
|
|||
break; /* success */
|
||||
|
||||
/* bind error, close and try next one */
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
closesocket(listenfd);
|
||||
#else
|
||||
close(listenfd);
|
||||
|
@ -784,7 +784,7 @@ void Console::loop()
|
|||
// receive a SIGPIPE, which will cause linux system shutdown the sending process.
|
||||
// Add this ioctl code to check if the socket has been closed by peer.
|
||||
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
u_long n = 0;
|
||||
ioctlsocket(fd, FIONREAD, &n);
|
||||
#else
|
||||
|
@ -841,14 +841,14 @@ void Console::loop()
|
|||
// clean up: ignore stdin, stdout and stderr
|
||||
for (const auto& fd : _fds)
|
||||
{
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
closesocket(fd);
|
||||
#else
|
||||
close(fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
closesocket(_listenfd);
|
||||
WSACleanup();
|
||||
#else
|
||||
|
@ -1244,7 +1244,7 @@ void Console::commandExit(socket_native_type fd, std::string_view /*args*/)
|
|||
{
|
||||
FD_CLR(fd, &_read_set);
|
||||
_fds.erase(std::remove(_fds.begin(), _fds.end(), fd), _fds.end());
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
closesocket(fd);
|
||||
#else
|
||||
close(fd);
|
||||
|
@ -1421,7 +1421,7 @@ void Console::commandTouchSubCommandSwipe(socket_native_type fd, std::string_vie
|
|||
_touchId = rand();
|
||||
|
||||
Scheduler* sched = Director::getInstance()->getScheduler();
|
||||
sched->runOnAxmolThread([=, this]() {
|
||||
sched->runOnAxmolThread([x1, y1, this]() {
|
||||
float tempx = x1, tempy = y1;
|
||||
Director::getInstance()->getOpenGLView()->handleTouchesBegin(1, &_touchId, &tempx, &tempy);
|
||||
});
|
||||
|
@ -1450,7 +1450,7 @@ void Console::commandTouchSubCommandSwipe(socket_native_type fd, std::string_vie
|
|||
{
|
||||
_y_ -= dy / dx;
|
||||
}
|
||||
sched->runOnAxmolThread([=, this]() {
|
||||
sched->runOnAxmolThread([_x_, _y_, this]() {
|
||||
float tempx = _x_, tempy = _y_;
|
||||
Director::getInstance()->getOpenGLView()->handleTouchesMove(1, &_touchId, &tempx, &tempy);
|
||||
});
|
||||
|
@ -1477,7 +1477,7 @@ void Console::commandTouchSubCommandSwipe(socket_native_type fd, std::string_vie
|
|||
{
|
||||
_y_ -= 1;
|
||||
}
|
||||
sched->runOnAxmolThread([=, this]() {
|
||||
sched->runOnAxmolThread([_x_, _y_, this]() {
|
||||
float tempx = _x_, tempy = _y_;
|
||||
Director::getInstance()->getOpenGLView()->handleTouchesMove(1, &_touchId, &tempx, &tempy);
|
||||
});
|
||||
|
@ -1485,7 +1485,7 @@ void Console::commandTouchSubCommandSwipe(socket_native_type fd, std::string_vie
|
|||
}
|
||||
}
|
||||
|
||||
sched->runOnAxmolThread([=, this]() {
|
||||
sched->runOnAxmolThread([x2, y2, this]() {
|
||||
float tempx = x2, tempy = y2;
|
||||
Director::getInstance()->getOpenGLView()->handleTouchesEnd(1, &_touchId, &tempx, &tempy);
|
||||
});
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define __cocos2d_libs__CCController__
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_ANDROID || AX_TARGET_PLATFORM == AX_PLATFORM_IOS || \
|
||||
AX_TARGET_PLATFORM == AX_PLATFORM_MAC || AX_TARGET_PLATFORM == AX_PLATFORM_LINUX || \
|
||||
AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
defined(_WIN32))
|
||||
|
||||
# include "platform/CCPlatformMacros.h"
|
||||
# include <string>
|
||||
|
|
|
@ -126,14 +126,14 @@ HttpClient::HttpClient()
|
|||
_service->set_option(yasio::YOPT_S_FORWARD_EVENT, 1);
|
||||
_service->set_option(yasio::YOPT_S_DNS_QUERIES_TIMEOUT, 3);
|
||||
_service->set_option(yasio::YOPT_S_DNS_QUERIES_TRIES, 1);
|
||||
_service->start([=, this](yasio::event_ptr&& e) { handleNetworkEvent(e.get()); });
|
||||
_service->start([this](yasio::event_ptr&& e) { handleNetworkEvent(e.get()); });
|
||||
|
||||
for (int i = 0; i < HttpClient::MAX_CHANNELS; ++i)
|
||||
{
|
||||
_availChannelQueue.unsafe_emplace_back(i);
|
||||
}
|
||||
|
||||
_scheduler->schedule([=, this](float) { dispatchResponseCallbacks(); }, this, 0, false, "#");
|
||||
_scheduler->schedule([this](float) { dispatchResponseCallbacks(); }, this, 0, false, "#");
|
||||
|
||||
_isInited = true;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void HttpClient::setDispatchOnWorkThread(bool bVal)
|
|||
_scheduler->unscheduleAllForTarget(this);
|
||||
_dispatchOnWorkThread = bVal;
|
||||
if (!bVal)
|
||||
_scheduler->schedule([=, this](float) { dispatchResponseCallbacks(); }, this, 0, false, "#");
|
||||
_scheduler->schedule([this](float) { dispatchResponseCallbacks(); }, this, 0, false, "#");
|
||||
}
|
||||
|
||||
void HttpClient::handleNetworkStatusChanged()
|
||||
|
|
|
@ -1114,7 +1114,7 @@ void FileUtils::listFilesRecursively(std::string_view dirPath, std::vector<std::
|
|||
}
|
||||
}
|
||||
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
// windows os implement should override in platform specific FileUtiles class
|
||||
bool FileUtils::isDirectoryExistInternal(std::string_view dirPath) const
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "platform/CCFileStream.h"
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
#include <string>
|
||||
#if AX_TARGET_PLATFORM == AX_PLATFORM_WIN32
|
||||
#if defined(_WIN32)
|
||||
# include <errno.h>
|
||||
# include <io.h>
|
||||
# include <direct.h>
|
||||
|
|
|
@ -43,14 +43,14 @@ public:
|
|||
{
|
||||
_curEleAttrs.reserve(64);
|
||||
|
||||
_sax3Handler.xml_start_element_cb = [=, this](char* name, size_t size) {
|
||||
_sax3Handler.xml_start_element_cb = [this](char* name, size_t size) {
|
||||
_curEleName = xsxml::string_view(name, size);
|
||||
};
|
||||
_sax3Handler.xml_attr_cb = [=, this](const char* name, size_t, const char* value, size_t) {
|
||||
_sax3Handler.xml_attr_cb = [this](const char* name, size_t, const char* value, size_t) {
|
||||
_curEleAttrs.emplace_back(name);
|
||||
_curEleAttrs.emplace_back(value);
|
||||
};
|
||||
_sax3Handler.xml_end_attr_cb = [=, this]() {
|
||||
_sax3Handler.xml_end_attr_cb = [this]() {
|
||||
if (!_curEleAttrs.empty())
|
||||
{
|
||||
_curEleAttrs.emplace_back(nullptr);
|
||||
|
@ -66,10 +66,10 @@ public:
|
|||
(const AX_XML_CHAR**)attrs);
|
||||
}
|
||||
};
|
||||
_sax3Handler.xml_end_element_cb = [=, this](const char* name, size_t len) {
|
||||
_sax3Handler.xml_end_element_cb = [this](const char* name, size_t len) {
|
||||
SAXParser::endElement(_ccsaxParserImp, (const AX_XML_CHAR*)name);
|
||||
};
|
||||
_sax3Handler.xml_text_cb = [=, this](const char* s, size_t len) {
|
||||
_sax3Handler.xml_text_cb = [this](const char* s, size_t len) {
|
||||
SAXParser::textHandler(_ccsaxParserImp, (const AX_XML_CHAR*)s, len);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
||||
#if defined(_WIN32)
|
||||
# define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
|
|
|
@ -864,7 +864,7 @@ void Renderer::clear(ClearFlag flags, const Color4F& color, float depth, unsigne
|
|||
|
||||
CallbackCommand* command = nextCallbackCommand();
|
||||
command->init(globalOrder);
|
||||
command->func = [=, this]() -> void {
|
||||
command->func = [this, flags, color, depth, stencil]() -> void {
|
||||
|
||||
backend::RenderPassDescriptor descriptor;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ void TextureInfoGL::applySampler(const SamplerDescriptor& descriptor, bool isPow
|
|||
}
|
||||
|
||||
// apply sampler for all internal textures
|
||||
foreach ([=, this](GLuint texID, int index) {
|
||||
foreach ([this, target](GLuint texID, int index) {
|
||||
glBindTexture(target, textures[index]);
|
||||
|
||||
setCurrentTexParameters(target);
|
||||
|
|
|
@ -295,7 +295,7 @@ void PageView::pageTurningEvent()
|
|||
void PageView::addEventListener(const ccPageViewCallback& callback)
|
||||
{
|
||||
_eventCallback = callback;
|
||||
ccScrollViewCallback scrollViewCallback = [=, this](Ref* /*ref*/, ScrollView::EventType type) -> void {
|
||||
ccScrollViewCallback scrollViewCallback = [this](Ref* /*ref*/, ScrollView::EventType type) -> void {
|
||||
if (type == ScrollView::EventType::AUTOSCROLL_ENDED && _previousPageIndex != _currentPageIndex)
|
||||
{
|
||||
pageTurningEvent();
|
||||
|
|
|
@ -248,7 +248,7 @@ void PageViewIndicator::increaseNumberOfPages()
|
|||
indexNode = Sprite::createWithSpriteFrameName(_indexNodesTextureFile);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
NS_AX_BEGIN
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
|
||||
# define nxbeep(t) MessageBeep(t)
|
||||
#else
|
||||
# define nxbeep(t)
|
||||
|
@ -380,7 +380,7 @@ void TextFieldEx::enableIME(Node* control)
|
|||
if (control == nullptr)
|
||||
control = this;
|
||||
|
||||
touchListener->onTouchBegan = [=, this](Touch* touch, Event*) {
|
||||
touchListener->onTouchBegan = [control,this](Touch* touch, Event*) {
|
||||
bool focus = (engine_inj_checkVisibility(this) && this->editable && this->enabled &&
|
||||
engine_inj_containsTouchPoint(control, touch));
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ void AssetsManager::downloadAndUncompress()
|
|||
// Uncompress zip file.
|
||||
if (!uncompress())
|
||||
{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([&, this] {
|
||||
Director::getInstance()->getScheduler()->runOnAxmolThread([&, this] {
|
||||
UserDefault::getInstance()->setStringForKey(this->keyOfDownloadedVersion().c_str(), "");
|
||||
UserDefault::getInstance()->flush();
|
||||
if (this->_delegate)
|
||||
|
@ -326,7 +326,7 @@ void AssetsManager::downloadAndUncompress()
|
|||
break;
|
||||
}
|
||||
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([&, this] {
|
||||
Director::getInstance()->getScheduler()->runOnAxmolThread([&, this] {
|
||||
// Record new version code.
|
||||
UserDefault::getInstance()->setStringForKey(this->keyOfVersion().c_str(), this->_version);
|
||||
|
||||
|
|
Loading…
Reference in New Issue