mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_fix
This commit is contained in:
commit
404db49538
|
@ -2,10 +2,13 @@ cocos2d-x-3.2 ???
|
||||||
[NEW] TextureCache: added unbindImageAsync() and unbindAllImageAsync()
|
[NEW] TextureCache: added unbindImageAsync() and unbindAllImageAsync()
|
||||||
|
|
||||||
[FIX] Application.mk: not output debug message in releae mode on Android
|
[FIX] Application.mk: not output debug message in releae mode on Android
|
||||||
|
[FIX] Android: 3d model will be black when coming from background
|
||||||
[FIX] Cocos2dxGLSurfaceView.java: prevent flickering when opening another activity
|
[FIX] Cocos2dxGLSurfaceView.java: prevent flickering when opening another activity
|
||||||
[FIX] Image: Set jpeg save quality to 90
|
[FIX] Image: Set jpeg save quality to 90
|
||||||
[FIX] Label: label is unsharp if it's created by smaller font
|
[FIX] Label: label is unsharp if it's created by smaller font
|
||||||
|
[FIX] Others: Treat warning as error on iOS and Mac
|
||||||
[FIX] Repeat: will run one more over in rare situations
|
[FIX] Repeat: will run one more over in rare situations
|
||||||
|
[FIX] Schedule: schedulePerFrame() can not be called twice
|
||||||
[FIX] SpriteFrameCache: fix memory leak
|
[FIX] SpriteFrameCache: fix memory leak
|
||||||
|
|
||||||
cocos2d-x-3.1 May.24 2014
|
cocos2d-x-3.1 May.24 2014
|
||||||
|
|
|
@ -7073,6 +7073,7 @@
|
||||||
CC_TARGET_OS_MAC,
|
CC_TARGET_OS_MAC,
|
||||||
CC_KEYBOARD_SUPPORT,
|
CC_KEYBOARD_SUPPORT,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
@ -7099,6 +7100,7 @@
|
||||||
CC_KEYBOARD_SUPPORT,
|
CC_KEYBOARD_SUPPORT,
|
||||||
CC_TARGET_OS_MAC,
|
CC_TARGET_OS_MAC,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
@ -7191,6 +7193,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC;
|
GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC;
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac";
|
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac";
|
||||||
};
|
};
|
||||||
|
@ -7201,6 +7204,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC;
|
GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC;
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac";
|
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac";
|
||||||
};
|
};
|
||||||
|
@ -7215,6 +7219,7 @@
|
||||||
CC_TARGET_OS_MAC,
|
CC_TARGET_OS_MAC,
|
||||||
CC_KEYBOARD_SUPPORT,
|
CC_KEYBOARD_SUPPORT,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop $(SRCROOT)/../external/glfw3/include/mac";
|
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop $(SRCROOT)/../external/glfw3/include/mac";
|
||||||
|
@ -7230,6 +7235,7 @@
|
||||||
CC_TARGET_OS_MAC,
|
CC_TARGET_OS_MAC,
|
||||||
CC_KEYBOARD_SUPPORT,
|
CC_KEYBOARD_SUPPORT,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop $(SRCROOT)/../external/glfw3/include/mac";
|
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop $(SRCROOT)/../external/glfw3/include/mac";
|
||||||
|
@ -7247,6 +7253,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
CC_TARGET_OS_IPHONE,
|
CC_TARGET_OS_IPHONE,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||||
|
@ -7285,6 +7292,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
CC_TARGET_OS_IPHONE,
|
CC_TARGET_OS_IPHONE,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||||
|
@ -7341,6 +7349,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
CC_TARGET_OS_IPHONE,
|
CC_TARGET_OS_IPHONE,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
|
@ -7359,6 +7368,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
CC_TARGET_OS_IPHONE,
|
CC_TARGET_OS_IPHONE,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
|
@ -7437,6 +7447,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
CC_TARGET_OS_IPHONE,
|
CC_TARGET_OS_IPHONE,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
@ -7454,6 +7465,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
CC_TARGET_OS_IPHONE,
|
CC_TARGET_OS_IPHONE,
|
||||||
);
|
);
|
||||||
|
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
|
|
@ -603,7 +603,8 @@ std::string ObjLoader::LoadObj(shapes_t& shapes, const char* filename, const cha
|
||||||
|
|
||||||
std::vector<vertex_index> face;
|
std::vector<vertex_index> face;
|
||||||
while (!isNewLine(token[0])) {
|
while (!isNewLine(token[0])) {
|
||||||
vertex_index vi = parseTriple(token, v.size() / 3, vn.size() / 3, vt.size() / 2);
|
// fix warning, cast to int, i think int is enough
|
||||||
|
vertex_index vi = parseTriple(token, (int)v.size() / 3, (int)vn.size() / 3, (int)vt.size() / 2);
|
||||||
face.push_back(vi);
|
face.push_back(vi);
|
||||||
auto n = strspn(token, " \t\r");
|
auto n = strspn(token, " \t\r");
|
||||||
token += n;
|
token += n;
|
||||||
|
|
|
@ -465,13 +465,28 @@ void Scheduler::schedulePerFrame(const ccSchedulerFunc& callback, void *target,
|
||||||
HASH_FIND_PTR(_hashForUpdates, &target, hashElement);
|
HASH_FIND_PTR(_hashForUpdates, &target, hashElement);
|
||||||
if (hashElement)
|
if (hashElement)
|
||||||
{
|
{
|
||||||
#if COCOS2D_DEBUG >= 1
|
// check if priority has changed
|
||||||
CCASSERT(hashElement->entry->markedForDeletion,"");
|
if ((*hashElement->list)->priority != priority)
|
||||||
#endif
|
{
|
||||||
// TODO: check if priority has changed!
|
if (_updateHashLocked)
|
||||||
|
{
|
||||||
hashElement->entry->markedForDeletion = false;
|
CCLOG("warning: you CANNOT change update priority in scheduled function");
|
||||||
return;
|
hashElement->entry->markedForDeletion = false;
|
||||||
|
hashElement->entry->paused = paused;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// will be added again outside if (hashElement).
|
||||||
|
unscheduleUpdate(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hashElement->entry->markedForDeletion = false;
|
||||||
|
hashElement->entry->paused = paused;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// most of the updates are going to be 0, that's way there
|
// most of the updates are going to be 0, that's way there
|
||||||
|
|
|
@ -33,6 +33,10 @@ THE SOFTWARE.
|
||||||
#include "renderer/CCGLProgramCache.h"
|
#include "renderer/CCGLProgramCache.h"
|
||||||
#include "renderer/ccGLStateCache.h"
|
#include "renderer/ccGLStateCache.h"
|
||||||
#include "renderer/CCTexture2D.h"
|
#include "renderer/CCTexture2D.h"
|
||||||
|
#include "base/CCEventCustom.h"
|
||||||
|
#include "base/CCEventListenerCustom.h"
|
||||||
|
#include "base/CCEventType.h"
|
||||||
|
#include "base/CCDirector.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -272,11 +276,22 @@ GLProgramState::GLProgramState()
|
||||||
: _vertexAttribsFlags(0)
|
: _vertexAttribsFlags(0)
|
||||||
, _glprogram(nullptr)
|
, _glprogram(nullptr)
|
||||||
, _textureUnitIndex(1)
|
, _textureUnitIndex(1)
|
||||||
|
, _uniformAttributeValueDirty(true)
|
||||||
{
|
{
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
// listen the event when app go to foreground
|
||||||
|
CCLOG("create _backToForegroundlistener for GLProgramState");
|
||||||
|
_backToForegroundlistener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, [this](EventCustom*) { _uniformAttributeValueDirty = true; });
|
||||||
|
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundlistener, -1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GLProgramState::~GLProgramState()
|
GLProgramState::~GLProgramState()
|
||||||
{
|
{
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundlistener);
|
||||||
|
#endif
|
||||||
|
|
||||||
CC_SAFE_RELEASE(_glprogram);
|
CC_SAFE_RELEASE(_glprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +327,24 @@ void GLProgramState::resetGLProgram()
|
||||||
void GLProgramState::apply(const Mat4& modelView)
|
void GLProgramState::apply(const Mat4& modelView)
|
||||||
{
|
{
|
||||||
CCASSERT(_glprogram, "invalid glprogram");
|
CCASSERT(_glprogram, "invalid glprogram");
|
||||||
|
if(_uniformAttributeValueDirty)
|
||||||
|
{
|
||||||
|
for(auto& uniformValue : _uniforms)
|
||||||
|
{
|
||||||
|
uniformValue.second._uniform = _glprogram->getUniform(uniformValue.first);
|
||||||
|
}
|
||||||
|
|
||||||
|
_vertexAttribsFlags = 0;
|
||||||
|
for(auto& attributeValue : _attributes)
|
||||||
|
{
|
||||||
|
attributeValue.second._vertexAttrib = _glprogram->getVertexAttrib(attributeValue.first);;
|
||||||
|
if(attributeValue.second._enabled)
|
||||||
|
_vertexAttribsFlags |= 1 << attributeValue.second._vertexAttrib->index;
|
||||||
|
}
|
||||||
|
|
||||||
|
_uniformAttributeValueDirty = false;
|
||||||
|
|
||||||
|
}
|
||||||
// set shader
|
// set shader
|
||||||
_glprogram->use();
|
_glprogram->use();
|
||||||
_glprogram->setUniformsForBuiltins(modelView);
|
_glprogram->setUniformsForBuiltins(modelView);
|
||||||
|
@ -322,9 +354,9 @@ void GLProgramState::apply(const Mat4& modelView)
|
||||||
if(_vertexAttribsFlags) {
|
if(_vertexAttribsFlags) {
|
||||||
// enable/disable vertex attribs
|
// enable/disable vertex attribs
|
||||||
GL::enableVertexAttribs(_vertexAttribsFlags);
|
GL::enableVertexAttribs(_vertexAttribsFlags);
|
||||||
|
|
||||||
// set attributes
|
// set attributes
|
||||||
for(auto &attribute : _attributes) {
|
for(auto &attribute : _attributes)
|
||||||
|
{
|
||||||
attribute.second.apply();
|
attribute.second.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ class GLProgram;
|
||||||
class Texture2D;
|
class Texture2D;
|
||||||
struct Uniform;
|
struct Uniform;
|
||||||
struct VertexAttrib;
|
struct VertexAttrib;
|
||||||
|
class EventListenerCustom;
|
||||||
|
class EventCustom;
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -48,7 +50,7 @@ struct VertexAttrib;
|
||||||
class UniformValue
|
class UniformValue
|
||||||
{
|
{
|
||||||
friend class GLProgram;
|
friend class GLProgram;
|
||||||
|
friend class GLProgramState;
|
||||||
public:
|
public:
|
||||||
UniformValue();
|
UniformValue();
|
||||||
UniformValue(Uniform *uniform, GLProgram* glprogram);
|
UniformValue(Uniform *uniform, GLProgram* glprogram);
|
||||||
|
@ -186,12 +188,17 @@ protected:
|
||||||
VertexAttribValue* getVertexAttribValue(const std::string &attributeName);
|
VertexAttribValue* getVertexAttribValue(const std::string &attributeName);
|
||||||
UniformValue* getUniformValue(const std::string &uniformName);
|
UniformValue* getUniformValue(const std::string &uniformName);
|
||||||
|
|
||||||
|
bool _uniformAttributeValueDirty;
|
||||||
std::unordered_map<std::string, UniformValue> _uniforms;
|
std::unordered_map<std::string, UniformValue> _uniforms;
|
||||||
std::unordered_map<std::string, VertexAttribValue> _attributes;
|
std::unordered_map<std::string, VertexAttribValue> _attributes;
|
||||||
|
|
||||||
int _textureUnitIndex;
|
int _textureUnitIndex;
|
||||||
uint32_t _vertexAttribsFlags;
|
uint32_t _vertexAttribsFlags;
|
||||||
GLProgram *_glprogram;
|
GLProgram *_glprogram;
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
EventListenerCustom* _backToForegroundlistener;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -28,7 +28,8 @@ static std::function<Layer*()> createFunctions[] = {
|
||||||
CL(RescheduleSelector),
|
CL(RescheduleSelector),
|
||||||
CL(SchedulerDelayAndRepeat),
|
CL(SchedulerDelayAndRepeat),
|
||||||
CL(SchedulerIssue2268),
|
CL(SchedulerIssue2268),
|
||||||
CL(ScheduleCallbackTest)
|
CL(ScheduleCallbackTest),
|
||||||
|
CL(ScheduleUpdatePriority)
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||||
|
@ -1148,6 +1149,47 @@ void ScheduleCallbackTest::callback(float dt)
|
||||||
log("In the callback of schedule(CC_CALLBACK_1(XXX::member_function), this), this, ...), dt = %f", dt);
|
log("In the callback of schedule(CC_CALLBACK_1(XXX::member_function), this), this, ...), dt = %f", dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ScheduleUpdatePriority
|
||||||
|
|
||||||
|
std::string ScheduleUpdatePriority::title() const
|
||||||
|
{
|
||||||
|
return "ScheduleUpdatePriorityTest";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ScheduleUpdatePriority::subtitle() const
|
||||||
|
{
|
||||||
|
return "click to change update priority with random value";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ScheduleUpdatePriority::onTouchBegan(Touch* touch, Event* event)
|
||||||
|
{
|
||||||
|
int priority = static_cast<int>(CCRANDOM_0_1() * 11) - 5; // -5 ~ 5
|
||||||
|
CCLOG("change update priority to %d", priority);
|
||||||
|
scheduleUpdateWithPriority(priority);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScheduleUpdatePriority::onEnter()
|
||||||
|
{
|
||||||
|
SchedulerTestLayer::onEnter();
|
||||||
|
|
||||||
|
scheduleUpdate();
|
||||||
|
|
||||||
|
auto listener = EventListenerTouchOneByOne::create();
|
||||||
|
listener->onTouchBegan = CC_CALLBACK_2(ScheduleUpdatePriority::onTouchBegan, this);
|
||||||
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScheduleUpdatePriority::onExit()
|
||||||
|
{
|
||||||
|
unscheduleUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScheduleUpdatePriority::update(float dt)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// SchedulerTestScene
|
// SchedulerTestScene
|
||||||
|
|
|
@ -302,6 +302,21 @@ public:
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ScheduleUpdatePriority : public SchedulerTestLayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(ScheduleUpdatePriority);
|
||||||
|
|
||||||
|
virtual std::string title() const override;
|
||||||
|
virtual std::string subtitle() const override;
|
||||||
|
void onEnter();
|
||||||
|
void onExit();
|
||||||
|
|
||||||
|
virtual void update(float dt);
|
||||||
|
|
||||||
|
bool onTouchBegan(Touch* touch, Event* event);
|
||||||
|
};
|
||||||
|
|
||||||
class SchedulerTestScene : public TestScene
|
class SchedulerTestScene : public TestScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -208,12 +208,42 @@ bool Effect::initGLProgramState(const std::string &fragmentFilename)
|
||||||
auto fragSource = fileUtiles->getStringFromFile(fragmentFullPath);
|
auto fragSource = fileUtiles->getStringFromFile(fragmentFullPath);
|
||||||
auto glprogram = GLProgram::createWithByteArrays(ccPositionTextureColor_noMVP_vert, fragSource.c_str());
|
auto glprogram = GLProgram::createWithByteArrays(ccPositionTextureColor_noMVP_vert, fragSource.c_str());
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
_fragSource = fragSource;
|
||||||
|
#endif
|
||||||
|
|
||||||
_glprogramstate = GLProgramState::getOrCreateWithGLProgram(glprogram);
|
_glprogramstate = GLProgramState::getOrCreateWithGLProgram(glprogram);
|
||||||
_glprogramstate->retain();
|
_glprogramstate->retain();
|
||||||
|
|
||||||
return _glprogramstate != nullptr;
|
return _glprogramstate != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Effect::Effect()
|
||||||
|
: _glprogramstate(nullptr)
|
||||||
|
{
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
_backgroundListener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND,
|
||||||
|
[this](EventCustom*)
|
||||||
|
{
|
||||||
|
auto glProgram = _glprogramstate->getGLProgram();
|
||||||
|
glProgram->reset();
|
||||||
|
glProgram->initWithByteArrays(ccPositionTextureColor_noMVP_vert, _fragSource.c_str());
|
||||||
|
glProgram->link();
|
||||||
|
glProgram->updateUniforms();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backgroundListener, -1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
Effect::~Effect()
|
||||||
|
{
|
||||||
|
CC_SAFE_RELEASE_NULL(_glprogramstate);
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
Director::getInstance()->getEventDispatcher()->removeEventListener(_backgroundListener);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Blur
|
// Blur
|
||||||
class EffectBlur : public Effect
|
class EffectBlur : public Effect
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,10 +37,13 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool initGLProgramState(const std::string &fragmentFilename);
|
bool initGLProgramState(const std::string &fragmentFilename);
|
||||||
Effect() : _glprogramstate(nullptr)
|
Effect();
|
||||||
{}
|
virtual ~Effect();
|
||||||
virtual ~Effect() {}
|
|
||||||
GLProgramState *_glprogramstate;
|
GLProgramState *_glprogramstate;
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
std::string _fragSource;
|
||||||
|
EventListenerCustom* _backgroundListener;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectSpriteTest : public ShaderTestDemo2
|
class EffectSpriteTest : public ShaderTestDemo2
|
||||||
|
|
|
@ -297,7 +297,7 @@ Effect3DOutline* Effect3DOutline::create()
|
||||||
bool Effect3DOutline::init()
|
bool Effect3DOutline::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
GLProgram* glprogram = Effect3DOutline::getOrCreateProgram();
|
GLProgram* glprogram = GLProgram::createWithFilenames(_vertShaderFile, _fragShaderFile);
|
||||||
if(nullptr == glprogram)
|
if(nullptr == glprogram)
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(glprogram);
|
CC_SAFE_DELETE(glprogram);
|
||||||
|
@ -320,12 +320,27 @@ Effect3DOutline::Effect3DOutline()
|
||||||
, _outlineColor(1, 1, 1)
|
, _outlineColor(1, 1, 1)
|
||||||
, _sprite(nullptr)
|
, _sprite(nullptr)
|
||||||
{
|
{
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
_backToForegroundListener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND,
|
||||||
|
[this](EventCustom*)
|
||||||
|
{
|
||||||
|
auto glProgram = _glProgramState->getGLProgram();
|
||||||
|
glProgram->reset();
|
||||||
|
glProgram->initWithFilenames(_vertShaderFile, _fragShaderFile);
|
||||||
|
glProgram->link();
|
||||||
|
glProgram->updateUniforms();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Effect3DOutline::~Effect3DOutline()
|
Effect3DOutline::~Effect3DOutline()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(_sprite);
|
CC_SAFE_RELEASE_NULL(_sprite);
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundListener);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect3DOutline::setOutlineColor(const Vec3& color)
|
void Effect3DOutline::setOutlineColor(const Vec3& color)
|
||||||
|
|
|
@ -98,6 +98,9 @@ protected:
|
||||||
Vec3 _outlineColor;
|
Vec3 _outlineColor;
|
||||||
float _outlineWidth;
|
float _outlineWidth;
|
||||||
EffectSprite3D* _sprite;
|
EffectSprite3D* _sprite;
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
EventListenerCustom* _backToForegroundListener;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const std::string _vertShaderFile;
|
static const std::string _vertShaderFile;
|
||||||
|
|
|
@ -5,9 +5,7 @@ import jenkinsapi
|
||||||
from jenkinsapi.jenkins import Jenkins
|
from jenkinsapi.jenkins import Jenkins
|
||||||
from jenkinsapi.constants import STATUS_SUCCESS
|
from jenkinsapi.constants import STATUS_SUCCESS
|
||||||
|
|
||||||
http_proxy = ''
|
payload_str = os.environ['payload']
|
||||||
if(os.environ.has_key('HTTP_PROXY')):
|
|
||||||
http_proxy = os.environ['HTTP_PROXY']
|
|
||||||
payload_str = payload_str.decode('utf-8','ignore')
|
payload_str = payload_str.decode('utf-8','ignore')
|
||||||
#parse to json obj
|
#parse to json obj
|
||||||
payload = json.loads(payload_str)
|
payload = json.loads(payload_str)
|
||||||
|
@ -31,6 +29,8 @@ if(result == STATUS_SUCCESS):
|
||||||
else:
|
else:
|
||||||
data['state'] = "failure"
|
data['state'] = "failure"
|
||||||
|
|
||||||
http_proxy = os.environ['HTTP_PROXY']
|
http_proxy = ''
|
||||||
|
if(os.environ.has_key('HTTP_PROXY')):
|
||||||
|
http_proxy = os.environ['HTTP_PROXY']
|
||||||
proxyDict = {'http':http_proxy,'https':http_proxy}
|
proxyDict = {'http':http_proxy,'https':http_proxy}
|
||||||
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
|
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
|
||||||
|
|
Loading…
Reference in New Issue