mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss2770_fix_warnings
This commit is contained in:
commit
15c8c04f3a
4
AUTHORS
4
AUTHORS
|
@ -642,6 +642,7 @@ Developers:
|
|||
ledyba
|
||||
Fixed a bug that EventListeners can't be removed sometimes.
|
||||
Fixed a bug that the data size has to be specified when parsing XML using TinyXML.
|
||||
Closed X display after getting DPI on Linux.
|
||||
|
||||
Luis Parravicini (luisparravicini)
|
||||
Fixed typos in create_project.py.
|
||||
|
@ -649,6 +650,9 @@ Developers:
|
|||
xhcnb
|
||||
Device::setAccelerometerEnabled needs to be invoked before adding ACC listener.
|
||||
|
||||
bopohaa
|
||||
Fixed a bug that Webp test crashes.
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
Author of windows port, CCTextField,
|
||||
|
|
|
@ -20,6 +20,7 @@ cocos2d-x-3.0alpha1 @??? 2013
|
|||
[NEW] Sprite: Override setScale(float scaleX, float scaleY)
|
||||
[NEW] External: added | operator for Control::EventType
|
||||
[NEW] Android & iOS screen size change support
|
||||
[FIX] Webp Test Crashes.
|
||||
[Android]
|
||||
[FIX] Added EGL_RENDERABLE_TYPE to OpenGL attributes
|
||||
[FIX] Fixed application will crash when pause and resume.
|
||||
|
@ -34,6 +35,7 @@ cocos2d-x-3.0alpha1 @??? 2013
|
|||
[FIX] Can't click the area that outside of keyboard to close keyboard when using EditBox.
|
||||
[Linux]
|
||||
[NEW] Used CMake to build linux projects.
|
||||
[FIX] Closed X display after getting DPI on Linux.
|
||||
[Desktop]
|
||||
[FIX] Trigger onKeyReleased only after the key has been released.
|
||||
[Javascript binding]
|
||||
|
|
|
@ -103,8 +103,8 @@ $ cmake ..
|
|||
$ make
|
||||
```
|
||||
|
||||
You may meet building errors when building libGLFW.so. It is because libGL.so directs to an error target, you should make it to direct to a correct one.
|
||||
`install-deps-linux.sh` only has to be run onece.
|
||||
You may meet building errors when building libGLFW.so. It is because libGL.so directs to an error target,
|
||||
you should make it to direct to a correct one. `install-deps-linux.sh` only has to be run onece.
|
||||
|
||||
* For Windows
|
||||
|
||||
|
|
|
@ -15,11 +15,12 @@ ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES + JSB_SAMPLES
|
|||
|
||||
def usage():
|
||||
|
||||
print "%prog [-n ndk-build-parameter] target\n\
|
||||
valid target are [hellocpp|testcpp|simplegame|assetsmanager|hellolua|testlua|cocosdragon\
|
||||
|crystalcraze|moonwarriors|testjavascript|watermelonwithme], of course you can use 'cpp'\
|
||||
to build all cpp samples, 'lua' to build all lua samples, 'jsb' to build all javascript samples,\
|
||||
and 'all' for all samples"
|
||||
print """%s [-n ndk-build-parameter] target.
|
||||
|
||||
Valid targets are: [hellocpp|testcpp|simplegame|assetsmanager|hellolua|testlua|cocosdragon
|
||||
|crystalcraze|moonwarriors|testjavascript|watermelonwithme]
|
||||
|
||||
You can use [all|cpp|lua|jsb], to build all, or all the C++, or all the Lua, or all the JavaScript samples respectevely.""" % sys.argv[0]
|
||||
|
||||
def check_environment_variables():
|
||||
''' Checking the environment NDK_ROOT, which will be used for building
|
||||
|
@ -132,13 +133,26 @@ def copy_resources(target, app_android_root):
|
|||
resources_dir = os.path.join(app_android_root, "../../Shared/games/CocosDragonJS/Published files Android")
|
||||
if target == "crystalcraze":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/CrystalCraze/Published-Android")
|
||||
if target == "moonwarriors":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/MoonWarriors/res")
|
||||
if target == "testjavascript":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/tests/")
|
||||
if target == "watermelonwithme":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/WatermelonWithMe")
|
||||
if target != "moonwarriors":
|
||||
copy_files(resources_dir, assets_dir)
|
||||
else:
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/MoonWarriors/res")
|
||||
dst_dir = os.path.join(assets_dir, "res")
|
||||
os.mkdir(dst_dir)
|
||||
copy_files(resources_dir, dst_dir)
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/MoonWarriors/src")
|
||||
dst_dir = os.path.join(assets_dir, "src")
|
||||
os.mkdir(dst_dir)
|
||||
copy_files(resources_dir, dst_dir)
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/MoonWarriors")
|
||||
for item in os.listdir(resources_dir):
|
||||
path = os.path.join(resources_dir, item)
|
||||
if item.endswith('.js') and os.path.isfile(path):
|
||||
shutil.copy(path, assets_dir)
|
||||
|
||||
# AssetsManager test should also copy javascript files
|
||||
if target == "assetsmanager":
|
||||
|
|
|
@ -27,6 +27,7 @@ THE SOFTWARE.
|
|||
#include "CCTMXXMLParser.h"
|
||||
#include "CCTMXLayer.h"
|
||||
#include "CCSprite.h"
|
||||
#include <algorithm>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -1737,12 +1737,12 @@ bool Image::initWithWebpData(const unsigned char * data, int dataLen)
|
|||
_width = config.input.width;
|
||||
_height = config.input.height;
|
||||
|
||||
int bufferSize = _width * _height * 4;
|
||||
_data = new unsigned char[bufferSize];
|
||||
_dataLen = _width * _height * 4;
|
||||
_data = new unsigned char[_dataLen];
|
||||
|
||||
config.output.u.RGBA.rgba = static_cast<uint8_t*>(_data);
|
||||
config.output.u.RGBA.stride = _width * 4;
|
||||
config.output.u.RGBA.size = bufferSize;
|
||||
config.output.u.RGBA.size = _dataLen;
|
||||
config.output.is_external_memory = 1;
|
||||
|
||||
if (WebPDecode(static_cast<const uint8_t*>(data), dataLen, &config) != VP8_STATUS_OK)
|
||||
|
|
|
@ -37,8 +37,10 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher;
|
|||
|
||||
- (id) init
|
||||
{
|
||||
if( (self = [super init]) ) {
|
||||
_acceleration = new cocos2d::Acceleration();
|
||||
_motionManager = [[CMMotionManager alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ int Device::getDPI()
|
|||
((double) DisplayWidthMM(dpy,scr)));
|
||||
dpi = (int) (xres + 0.5);
|
||||
//printf("dpi = %d\n", dpi);
|
||||
XCloseDisplay (dpy);
|
||||
}
|
||||
return dpi;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ bool FileUtilsWin32::isAbsolutePath(const std::string& strPath) const
|
|||
return false;
|
||||
}
|
||||
|
||||
unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, unsigned long* size)
|
||||
unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, long* size)
|
||||
{
|
||||
unsigned char * pBuffer = NULL;
|
||||
CCASSERT(filename != NULL && size != NULL && mode != NULL, "Invalid parameters.");
|
||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
|||
* @return Upon success, a pointer to the data is returned, otherwise NULL.
|
||||
* @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
|
||||
*/
|
||||
virtual unsigned char* getFileData(const char* filename, const char* mode, unsigned long * size) override;
|
||||
virtual unsigned char* getFileData(const char* filename, const char* mode, long * size) override;
|
||||
|
||||
/**
|
||||
* Gets full path for filename, resolution directory and search path.
|
||||
|
|
|
@ -56,6 +56,7 @@ ArmatureAnimation::ArmatureAnimation()
|
|||
, _toIndex(0)
|
||||
, _tweenList(nullptr)
|
||||
, _ignoreFrameEvent(false)
|
||||
, _userObject(nullptr)
|
||||
|
||||
, _movementEventCallFunc(nullptr)
|
||||
, _frameEventCallFunc(nullptr)
|
||||
|
@ -70,8 +71,7 @@ ArmatureAnimation::~ArmatureAnimation(void)
|
|||
CC_SAFE_RELEASE_NULL(_tweenList);
|
||||
CC_SAFE_RELEASE_NULL(_animationData);
|
||||
|
||||
CC_SAFE_RELEASE_NULL(_movementEventTarget);
|
||||
CC_SAFE_RELEASE_NULL(_frameEventTarget);
|
||||
CC_SAFE_RELEASE_NULL(_userObject);
|
||||
}
|
||||
|
||||
bool ArmatureAnimation::init(Armature *armature)
|
||||
|
@ -208,7 +208,7 @@ void ArmatureAnimation::play(const char *animationName, int durationTo, int dura
|
|||
loop = (loop < 0) ? _movementData->loop : loop;
|
||||
|
||||
|
||||
ProcessBase::play((void *)animationName, durationTo, durationTween, loop, tweenEasing);
|
||||
ProcessBase::play(durationTo, durationTween, loop, tweenEasing);
|
||||
|
||||
|
||||
if (_rawDuration == 0)
|
||||
|
@ -423,26 +423,23 @@ std::string ArmatureAnimation::getCurrentMovementID() const
|
|||
|
||||
void ArmatureAnimation::setMovementEventCallFunc(Object *target, SEL_MovementEventCallFunc callFunc)
|
||||
{
|
||||
if (target != _movementEventTarget)
|
||||
{
|
||||
CC_SAFE_RETAIN(target);
|
||||
CC_SAFE_RELEASE_NULL(_movementEventTarget);
|
||||
_movementEventTarget = target;
|
||||
}
|
||||
_movementEventCallFunc = callFunc;
|
||||
}
|
||||
|
||||
void ArmatureAnimation::setFrameEventCallFunc(Object *target, SEL_FrameEventCallFunc callFunc)
|
||||
{
|
||||
if (target != _frameEventTarget)
|
||||
{
|
||||
CC_SAFE_RETAIN(target);
|
||||
CC_SAFE_RELEASE_NULL(_frameEventTarget);
|
||||
_frameEventTarget = target;
|
||||
}
|
||||
_frameEventCallFunc = callFunc;
|
||||
}
|
||||
|
||||
void ArmatureAnimation::setUserObject(Object *pUserObject)
|
||||
{
|
||||
CC_SAFE_RETAIN(pUserObject);
|
||||
CC_SAFE_RELEASE(_userObject);
|
||||
_userObject = pUserObject;
|
||||
}
|
||||
|
||||
void ArmatureAnimation::frameEvent(Bone *bone, const char *frameEventName, int originFrameIndex, int currentFrameIndex)
|
||||
{
|
||||
if (_frameEventTarget && _frameEventCallFunc)
|
||||
|
|
|
@ -100,6 +100,7 @@ public:
|
|||
//! The animation update speed
|
||||
virtual void setAnimationInternal(float animationInternal);
|
||||
|
||||
using ProcessBase::play;
|
||||
/**
|
||||
* Play animation by animation name.
|
||||
*
|
||||
|
@ -202,6 +203,35 @@ public:
|
|||
}
|
||||
}
|
||||
virtual AnimationData *getAnimationData() const { return _animationData; }
|
||||
|
||||
|
||||
/**
|
||||
* Returns a user assigned Object
|
||||
*
|
||||
* Similar to userData, but instead of holding a void* it holds an object
|
||||
*
|
||||
* @return A user assigned Object
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual Object* getUserObject() { return _userObject; }
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual const Object* getUserObject() const { return _userObject; }
|
||||
|
||||
/**
|
||||
* Returns a user assigned Object
|
||||
*
|
||||
* Similar to UserData, but instead of holding a void* it holds an object.
|
||||
* The UserObject will be retained once in this method,
|
||||
* and the previous UserObject (if existed) will be relese.
|
||||
* The UserObject will be released in Node's destructure.
|
||||
*
|
||||
* @param userObject A user assigned Object
|
||||
*/
|
||||
virtual void setUserObject(Object *userObject);
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
@ -242,6 +272,8 @@ protected:
|
|||
bool _ignoreFrameEvent;
|
||||
|
||||
std::queue<FrameEvent*> _frameEventQueue;
|
||||
|
||||
cocos2d::Object *_userObject;
|
||||
protected:
|
||||
/**
|
||||
* MovementEvent CallFunc.
|
||||
|
|
|
@ -112,6 +112,7 @@ public:
|
|||
*/
|
||||
Bone *getParentBone();
|
||||
|
||||
using Node::removeFromParent;
|
||||
/**
|
||||
* Remove itself from its parent.
|
||||
* @param recursion whether or not to remove childBone's display
|
||||
|
|
|
@ -594,10 +594,10 @@ ArmatureData *DataReaderHelper::decodeArmature(tinyxml2::XMLElement *armatureXML
|
|||
if (parentName)
|
||||
{
|
||||
parentXML = armatureXML->FirstChildElement(BONE);
|
||||
std::string name = parentName;
|
||||
std::string parentNameStr = parentName;
|
||||
while (parentXML)
|
||||
{
|
||||
if (name.compare(parentXML->Attribute(A_NAME)) == 0)
|
||||
if (parentNameStr.compare(parentXML->Attribute(A_NAME)) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ MovementBoneData *DataReaderHelper::decodeMovementBone(tinyxml2::XMLElement *mov
|
|||
}
|
||||
|
||||
int length = 0;
|
||||
int i = 0;
|
||||
int index = 0;
|
||||
int parentTotalDuration = 0;
|
||||
int currentDuration = 0;
|
||||
|
||||
|
@ -863,13 +863,12 @@ MovementBoneData *DataReaderHelper::decodeMovementBone(tinyxml2::XMLElement *mov
|
|||
/*
|
||||
* in this loop we get the corresponding parent frame xml
|
||||
*/
|
||||
while(i < length && (parentFrameXML ? (totalDuration < parentTotalDuration || totalDuration >= parentTotalDuration + currentDuration) : true))
|
||||
while(index < length && (parentFrameXML ? (totalDuration < parentTotalDuration || totalDuration >= parentTotalDuration + currentDuration) : true))
|
||||
{
|
||||
parentFrameXML = parentXmlList[i];
|
||||
parentFrameXML = parentXmlList[index];
|
||||
parentTotalDuration += currentDuration;
|
||||
parentFrameXML->QueryIntAttribute(A_DURATION, ¤tDuration);
|
||||
i++;
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,10 +163,8 @@ public:
|
|||
*/
|
||||
virtual ~SpriteDisplayData();
|
||||
|
||||
inline void setParam(const char *name)
|
||||
{
|
||||
this->displayName = name;
|
||||
}
|
||||
void setParam(const char *pszDisplayName) { this->displayName = pszDisplayName; }
|
||||
|
||||
void copy(SpriteDisplayData *displayData);
|
||||
public:
|
||||
/**
|
||||
|
@ -197,10 +195,7 @@ public:
|
|||
*/
|
||||
virtual ~ArmatureDisplayData();
|
||||
|
||||
inline void setParam(const char *name)
|
||||
{
|
||||
this->displayName = name;
|
||||
}
|
||||
void setParam(const char *pszDisplayName) { this->displayName = pszDisplayName; }
|
||||
void copy(ArmatureDisplayData *displayData);
|
||||
public:
|
||||
/**
|
||||
|
@ -230,10 +225,7 @@ public:
|
|||
*/
|
||||
virtual ~ParticleDisplayData() {};
|
||||
|
||||
void setParam(const char *aPlist)
|
||||
{
|
||||
this->plist = aPlist;
|
||||
}
|
||||
void setParam(const char *pszPlistName) { this->plist = pszPlistName; }
|
||||
|
||||
void copy(ParticleDisplayData *displayData);
|
||||
public:
|
||||
|
@ -478,10 +470,10 @@ public:
|
|||
|
||||
struct ContourVertex2 : public cocos2d::Object
|
||||
{
|
||||
ContourVertex2(float ax, float ay)
|
||||
ContourVertex2(float xx, float yy)
|
||||
{
|
||||
this->x = ax;
|
||||
this->y = ay;
|
||||
this->x = xx;
|
||||
this->y = yy;
|
||||
}
|
||||
|
||||
float x;
|
||||
|
|
|
@ -141,11 +141,29 @@ void DisplayManager::addDisplay(Node *display, int index)
|
|||
((SpriteDisplayData *)displayData)->skinData = spriteDisplayData->skinData;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool find = false;
|
||||
|
||||
for (int i = _decoDisplayList->count()-2; i>=0; i--)
|
||||
{
|
||||
DecorativeDisplay *dd = static_cast<DecorativeDisplay*>(_decoDisplayList->getObjectAtIndex(i));
|
||||
SpriteDisplayData *sdd = static_cast<SpriteDisplayData*>(dd->getDisplayData());
|
||||
if (sdd)
|
||||
{
|
||||
find = true;
|
||||
skin->setSkinData(sdd->skinData);
|
||||
static_cast<SpriteDisplayData*>(displayData)->skinData = sdd->skinData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!find)
|
||||
{
|
||||
BaseData baseData;
|
||||
skin->setSkinData(baseData);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<ParticleSystemQuad *>(display))
|
||||
{
|
||||
displayData = ParticleDisplayData::create();
|
||||
|
|
|
@ -77,7 +77,7 @@ void ProcessBase::stop()
|
|||
_currentPercent = 0;
|
||||
}
|
||||
|
||||
void ProcessBase::play(void *animation, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
void ProcessBase::play(int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
{
|
||||
_isComplete = false;
|
||||
_isPause = false;
|
||||
|
|
|
@ -63,7 +63,6 @@ public:
|
|||
/**
|
||||
* Play animation by animation name.
|
||||
*
|
||||
* @param animation It will not used in the ProcessBase Class
|
||||
* @param durationTo The frames between two animation changing-over.
|
||||
* It's meaning is changing to this animation need how many frames
|
||||
*
|
||||
|
@ -88,7 +87,7 @@ public:
|
|||
* 2 : fade in and out
|
||||
*
|
||||
*/
|
||||
virtual void play(void *animation, int durationTo, int durationTween, int loop, int tweenEasing);
|
||||
virtual void play(int durationTo, int durationTween, int loop, int tweenEasing);
|
||||
|
||||
/**
|
||||
* Pause the Process
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,49 +31,90 @@
|
|||
namespace cocostudio {
|
||||
|
||||
#define kCCSVersion 1.0
|
||||
class CCSGUIReader : cocos2d::Object
|
||||
class GUIReader : public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
CCSGUIReader();
|
||||
~CCSGUIReader();
|
||||
static CCSGUIReader* shareReader();
|
||||
static void purgeCCSGUIReader();
|
||||
GUIReader();
|
||||
~GUIReader();
|
||||
static GUIReader* shareReader();
|
||||
static void purgeGUIReader();
|
||||
|
||||
gui::UIWidget* widgetFromJsonFile(const char* fileName);
|
||||
gui::UIWidget* widgetFromJsonDictionary(JsonDictionary* data);
|
||||
|
||||
int getVersionInteger(const char* str);
|
||||
|
||||
void setPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setColorPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForButtonFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForCheckBoxFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForImageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForLabelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForLabelAtlasFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForContainerWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForPanelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForScrollViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForSliderFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForTextAreaFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForTextButtonFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForTextFieldFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForLoadingBarFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForImageButtonFromJsonDictionary(gui::UIWidget* widget, JsonDictionary* options);
|
||||
void setPropsForListViewFromJsonDictionary(gui::UIWidget* widget, JsonDictionary* options);
|
||||
void setPropsForPageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForLabelBMFontFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
void setPropsForDragPanelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
|
||||
void storeFileDesignSize(const char* fileName, const cocos2d::Size &size);
|
||||
|
||||
const cocos2d::Size getFileDesignSize(const char* fileName) const;
|
||||
protected:
|
||||
std::string m_strFilePath;
|
||||
bool m_bOlderVersion;
|
||||
cocos2d::Dictionary* _fileDesignSizes;
|
||||
};
|
||||
|
||||
class WidgetPropertiesReader : public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
virtual gui::UIWidget* createWidget(JsonDictionary* dic, const char* fullPath, const char* fileName)=0;
|
||||
virtual gui::UIWidget* widgetFromJsonDictionary(JsonDictionary* dic) = 0;
|
||||
protected:
|
||||
std::string m_strFilePath;
|
||||
};
|
||||
|
||||
|
||||
class WidgetPropertiesReader0250 : public WidgetPropertiesReader
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
WidgetPropertiesReader0250(){};
|
||||
virtual ~WidgetPropertiesReader0250(){};
|
||||
|
||||
virtual gui::UIWidget* createWidget(JsonDictionary* dic, const char* fullPath, const char* fileName);
|
||||
virtual gui::UIWidget* widgetFromJsonDictionary(JsonDictionary* dic);
|
||||
virtual void setPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
|
||||
virtual void setColorPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForButtonFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForCheckBoxFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForImageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForLabelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForLabelAtlasFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForLabelBMFontFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForLoadingBarFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForSliderFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForTextFieldFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
|
||||
virtual void setPropsForLayoutFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForScrollViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
};
|
||||
|
||||
class WidgetPropertiesReader0300 : public WidgetPropertiesReader
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
WidgetPropertiesReader0300(){};
|
||||
virtual ~WidgetPropertiesReader0300(){};
|
||||
|
||||
virtual gui::UIWidget* createWidget(JsonDictionary* dic, const char* fullPath, const char* fileName);
|
||||
virtual gui::UIWidget* widgetFromJsonDictionary(JsonDictionary* dic);
|
||||
virtual void setPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
|
||||
virtual void setColorPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForButtonFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForCheckBoxFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForImageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForLabelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForLabelAtlasFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForLabelBMFontFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForLoadingBarFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForSliderFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForTextFieldFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
|
||||
virtual void setPropsForLayoutFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForPageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForScrollViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||
virtual void setPropsForListViewFromJsonDictionary(gui::UIWidget* widget, JsonDictionary* options);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ bool Tween::init(Bone *bone)
|
|||
|
||||
void Tween::play(MovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
{
|
||||
ProcessBase::play(nullptr, durationTo, durationTween, loop, tweenEasing);
|
||||
ProcessBase::play(durationTo, durationTween, loop, tweenEasing);
|
||||
|
||||
if (loop)
|
||||
{
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
*/
|
||||
virtual bool init(Bone *bone);
|
||||
|
||||
using ProcessBase::play;
|
||||
/**
|
||||
* Start the Process
|
||||
*
|
||||
|
|
|
@ -34,8 +34,8 @@ _frontCrossRenderer(NULL),
|
|||
_backGroundBoxDisabledRenderer(NULL),
|
||||
_frontCrossDisabledRenderer(NULL),
|
||||
_isSelected(true),
|
||||
_selectedStateEventListener(NULL),
|
||||
_selectedStateEventSelector(NULL),
|
||||
_checkBoxEventListener(NULL),
|
||||
_checkBoxEventSelector(NULL),
|
||||
_backGroundTexType(UI_TEX_TYPE_LOCAL),
|
||||
_backGroundSelectedTexType(UI_TEX_TYPE_LOCAL),
|
||||
_frontCrossTexType(UI_TEX_TYPE_LOCAL),
|
||||
|
@ -51,8 +51,8 @@ _frontCrossDisabledFileName("")
|
|||
|
||||
UICheckBox::~UICheckBox()
|
||||
{
|
||||
_selectedStateEventListener = NULL;
|
||||
_selectedStateEventSelector = NULL;
|
||||
_checkBoxEventListener = NULL;
|
||||
_checkBoxEventSelector = NULL;
|
||||
}
|
||||
|
||||
UICheckBox* UICheckBox::create()
|
||||
|
@ -285,24 +285,24 @@ bool UICheckBox::getSelectedState()
|
|||
|
||||
void UICheckBox::selectedEvent()
|
||||
{
|
||||
if (_selectedStateEventListener && _selectedStateEventSelector)
|
||||
if (_checkBoxEventListener && _checkBoxEventSelector)
|
||||
{
|
||||
(_selectedStateEventListener->*_selectedStateEventSelector)(this,CHECKBOX_STATE_EVENT_SELECTED);
|
||||
(_checkBoxEventListener->*_checkBoxEventSelector)(this,CHECKBOX_STATE_EVENT_SELECTED);
|
||||
}
|
||||
}
|
||||
|
||||
void UICheckBox::unSelectedEvent()
|
||||
{
|
||||
if (_selectedStateEventListener && _selectedStateEventSelector)
|
||||
if (_checkBoxEventListener && _checkBoxEventSelector)
|
||||
{
|
||||
(_selectedStateEventListener->*_selectedStateEventSelector)(this,CHECKBOX_STATE_EVENT_UNSELECTED);
|
||||
(_checkBoxEventListener->*_checkBoxEventSelector)(this,CHECKBOX_STATE_EVENT_UNSELECTED);
|
||||
}
|
||||
}
|
||||
|
||||
void UICheckBox::addEventListener(cocos2d::Object *target, SEL_SelectedStateEvent selector)
|
||||
void UICheckBox::addEventListenerCheckBox(cocos2d::Object *target, SEL_SelectedStateEvent selector)
|
||||
{
|
||||
_selectedStateEventListener = target;
|
||||
_selectedStateEventSelector = selector;
|
||||
_checkBoxEventListener = target;
|
||||
_checkBoxEventSelector = selector;
|
||||
}
|
||||
|
||||
void UICheckBox::setFlipX(bool flipX)
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
virtual void setAnchorPoint(const cocos2d::Point &pt);
|
||||
|
||||
//add a call back function would called when checkbox is selected or unselected.
|
||||
void addEventListener(cocos2d::Object* target,SEL_SelectedStateEvent selector);
|
||||
void addEventListenerCheckBox(cocos2d::Object* target,SEL_SelectedStateEvent selector);
|
||||
|
||||
//override "setFlipX" method of widget.
|
||||
virtual void setFlipX(bool flipX);
|
||||
|
@ -190,8 +190,8 @@ protected:
|
|||
cocos2d::Sprite* _frontCrossDisabledRenderer;
|
||||
bool _isSelected;
|
||||
|
||||
cocos2d::Object* _selectedStateEventListener;
|
||||
SEL_SelectedStateEvent _selectedStateEventSelector;
|
||||
cocos2d::Object* _checkBoxEventListener;
|
||||
SEL_SelectedStateEvent _checkBoxEventSelector;
|
||||
|
||||
TextureResType _backGroundTexType;
|
||||
TextureResType _backGroundSelectedTexType;
|
||||
|
|
|
@ -129,7 +129,17 @@ void UILayout::setClippingEnabled(bool able)
|
|||
void UILayout::onSizeChanged()
|
||||
{
|
||||
DYNAMIC_CAST_CLIPPINGLAYER->setClippingSize(_size);
|
||||
if (strcmp(getDescription(), "Layout") == 0)
|
||||
{
|
||||
cocos2d::ccArray* arrayChildren = _children->data;
|
||||
int length = arrayChildren->num;
|
||||
for (int i=0; i<length; ++i)
|
||||
{
|
||||
UIWidget* child = (UIWidget*)arrayChildren->arr[i];
|
||||
child->updateSizeAndPosition();
|
||||
}
|
||||
doLayout();
|
||||
}
|
||||
if (_backGroundImage)
|
||||
{
|
||||
_backGroundImage->setPosition(cocos2d::Point(_size.width/2.0f, _size.height/2.0f));
|
||||
|
@ -953,7 +963,7 @@ bool UIRectClippingNode::init()
|
|||
rect[2] = cocos2d::Point(_clippingSize.width, _clippingSize.height);
|
||||
rect[3] = cocos2d::Point(0, _clippingSize.height);
|
||||
|
||||
cocos2d::Color4F green = {0, 1, 0, 1};
|
||||
cocos2d::Color4F green(0, 1, 0, 1);
|
||||
_innerStencil->drawPolygon(rect, 4, green, 0, green);
|
||||
if (cocos2d::ClippingNode::init(_innerStencil))
|
||||
{
|
||||
|
@ -971,7 +981,7 @@ void UIRectClippingNode::setClippingSize(const cocos2d::Size &size)
|
|||
rect[1] = cocos2d::Point(_clippingSize.width, 0);
|
||||
rect[2] = cocos2d::Point(_clippingSize.width, _clippingSize.height);
|
||||
rect[3] = cocos2d::Point(0, _clippingSize.height);
|
||||
cocos2d::Color4F green = {0, 1, 0, 1};
|
||||
cocos2d::Color4F green(0, 1, 0, 1);
|
||||
_innerStencil->clear();
|
||||
_innerStencil->drawPolygon(rect, 4, green, 0, green);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,10 @@ UIListView::UIListView():
|
|||
_model(NULL),
|
||||
_items(NULL),
|
||||
_gravity(LISTVIEW_GRAVITY_CENTER_HORIZONTAL),
|
||||
_itemsMargin(0.0f)
|
||||
_itemsMargin(0.0f),
|
||||
_listViewEventListener(NULL),
|
||||
_listViewEventSelector(NULL),
|
||||
_curSelectedIndex(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -41,6 +44,8 @@ UIListView::~UIListView()
|
|||
{
|
||||
_items->removeAllObjects();
|
||||
CC_SAFE_RELEASE(_items);
|
||||
_listViewEventListener = NULL;
|
||||
_listViewEventSelector = NULL;
|
||||
}
|
||||
|
||||
UIListView* UIListView::create()
|
||||
|
@ -376,7 +381,44 @@ void UIListView::refreshView()
|
|||
remedyLayoutParameter(item);
|
||||
}
|
||||
updateInnerContainerSize();
|
||||
doLayout();
|
||||
}
|
||||
|
||||
void UIListView::addEventListenerListView(cocos2d::Object *target, SEL_ListViewEvent selector)
|
||||
{
|
||||
_listViewEventListener = target;
|
||||
_listViewEventSelector = selector;
|
||||
}
|
||||
|
||||
void UIListView::selectedItemEvent()
|
||||
{
|
||||
if (_listViewEventListener && _listViewEventSelector)
|
||||
{
|
||||
(_listViewEventListener->*_listViewEventSelector)(this, LISTVIEW_ONSELECEDTITEM);
|
||||
}
|
||||
}
|
||||
|
||||
void UIListView::interceptTouchEvent(int handleState, gui::UIWidget *sender, const cocos2d::Point &touchPoint)
|
||||
{
|
||||
UIScrollView::interceptTouchEvent(handleState, sender, touchPoint);
|
||||
if (handleState != 1)
|
||||
{
|
||||
UIWidget* parent = sender;
|
||||
while (parent)
|
||||
{
|
||||
if (parent && parent->getParent() == _innerContainer)
|
||||
{
|
||||
_curSelectedIndex = getIndex(parent);
|
||||
break;
|
||||
}
|
||||
parent = parent->getParent();
|
||||
}
|
||||
selectedItemEvent();
|
||||
}
|
||||
}
|
||||
|
||||
int UIListView::getCurSelectedIndex() const
|
||||
{
|
||||
return _curSelectedIndex;
|
||||
}
|
||||
|
||||
void UIListView::onSizeChanged()
|
||||
|
|
|
@ -41,6 +41,14 @@ typedef enum
|
|||
LISTVIEW_GRAVITY_CENTER_VERTICAL,
|
||||
}ListViewGravity;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LISTVIEW_ONSELECEDTITEM
|
||||
}ListViewEventType;
|
||||
|
||||
typedef void (cocos2d::Object::*SEL_ListViewEvent)(cocos2d::Object*,ListViewEventType);
|
||||
#define listvieweventselector(_SELECTOR) (SEL_ListViewEvent)(&_SELECTOR)
|
||||
|
||||
class UIListView : public UIScrollView
|
||||
{
|
||||
|
||||
|
@ -145,6 +153,10 @@ public:
|
|||
*/
|
||||
void refreshView();
|
||||
|
||||
int getCurSelectedIndex() const;
|
||||
|
||||
void addEventListenerListView(cocos2d::Object* target, SEL_ListViewEvent selector);
|
||||
|
||||
/**
|
||||
* Changes scroll direction of scrollview.
|
||||
*
|
||||
|
@ -164,12 +176,17 @@ protected:
|
|||
virtual UIWidget* createCloneInstance();
|
||||
virtual void copySpecialProperties(UIWidget* model);
|
||||
virtual void copyClonedWidgetChildren(UIWidget* model);
|
||||
void selectedItemEvent();
|
||||
virtual void interceptTouchEvent(int handleState,UIWidget* sender,const cocos2d::Point &touchPoint);
|
||||
protected:
|
||||
|
||||
UIWidget* _model;
|
||||
cocos2d::Array* _items;
|
||||
ListViewGravity _gravity;
|
||||
float _itemsMargin;
|
||||
cocos2d::Object* _listViewEventListener;
|
||||
SEL_ListViewEvent _listViewEventSelector;
|
||||
int _curSelectedIndex;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ _autoScrollDistance(0.0f),
|
|||
_autoScrollSpeed(0.0f),
|
||||
_autoScrollDir(0),
|
||||
_childFocusCancelOffset(5.0f),
|
||||
_eventListener(NULL),
|
||||
_eventSelector(NULL)
|
||||
_pageViewEventListener(NULL),
|
||||
_pageViewEventSelector(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ UIPageView::~UIPageView()
|
|||
{
|
||||
_pages->removeAllObjects();
|
||||
CC_SAFE_RELEASE(_pages);
|
||||
_eventListener = NULL;
|
||||
_eventSelector = NULL;
|
||||
_pageViewEventListener = NULL;
|
||||
_pageViewEventSelector = NULL;
|
||||
}
|
||||
|
||||
UIPageView* UIPageView::create()
|
||||
|
@ -565,16 +565,16 @@ void UIPageView::interceptTouchEvent(int handleState, UIWidget *sender, const co
|
|||
|
||||
void UIPageView::pageTurningEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_pageViewEventListener && _pageViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, PAGEVIEW_EVENT_TURNING);
|
||||
(_pageViewEventListener->*_pageViewEventSelector)(this, PAGEVIEW_EVENT_TURNING);
|
||||
}
|
||||
}
|
||||
|
||||
void UIPageView::addEventListener(cocos2d::Object *target, SEL_PageViewEvent selector)
|
||||
void UIPageView::addEventListenerPageView(cocos2d::Object *target, SEL_PageViewEvent selector)
|
||||
{
|
||||
_eventListener = target;
|
||||
_eventSelector = selector;
|
||||
_pageViewEventListener = target;
|
||||
_pageViewEventSelector = selector;
|
||||
}
|
||||
|
||||
int UIPageView::getCurPageIndex() const
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
cocos2d::Array* getPages();
|
||||
|
||||
// event
|
||||
void addEventListener(cocos2d::Object *target, SEL_PageViewEvent selector);
|
||||
void addEventListenerPageView(cocos2d::Object *target, SEL_PageViewEvent selector);
|
||||
|
||||
|
||||
//override "removeChild" method of widget.
|
||||
|
@ -186,8 +186,8 @@ protected:
|
|||
float _autoScrollSpeed;
|
||||
int _autoScrollDir;
|
||||
float _childFocusCancelOffset;
|
||||
cocos2d::Object* _eventListener;
|
||||
SEL_PageViewEvent _eventSelector;
|
||||
cocos2d::Object* _pageViewEventListener;
|
||||
SEL_PageViewEvent _pageViewEventSelector;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -69,15 +69,15 @@ _bouncing(false),
|
|||
_bounceDir(cocos2d::Point::ZERO),
|
||||
_bounceOriginalSpeed(0.0f),
|
||||
_inertiaScrollEnabled(true),
|
||||
_eventListener(NULL),
|
||||
_eventSelector(NULL)
|
||||
_scrollViewEventListener(NULL),
|
||||
_scrollViewEventSelector(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
UIScrollView::~UIScrollView()
|
||||
{
|
||||
_eventListener = NULL;
|
||||
_eventSelector = NULL;
|
||||
_scrollViewEventListener = NULL;
|
||||
_scrollViewEventSelector = NULL;
|
||||
}
|
||||
|
||||
UIScrollView* UIScrollView::create()
|
||||
|
@ -1458,80 +1458,80 @@ void UIScrollView::checkChildInfo(int handleState,UIWidget* sender,const cocos2d
|
|||
|
||||
void UIScrollView::scrollToTopEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_TOP);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_TOP);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::scrollToBottomEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::scrollToLeftEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_LEFT);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::scrollToRightEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_RIGHT);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::scrollingEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLLING);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLLING);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::bounceTopEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_TOP);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_TOP);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::bounceBottomEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_BOTTOM);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_BOTTOM);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::bounceLeftEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_LEFT);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::bounceRightEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_RIGHT);
|
||||
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollView::addEventListener(cocos2d::Object *target, SEL_ScrollViewEvent selector)
|
||||
void UIScrollView::addEventListenerScrollView(cocos2d::Object *target, SEL_ScrollViewEvent selector)
|
||||
{
|
||||
_eventListener = target;
|
||||
_eventSelector = selector;
|
||||
_scrollViewEventListener = target;
|
||||
_scrollViewEventSelector = selector;
|
||||
}
|
||||
|
||||
void UIScrollView::setDirection(SCROLLVIEW_DIR dir)
|
||||
|
|
|
@ -231,7 +231,7 @@ public:
|
|||
/**
|
||||
* Add call back function called scrollview event triggered
|
||||
*/
|
||||
void addEventListener(cocos2d::Object* target, SEL_ScrollViewEvent selector);
|
||||
void addEventListenerScrollView(cocos2d::Object* target, SEL_ScrollViewEvent selector);
|
||||
|
||||
//override "addChild" method of widget.
|
||||
virtual bool addChild(UIWidget* widget);
|
||||
|
@ -382,8 +382,8 @@ protected:
|
|||
|
||||
|
||||
|
||||
cocos2d::Object* _eventListener;
|
||||
SEL_ScrollViewEvent _eventSelector;
|
||||
cocos2d::Object* _scrollViewEventListener;
|
||||
SEL_ScrollViewEvent _scrollViewEventSelector;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ _slidBallPressedTextureFile(""),
|
|||
_slidBallDisabledTextureFile(""),
|
||||
_capInsetsBarRenderer(cocos2d::Rect::ZERO),
|
||||
_capInsetsProgressBarRenderer(cocos2d::Rect::ZERO),
|
||||
_slidPercentListener(NULL),
|
||||
_slidPercentSelector(NULL),
|
||||
_sliderEventListener(NULL),
|
||||
_sliderEventSelector(NULL),
|
||||
_barTexType(UI_TEX_TYPE_LOCAL),
|
||||
_progressBarTexType(UI_TEX_TYPE_LOCAL),
|
||||
_ballNTexType(UI_TEX_TYPE_LOCAL),
|
||||
|
@ -58,8 +58,8 @@ _ballDTexType(UI_TEX_TYPE_LOCAL)
|
|||
|
||||
UISlider::~UISlider()
|
||||
{
|
||||
_slidPercentListener = NULL;
|
||||
_slidPercentSelector = NULL;
|
||||
_sliderEventListener = NULL;
|
||||
_sliderEventSelector = NULL;
|
||||
}
|
||||
|
||||
UISlider* UISlider::create()
|
||||
|
@ -411,17 +411,17 @@ float UISlider::getPercentWithBallPos(float px)
|
|||
return (((px-(-_barLength/2.0f))/_barLength)*100.0f);
|
||||
}
|
||||
|
||||
void UISlider::addEventListener(cocos2d::Object *target, SEL_SlidPercentChangedEvent selector)
|
||||
void UISlider::addEventListenerSlider(cocos2d::Object *target, SEL_SlidPercentChangedEvent selector)
|
||||
{
|
||||
_slidPercentListener = target;
|
||||
_slidPercentSelector = selector;
|
||||
_sliderEventListener = target;
|
||||
_sliderEventSelector = selector;
|
||||
}
|
||||
|
||||
void UISlider::percentChangedEvent()
|
||||
{
|
||||
if (_slidPercentListener && _slidPercentSelector)
|
||||
if (_sliderEventListener && _sliderEventSelector)
|
||||
{
|
||||
(_slidPercentListener->*_slidPercentSelector)(this,SLIDER_PERCENTCHANGED);
|
||||
(_sliderEventListener->*_sliderEventSelector)(this,SLIDER_PERCENTCHANGED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
/**
|
||||
* Add call back function called when slider's percent has changed to slider.
|
||||
*/
|
||||
void addEventListener(cocos2d::Object* target,SEL_SlidPercentChangedEvent selector);
|
||||
void addEventListenerSlider(cocos2d::Object* target,SEL_SlidPercentChangedEvent selector);
|
||||
|
||||
//override "onTouchBegan" method of widget.
|
||||
virtual bool onTouchBegan(const cocos2d::Point &touchPoint);
|
||||
|
@ -226,8 +226,8 @@ protected:
|
|||
cocos2d::Rect _capInsetsBarRenderer;
|
||||
cocos2d::Rect _capInsetsProgressBarRenderer;
|
||||
|
||||
cocos2d::Object* _slidPercentListener;
|
||||
SEL_SlidPercentChangedEvent _slidPercentSelector;
|
||||
cocos2d::Object* _sliderEventListener;
|
||||
SEL_SlidPercentChangedEvent _sliderEventSelector;
|
||||
TextureResType _barTexType;
|
||||
TextureResType _progressBarTexType;
|
||||
TextureResType _ballNTexType;
|
||||
|
|
|
@ -275,16 +275,16 @@ _textFieldRenderer(NULL),
|
|||
_touchWidth(0.0f),
|
||||
_touchHeight(0.0f),
|
||||
_useTouchArea(false),
|
||||
_eventListener(NULL),
|
||||
_eventSelector(NULL),
|
||||
_textFieldEventListener(NULL),
|
||||
_textFieldEventSelector(NULL),
|
||||
_passwordStyleText("")
|
||||
{
|
||||
}
|
||||
|
||||
UITextField::~UITextField()
|
||||
{
|
||||
_eventListener = NULL;
|
||||
_eventSelector = NULL;
|
||||
_textFieldEventListener = NULL;
|
||||
_textFieldEventSelector = NULL;
|
||||
}
|
||||
|
||||
UITextField* UITextField::create()
|
||||
|
@ -472,40 +472,40 @@ void UITextField::setDeleteBackward(bool deleteBackward)
|
|||
|
||||
void UITextField::attachWithIMEEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_textFieldEventListener && _textFieldEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_ATTACH_WITH_IME);
|
||||
(_textFieldEventListener->*_textFieldEventSelector)(this, TEXTFIELD_EVENT_ATTACH_WITH_IME);
|
||||
}
|
||||
}
|
||||
|
||||
void UITextField::detachWithIMEEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_textFieldEventListener && _textFieldEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_DETACH_WITH_IME);
|
||||
(_textFieldEventListener->*_textFieldEventSelector)(this, TEXTFIELD_EVENT_DETACH_WITH_IME);
|
||||
}
|
||||
}
|
||||
|
||||
void UITextField::insertTextEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_textFieldEventListener && _textFieldEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_INSERT_TEXT);
|
||||
(_textFieldEventListener->*_textFieldEventSelector)(this, TEXTFIELD_EVENT_INSERT_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
void UITextField::deleteBackwardEvent()
|
||||
{
|
||||
if (_eventListener && _eventSelector)
|
||||
if (_textFieldEventListener && _textFieldEventSelector)
|
||||
{
|
||||
(_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_DELETE_BACKWARD);
|
||||
(_textFieldEventListener->*_textFieldEventSelector)(this, TEXTFIELD_EVENT_DELETE_BACKWARD);
|
||||
}
|
||||
}
|
||||
|
||||
void UITextField::addEventListener(cocos2d::Object *target, SEL_TextFieldEvent selecor)
|
||||
void UITextField::addEventListenerTextField(cocos2d::Object *target, SEL_TextFieldEvent selecor)
|
||||
{
|
||||
_eventListener = target;
|
||||
_eventSelector = selecor;
|
||||
_textFieldEventListener = target;
|
||||
_textFieldEventSelector = selecor;
|
||||
}
|
||||
|
||||
void UITextField::setAnchorPoint(const cocos2d::Point &pt)
|
||||
|
|
|
@ -132,7 +132,7 @@ public:
|
|||
void setInsertText(bool insertText);
|
||||
bool getDeleteBackward();
|
||||
void setDeleteBackward(bool deleteBackward);
|
||||
void addEventListener(cocos2d::Object* target, SEL_TextFieldEvent selecor);
|
||||
void addEventListenerTextField(cocos2d::Object* target, SEL_TextFieldEvent selecor);
|
||||
|
||||
virtual void setAnchorPoint(const cocos2d::Point &pt);
|
||||
virtual void setColor(const cocos2d::Color3B &color);
|
||||
|
@ -163,8 +163,8 @@ protected:
|
|||
float _touchHeight;
|
||||
bool _useTouchArea;
|
||||
|
||||
cocos2d::Object* _eventListener;
|
||||
SEL_TextFieldEvent _eventSelector;
|
||||
cocos2d::Object* _textFieldEventListener;
|
||||
SEL_TextFieldEvent _textFieldEventSelector;
|
||||
|
||||
std::string _passwordStyleText;
|
||||
};
|
||||
|
|
|
@ -881,6 +881,8 @@ public:
|
|||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
|
||||
void updateSizeAndPosition();
|
||||
|
||||
virtual Object* getUserObject() { return _userObject; }
|
||||
/**
|
||||
* @js NA
|
||||
|
@ -926,7 +928,6 @@ protected:
|
|||
void cancelUpEvent();
|
||||
void longClickEvent();
|
||||
void updateAnchorPoint();
|
||||
void updateSizeAndPosition();
|
||||
void copyProperties(UIWidget* model);
|
||||
virtual UIWidget* createCloneInstance();
|
||||
virtual void copySpecialProperties(UIWidget* model);
|
||||
|
|
|
@ -12,11 +12,8 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CocosGUI.h" />
|
||||
<ClInclude Include="..\Layout.h" />
|
||||
<ClInclude Include="..\LayoutParameter.h" />
|
||||
<ClInclude Include="..\UIButton.h" />
|
||||
<ClInclude Include="..\UICheckBox.h" />
|
||||
<ClInclude Include="..\UIDragPanel.h" />
|
||||
<ClInclude Include="..\UIHelper.h" />
|
||||
<ClInclude Include="..\UIImageView.h" />
|
||||
<ClInclude Include="..\UIInputManager.h" />
|
||||
|
@ -24,7 +21,9 @@
|
|||
<ClInclude Include="..\UILabelAtlas.h" />
|
||||
<ClInclude Include="..\UILabelBMFont.h" />
|
||||
<ClInclude Include="..\UILayer.h" />
|
||||
<ClInclude Include="..\UILayout.h" />
|
||||
<ClInclude Include="..\UILayoutDefine.h" />
|
||||
<ClInclude Include="..\UILayoutParameter.h" />
|
||||
<ClInclude Include="..\UIListView.h" />
|
||||
<ClInclude Include="..\UILoadingBar.h" />
|
||||
<ClInclude Include="..\UIPageView.h" />
|
||||
|
@ -37,11 +36,8 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\CocosGUI.cpp" />
|
||||
<ClCompile Include="..\Layout.cpp" />
|
||||
<ClCompile Include="..\LayoutParameter.cpp" />
|
||||
<ClCompile Include="..\UIButton.cpp" />
|
||||
<ClCompile Include="..\UICheckBox.cpp" />
|
||||
<ClCompile Include="..\UIDragPanel.cpp" />
|
||||
<ClCompile Include="..\UIHelper.cpp" />
|
||||
<ClCompile Include="..\UIImageView.cpp" />
|
||||
<ClCompile Include="..\UIInputManager.cpp" />
|
||||
|
@ -49,7 +45,9 @@
|
|||
<ClCompile Include="..\UILabelAtlas.cpp" />
|
||||
<ClCompile Include="..\UILabelBMFont.cpp" />
|
||||
<ClCompile Include="..\UILayer.cpp" />
|
||||
<ClCompile Include="..\UILayout.cpp" />
|
||||
<ClCompile Include="..\UILayoutDefine.cpp" />
|
||||
<ClCompile Include="..\UILayoutParameter.cpp" />
|
||||
<ClCompile Include="..\UIListView.cpp" />
|
||||
<ClCompile Include="..\UILoadingBar.cpp" />
|
||||
<ClCompile Include="..\UIPageView.cpp" />
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
<ClInclude Include="..\UIScrollView.h">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIDragPanel.h">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIListView.h">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClInclude>
|
||||
|
@ -72,12 +69,6 @@
|
|||
<ClInclude Include="..\UILayer.h">
|
||||
<Filter>System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Layout.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\LayoutParameter.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UILayoutDefine.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
|
@ -87,14 +78,17 @@
|
|||
<ClInclude Include="..\UIWidget.h">
|
||||
<Filter>BaseClasses</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UILayout.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UILayoutParameter.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\UIScrollView.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIDragPanel.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIListView.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
|
@ -140,12 +134,6 @@
|
|||
<ClCompile Include="..\UILayer.cpp">
|
||||
<Filter>System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Layout.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\LayoutParameter.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UILayoutDefine.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
|
@ -155,5 +143,11 @@
|
|||
<ClCompile Include="..\UIWidget.cpp">
|
||||
<Filter>BaseClasses</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UILayout.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UILayoutParameter.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -539,7 +539,7 @@ bool PhysicsShapePolygon::init(const Point* points, int count, const PhysicsMate
|
|||
cpVect* vecs = new cpVect[count];
|
||||
PhysicsHelper::points2cpvs(points, vecs, count);
|
||||
cpShape* shape = cpPolyShapeNew(_info->getSharedBody(), count, vecs, PhysicsHelper::point2cpv(offset));
|
||||
CC_SAFE_DELETE(vecs);
|
||||
CC_SAFE_DELETE_ARRAY(vecs);
|
||||
|
||||
CC_BREAK_IF(shape == nullptr);
|
||||
|
||||
|
@ -563,7 +563,7 @@ float PhysicsShapePolygon::calculateArea(const Point* points, int count)
|
|||
cpVect* vecs = new cpVect[count];
|
||||
PhysicsHelper::points2cpvs(points, vecs, count);
|
||||
float area = PhysicsHelper::cpfloat2float(cpAreaForPoly(count, vecs));
|
||||
CC_SAFE_DELETE(vecs);
|
||||
CC_SAFE_DELETE_ARRAY(vecs);
|
||||
|
||||
return area;
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ float PhysicsShapePolygon::calculateMoment(float mass, const Point* points, int
|
|||
PhysicsHelper::points2cpvs(points, vecs, count);
|
||||
float moment = mass == PHYSICS_INFINITY ? PHYSICS_INFINITY
|
||||
: PhysicsHelper::cpfloat2float(cpMomentForPoly(mass, count, vecs, PhysicsHelper::point2cpv(offset)));
|
||||
CC_SAFE_DELETE(vecs);
|
||||
CC_SAFE_DELETE_ARRAY(vecs);
|
||||
|
||||
return moment;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5788b2500339473ecc19acf1c2e43656a2537a6d
|
||||
Subproject commit 3fa10c3f8f9fe083ef05cb401924d31740da9719
|
|
@ -32,7 +32,7 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
std::map<int, std::string> g_luaType;
|
||||
std::map<long, std::string> g_luaType;
|
||||
|
||||
#if COCOS2D_DEBUG >=1
|
||||
void luaval_to_native_err(lua_State* L,const char* msg,tolua_Error* err)
|
||||
|
|
|
@ -10,7 +10,7 @@ extern "C" {
|
|||
|
||||
using namespace cocos2d;
|
||||
|
||||
extern std::map<int, std::string> g_luaType;
|
||||
extern std::map<long, std::string> g_luaType;
|
||||
|
||||
#if COCOS2D_DEBUG >=1
|
||||
void luaval_to_native_err(lua_State* L,const char* msg,tolua_Error* err);
|
||||
|
|
|
@ -54,7 +54,7 @@ bool UICheckBoxTest::init()
|
|||
"cocosgui/check_box_active_disable.png");
|
||||
checkBox->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||
|
||||
checkBox->addEventListener(this, checkboxselectedeventselector(UICheckBoxTest::selectedEvent));
|
||||
checkBox->addEventListenerCheckBox(this, checkboxselectedeventselector(UICheckBoxTest::selectedEvent));
|
||||
|
||||
// checkBox->addSelectEvent(this, coco_selectselector(UICheckBoxTest::selectedEvent));
|
||||
m_pUiLayer->addWidget(checkBox);
|
||||
|
|
|
@ -79,7 +79,7 @@ bool UIPageViewTest::init()
|
|||
|
||||
pageView->addPage(layout);
|
||||
}
|
||||
pageView->addEventListener(this, pagevieweventselector(UIPageViewTest::pageViewEvent));
|
||||
pageView->addEventListenerPageView(this, pagevieweventselector(UIPageViewTest::pageViewEvent));
|
||||
|
||||
m_pUiLayer->addWidget(pageView);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ bool UIScene::init()
|
|||
m_pUiLayer = UILayer::create();
|
||||
addChild(m_pUiLayer);
|
||||
|
||||
m_pWidget = dynamic_cast<UILayout*>(cocostudio::CCSGUIReader::shareReader()->widgetFromJsonFile("cocosgui/UITest/UITest.json"));
|
||||
m_pWidget = dynamic_cast<UILayout*>(cocostudio::GUIReader::shareReader()->widgetFromJsonFile("cocosgui/UITest/UITest.json"));
|
||||
m_pUiLayer->addWidget(m_pWidget);
|
||||
|
||||
m_pSceneTitle = dynamic_cast<UILabel*>(m_pUiLayer->getWidgetByName("UItest"));
|
||||
|
|
|
@ -52,7 +52,7 @@ bool UISliderTest::init()
|
|||
slider->loadSlidBallTextures("cocosgui/sliderThumb.png", "cocosgui/sliderThumb.png", "");
|
||||
slider->loadProgressBarTexture("cocosgui/sliderProgress.png");
|
||||
slider->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||
slider->addEventListener(this, sliderpercentchangedselector(UISliderTest::percentChangedEvent));
|
||||
slider->addEventListenerSlider(this, sliderpercentchangedselector(UISliderTest::percentChangedEvent));
|
||||
m_pUiLayer->addWidget(slider);
|
||||
|
||||
return true;
|
||||
|
@ -116,7 +116,7 @@ bool UISliderTest_Scale9::init()
|
|||
slider->setCapInsets(Rect(0, 0, 0, 0));
|
||||
slider->setSize(Size(250, 10));
|
||||
slider->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||
slider->addEventListener(this, sliderpercentchangedselector(UISliderTest_Scale9::percentChangedEvent));
|
||||
slider->addEventListenerSlider(this, sliderpercentchangedselector(UISliderTest_Scale9::percentChangedEvent));
|
||||
m_pUiLayer->addWidget(slider);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -51,7 +51,7 @@ bool UITextFieldTest::init()
|
|||
textField->setFontSize(30);
|
||||
textField->setPlaceHolder("input words here");
|
||||
textField->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||
textField->addEventListener(this, textfieldeventselector(UITextFieldTest::textFieldEvent));
|
||||
textField->addEventListenerTextField(this, textfieldeventselector(UITextFieldTest::textFieldEvent));
|
||||
m_pUiLayer->addWidget(textField);
|
||||
|
||||
return true;
|
||||
|
@ -139,7 +139,7 @@ bool UITextFieldTest_MaxLength::init()
|
|||
textField->setFontSize(30);
|
||||
textField->setPlaceHolder("input words here");
|
||||
textField->setPosition(Point(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
textField->addEventListener(this, textfieldeventselector(UITextFieldTest_MaxLength::textFieldEvent));
|
||||
textField->addEventListenerTextField(this, textfieldeventselector(UITextFieldTest_MaxLength::textFieldEvent));
|
||||
m_pUiLayer->addWidget(textField);
|
||||
|
||||
return true;
|
||||
|
@ -233,7 +233,7 @@ bool UITextFieldTest_Password::init()
|
|||
textField->setFontSize(30);
|
||||
textField->setPlaceHolder("input password here");
|
||||
textField->setPosition(Point(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
textField->addEventListener(this, textfieldeventselector(UITextFieldTest_Password::textFieldEvent));
|
||||
textField->addEventListenerTextField(this, textfieldeventselector(UITextFieldTest_Password::textFieldEvent));
|
||||
m_pUiLayer->addWidget(textField);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9797d4403207848f431d5b6456632cc966d84b0d
|
||||
Subproject commit 2f3c19e01d5043485d0887ad69a3f02e312ad690
|
Loading…
Reference in New Issue