Skip to content

Commit e00d05b

Browse files
committed
fix android compiling error
1 parent 15fb802 commit e00d05b

File tree

6 files changed

+44
-21
lines changed

6 files changed

+44
-21
lines changed

cocos/2d/CCActionInterval.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,15 +2535,7 @@ Animate* Animate::create(Animation *animation)
25352535
}
25362536

25372537
Animate::Animate()
2538-
: _splitTimes(new std::vector<float>)
2539-
, _nextFrame(0)
2540-
, _origFrame(nullptr)
2541-
, _executedLoops(0)
2542-
, _animation(nullptr)
2543-
, _frameDisplayedEvent(nullptr)
2544-
, _currFrameIndex(0)
25452538
{
2546-
25472539
}
25482540

25492541
Animate::~Animate()

cocos/2d/CCActionInterval.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,14 +1561,14 @@ class CC_DLL Animate : public ActionInterval
15611561
bool initWithAnimation(Animation *animation);
15621562

15631563
protected:
1564-
std::vector<float>* _splitTimes;
1565-
int _nextFrame;
1566-
SpriteFrame* _origFrame;
1567-
int _currFrameIndex;
1568-
unsigned int _executedLoops;
1569-
Animation* _animation;
1570-
1571-
EventCustom* _frameDisplayedEvent;
1564+
std::vector<float>* _splitTimes = new std::vector<float>;
1565+
int _nextFrame = 0;
1566+
SpriteFrame* _origFrame = nullptr;
1567+
int _currFrameIndex = 0;
1568+
unsigned int _executedLoops = 0;
1569+
Animation* _animation = nullptr;
1570+
1571+
EventCustom* _frameDisplayedEvent = nullptr;
15721572
AnimationFrame::DisplayedEventInfo _frameDisplayedEventInfo;
15731573
private:
15741574
CC_DISALLOW_COPY_AND_ASSIGN(Animate);

cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ float _levelDecreaseThreshold = 0.2f;
173173
float _cpuFpsFactor = 1.0f;
174174
float _gpuFpsFactor = 1.0f;
175175
bool _isFpsChanged = false;
176-
float _oldRealFps = 60.0f;
177176

178177
uint32_t _lowFpsCheckMode = 0; // 0: Continuous mode, 1: Average mode
179178
float _lowRealFpsThreshold = 0.5f; // Unit: percentage (0 ~ 1)

cocos/platform/android/jni/TouchesJni.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ extern "C" {
101101

102102
};
103103

104-
JNIEXPORT jboolean JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyEvent(JNIEnv * env, jobject thiz, jint keyCode, jboolean isPressed) {
105-
Director* pDirector = Director::getInstance();
106-
104+
JNIEXPORT jboolean JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyEvent(JNIEnv * env, jobject thiz, jint keyCode, jboolean isPressed) {
107105
auto iterKeyCode = g_keyCodeMap.find(keyCode);
108106
if (iterKeyCode == g_keyCodeMap.end()) {
109107
return JNI_FALSE;

cocos/renderer/backend/BindGroup.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,31 @@ BindGroup::UniformInfo& BindGroup::UniformInfo::operator=(UniformInfo&& rhs)
3636
{
3737
name = rhs.name;
3838
size = rhs.size;
39-
39+
40+
if (data) free(data);
4041
data = rhs.data;
4142
rhs.data = nullptr;
4243
}
4344

4445
return *this;
4546
}
4647

48+
BindGroup::UniformInfo& BindGroup::UniformInfo::operator=(const UniformInfo& rhs)
49+
{
50+
if (this != &rhs)
51+
{
52+
name = rhs.name;
53+
size = rhs.size;
54+
55+
if (data) free(data);
56+
data = malloc(size);
57+
if (data)
58+
memcpy(data, rhs.data, size);
59+
}
60+
61+
return *this;
62+
}
63+
4764
BindGroup::TextureInfo::TextureInfo(const std::string& _name, const std::vector<uint32_t>& _indices, const std::vector<Texture*> _textures)
4865
: name(_name)
4966
, indices(_indices)
@@ -78,6 +95,21 @@ BindGroup::TextureInfo& BindGroup::TextureInfo::operator=(TextureInfo&& rhs)
7895
return *this;
7996
}
8097

98+
BindGroup::TextureInfo& BindGroup::TextureInfo::operator=(const TextureInfo& rhs)
99+
{
100+
if (this != &rhs)
101+
{
102+
name = rhs.name;
103+
indices = rhs.indices;
104+
105+
releaseTextures();
106+
textures = rhs.textures;
107+
retainTextures();
108+
}
109+
110+
return *this;
111+
}
112+
81113
void BindGroup::TextureInfo::retainTextures()
82114
{
83115
for (auto& texture : textures)

cocos/renderer/backend/BindGroup.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class BindGroup : public cocos2d::Ref
2222
UniformInfo(const UniformInfo&);
2323
~UniformInfo();
2424
UniformInfo& operator =(UniformInfo&& rhs);
25+
UniformInfo& operator =(const UniformInfo& rhs);
2526

2627
std::string name;
2728
uint32_t size = 0;
@@ -35,6 +36,7 @@ class BindGroup : public cocos2d::Ref
3536
TextureInfo(const TextureInfo&);
3637
~TextureInfo();
3738
TextureInfo& operator =(TextureInfo&& rhs);
39+
TextureInfo& operator =(const TextureInfo& rhs);
3840

3941
void retainTextures();
4042
void releaseTextures();

0 commit comments

Comments
 (0)