mirror of https://github.com/axmolengine/axmol.git
Merge branch 'gles20' of git://github.com/cocos2d/cocos2d-x into gles20
This commit is contained in:
commit
0cd22c380e
|
@ -144,13 +144,13 @@ OBJECTS = ../actions/CCAction.o \
|
|||
../../extensions/CCBReader/CCLayerGradientLoader.o \
|
||||
../../extensions/CCBReader/CCSpriteLoader.o \
|
||||
../../extensions/CCBReader/CCLayerLoader.o \
|
||||
../../extensions/CCBReader/CCBAnimationManager.o \
|
||||
../../extensions/CCBReader/CCBKeyframe.o \
|
||||
../../extensions/CCBReader/CCBSequence.o \
|
||||
../../extensions/CCBReader/CCBSequenceProperty.o \
|
||||
../../extensions/CCBReader/CCBValue.o \
|
||||
../../extensions/CCBReader/CCData.o \
|
||||
../../extensions/CCBReader/CCNode+CCBRelativePositioning.o \
|
||||
../../extensions/CCBReader/CCBAnimationManager.o \
|
||||
../../extensions/CCBReader/CCBKeyframe.o \
|
||||
../../extensions/CCBReader/CCBSequence.o \
|
||||
../../extensions/CCBReader/CCBSequenceProperty.o \
|
||||
../../extensions/CCBReader/CCBValue.o \
|
||||
../../extensions/CCBReader/CCData.o \
|
||||
../../extensions/CCBReader/CCNode+CCBRelativePositioning.o \
|
||||
../../extensions/GUI/CCScrollView/CCScrollView.o \
|
||||
../../extensions/GUI/CCScrollView/CCSorting.o \
|
||||
../../extensions/GUI/CCScrollView/CCTableView.o \
|
||||
|
@ -164,9 +164,9 @@ OBJECTS = ../actions/CCAction.o \
|
|||
../../extensions/GUI/CCControlExtension/CCControlSwitch.o \
|
||||
../../extensions/GUI/CCControlExtension/CCControlUtils.o \
|
||||
../../extensions/GUI/CCControlExtension/CCInvocation.o \
|
||||
../../extensions/GUI/CCControlExtension/CCMenuPassive.o \
|
||||
../../extensions/GUI/CCControlExtension/CCScale9Sprite.o \
|
||||
../../extensions/GUI/CCControlExtension/CCSpacer.o \
|
||||
../../extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp \
|
||||
../../extensions/GUI/CCControlExtension/CCControlStepper.cpp \
|
||||
../../extensions/network/HttpClient.o \
|
||||
../kazmath/src/aabb.o \
|
||||
../kazmath/src/plane.o \
|
||||
|
|
|
@ -38,9 +38,9 @@ GUI/CCControlExtension/CCControlSlider.cpp \
|
|||
GUI/CCControlExtension/CCControlSwitch.cpp \
|
||||
GUI/CCControlExtension/CCControlUtils.cpp \
|
||||
GUI/CCControlExtension/CCInvocation.cpp \
|
||||
GUI/CCControlExtension/CCMenuPassive.cpp \
|
||||
GUI/CCControlExtension/CCScale9Sprite.cpp \
|
||||
GUI/CCControlExtension/CCSpacer.cpp \
|
||||
GUI/CCControlExtension/CCControlPotentiometer.cpp \
|
||||
GUI/CCControlExtension/CCControlStepper.cpp \
|
||||
GUI/CCScrollView/CCScrollView.cpp \
|
||||
GUI/CCScrollView/CCTableView.cpp \
|
||||
GUI/CCScrollView/CCTableViewCell.cpp \
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __EXTENSIONMARCROS_H__
|
||||
#define __EXTENSIONMARCROS_H__
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControl.m
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2011 Yannick Loriot.
|
||||
* http://yannickloriot.com
|
||||
|
@ -35,6 +36,16 @@
|
|||
NS_CC_EXT_BEGIN
|
||||
|
||||
CCControl::CCControl()
|
||||
: m_cOpacity(0)
|
||||
, m_tColor(ccBLACK)
|
||||
, m_bIsOpacityModifyRGB(false)
|
||||
, m_nDefaultTouchPriority(0)
|
||||
, m_eState(CCControlStateNormal)
|
||||
, m_hasVisibleParents(false)
|
||||
, m_bEnabled(false)
|
||||
, m_bSelected(false)
|
||||
, m_bHighlighted(false)
|
||||
, m_pDispatchTable(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -46,76 +57,75 @@ bool CCControl::init()
|
|||
//this->setTouchEnabled(true);
|
||||
//m_bIsTouchEnabled=true;
|
||||
// Initialise instance variables
|
||||
m_nState=CCControlStateNormal;
|
||||
m_bEnabled=true;
|
||||
m_bSelected=false;
|
||||
m_bHighlighted=false;
|
||||
m_eState=CCControlStateNormal;
|
||||
setEnabled(true);
|
||||
setSelected(false);
|
||||
setHighlighted(false);
|
||||
|
||||
// Set the touch dispatcher priority by default to 1
|
||||
m_nDefaultTouchPriority = 1;
|
||||
setDefaultTouchPriority(1);
|
||||
this->setDefaultTouchPriority(m_nDefaultTouchPriority);
|
||||
// Initialise the tables
|
||||
dispatchTable=new CCDictionary();
|
||||
//dispatchTable->autorelease();
|
||||
// dispatchTable_ = [[NSMutableDictionary alloc] initWithCapacity:1];
|
||||
m_pDispatchTable = new CCDictionary();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CCControl::~CCControl()
|
||||
{
|
||||
CC_SAFE_RELEASE(dispatchTable);
|
||||
CC_SAFE_RELEASE(m_pDispatchTable);
|
||||
}
|
||||
|
||||
//Menu - Events
|
||||
void CCControl::registerWithTouchDispatcher()
|
||||
{
|
||||
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, kCCMenuHandlerPriority, true);
|
||||
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, m_nDefaultTouchPriority, true);
|
||||
}
|
||||
|
||||
void CCControl::onEnter()
|
||||
{
|
||||
//CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, m_nDefaultTouchPriority, true);
|
||||
CCLayer::onEnter();
|
||||
}
|
||||
|
||||
void CCControl::onExit()
|
||||
{
|
||||
//CCTouchDispatcher::sharedDispatcher()->removeDelegate(this);
|
||||
CCLayer::onExit();
|
||||
}
|
||||
|
||||
void CCControl::sendActionsForControlEvents(CCControlEvent controlEvents)
|
||||
{
|
||||
// For each control events
|
||||
for (int i = 0; i < CONTROL_EVENT_TOTAL_NUMBER; i++)
|
||||
for (int i = 0; i < kControlEventTotalNumber; i++)
|
||||
{
|
||||
// If the given controlEvents bitmask contains the curent event
|
||||
if ((controlEvents & (1 << i)))
|
||||
{
|
||||
// Call invocations
|
||||
// <CCInvocation*>
|
||||
CCArray* invocationList=CCControl::dispatchListforControlEvent(1<<i);
|
||||
CCArray* invocationList = this->dispatchListforControlEvent(1<<i);
|
||||
CCObject* pObj = NULL;
|
||||
CCARRAY_FOREACH(invocationList, pObj)
|
||||
{
|
||||
CCInvocation* invocation = (CCInvocation*)pObj;
|
||||
invocation->invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void CCControl::addTargetWithActionForControlEvents(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvents)
|
||||
{
|
||||
// For each control events
|
||||
for (int i = 0; i < CONTROL_EVENT_TOTAL_NUMBER; i++)
|
||||
for (int i = 0; i < kControlEventTotalNumber; i++)
|
||||
{
|
||||
// If the given controlEvents bitmask contains the curent event
|
||||
if ((controlEvents & (1 << i)))
|
||||
{
|
||||
CCControl::addTargetWithActionForControlEvent(target, action, 1<<i);
|
||||
this->addTargetWithActionForControlEvent(target, action, 1<<i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +139,7 @@ void CCControl::addTargetWithActionForControlEvents(CCObject* target, SEL_CCCont
|
|||
* parameters, in that order.
|
||||
* When you call this method, target is not retained.
|
||||
*
|
||||
* @param target The target object—that is, the object to which the action
|
||||
* @param target The target object that is, the object to which the action
|
||||
* message is sent. It cannot be nil. The target is not retained.
|
||||
* @param action A selector identifying an action message. It cannot be NULL.
|
||||
* @param controlEvent A control event for which the action message is sent.
|
||||
|
@ -138,43 +148,31 @@ void CCControl::addTargetWithActionForControlEvents(CCObject* target, SEL_CCCont
|
|||
void CCControl::addTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent)
|
||||
{
|
||||
// Create the invocation object
|
||||
CCInvocation *invocation=new CCInvocation(target, action, controlEvent);
|
||||
invocation->autorelease();
|
||||
CCInvocation *invocation = CCInvocation::create(target, action, controlEvent);
|
||||
|
||||
// Add the invocation into the dispatch list for the given control event
|
||||
CCArray* eventInvocationList = dispatchListforControlEvent(controlEvent);
|
||||
CCArray* eventInvocationList = this->dispatchListforControlEvent(controlEvent);
|
||||
eventInvocationList->addObject(invocation);
|
||||
}
|
||||
|
||||
void CCControl::removeTargetWithActionForControlEvents(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvents)
|
||||
{
|
||||
// For each control events
|
||||
for (int i = 0; i < CONTROL_EVENT_TOTAL_NUMBER; i++)
|
||||
for (int i = 0; i < kControlEventTotalNumber; i++)
|
||||
{
|
||||
// If the given controlEvents bitmask contains the curent event
|
||||
if ((controlEvents & (1 << i)))
|
||||
{
|
||||
removeTargetWithActionForControlEvent(target, action, 1 << i);
|
||||
this->removeTargetWithActionForControlEvent(target, action, 1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a target and action for a particular event from an internal dispatch
|
||||
* table.
|
||||
*
|
||||
* @param target The target object—that is, the object to which the action
|
||||
* message is sent. Pass nil to remove all targets paired with action and the
|
||||
* specified control events.
|
||||
* @param action A selector identifying an action message. Pass NULL to remove
|
||||
* all action messages paired with target.
|
||||
* @param controlEvent A control event for which the action message is sent.
|
||||
* See "CCControlEvent" for constants.
|
||||
*/
|
||||
void CCControl::removeTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent)
|
||||
{
|
||||
// Retrieve all invocations for the given control event
|
||||
//<CCInvocation*>
|
||||
CCArray *eventInvocationList=dispatchListforControlEvent(controlEvent);
|
||||
CCArray *eventInvocationList = this->dispatchListforControlEvent(controlEvent);
|
||||
|
||||
//remove all invocations if the target and action are null
|
||||
//TODO: should the invocations be deleted, or just removed from the array? Won't that cause issues if you add a single invocation for multiple events?
|
||||
|
@ -192,13 +190,19 @@ void CCControl::removeTargetWithActionForControlEvent(CCObject* target, SEL_CCCo
|
|||
{
|
||||
CCInvocation *invocation = (CCInvocation*)pObj;
|
||||
bool shouldBeRemoved=true;
|
||||
if (target)
|
||||
shouldBeRemoved=(target==invocation->getTarget());
|
||||
if (target)
|
||||
{
|
||||
shouldBeRemoved=(target==invocation->getTarget());
|
||||
}
|
||||
if (action)
|
||||
{
|
||||
shouldBeRemoved=(shouldBeRemoved && (action==invocation->getAction()));
|
||||
}
|
||||
// Remove the corresponding invocation object
|
||||
if (shouldBeRemoved)
|
||||
{
|
||||
eventInvocationList->removeObject(invocation, bDeleteObjects);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,17 +253,17 @@ GLubyte CCControl::getOpacity()
|
|||
}
|
||||
|
||||
|
||||
void CCControl::setOpacityModifyRGB(bool opacityModifyRGB)
|
||||
void CCControl::setOpacityModifyRGB(bool bOpacityModifyRGB)
|
||||
{
|
||||
m_bIsOpacityModifyRGB=opacityModifyRGB;
|
||||
CCObject* child;
|
||||
m_bIsOpacityModifyRGB=bOpacityModifyRGB;
|
||||
CCObject* child;
|
||||
CCArray* children=getChildren();
|
||||
CCARRAY_FOREACH(children, child)
|
||||
{
|
||||
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
|
||||
if (pNode)
|
||||
{
|
||||
pNode->setOpacityModifyRGB(opacityModifyRGB);
|
||||
pNode->setOpacityModifyRGB(bOpacityModifyRGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,35 +276,47 @@ bool CCControl::isOpacityModifyRGB()
|
|||
|
||||
CCPoint CCControl::getTouchLocation(CCTouch* touch)
|
||||
{
|
||||
CCPoint touchLocation = touch->getLocation();; // Get the touch position
|
||||
touchLocation = this->getParent()->convertToNodeSpace(touchLocation); // Convert to the node space of this class
|
||||
CCPoint touchLocation = touch->getLocation(); // Get the touch position
|
||||
touchLocation = this->convertToNodeSpace(touchLocation); // Convert to the node space of this class
|
||||
|
||||
return touchLocation;
|
||||
}
|
||||
|
||||
bool CCControl::isTouchInside(CCTouch* touch)
|
||||
{
|
||||
CCPoint touchLocation=getTouchLocation(touch);
|
||||
CCPoint touchLocation = touch->getLocation(); // Get the touch position
|
||||
touchLocation = this->getParent()->convertToNodeSpace(touchLocation);
|
||||
CCRect bBox=boundingBox();
|
||||
return bBox.containsPoint(touchLocation);
|
||||
}
|
||||
|
||||
CCArray* CCControl::dispatchListforControlEvent(CCControlEvent controlEvent)
|
||||
{
|
||||
CCArray* invocationList = (CCArray*)dispatchTable->objectForKey(controlEvent);
|
||||
CCArray* invocationList = (CCArray*)m_pDispatchTable->objectForKey(controlEvent);
|
||||
|
||||
// If the invocation list does not exist for the dispatch table, we create it
|
||||
if (invocationList == NULL)
|
||||
{
|
||||
invocationList = CCArray::createWithCapacity(1);
|
||||
dispatchTable->setObject(invocationList, controlEvent);
|
||||
m_pDispatchTable->setObject(invocationList, controlEvent);
|
||||
}
|
||||
return invocationList;
|
||||
}
|
||||
|
||||
void CCControl::needsLayout()
|
||||
{
|
||||
}
|
||||
|
||||
void CCControl::setEnabled(bool bEnabled)
|
||||
{
|
||||
m_bEnabled = bEnabled;
|
||||
if(m_bEnabled) {
|
||||
m_eState = CCControlStateNormal;
|
||||
} else {
|
||||
m_eState = CCControlStateDisabled;
|
||||
}
|
||||
|
||||
this->needsLayout();
|
||||
}
|
||||
|
||||
bool CCControl::isEnabled()
|
||||
|
@ -311,6 +327,7 @@ bool CCControl::isEnabled()
|
|||
void CCControl::setSelected(bool bSelected)
|
||||
{
|
||||
m_bSelected = bSelected;
|
||||
this->needsLayout();
|
||||
}
|
||||
|
||||
bool CCControl::isSelected()
|
||||
|
@ -321,6 +338,7 @@ bool CCControl::isSelected()
|
|||
void CCControl::setHighlighted(bool bHighlighted)
|
||||
{
|
||||
m_bHighlighted = bHighlighted;
|
||||
this->needsLayout();
|
||||
}
|
||||
|
||||
bool CCControl::isHighlighted()
|
||||
|
@ -328,4 +346,17 @@ bool CCControl::isHighlighted()
|
|||
return m_bHighlighted;
|
||||
}
|
||||
|
||||
bool CCControl::hasVisibleParents()
|
||||
{
|
||||
CCNode* pParent = this->getParent();
|
||||
for( CCNode *c = pParent; c != NULL; c = c->getParent() )
|
||||
{
|
||||
if( !c->isVisible() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControl.h
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2011 Yannick Loriot.
|
||||
* http://yannickloriot.com
|
||||
|
@ -31,7 +32,7 @@
|
|||
|
||||
#include "CCInvocation.h"
|
||||
#include "CCControlUtils.h"
|
||||
#include "layers_scenes_transitions_nodes/CCLayer.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
@ -45,7 +46,7 @@ class CCInvocation;
|
|||
*/
|
||||
|
||||
/** Number of kinds of control event. */
|
||||
#define CONTROL_EVENT_TOTAL_NUMBER 9
|
||||
#define kControlEventTotalNumber 9
|
||||
|
||||
/** Kinds of possible events for the control objects. */
|
||||
enum
|
||||
|
@ -65,11 +66,10 @@ typedef unsigned int CCControlEvent;
|
|||
/** The possible state for a control. */
|
||||
enum
|
||||
{
|
||||
CCControlStateNormal = 1 << 0, // The normal, or default state of a control—that is, enabled but neither selected nor highlighted.
|
||||
CCControlStateNormal = 1 << 0, // The normal, or default state of a control¡ªthat is, enabled but neither selected nor highlighted.
|
||||
CCControlStateHighlighted = 1 << 1, // Highlighted state of a control. A control enters this state when a touch down, drag inside or drag enter is performed. You can retrieve and set this value through the highlighted property.
|
||||
CCControlStateDisabled = 1 << 2, // Disabled state of a control. This state indicates that the control is currently disabled. You can retrieve and set this value through the enabled property.
|
||||
CCControlStateSelected = 1 << 3, // Selected state of a control. This state indicates that the control is currently selected. You can retrieve and set this value through the selected property.
|
||||
CCControlStateInitial = 1 << 3
|
||||
CCControlStateSelected = 1 << 3 // Selected state of a control. This state indicates that the control is currently selected. You can retrieve and set this value through the selected property.
|
||||
};
|
||||
typedef unsigned int CCControlState;
|
||||
|
||||
|
@ -93,12 +93,16 @@ class CCControl : public CCLayer, public CCRGBAProtocol
|
|||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
|
||||
bool m_bIsOpacityModifyRGB;
|
||||
bool isOpacityModifyRGB();
|
||||
void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
||||
void setOpacityModifyRGB(bool bOpacityModifyRGB);
|
||||
|
||||
/** Changes the priority of the button. The lower the number, the higher the priority. */
|
||||
CC_SYNTHESIZE(int, m_nDefaultTouchPriority, DefaultTouchPriority);
|
||||
/** The current control state constant. */
|
||||
CC_SYNTHESIZE_READONLY(CCControlState, m_nState, State);
|
||||
CC_SYNTHESIZE_READONLY(CCControlState, m_eState, State);
|
||||
|
||||
/** True if all of the controls parents are visible */
|
||||
protected:
|
||||
bool m_hasVisibleParents;
|
||||
|
||||
public:
|
||||
/** Tells whether the control is enabled. */
|
||||
|
@ -110,16 +114,23 @@ public:
|
|||
/** A Boolean value that determines whether the control is highlighted. */
|
||||
virtual void setHighlighted(bool bHighlighted);
|
||||
virtual bool isHighlighted();
|
||||
bool hasVisibleParents();
|
||||
/**
|
||||
* Updates the control layout using its current internal state.
|
||||
*/
|
||||
virtual void needsLayout();
|
||||
|
||||
protected:
|
||||
bool m_bEnabled;
|
||||
bool m_bSelected;
|
||||
bool m_bHighlighted;
|
||||
|
||||
// CCControlState, CCArray<CCInvocation*>
|
||||
CCDictionary* dispatchTable;
|
||||
|
||||
|
||||
/**
|
||||
* Table of connection between the CCControlEvents and their associated
|
||||
* target-actions pairs. For each CCButtonEvents a list of NSInvocation
|
||||
* (which contains the target-action pair) is linked.
|
||||
*/
|
||||
CCDictionary* m_pDispatchTable;
|
||||
|
||||
public:
|
||||
CCControl();
|
||||
|
@ -146,7 +157,7 @@ public:
|
|||
* parameters, in that order.
|
||||
* When you call this method, target is not retained.
|
||||
*
|
||||
* @param target The target object—that is, the object to which the action
|
||||
* @param target The target object that is, the object to which the action
|
||||
* message is sent. It cannot be nil. The target is not retained.
|
||||
* @param action A selector identifying an action message. It cannot be NULL.
|
||||
* @param controlEvents A bitmask specifying the control events for which the
|
||||
|
@ -182,25 +193,25 @@ public:
|
|||
*
|
||||
* @param touch A CCTouch object that represents a touch.
|
||||
*
|
||||
* @return YES whether a touch is inside the receiver’s rect.
|
||||
* @return YES whether a touch is inside the receiver¡¯s rect.
|
||||
*/
|
||||
virtual bool isTouchInside(CCTouch * touch);
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Returns an CCInvocation object able to construct messages using a given
|
||||
* target-action pair. (The invocation may optionnaly include the sender and
|
||||
* the event as parameters, in that order)
|
||||
*
|
||||
* @param target The target object.
|
||||
* @param action A selector identifying an action message.
|
||||
* @param controlEvent A control events for which the action message is sent.
|
||||
* See "CCControlEvent" for constants.
|
||||
*
|
||||
* @return an CCInvocation object able to construct messages using a given
|
||||
* target-action pair.
|
||||
*/
|
||||
* Returns an CCInvocation object able to construct messages using a given
|
||||
* target-action pair. (The invocation may optionnaly include the sender and
|
||||
* the event as parameters, in that order)
|
||||
*
|
||||
* @param target The target object.
|
||||
* @param action A selector identifying an action message.
|
||||
* @param controlEvent A control events for which the action message is sent.
|
||||
* See "CCControlEvent" for constants.
|
||||
*
|
||||
* @return an CCInvocation object able to construct messages using a given
|
||||
* target-action pair.
|
||||
*/
|
||||
CCInvocation* invocationWithTargetAndActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
|
||||
|
||||
|
||||
|
@ -216,8 +227,33 @@ protected:
|
|||
*/
|
||||
//<CCInvocation*>
|
||||
CCArray* dispatchListforControlEvent(CCControlEvent controlEvent);
|
||||
public:
|
||||
/**
|
||||
* Adds a target and action for a particular event to an internal dispatch
|
||||
* table.
|
||||
* The action message may optionnaly include the sender and the event as
|
||||
* parameters, in that order.
|
||||
* When you call this method, target is not retained.
|
||||
*
|
||||
* @param target The target object¡ªthat is, the object to which the action
|
||||
* message is sent. It cannot be nil. The target is not retained.
|
||||
* @param action A selector identifying an action message. It cannot be NULL.
|
||||
* @param controlEvent A control event for which the action message is sent.
|
||||
* See "CCControlEvent" for constants.
|
||||
*/
|
||||
void addTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
|
||||
|
||||
/**
|
||||
* Removes a target and action for a particular event from an internal dispatch
|
||||
* table.
|
||||
*
|
||||
* @param target The target object¡ªthat is, the object to which the action
|
||||
* message is sent. Pass nil to remove all targets paired with action and the
|
||||
* specified control events.
|
||||
* @param action A selector identifying an action message. Pass NULL to remove
|
||||
* all action messages paired with target.
|
||||
* @param controlEvent A control event for which the action message is sent.
|
||||
* See "CCControlEvent" for constants.
|
||||
*/
|
||||
void removeTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
|
||||
|
||||
CREATE_FUNC(CCControl);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlButton.m
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2011 Yannick Loriot.
|
||||
* http://yannickloriot.com
|
||||
|
@ -41,12 +42,32 @@ enum
|
|||
kZoomActionTag = 0xCCCB0001,
|
||||
};
|
||||
|
||||
CCControlButton::CCControlButton()
|
||||
: m_currentTitle(NULL)
|
||||
, m_currentTitleColor(ccWHITE)
|
||||
, m_doesAdjustBackgroundImage(false)
|
||||
, m_titleLabel(NULL)
|
||||
, m_backgroundSprite(NULL)
|
||||
, m_zoomOnTouchDown(false)
|
||||
, m_isPushed(false)
|
||||
, m_bParentInited(false)
|
||||
, m_titleDispatchTable(NULL)
|
||||
, m_titleColorDispatchTable(NULL)
|
||||
, m_titleLabelDispatchTable(NULL)
|
||||
, m_backgroundSpriteDispatchTable(NULL)
|
||||
, m_marginH(CCControlButtonMarginLR)
|
||||
, m_marginV(CCControlButtonMarginTB)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlButton::~CCControlButton()
|
||||
{
|
||||
CC_SAFE_RELEASE(m_backgroundSpriteDispatchTable);
|
||||
CC_SAFE_RELEASE(m_titleLabelDispatchTable);
|
||||
CC_SAFE_RELEASE(m_titleColorDispatchTable);
|
||||
CC_SAFE_RELEASE(m_titleDispatchTable);
|
||||
CC_SAFE_RELEASE(m_backgroundSprite);
|
||||
}
|
||||
|
||||
//initialisers
|
||||
|
@ -56,50 +77,47 @@ bool CCControlButton::init()
|
|||
return this->initWithLabelAndBackgroundSprite(CCLabelTTF::create("", "Helvetica", 12), CCScale9Sprite::create());
|
||||
}
|
||||
|
||||
|
||||
bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Sprite* backgroundSprite)
|
||||
{
|
||||
if (CCControl::init())
|
||||
{
|
||||
assert(node != NULL);
|
||||
CCAssert(node != NULL, "Label must not be nil.");
|
||||
CCLabelProtocol* label = dynamic_cast<CCLabelProtocol*>(node);
|
||||
CCRGBAProtocol* rgbaLabel = dynamic_cast<CCRGBAProtocol*>(node);
|
||||
assert(label != NULL || rgbaLabel!=NULL || backgroundSprite != NULL);
|
||||
CCAssert(backgroundSprite != NULL, "Background sprite must not be nil.");
|
||||
CCAssert(label != NULL || rgbaLabel!=NULL || backgroundSprite != NULL, "");
|
||||
|
||||
m_bParentInited = true;
|
||||
|
||||
// Initialize the button state tables
|
||||
this->setTitleDispatchTable(CCDictionary::create());
|
||||
this->setTitleColorDispatchTable(CCDictionary::create());
|
||||
this->setTitleLabelDispatchTable(CCDictionary::create());
|
||||
this->setBackgroundSpriteDispatchTable(CCDictionary::create());
|
||||
|
||||
setTouchEnabled(true);
|
||||
pushed=false;
|
||||
m_isPushed = false;
|
||||
m_zoomOnTouchDown = true;
|
||||
m_nState=CCControlStateInitial;
|
||||
|
||||
m_currentTitle=NULL;
|
||||
|
||||
// Adjust the background image by default
|
||||
m_adjustBackgroundImage=true;
|
||||
|
||||
setAdjustBackgroundImage(true);
|
||||
setPreferredSize(CCSizeZero);
|
||||
// Zooming button by default
|
||||
m_zoomOnTouchDown = true;
|
||||
|
||||
|
||||
// Set the default anchor point
|
||||
ignoreAnchorPointForPosition(false);
|
||||
setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
|
||||
// Set the nodes
|
||||
m_titleLabel = node;
|
||||
m_backgroundSprite = backgroundSprite;
|
||||
|
||||
|
||||
// Initialize the button state tables
|
||||
m_titleDispatchTable=new CCDictionary();
|
||||
//m_titleDispatchTable->autorelease();
|
||||
m_titleColorDispatchTable=new CCDictionary();
|
||||
//m_titleColorDispatchTable->autorelease();
|
||||
m_titleLabelDispatchTable=new CCDictionary();
|
||||
//m_titleLabelDispatchTable->autorelease();
|
||||
m_backgroundSpriteDispatchTable=new CCDictionary();
|
||||
//m_backgroundSpriteDispatchTable->autorelease();
|
||||
setTitleLabel(node);
|
||||
setBackgroundSprite(backgroundSprite);
|
||||
|
||||
// Set the default color and opacity
|
||||
setColor(ccc3(255, 255, 255));
|
||||
setOpacity(255);
|
||||
setColor(ccc3(255.0f, 255.0f, 255.0f));
|
||||
setOpacity(255.0f);
|
||||
setOpacityModifyRGB(true);
|
||||
|
||||
// Initialize the dispatch table
|
||||
|
@ -111,13 +129,7 @@ bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Spr
|
|||
setTitleLabelForState(node, CCControlStateNormal);
|
||||
setBackgroundSpriteForState(backgroundSprite, CCControlStateNormal);
|
||||
|
||||
m_nState=CCControlStateNormal;
|
||||
|
||||
//default margins
|
||||
m_marginH=24;
|
||||
m_marginV=12;
|
||||
|
||||
this->m_labelAnchorPoint = CCPoint(0.5f, 0.5f);
|
||||
setLabelAnchorPoint(ccp(0.5f, 0.5f));
|
||||
|
||||
// Layout update
|
||||
needsLayout();
|
||||
|
@ -126,7 +138,9 @@ bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Spr
|
|||
}
|
||||
//couldn't init the CCControl
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CCControlButton* CCControlButton::buttonWithLabelAndBackgroundSprite(CCNode* label, CCScale9Sprite* backgroundSprite)
|
||||
|
@ -233,20 +247,20 @@ void CCControlButton::setPreferredSize(CCSize size)
|
|||
{
|
||||
if(size.width == 0 && size.height == 0)
|
||||
{
|
||||
m_adjustBackgroundImage = true;
|
||||
m_doesAdjustBackgroundImage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_adjustBackgroundImage = false;
|
||||
m_doesAdjustBackgroundImage = false;
|
||||
CCDictElement * item = NULL;
|
||||
CCDICT_FOREACH(m_backgroundSpriteDispatchTable, item)
|
||||
{
|
||||
CCScale9Sprite* sprite = (CCScale9Sprite*)item->getObject();
|
||||
sprite->setPreferredSize(size);
|
||||
}
|
||||
|
||||
m_preferredSize = size;
|
||||
}
|
||||
|
||||
m_preferredSize = size;
|
||||
needsLayout();
|
||||
}
|
||||
|
||||
|
@ -257,13 +271,13 @@ CCSize CCControlButton::getPreferredSize()
|
|||
|
||||
void CCControlButton::setAdjustBackgroundImage(bool adjustBackgroundImage)
|
||||
{
|
||||
m_adjustBackgroundImage=adjustBackgroundImage;
|
||||
m_doesAdjustBackgroundImage=adjustBackgroundImage;
|
||||
needsLayout();
|
||||
}
|
||||
|
||||
bool CCControlButton::getAdjustBackgroundImage()
|
||||
bool CCControlButton::doesAdjustBackgroundImage()
|
||||
{
|
||||
return m_adjustBackgroundImage;
|
||||
return m_doesAdjustBackgroundImage;
|
||||
}
|
||||
|
||||
CCPoint CCControlButton::getLabelAnchorPoint()
|
||||
|
@ -274,18 +288,24 @@ CCPoint CCControlButton::getLabelAnchorPoint()
|
|||
void CCControlButton::setLabelAnchorPoint(CCPoint labelAnchorPoint)
|
||||
{
|
||||
this->m_labelAnchorPoint = labelAnchorPoint;
|
||||
|
||||
this->m_titleLabel->setAnchorPoint(labelAnchorPoint);
|
||||
if (m_titleLabel != NULL)
|
||||
{
|
||||
this->m_titleLabel->setAnchorPoint(labelAnchorPoint);
|
||||
}
|
||||
}
|
||||
|
||||
CCString* CCControlButton::getTitleForState(CCControlState state)
|
||||
{
|
||||
CCString* title=(CCString*)m_titleDispatchTable->objectForKey(state);
|
||||
if (title)
|
||||
if (m_titleDispatchTable != NULL)
|
||||
{
|
||||
return title;
|
||||
CCString* title=(CCString*)m_titleDispatchTable->objectForKey(state);
|
||||
if (title)
|
||||
{
|
||||
return title;
|
||||
}
|
||||
return (CCString*)m_titleDispatchTable->objectForKey(CCControlStateNormal);
|
||||
}
|
||||
return (CCString*)m_titleDispatchTable->objectForKey(CCControlStateNormal);
|
||||
return CCString::create("");
|
||||
}
|
||||
|
||||
void CCControlButton::setTitleForState(CCString* title, CCControlState state)
|
||||
|
@ -307,15 +327,24 @@ void CCControlButton::setTitleForState(CCString* title, CCControlState state)
|
|||
|
||||
const ccColor3B CCControlButton::getTitleColorForState(CCControlState state)
|
||||
{
|
||||
ccColor3B returnColor;
|
||||
CCColor3bObject* colorObject=(CCColor3bObject*)m_titleColorDispatchTable->objectForKey(state);
|
||||
if (colorObject)
|
||||
ccColor3B returnColor = ccWHITE;
|
||||
do
|
||||
{
|
||||
returnColor= colorObject->value;
|
||||
return returnColor;
|
||||
}
|
||||
colorObject=(CCColor3bObject*)m_titleColorDispatchTable->objectForKey(CCControlStateNormal);
|
||||
returnColor=colorObject->value;
|
||||
CC_BREAK_IF(NULL == m_titleColorDispatchTable);
|
||||
CCColor3bObject* colorObject=(CCColor3bObject*)m_titleColorDispatchTable->objectForKey(state);
|
||||
if (colorObject)
|
||||
{
|
||||
returnColor= colorObject->value;
|
||||
break;
|
||||
}
|
||||
|
||||
colorObject=(CCColor3bObject*)m_titleColorDispatchTable->objectForKey(CCControlStateNormal);
|
||||
if (colorObject)
|
||||
{
|
||||
returnColor=colorObject->value;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
return returnColor;
|
||||
}
|
||||
|
||||
|
@ -368,7 +397,10 @@ void CCControlButton::setTitleLabelForState(CCNode* titleLabel, CCControlState s
|
|||
void CCControlButton::setTitleTTFForState(const char * fntFile, CCControlState state)
|
||||
{
|
||||
CCString * title = this->getTitleForState(state);
|
||||
if (!title) title = new CCString("");
|
||||
if (!title)
|
||||
{
|
||||
title = CCString::create("");
|
||||
}
|
||||
this->setTitleLabelForState(CCLabelTTF::create(title->getCString(), fntFile, 12), state);
|
||||
}
|
||||
|
||||
|
@ -416,7 +448,10 @@ float CCControlButton::getTitleTTFSizeForState(CCControlState state)
|
|||
void CCControlButton::setTitleBMFontForState(const char * fntFile, CCControlState state)
|
||||
{
|
||||
CCString * title = this->getTitleForState(state);
|
||||
if (!title) title = new CCString("");
|
||||
if (!title)
|
||||
{
|
||||
title = CCString::create("");
|
||||
}
|
||||
this->setTitleLabelForState(CCLabelBMFont::create(title->getCString(), fntFile), state);
|
||||
}
|
||||
|
||||
|
@ -448,10 +483,12 @@ CCScale9Sprite* CCControlButton::getBackgroundSpriteForState(CCControlState stat
|
|||
|
||||
void CCControlButton::setBackgroundSpriteForState(CCScale9Sprite* sprite, CCControlState state)
|
||||
{
|
||||
CCScale9Sprite* previousSprite = (CCScale9Sprite*)m_backgroundSpriteDispatchTable->objectForKey(state);
|
||||
if (previousSprite)
|
||||
CCSize oldPreferredSize = m_preferredSize;
|
||||
|
||||
CCScale9Sprite* previousBackgroundSprite = (CCScale9Sprite*)m_backgroundSpriteDispatchTable->objectForKey(state);
|
||||
if (previousBackgroundSprite)
|
||||
{
|
||||
removeChild(previousSprite, true);
|
||||
removeChild(previousBackgroundSprite, true);
|
||||
m_backgroundSpriteDispatchTable->removeObjectForKey(state);
|
||||
}
|
||||
|
||||
|
@ -462,6 +499,12 @@ void CCControlButton::setBackgroundSpriteForState(CCScale9Sprite* sprite, CCCont
|
|||
|
||||
if (this->m_preferredSize.width != 0 || this->m_preferredSize.height != 0)
|
||||
{
|
||||
if (oldPreferredSize.equals(m_preferredSize))
|
||||
{
|
||||
// Force update of preferred size
|
||||
sprite->setPreferredSize(CCSizeMake(oldPreferredSize.width+1, oldPreferredSize.height+1));
|
||||
}
|
||||
|
||||
sprite->setPreferredSize(this->m_preferredSize);
|
||||
}
|
||||
|
||||
|
@ -481,70 +524,113 @@ void CCControlButton::setBackgroundSpriteFrameForState(CCSpriteFrame * spriteFra
|
|||
|
||||
void CCControlButton::needsLayout()
|
||||
{
|
||||
if (!m_bParentInited) {
|
||||
return;
|
||||
}
|
||||
// Hide the background and the label
|
||||
m_titleLabel->setVisible(false);
|
||||
m_backgroundSprite->setVisible(false);
|
||||
|
||||
if (m_titleLabel != NULL) {
|
||||
m_titleLabel->setVisible(false);
|
||||
}
|
||||
if (m_backgroundSprite) {
|
||||
m_backgroundSprite->setVisible(false);
|
||||
}
|
||||
// Update anchor of all labels
|
||||
this->setLabelAnchorPoint(this->m_labelAnchorPoint);
|
||||
|
||||
// Update the label to match with the current state
|
||||
//CC_SAFE_RELEASE(m_currentTitle)
|
||||
|
||||
m_currentTitle=getTitleForState(m_nState);
|
||||
m_currentTitleColor=getTitleColorForState(m_nState);
|
||||
CC_SAFE_RELEASE(m_currentTitle);
|
||||
m_currentTitle = getTitleForState(m_eState);
|
||||
CC_SAFE_RETAIN(m_currentTitle);
|
||||
|
||||
m_currentTitleColor=getTitleColorForState(m_eState);
|
||||
|
||||
this->setTitleLabel(getTitleLabelForState(m_eState));
|
||||
|
||||
m_titleLabel=getTitleLabelForState(m_nState);
|
||||
|
||||
CCLabelProtocol* label = dynamic_cast<CCLabelProtocol*>(m_titleLabel);
|
||||
if (label)
|
||||
if (label && m_currentTitle)
|
||||
{
|
||||
label->setString(m_currentTitle->getCString());
|
||||
}
|
||||
|
||||
CCRGBAProtocol* rgbaLabel = dynamic_cast<CCRGBAProtocol*>(m_titleLabel);
|
||||
if (rgbaLabel)
|
||||
{
|
||||
rgbaLabel->setColor(m_currentTitleColor);
|
||||
m_titleLabel->setPosition(ccp (getContentSize().width / 2, getContentSize().height / 2));
|
||||
|
||||
}
|
||||
if (m_titleLabel != NULL)
|
||||
{
|
||||
m_titleLabel->setPosition(ccp (getContentSize().width / 2, getContentSize().height / 2));
|
||||
}
|
||||
|
||||
// Update the background sprite
|
||||
m_backgroundSprite=getBackgroundSpriteForState(m_nState);
|
||||
m_backgroundSprite->setPosition(ccp (getContentSize().width / 2, getContentSize().height / 2));
|
||||
|
||||
this->setBackgroundSprite(this->getBackgroundSpriteForState(m_eState));
|
||||
if (m_backgroundSprite != NULL)
|
||||
{
|
||||
m_backgroundSprite->setPosition(ccp (getContentSize().width / 2, getContentSize().height / 2));
|
||||
}
|
||||
|
||||
// Get the title label size
|
||||
CCSize titleLabelSize =m_titleLabel->boundingBox().size;
|
||||
CCSize titleLabelSize;
|
||||
if (m_titleLabel != NULL)
|
||||
{
|
||||
titleLabelSize = m_titleLabel->boundingBox().size;
|
||||
}
|
||||
|
||||
// Adjust the background image if necessary
|
||||
if (m_adjustBackgroundImage)
|
||||
if (m_doesAdjustBackgroundImage)
|
||||
{
|
||||
// Add the margins
|
||||
m_backgroundSprite->setContentSize(CCSizeMake(titleLabelSize.width + m_marginH * 2, titleLabelSize.height + m_marginV * 2));
|
||||
if (m_backgroundSprite != NULL)
|
||||
{
|
||||
m_backgroundSprite->setContentSize(CCSizeMake(titleLabelSize.width + m_marginH * 2, titleLabelSize.height + m_marginV * 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: should this also have margins if one of the preferred sizes is relaxed?
|
||||
CCSize preferredSize = m_backgroundSprite->getPreferredSize();
|
||||
if (preferredSize.width <= 0)
|
||||
if (m_backgroundSprite != NULL)
|
||||
{
|
||||
preferredSize.width = titleLabelSize.width;
|
||||
CCSize preferredSize = m_backgroundSprite->getPreferredSize();
|
||||
if (preferredSize.width <= 0)
|
||||
{
|
||||
preferredSize.width = titleLabelSize.width;
|
||||
}
|
||||
if (preferredSize.height <= 0)
|
||||
{
|
||||
preferredSize.height = titleLabelSize.height;
|
||||
}
|
||||
|
||||
m_backgroundSprite->setContentSize(preferredSize);
|
||||
}
|
||||
if (preferredSize.height <= 0)
|
||||
{
|
||||
preferredSize.height = titleLabelSize.height;
|
||||
}
|
||||
|
||||
m_backgroundSprite->setContentSize(preferredSize);
|
||||
}
|
||||
|
||||
// Set the content size
|
||||
|
||||
CCRect maxRect = CCControlUtils::CCRectUnion(m_titleLabel->boundingBox(), m_backgroundSprite->boundingBox());
|
||||
CCRect rectTitle;
|
||||
if (m_titleLabel != NULL)
|
||||
{
|
||||
rectTitle = m_titleLabel->boundingBox();
|
||||
}
|
||||
CCRect rectBackground;
|
||||
if (m_backgroundSprite != NULL)
|
||||
{
|
||||
rectBackground = m_backgroundSprite->boundingBox();
|
||||
}
|
||||
|
||||
CCRect maxRect = CCControlUtils::CCRectUnion(rectTitle, rectBackground);
|
||||
setContentSize(CCSizeMake(maxRect.size.width, maxRect.size.height));
|
||||
|
||||
m_titleLabel->setPosition(ccp(getContentSize().width/2, getContentSize().height/2));
|
||||
m_backgroundSprite->setPosition(ccp(getContentSize().width/2, getContentSize().height/2));
|
||||
|
||||
// Make visible the background and the label
|
||||
m_titleLabel->setVisible(true);
|
||||
m_backgroundSprite->setVisible(true);
|
||||
if (m_titleLabel != NULL)
|
||||
{
|
||||
m_titleLabel->setPosition(ccp(getContentSize().width/2, getContentSize().height/2));
|
||||
// Make visible the background and the label
|
||||
m_titleLabel->setVisible(true);
|
||||
}
|
||||
|
||||
if (m_backgroundSprite != NULL)
|
||||
{
|
||||
m_backgroundSprite->setPosition(ccp(getContentSize().width/2, getContentSize().height/2));
|
||||
m_backgroundSprite->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -556,8 +642,8 @@ bool CCControlButton::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
|
|||
return false;
|
||||
}
|
||||
|
||||
m_nState=CCControlStateHighlighted;
|
||||
pushed=true;
|
||||
m_eState=CCControlStateHighlighted;
|
||||
m_isPushed=true;
|
||||
this->setHighlighted(true);
|
||||
sendActionsForControlEvents(CCControlEventTouchDown);
|
||||
return true;
|
||||
|
@ -565,9 +651,9 @@ bool CCControlButton::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
|
|||
|
||||
void CCControlButton::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
if (!m_bEnabled || !pushed || m_bSelected)
|
||||
if (!isEnabled() || !isPushed() || isSelected())
|
||||
{
|
||||
if (m_bHighlighted)
|
||||
if (isHighlighted())
|
||||
{
|
||||
setHighlighted(false);
|
||||
}
|
||||
|
@ -575,32 +661,32 @@ void CCControlButton::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent)
|
|||
}
|
||||
|
||||
bool isTouchMoveInside = isTouchInside(pTouch);
|
||||
if (isTouchMoveInside && !m_bHighlighted)
|
||||
if (isTouchMoveInside && !isHighlighted())
|
||||
{
|
||||
m_nState = CCControlStateHighlighted;
|
||||
m_eState = CCControlStateHighlighted;
|
||||
setHighlighted(true);
|
||||
sendActionsForControlEvents(CCControlEventTouchDragEnter);
|
||||
}
|
||||
else if (isTouchMoveInside && m_bHighlighted)
|
||||
else if (isTouchMoveInside && isHighlighted())
|
||||
{
|
||||
sendActionsForControlEvents(CCControlEventTouchDragInside);
|
||||
}
|
||||
else if (!isTouchMoveInside && m_bHighlighted)
|
||||
else if (!isTouchMoveInside && isHighlighted())
|
||||
{
|
||||
m_nState = CCControlStateNormal;
|
||||
m_eState = CCControlStateNormal;
|
||||
setHighlighted(false);
|
||||
|
||||
sendActionsForControlEvents(CCControlEventTouchDragExit);
|
||||
}
|
||||
else if (!isTouchMoveInside && !m_bHighlighted)
|
||||
else if (!isTouchMoveInside && !isHighlighted())
|
||||
{
|
||||
sendActionsForControlEvents(CCControlEventTouchDragOutside);
|
||||
}
|
||||
}
|
||||
void CCControlButton::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
m_nState = CCControlStateNormal;
|
||||
pushed = false;
|
||||
m_eState = CCControlStateNormal;
|
||||
m_isPushed = false;
|
||||
setHighlighted(false);
|
||||
|
||||
|
||||
|
@ -643,8 +729,8 @@ GLubyte CCControlButton::getOpacity()
|
|||
|
||||
void CCControlButton::ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
m_nState = CCControlStateNormal;
|
||||
pushed = false;
|
||||
m_eState = CCControlStateNormal;
|
||||
m_isPushed = false;
|
||||
setHighlighted(false);
|
||||
sendActionsForControlEvents(CCControlEventTouchCancel);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlButton.h
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2011 Yannick Loriot. All rights reserved.
|
||||
* http://yannickloriot.com
|
||||
|
@ -35,6 +36,12 @@
|
|||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
/* Define the button margin for Left/Right edge */
|
||||
#define CCControlButtonMarginLR 8 // px
|
||||
/* Define the button margin for Top/Bottom edge */
|
||||
#define CCControlButtonMarginTB 2 // px
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup GUI
|
||||
* @{
|
||||
|
@ -46,6 +53,7 @@ NS_CC_EXT_BEGIN
|
|||
class CCControlButton : public CCControl
|
||||
{
|
||||
public:
|
||||
CCControlButton();
|
||||
virtual ~CCControlButton();
|
||||
virtual void needsLayout(void);
|
||||
|
||||
|
@ -56,42 +64,51 @@ protected:
|
|||
// CCRGBAProtocol
|
||||
//bool m_bIsOpacityModifyRGB;
|
||||
|
||||
/** The current title that is displayed on the button. */
|
||||
CC_SYNTHESIZE_READONLY(CCString*, m_currentTitle, CurrentTitle);
|
||||
|
||||
/** The current color used to display the title. */
|
||||
CC_SYNTHESIZE_READONLY_PASS_BY_REF(ccColor3B, m_currentTitleColor, CurrentTitleColor);
|
||||
|
||||
/** Adjust the background image. YES by default. If the property is set to NO, the
|
||||
background will use the prefered size of the background image. */
|
||||
CC_PROPERTY(bool, m_adjustBackgroundImage, AdjustBackgroundImage);
|
||||
bool doesAdjustBackgroundImage();
|
||||
void setAdjustBackgroundImage(bool adjustBackgroundImage);
|
||||
bool m_doesAdjustBackgroundImage;
|
||||
|
||||
/** Adjust the button zooming on touchdown. Default value is YES. */
|
||||
CC_PROPERTY(bool, m_zoomOnTouchDown, ZoomOnTouchDown);
|
||||
/** The current title label. */
|
||||
CC_SYNTHESIZE_RETAIN(CCNode*, m_titleLabel, TitleLabel);
|
||||
|
||||
/** The current background sprite. */
|
||||
CC_SYNTHESIZE_RETAIN(CCScale9Sprite*, m_backgroundSprite, BackgroundSprite);
|
||||
|
||||
/** The prefered size of the button, if label is larger it will be expanded. */
|
||||
CC_PROPERTY(CCSize, m_preferredSize, PreferredSize);
|
||||
|
||||
/** Adjust the button zooming on touchdown. Default value is YES. */
|
||||
CC_PROPERTY(bool, m_zoomOnTouchDown, ZoomOnTouchDown);
|
||||
|
||||
CC_PROPERTY(CCPoint, m_labelAnchorPoint, LabelAnchorPoint);
|
||||
|
||||
/** The current title that is displayed on the button. */
|
||||
CC_SYNTHESIZE_READONLY(CCString*, m_currentTitle, CurrentTitle);
|
||||
/** The current color used to display the title. */
|
||||
CC_SYNTHESIZE_READONLY_PASS_BY_REF(ccColor3B, m_currentTitleColor, CurrentTitleColor);
|
||||
/** The current title label. */
|
||||
//CC_PROPERTY(CCNode*, m_titleLabel, TitleLabel);
|
||||
CCNode* m_titleLabel;
|
||||
/** The current background sprite. */
|
||||
//CC_PROPERTY(CCScale9Sprite*, m_backgroundSprite, BackgroundSprite);
|
||||
CCScale9Sprite* m_backgroundSprite;
|
||||
|
||||
/* Override setter to affect a background sprite too */
|
||||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
|
||||
virtual GLubyte getOpacity(void);
|
||||
virtual void setOpacity(GLubyte var);
|
||||
|
||||
/** Flag to know if the button is currently pushed. */
|
||||
CC_SYNTHESIZE_READONLY(bool, pushed, IsPushed);
|
||||
protected:
|
||||
bool m_isPushed;
|
||||
bool m_bParentInited;
|
||||
public:
|
||||
bool isPushed() { return m_isPushed; }
|
||||
|
||||
// <CCControlState, CCString*>
|
||||
CCDictionary* m_titleDispatchTable;
|
||||
CC_SYNTHESIZE_RETAIN(CCDictionary*, m_titleDispatchTable, TitleDispatchTable);
|
||||
// <CCControlState, CCColor3bObject*>
|
||||
CCDictionary* m_titleColorDispatchTable;
|
||||
CC_SYNTHESIZE_RETAIN(CCDictionary*, m_titleColorDispatchTable, TitleColorDispatchTable);
|
||||
// <CCControlState, CCNode*>
|
||||
CCDictionary* m_titleLabelDispatchTable;
|
||||
CC_SYNTHESIZE_RETAIN(CCDictionary*, m_titleLabelDispatchTable, TitleLabelDispatchTable);
|
||||
// <CCControlState, CCScale9Sprite*>
|
||||
CCDictionary* m_backgroundSpriteDispatchTable;
|
||||
CC_SYNTHESIZE_RETAIN(CCDictionary*, m_backgroundSpriteDispatchTable, BackgroundSpriteDispatchTable);
|
||||
|
||||
/* Define the button margin for Top/Bottom edge */
|
||||
CC_SYNTHESIZE_READONLY(int, m_marginV, VerticalMargin);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlColourPicker.m
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Stewart Hamilton-Arrandale.
|
||||
* http://creativewax.co.uk
|
||||
|
@ -35,6 +36,36 @@
|
|||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
CCControlColourPicker::CCControlColourPicker()
|
||||
: m_colourPicker(NULL)
|
||||
, m_huePicker(NULL)
|
||||
, m_background(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlColourPicker::~CCControlColourPicker()
|
||||
{
|
||||
if (m_background)
|
||||
{
|
||||
m_background->removeFromParentAndCleanup(true);
|
||||
}
|
||||
|
||||
if (m_huePicker)
|
||||
{
|
||||
m_huePicker->removeFromParentAndCleanup(true);
|
||||
}
|
||||
|
||||
if (m_colourPicker)
|
||||
{
|
||||
m_colourPicker->removeFromParentAndCleanup(true);
|
||||
}
|
||||
|
||||
m_background = NULL;
|
||||
m_huePicker = NULL;
|
||||
m_colourPicker = NULL;
|
||||
}
|
||||
|
||||
bool CCControlColourPicker::init()
|
||||
{
|
||||
if (CCControl::init())
|
||||
|
@ -48,10 +79,10 @@ bool CCControlColourPicker::init()
|
|||
addChild(spriteSheet);
|
||||
|
||||
// MIPMAP
|
||||
ccTexParams params = {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT};
|
||||
// ccTexParams params = {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT};
|
||||
spriteSheet->getTexture()->setAliasTexParameters();
|
||||
spriteSheet->getTexture()->setTexParameters(¶ms);
|
||||
spriteSheet->getTexture()->generateMipmap();
|
||||
// spriteSheet->getTexture()->setTexParameters(¶ms);
|
||||
// spriteSheet->getTexture()->generateMipmap();
|
||||
|
||||
// Init default color
|
||||
m_hsv.h = 0;
|
||||
|
@ -63,12 +94,14 @@ bool CCControlColourPicker::init()
|
|||
|
||||
CCPoint backgroundPointZero = ccpSub(m_background->getPosition(), ccp (m_background->getContentSize().width / 2, m_background->getContentSize().height / 2));
|
||||
|
||||
// Setup panels . currently hard-coded...
|
||||
// Setup panels
|
||||
float hueShift = 8;
|
||||
float colourShift = 28;
|
||||
|
||||
m_huePicker=CCControlHuePicker::create(spriteSheet, ccp(backgroundPointZero.x + hueShift, backgroundPointZero.y + hueShift));
|
||||
m_colourPicker=CCControlSaturationBrightnessPicker::create(spriteSheet, ccp(backgroundPointZero.x + colourShift, backgroundPointZero.y + colourShift));
|
||||
m_huePicker = new CCControlHuePicker();
|
||||
m_huePicker->initWithTargetAndPos(spriteSheet, ccp(backgroundPointZero.x + hueShift, backgroundPointZero.y + hueShift));
|
||||
m_colourPicker = new CCControlSaturationBrightnessPicker();
|
||||
m_colourPicker->initWithTargetAndPos(spriteSheet, ccp(backgroundPointZero.x + colourShift, backgroundPointZero.y + colourShift));
|
||||
|
||||
// Setup events
|
||||
m_huePicker->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlColourPicker::hueSliderValueChanged), CCControlEventValueChanged);
|
||||
|
@ -101,20 +134,34 @@ CCControlColourPicker* CCControlColourPicker::create()
|
|||
}
|
||||
|
||||
|
||||
void CCControlColourPicker::setColorValue(const ccColor3B& colorValue)
|
||||
void CCControlColourPicker::setColor(const ccColor3B& color)
|
||||
{
|
||||
m_colorValue = colorValue;
|
||||
m_tColor = color;
|
||||
|
||||
RGBA rgba;
|
||||
rgba.r = colorValue.r / 255.0f;
|
||||
rgba.g = colorValue.g / 255.0f;
|
||||
rgba.b = colorValue.b / 255.0f;
|
||||
rgba.r = color.r / 255.0f;
|
||||
rgba.g = color.g / 255.0f;
|
||||
rgba.b = color.b / 255.0f;
|
||||
rgba.a = 1.0f;
|
||||
|
||||
m_hsv=CCControlUtils::HSVfromRGB(rgba);
|
||||
updateHueAndControlPicker();
|
||||
}
|
||||
|
||||
void CCControlColourPicker::setEnabled(bool enabled)
|
||||
{
|
||||
CCControl::setEnabled(enabled);
|
||||
if (m_huePicker != NULL)
|
||||
{
|
||||
m_huePicker->setEnabled(enabled);
|
||||
}
|
||||
if (m_colourPicker)
|
||||
{
|
||||
m_colourPicker->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//need two events to prevent an infinite loop! (can't update huePicker when the huePicker triggers the callback due to CCControlEventValueChanged)
|
||||
void CCControlColourPicker::updateControlPicker()
|
||||
{
|
||||
|
@ -136,7 +183,7 @@ void CCControlColourPicker::hueSliderValueChanged(CCObject * sender, CCControlEv
|
|||
|
||||
// Update the value
|
||||
RGBA rgb = CCControlUtils::RGBfromHSV(m_hsv);
|
||||
m_colorValue= ccc3((GLubyte)(rgb.r * 255.0f), (GLubyte)(rgb.g * 255.0f), (GLubyte)(rgb.b * 255.0f));
|
||||
m_tColor= ccc3((GLubyte)(rgb.r * 255.0f), (GLubyte)(rgb.g * 255.0f), (GLubyte)(rgb.b * 255.0f));
|
||||
|
||||
// Send CCControl callback
|
||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
|
@ -151,7 +198,7 @@ void CCControlColourPicker::colourSliderValueChanged(CCObject * sender, CCContro
|
|||
|
||||
// Update the value
|
||||
RGBA rgb = CCControlUtils::RGBfromHSV(m_hsv);
|
||||
m_colorValue=ccc3((GLubyte)(rgb.r * 255.0f), (GLubyte)(rgb.g * 255.0f), (GLubyte)(rgb.b * 255.0f));
|
||||
m_tColor=ccc3((GLubyte)(rgb.r * 255.0f), (GLubyte)(rgb.g * 255.0f), (GLubyte)(rgb.b * 255.0f));
|
||||
|
||||
// Send CCControl callback
|
||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlColourPicker.h
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Stewart Hamilton-Arrandale.
|
||||
* http://creativewax.co.uk
|
||||
|
@ -48,15 +49,16 @@ NS_CC_EXT_BEGIN
|
|||
|
||||
class CCControlColourPicker: public CCControl
|
||||
{
|
||||
CC_SYNTHESIZE_READONLY_PASS_BY_REF(ccColor3B, m_colorValue, ColorValue);
|
||||
virtual void setColorValue(const ccColor3B& colorValue);
|
||||
|
||||
public:
|
||||
CCControlColourPicker();
|
||||
virtual ~CCControlColourPicker();
|
||||
virtual void setColor(const ccColor3B& colorValue);
|
||||
virtual void setEnabled(bool bEnabled);
|
||||
protected:
|
||||
HSV m_hsv;
|
||||
CCControlSaturationBrightnessPicker* m_colourPicker;
|
||||
CCControlHuePicker* m_huePicker;
|
||||
|
||||
CC_SYNTHESIZE_READONLY(CCSprite*, m_background, Background);
|
||||
CC_SYNTHESIZE_RETAIN(CCControlSaturationBrightnessPicker*, m_colourPicker, colourPicker)
|
||||
CC_SYNTHESIZE_RETAIN(CCControlHuePicker*, m_huePicker, HuePicker)
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_background, Background)
|
||||
|
||||
public:
|
||||
//@deprecated: This interface will be deprecated sooner or later.
|
||||
|
|
|
@ -1,14 +1,37 @@
|
|||
#ifndef __CCCONTROL_EXTENSIONS_H__
|
||||
#define __CCCONTROL_EXTENSIONS_H__
|
||||
|
||||
#include "CCControl.h"
|
||||
#include "CCControlButton.h"
|
||||
#include "CCControlColourPicker.h"
|
||||
#include "CCControlHuePicker.h"
|
||||
#include "CCControlSaturationBrightnessPicker.h"
|
||||
#include "CCControlSlider.h"
|
||||
#include "CCControlSwitch.h"
|
||||
#include "CCMenuPassive.h"
|
||||
#include "CCSpacer.h"
|
||||
|
||||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCCONTROL_EXTENSIONS_H__
|
||||
#define __CCCONTROL_EXTENSIONS_H__
|
||||
|
||||
#include "CCScale9Sprite.h"
|
||||
#include "CCControl.h"
|
||||
#include "CCControlButton.h"
|
||||
#include "CCControlColourPicker.h"
|
||||
#include "CCControlPotentiometer.h"
|
||||
#include "CCControlSlider.h"
|
||||
#include "CCControlStepper.h"
|
||||
#include "CCControlSwitch.h"
|
||||
|
||||
#endif
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlHuePicker.m
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Stewart Hamilton-Arrandale.
|
||||
* http://creativewax.co.uk
|
||||
|
@ -33,11 +34,22 @@
|
|||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
CCControlHuePicker::~CCControlHuePicker()
|
||||
CCControlHuePicker::CCControlHuePicker()
|
||||
: m_hue(0.0f)
|
||||
, m_huePercentage(0.0f)
|
||||
, m_background(NULL)
|
||||
, m_slider(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlHuePicker::~CCControlHuePicker()
|
||||
{
|
||||
removeAllChildrenWithCleanup(true);
|
||||
CC_SAFE_RELEASE(m_background);
|
||||
CC_SAFE_RELEASE(m_slider);
|
||||
}
|
||||
|
||||
CCControlHuePicker* CCControlHuePicker::pickerWithTargetAndPos(CCNode* target, CCPoint pos)
|
||||
{
|
||||
return CCControlHuePicker::create(target, pos);
|
||||
|
@ -58,8 +70,8 @@ bool CCControlHuePicker::initWithTargetAndPos(CCNode* target, CCPoint pos)
|
|||
{
|
||||
setTouchEnabled(true);
|
||||
// Add background and slider sprites
|
||||
m_background=CCControlUtils::addSpriteToTargetWithPosAndAnchor("huePickerBackground.png", target, pos, ccp(0.0f, 0.0f));
|
||||
m_slider=CCControlUtils::addSpriteToTargetWithPosAndAnchor("colourPicker.png", target, pos, ccp(0.5f, 0.5f));
|
||||
this->setBackground(CCControlUtils::addSpriteToTargetWithPosAndAnchor("huePickerBackground.png", target, pos, ccp(0.0f, 0.0f)));
|
||||
this->setSlider(CCControlUtils::addSpriteToTargetWithPosAndAnchor("colourPicker.png", target, pos, ccp(0.5f, 0.5f)));
|
||||
|
||||
m_slider->setPosition(ccp(pos.x, pos.y + m_background->boundingBox().size.height * 0.5f));
|
||||
m_startPos=pos;
|
||||
|
@ -70,13 +82,18 @@ bool CCControlHuePicker::initWithTargetAndPos(CCNode* target, CCPoint pos)
|
|||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlHuePicker::setHue(float hueValue)
|
||||
{
|
||||
m_hue=hueValue;
|
||||
setHuePercentage(m_hue/360.0f);
|
||||
// Set the position of the slider to the correct hue
|
||||
// We need to divide it by 360 as its taken as an angle in degrees
|
||||
float huePercentage = hueValue / 360.0f;
|
||||
setHuePercentage(huePercentage);
|
||||
}
|
||||
|
||||
void CCControlHuePicker::setHuePercentage(float hueValueInPercent)
|
||||
|
@ -105,6 +122,15 @@ void CCControlHuePicker::setHuePercentage(float hueValueInPercent)
|
|||
|
||||
}
|
||||
|
||||
void CCControlHuePicker::setEnabled(bool enabled)
|
||||
{
|
||||
CCControl::setEnabled(enabled);
|
||||
if (m_slider != NULL)
|
||||
{
|
||||
m_slider->setOpacity(enabled ? 255 : 128);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlHuePicker::updateSliderPosition(CCPoint location)
|
||||
{
|
||||
|
||||
|
@ -132,9 +158,12 @@ void CCControlHuePicker::updateSliderPosition(CCPoint location)
|
|||
|
||||
bool CCControlHuePicker::checkSliderPosition(CCPoint location)
|
||||
{
|
||||
// check that the touch location is within the bounding rectangle before sending updates
|
||||
if (m_background->boundingBox().containsPoint(location))
|
||||
{
|
||||
// compute the distance between the current location and the center
|
||||
double distance = sqrt(pow (location.x + 10, 2) + pow(location.y, 2));
|
||||
|
||||
// check that the touch location is within the circle
|
||||
if (160 > distance && distance > 118)
|
||||
{
|
||||
updateSliderPosition(location);
|
||||
return true;
|
||||
}
|
||||
|
@ -143,6 +172,11 @@ bool CCControlHuePicker::checkSliderPosition(CCPoint location)
|
|||
|
||||
bool CCControlHuePicker::ccTouchBegan(CCTouch* touch, CCEvent* event)
|
||||
{
|
||||
if (!isEnabled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the touch location
|
||||
CCPoint touchLocation=getTouchLocation(touch);
|
||||
|
||||
|
@ -157,10 +191,10 @@ void CCControlHuePicker::ccTouchMoved(CCTouch* touch, CCEvent* event)
|
|||
CCPoint touchLocation=getTouchLocation(touch);
|
||||
|
||||
//small modification: this allows changing of the colour, even if the touch leaves the bounding area
|
||||
updateSliderPosition(touchLocation);
|
||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
// updateSliderPosition(touchLocation);
|
||||
// sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
// Check the touch position on the slider
|
||||
//checkSliderPosition(touchLocation);
|
||||
checkSliderPosition(touchLocation);
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlHuePicker.h
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Stewart Hamilton-Arrandale.
|
||||
* http://creativewax.co.uk
|
||||
|
@ -54,16 +55,18 @@ class CCControlHuePicker : public CCControl
|
|||
|
||||
|
||||
//not sure if these need to be there actually. I suppose someone might want to access the sprite?
|
||||
CC_SYNTHESIZE_READONLY(CCSprite*, m_background, Background);
|
||||
CC_SYNTHESIZE_READONLY(CCSprite*, m_slider, Slider);
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_background, Background);
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_slider, Slider);
|
||||
CC_SYNTHESIZE_READONLY(CCPoint, m_startPos, StartPos);
|
||||
|
||||
public:
|
||||
public:
|
||||
CCControlHuePicker();
|
||||
virtual ~CCControlHuePicker();
|
||||
virtual bool initWithTargetAndPos(CCNode* target, CCPoint pos);
|
||||
//@deprecated: This interface will be deprecated sooner or later.
|
||||
CC_DEPRECATED_ATTRIBUTE static CCControlHuePicker* pickerWithTargetAndPos(CCNode* target, CCPoint pos);
|
||||
static CCControlHuePicker* create(CCNode* target, CCPoint pos);
|
||||
virtual void setEnabled(bool enabled);
|
||||
protected:
|
||||
void updateSliderPosition(CCPoint location);
|
||||
bool checkSliderPosition(CCPoint location);
|
||||
|
|
|
@ -0,0 +1,267 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Yannick Loriot. All rights reserved.
|
||||
* http://yannickloriot.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CCControlPotentiometer.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
CCControlPotentiometer::CCControlPotentiometer()
|
||||
: m_fValue(0.0f)
|
||||
, m_fMinimumValue(0.0f)
|
||||
, m_fMaximumValue(0.0f)
|
||||
, m_pThumbSprite(NULL)
|
||||
, m_pProgressTimer(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlPotentiometer::~CCControlPotentiometer()
|
||||
{
|
||||
CC_SAFE_RELEASE(m_pThumbSprite);
|
||||
CC_SAFE_RELEASE(m_pProgressTimer);
|
||||
}
|
||||
|
||||
CCControlPotentiometer* CCControlPotentiometer::create(const char* backgroundFile, const char* progressFile, const char* thumbFile)
|
||||
{
|
||||
CCControlPotentiometer* pRet = new CCControlPotentiometer();
|
||||
if (pRet != NULL)
|
||||
{
|
||||
// Prepare track for potentiometer
|
||||
CCSprite *backgroundSprite = CCSprite::create(backgroundFile);
|
||||
|
||||
// Prepare thumb for potentiometer
|
||||
CCSprite *thumbSprite = CCSprite::create(thumbFile);
|
||||
|
||||
// Prepare progress for potentiometer
|
||||
CCProgressTimer *progressTimer = CCProgressTimer::create(CCSprite::create(progressFile));
|
||||
//progressTimer.type = kCCProgressTimerTypeRadialCW;
|
||||
if (pRet->initWithTrackSprite_ProgressTimer_ThumbSprite(backgroundSprite, progressTimer, thumbSprite))
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_DELETE(pRet);
|
||||
}
|
||||
}
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool CCControlPotentiometer::initWithTrackSprite_ProgressTimer_ThumbSprite(CCSprite* trackSprite, CCProgressTimer* progressTimer, CCSprite* thumbSprite)
|
||||
{
|
||||
if (CCControl::init())
|
||||
{
|
||||
setTouchEnabled(true);
|
||||
|
||||
setProgressTimer(progressTimer);
|
||||
setThumbSprite(thumbSprite);
|
||||
thumbSprite->setPosition(progressTimer->getPosition());
|
||||
|
||||
addChild(thumbSprite, 2);
|
||||
addChild(progressTimer, 1);
|
||||
addChild(trackSprite);
|
||||
|
||||
setContentSize(trackSprite->getContentSize());
|
||||
|
||||
// Init default values
|
||||
m_fMinimumValue = 0.0f;
|
||||
m_fMaximumValue = 1.0f;
|
||||
setValue(m_fMinimumValue);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::setEnabled(bool enabled)
|
||||
{
|
||||
CCControl::setEnabled(enabled);
|
||||
if (m_pThumbSprite != NULL)
|
||||
{
|
||||
m_pThumbSprite->setOpacity((enabled) ? 255 : 128);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::setValue(float value)
|
||||
{
|
||||
// set new value with sentinel
|
||||
if (value < m_fMinimumValue)
|
||||
{
|
||||
value = m_fMinimumValue;
|
||||
}
|
||||
|
||||
if (value > m_fMaximumValue)
|
||||
{
|
||||
value = m_fMaximumValue;
|
||||
}
|
||||
|
||||
m_fValue = value;
|
||||
|
||||
// Update thumb and progress position for new value
|
||||
float percent = (value - m_fMinimumValue) / (m_fMaximumValue - m_fMinimumValue);
|
||||
m_pProgressTimer->setPercentage(percent * 100.0f);
|
||||
m_pThumbSprite->setRotation(percent * 360.0f);
|
||||
|
||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
}
|
||||
|
||||
float CCControlPotentiometer::getValue()
|
||||
{
|
||||
return m_fValue;
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::setMinimumValue(float minimumValue)
|
||||
{
|
||||
m_fMinimumValue = minimumValue;
|
||||
|
||||
if (m_fMinimumValue >= m_fMaximumValue)
|
||||
{
|
||||
m_fMaximumValue = m_fMinimumValue + 1.0f;
|
||||
}
|
||||
|
||||
setValue(m_fMaximumValue);
|
||||
}
|
||||
|
||||
float CCControlPotentiometer::getMinimumValue()
|
||||
{
|
||||
return m_fMinimumValue;
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::setMaximumValue(float maximumValue)
|
||||
{
|
||||
m_fMaximumValue = maximumValue;
|
||||
|
||||
if (m_fMaximumValue <= m_fMinimumValue)
|
||||
{
|
||||
m_fMinimumValue = m_fMaximumValue - 1.0f;
|
||||
}
|
||||
|
||||
setValue(m_fMinimumValue);
|
||||
}
|
||||
|
||||
float CCControlPotentiometer::getMaximumValue()
|
||||
{
|
||||
return m_fMaximumValue;
|
||||
}
|
||||
|
||||
bool CCControlPotentiometer::isTouchInside(CCTouch * touch)
|
||||
{
|
||||
CCPoint touchLocation = this->getTouchLocation(touch);
|
||||
|
||||
float distance = this->distanceBetweenPointAndPoint(m_pProgressTimer->getPosition(), touchLocation);
|
||||
|
||||
return distance < MIN(getContentSize().width / 2, getContentSize().height / 2);
|
||||
}
|
||||
|
||||
bool CCControlPotentiometer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
if (!this->isTouchInside(pTouch)
|
||||
|| !this->isEnabled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_tPreviousLocation = this->getTouchLocation(pTouch);
|
||||
|
||||
this->potentiometerBegan(m_tPreviousLocation);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
CCPoint location = this->getTouchLocation(pTouch);
|
||||
|
||||
this->potentiometerMoved(location);
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
this->potentiometerEnded(CCPointZero);
|
||||
}
|
||||
|
||||
float CCControlPotentiometer::distanceBetweenPointAndPoint(CCPoint point1, CCPoint point2)
|
||||
{
|
||||
float dx = point1.x - point2.x;
|
||||
float dy = point1.y - point2.y;
|
||||
return sqrt(dx*dx + dy*dy);
|
||||
}
|
||||
|
||||
float CCControlPotentiometer::angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint(
|
||||
CCPoint beginLineA,
|
||||
CCPoint endLineA,
|
||||
CCPoint beginLineB,
|
||||
CCPoint endLineB)
|
||||
{
|
||||
float a = endLineA.x - beginLineA.x;
|
||||
float b = endLineA.y - beginLineA.y;
|
||||
float c = endLineB.x - beginLineB.x;
|
||||
float d = endLineB.y - beginLineB.y;
|
||||
|
||||
float atanA = atan2(a, b);
|
||||
float atanB = atan2(c, d);
|
||||
|
||||
// convert radiants to degrees
|
||||
return (atanA - atanB) * 180 / M_PI;
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::potentiometerBegan(CCPoint location)
|
||||
{
|
||||
setSelected(true);
|
||||
getThumbSprite()->setColor(ccGRAY);
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::potentiometerMoved(CCPoint location)
|
||||
{
|
||||
float angle = this->angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint(
|
||||
m_pProgressTimer->getPosition(),
|
||||
location,
|
||||
m_pProgressTimer->getPosition(),
|
||||
m_tPreviousLocation);
|
||||
|
||||
// fix value, if the 12 o'clock position is between location and previousLocation
|
||||
if (angle > 180)
|
||||
{
|
||||
angle -= 360;
|
||||
}
|
||||
else if (angle < -180)
|
||||
{
|
||||
angle += 360;
|
||||
}
|
||||
|
||||
setValue(m_fValue + angle / 360.0f * (m_fMaximumValue - m_fMinimumValue));
|
||||
|
||||
m_tPreviousLocation = location;
|
||||
}
|
||||
|
||||
void CCControlPotentiometer::potentiometerEnded(CCPoint location)
|
||||
{
|
||||
getThumbSprite()->setColor(ccWHITE);
|
||||
setSelected(false);
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Yannick Loriot. All rights reserved.
|
||||
* http://yannickloriot.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef __CCCONTROLPOTENTIOMETER_H__
|
||||
#define __CCCONTROLPOTENTIOMETER_H__
|
||||
|
||||
#include "CCControl.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup GUI
|
||||
* @{
|
||||
* @addtogroup control_extension
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @class CCControlPotentiometer Potentiometer control for Cocos2D. */
|
||||
class CCControlPotentiometer : public CCControl
|
||||
{
|
||||
public:
|
||||
CCControlPotentiometer();
|
||||
virtual ~CCControlPotentiometer();
|
||||
/**
|
||||
* Creates potentiometer with a track filename and a progress filename.
|
||||
*/
|
||||
static CCControlPotentiometer* create(const char* backgroundFile, const char* progressFile, const char* thumbFile);
|
||||
|
||||
/**
|
||||
* Initializes a potentiometer with a track sprite and a progress bar.
|
||||
*
|
||||
* @param trackSprite CCSprite, that is used as a background.
|
||||
* @param progressSprite CCProgressTimer, that is used as a progress bar.
|
||||
*/
|
||||
bool initWithTrackSprite_ProgressTimer_ThumbSprite(CCSprite* trackSprite, CCProgressTimer* progressTimer, CCSprite* thumbSprite);
|
||||
void setValue(float value);
|
||||
float getValue();
|
||||
|
||||
void setMinimumValue(float minimumValue);
|
||||
float getMinimumValue();
|
||||
|
||||
void setMaximumValue(float maximumValue);
|
||||
float getMaximumValue();
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
virtual bool isTouchInside(CCTouch * touch);
|
||||
|
||||
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
||||
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
|
||||
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
|
||||
|
||||
protected:
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_pThumbSprite, ThumbSprite)
|
||||
CC_SYNTHESIZE_RETAIN(CCProgressTimer*, m_pProgressTimer, ProgressTimer)
|
||||
CC_SYNTHESIZE(CCPoint, m_tPreviousLocation, PreviousLocation)
|
||||
/** Contains the receiver’s current value. */
|
||||
float m_fValue;
|
||||
/** Contains the minimum value of the receiver.
|
||||
* The default value of this property is 0.0. */
|
||||
float m_fMinimumValue;
|
||||
/** Contains the maximum value of the receiver.
|
||||
* The default value of this property is 1.0. */
|
||||
float m_fMaximumValue;
|
||||
/** Factorize the event dispath into these methods. */
|
||||
void potentiometerBegan(CCPoint location);
|
||||
void potentiometerMoved(CCPoint location);
|
||||
void potentiometerEnded(CCPoint location);
|
||||
|
||||
/** Returns the distance between the point1 and point2. */
|
||||
float distanceBetweenPointAndPoint(CCPoint point1, CCPoint point2);
|
||||
/** Returns the angle in degree between line1 and line2. */
|
||||
float angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint(
|
||||
CCPoint beginLineA,
|
||||
CCPoint endLineA,
|
||||
CCPoint beginLineB,
|
||||
CCPoint endLineB);
|
||||
|
||||
};
|
||||
|
||||
// end of GUI group
|
||||
/// @}
|
||||
/// @}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif /* __CCCONTROLPOTENTIOMETER_H__ */
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlSaturationBrightnessPicker.m
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Stewart Hamilton-Arrandale.
|
||||
* http://creativewax.co.uk
|
||||
|
@ -33,10 +34,28 @@
|
|||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
CCControlSaturationBrightnessPicker::~CCControlSaturationBrightnessPicker()
|
||||
CCControlSaturationBrightnessPicker::CCControlSaturationBrightnessPicker()
|
||||
: m_saturation(0.0f)
|
||||
, m_brightness(0.0f)
|
||||
, m_background(NULL)
|
||||
, m_overlay(NULL)
|
||||
, m_shadow(NULL)
|
||||
, m_slider(NULL)
|
||||
, boxPos(0)
|
||||
, boxSize(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlSaturationBrightnessPicker::~CCControlSaturationBrightnessPicker()
|
||||
{
|
||||
removeAllChildrenWithCleanup(true);
|
||||
|
||||
m_background = NULL;
|
||||
m_overlay = NULL;
|
||||
m_shadow = NULL;
|
||||
m_slider = NULL;
|
||||
}
|
||||
|
||||
bool CCControlSaturationBrightnessPicker::initWithTargetAndPos(CCNode* target, CCPoint pos)
|
||||
{
|
||||
|
@ -51,11 +70,13 @@ bool CCControlSaturationBrightnessPicker::initWithTargetAndPos(CCNode* target, C
|
|||
|
||||
m_startPos=pos; // starting position of the colour picker
|
||||
boxPos = 35; // starting position of the virtual box area for picking a colour
|
||||
boxSize = 150; // the size (width and height) of the virtual box for picking a colour from
|
||||
boxSize = m_background->getContentSize().width / 2;; // the size (width and height) of the virtual box for picking a colour from
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CCControlSaturationBrightnessPicker* CCControlSaturationBrightnessPicker::pickerWithTargetAndPos(CCNode* target, CCPoint pos)
|
||||
|
@ -71,7 +92,14 @@ CCControlSaturationBrightnessPicker* CCControlSaturationBrightnessPicker::create
|
|||
return pRet;
|
||||
}
|
||||
|
||||
|
||||
void CCControlSaturationBrightnessPicker::setEnabled(bool enabled)
|
||||
{
|
||||
CCControl::setEnabled(enabled);
|
||||
if (m_slider != NULL)
|
||||
{
|
||||
m_slider->setOpacity(enabled ? 255 : 128);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlSaturationBrightnessPicker::updateWithHSV(HSV hsv)
|
||||
{
|
||||
|
@ -149,7 +177,7 @@ bool CCControlSaturationBrightnessPicker::checkSliderPosition(CCPoint location)
|
|||
float dist = sqrtf(dx*dx+dy*dy);
|
||||
|
||||
// check that the touch location is within the bounding rectangle before sending updates
|
||||
if (dist <= m_background->boundingBox().size.width*.5)
|
||||
if (dist <= m_background->boundingBox().size.width*0.5f)
|
||||
{
|
||||
updateSliderPosition(location);
|
||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
|
@ -161,6 +189,11 @@ bool CCControlSaturationBrightnessPicker::checkSliderPosition(CCPoint location)
|
|||
|
||||
bool CCControlSaturationBrightnessPicker::ccTouchBegan(CCTouch* touch, CCEvent* event)
|
||||
{
|
||||
if (!isEnabled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the touch location
|
||||
CCPoint touchLocation=getTouchLocation(touch);
|
||||
|
||||
|
@ -175,10 +208,10 @@ void CCControlSaturationBrightnessPicker::ccTouchMoved(CCTouch* touch, CCEvent*
|
|||
CCPoint touchLocation=getTouchLocation(touch);
|
||||
|
||||
//small modification: this allows changing of the colour, even if the touch leaves the bounding area
|
||||
updateSliderPosition(touchLocation);
|
||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
// updateSliderPosition(touchLocation);
|
||||
// sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
// Check the touch position on the slider
|
||||
//checkSliderPosition(touchLocation);
|
||||
checkSliderPosition(touchLocation);
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlSaturationBrightnessPicker.h
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Stewart Hamilton-Arrandale.
|
||||
* http://creativewax.co.uk
|
||||
|
@ -46,7 +47,9 @@ NS_CC_EXT_BEGIN
|
|||
|
||||
class CCControlSaturationBrightnessPicker : public CCControl
|
||||
{
|
||||
/** Contains the receiver¡¯s current saturation value. */
|
||||
CC_SYNTHESIZE_READONLY(float, m_saturation, Saturation);
|
||||
/** Contains the receiver¡¯s current brightness value. */
|
||||
CC_SYNTHESIZE_READONLY(float, m_brightness, Brightness);
|
||||
|
||||
//not sure if these need to be there actually. I suppose someone might want to access the sprite?
|
||||
|
@ -61,12 +64,15 @@ protected:
|
|||
int boxSize;
|
||||
|
||||
public:
|
||||
CCControlSaturationBrightnessPicker();
|
||||
virtual ~CCControlSaturationBrightnessPicker();
|
||||
virtual bool initWithTargetAndPos(CCNode* target, CCPoint pos);
|
||||
|
||||
//@deprecated: This interface will be deprecated sooner or later.
|
||||
CC_DEPRECATED_ATTRIBUTE static CCControlSaturationBrightnessPicker* pickerWithTargetAndPos(CCNode* target, CCPoint pos);
|
||||
static CCControlSaturationBrightnessPicker* create(CCNode* target, CCPoint pos);
|
||||
|
||||
virtual void setEnabled(bool enabled);
|
||||
virtual void updateWithHSV(HSV hsv);
|
||||
virtual void updateDraggerWithHSV(HSV hsv);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlSlider
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2011 Yannick Loriot.
|
||||
* http://yannickloriot.com
|
||||
|
@ -33,11 +34,26 @@
|
|||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
CCControlSlider::~CCControlSlider()
|
||||
CCControlSlider::CCControlSlider()
|
||||
: m_value(0.0f)
|
||||
, m_minimumValue(0.0f)
|
||||
, m_maximumValue(0.0f)
|
||||
, m_minimumAllowedValue(0.0f)
|
||||
, m_maximumAllowedValue(0.0f)
|
||||
, m_thumbSprite(NULL)
|
||||
, m_progressSprite(NULL)
|
||||
, m_backgroundSprite(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlSlider::~CCControlSlider()
|
||||
{
|
||||
CC_SAFE_RELEASE(m_thumbSprite);
|
||||
CC_SAFE_RELEASE(m_progressSprite);
|
||||
CC_SAFE_RELEASE(m_backgroundSprite);
|
||||
}
|
||||
|
||||
CCControlSlider* CCControlSlider::sliderWithFiles(const char* bgFile, const char* progressFile, const char* thumbFile)
|
||||
{
|
||||
return CCControlSlider::create(bgFile, progressFile, thumbFile);
|
||||
|
@ -52,62 +68,62 @@ CCControlSlider* CCControlSlider::create(const char* bgFile, const char* progres
|
|||
CCSprite *progressSprite = CCSprite::create(progressFile);
|
||||
|
||||
// Prepare thumb (menuItem) for slider
|
||||
CCSprite *thumbNormal = CCSprite::create(thumbFile);
|
||||
CCSprite *thumbSelected = CCSprite::create(thumbFile);
|
||||
thumbSelected->setColor(ccGRAY);
|
||||
CCSprite *thumbSprite = CCSprite::create(thumbFile);
|
||||
|
||||
CCMenuItemSprite* thumbMenuItem =CCMenuItemSprite::create(thumbNormal, thumbSelected);
|
||||
|
||||
return CCControlSlider::create(backgroundSprite, progressSprite, thumbMenuItem);
|
||||
return CCControlSlider::create(backgroundSprite, progressSprite, thumbSprite);
|
||||
}
|
||||
|
||||
CCControlSlider* CCControlSlider::sliderWithSprites(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem)
|
||||
CCControlSlider* CCControlSlider::sliderWithSprites(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCSprite* thumbSprite)
|
||||
{
|
||||
return CCControlSlider::create(backgroundSprite, pogressSprite, thumbItem);
|
||||
return CCControlSlider::create(backgroundSprite, pogressSprite, thumbSprite);
|
||||
}
|
||||
|
||||
CCControlSlider* CCControlSlider::create(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem)
|
||||
CCControlSlider* CCControlSlider::create(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCSprite* thumbSprite)
|
||||
{
|
||||
CCControlSlider *pRet = new CCControlSlider();
|
||||
pRet->initWithSprites(backgroundSprite, pogressSprite, thumbItem);
|
||||
pRet->initWithSprites(backgroundSprite, pogressSprite, thumbSprite);
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool CCControlSlider::initWithSprites(CCSprite * backgroundSprite, CCSprite* progessSprite, CCMenuItem* thumbItem)
|
||||
bool CCControlSlider::initWithSprites(CCSprite * backgroundSprite, CCSprite* progressSprite, CCSprite* thumbSprite)
|
||||
{
|
||||
if (CCControl::init())
|
||||
{
|
||||
CCAssert(backgroundSprite, "Background sprite must be not nil");
|
||||
CCAssert(progressSprite, "Progress sprite must be not nil");
|
||||
CCAssert(thumbSprite, "Thumb sprite must be not nil");
|
||||
|
||||
ignoreAnchorPointForPosition(false);
|
||||
setTouchEnabled(true);
|
||||
|
||||
m_backgroundSprite=backgroundSprite;
|
||||
m_progressSprite=progessSprite;
|
||||
m_thumbItem=thumbItem;
|
||||
this->setBackgroundSprite(backgroundSprite);
|
||||
this->setProgressSprite(progressSprite);
|
||||
this->setThumbSprite(thumbSprite);
|
||||
|
||||
// Defines the content size
|
||||
CCRect maxRect = CCControlUtils::CCRectUnion(backgroundSprite->boundingBox(), thumbItem->boundingBox());
|
||||
CCSize size=CCSizeMake(maxRect.size.width+2*SLIDER_MARGIN_H, maxRect.size.height+2*SLIDER_MARGIN_V);
|
||||
setContentSize(size);
|
||||
//setContentSize(CCSizeMake(backgroundSprite->getContentSize().width, thumbItem->getContentSize().height));
|
||||
CCRect maxRect = CCControlUtils::CCRectUnion(backgroundSprite->boundingBox(), thumbSprite->boundingBox());
|
||||
|
||||
setContentSize(CCSizeMake(maxRect.size.width, maxRect.size.height));
|
||||
|
||||
// Add the slider background
|
||||
m_backgroundSprite->setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
m_backgroundSprite->setPosition(ccp(size.width / 2, size.height / 2));
|
||||
m_backgroundSprite->setPosition(ccp(this->getContentSize().width / 2, this->getContentSize().height / 2));
|
||||
addChild(m_backgroundSprite);
|
||||
|
||||
// Add the progress bar
|
||||
m_progressSprite->setAnchorPoint(ccp(0.0f, 0.5f));
|
||||
m_progressSprite->setPosition(ccp(0.0f+SLIDER_MARGIN_H, size.height / 2));
|
||||
m_progressSprite->setPosition(ccp(0.0f, this->getContentSize().height / 2));
|
||||
addChild(m_progressSprite);
|
||||
|
||||
// Add the slider thumb
|
||||
m_thumbItem->setPosition(ccp(0+SLIDER_MARGIN_H, size.height / 2));
|
||||
addChild(m_thumbItem);
|
||||
m_thumbSprite->setPosition(ccp(0.0f, this->getContentSize().height / 2));
|
||||
addChild(m_thumbSprite);
|
||||
|
||||
// Init default values
|
||||
m_minimumValue = 0.0f;
|
||||
m_maximumValue = 1.0f;
|
||||
m_snappingInterval=-1.0f;
|
||||
|
||||
setValue(m_minimumValue);
|
||||
return true;
|
||||
}
|
||||
|
@ -118,32 +134,33 @@ CCControlSlider* CCControlSlider::create(CCSprite * backgroundSprite, CCSprite*
|
|||
}
|
||||
|
||||
|
||||
void CCControlSlider::setEnabled(bool enabled)
|
||||
{
|
||||
CCControl::setEnabled(enabled);
|
||||
if (m_thumbSprite != NULL)
|
||||
{
|
||||
m_thumbSprite->setOpacity((enabled) ? 255 : 128);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlSlider::setValue(float value)
|
||||
{
|
||||
//clamp between the two bounds
|
||||
value=MAX(value, m_minimumValue);
|
||||
value=MIN(value, m_maximumValue);
|
||||
|
||||
//if we're snapping
|
||||
if (m_snappingInterval>=0)
|
||||
// set new value with sentinel
|
||||
if (value < m_minimumValue)
|
||||
{
|
||||
//int nTotal=(int)(ceil(m_maximumValue-m_minimumValue)/m_snappingInterval);
|
||||
//floor (n + 0.5f) == round(n)
|
||||
value=floor(0.5f + value/m_snappingInterval)*m_snappingInterval;
|
||||
value = m_minimumValue;
|
||||
}
|
||||
m_value=value;
|
||||
|
||||
// Update thumb position for new value
|
||||
float percent = (m_value - m_minimumValue) / (m_maximumValue - m_minimumValue);
|
||||
CCPoint pos= m_thumbItem->getPosition();
|
||||
pos.x = percent * m_backgroundSprite->getContentSize().width+SLIDER_MARGIN_H;
|
||||
m_thumbItem->setPosition(pos);
|
||||
|
||||
// Stretches content proportional to newLevel
|
||||
CCRect textureRect = m_progressSprite->getTextureRect();
|
||||
textureRect = CCRectMake(textureRect.origin.x, textureRect.origin.y, percent * m_backgroundSprite->getContentSize().width, textureRect.size.height);
|
||||
m_progressSprite->setTextureRect(textureRect, m_progressSprite->isTextureRectRotated(), textureRect.size);
|
||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
if (value > m_maximumValue)
|
||||
{
|
||||
value = m_maximumValue;
|
||||
}
|
||||
|
||||
m_value = value;
|
||||
|
||||
this->needsLayout();
|
||||
|
||||
this->sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
}
|
||||
|
||||
void CCControlSlider::setMinimumValue(float minimumValue)
|
||||
|
@ -151,61 +168,96 @@ CCControlSlider* CCControlSlider::create(CCSprite * backgroundSprite, CCSprite*
|
|||
m_minimumValue=minimumValue;
|
||||
m_minimumAllowedValue = minimumValue;
|
||||
if (m_minimumValue >= m_maximumValue)
|
||||
{
|
||||
m_maximumValue = m_minimumValue + 1.0f;
|
||||
}
|
||||
setValue(m_value);
|
||||
}
|
||||
|
||||
void CCControlSlider::setMaximumValue(float maximumValue)
|
||||
void CCControlSlider::setMaximumValue(float maximumValue)
|
||||
{
|
||||
m_maximumValue=maximumValue;
|
||||
m_maximumAllowedValue = maximumValue;
|
||||
if (m_maximumValue <= m_minimumValue)
|
||||
if (m_maximumValue <= m_minimumValue)
|
||||
{
|
||||
m_minimumValue = m_maximumValue - 1.0f;
|
||||
}
|
||||
setValue(m_value);
|
||||
}
|
||||
|
||||
//this is the same as CCControl::getTouchLocation, but it returns the position relative to the position of this control
|
||||
CCPoint CCControlSlider::getTouchLocationInControl(CCTouch* touch)
|
||||
bool CCControlSlider::isTouchInside(CCTouch * touch)
|
||||
{
|
||||
CCPoint touchLocation = touch->getLocation();; // Get the touch position
|
||||
touchLocation = convertToNodeSpace(touchLocation); // Convert to the node space of this class
|
||||
|
||||
if (touchLocation.x < 0)
|
||||
{
|
||||
touchLocation.x = 0;
|
||||
}
|
||||
else if (touchLocation.x > m_backgroundSprite->getContentSize().width+SLIDER_MARGIN_H)
|
||||
{
|
||||
touchLocation.x = m_backgroundSprite->getContentSize().width+SLIDER_MARGIN_H;
|
||||
}
|
||||
return touchLocation;
|
||||
CCPoint touchLocation = touch->getLocation();
|
||||
touchLocation = this->getParent()->convertToNodeSpace(touchLocation);
|
||||
|
||||
CCRect rect = this->boundingBox();
|
||||
rect.size.width += m_thumbSprite->getContentSize().width;
|
||||
rect.origin.x -= m_thumbSprite->getContentSize().width / 2;
|
||||
|
||||
return rect.containsPoint(touchLocation);
|
||||
}
|
||||
|
||||
bool CCControlSlider::ccTouchBegan(CCTouch* touch, CCEvent* pEvent)
|
||||
CCPoint CCControlSlider::locationFromTouch(CCTouch* touch)
|
||||
{
|
||||
CCPoint touchLocation = touch->getLocation(); // Get the touch position
|
||||
touchLocation = this->convertToNodeSpace(touchLocation); // Convert to the node space of this class
|
||||
|
||||
if (touchLocation.x < 0)
|
||||
{
|
||||
if (!isTouchInside(touch))
|
||||
touchLocation.x = 0;
|
||||
} else if (touchLocation.x > m_backgroundSprite->getContentSize().width)
|
||||
{
|
||||
touchLocation.x = m_backgroundSprite->getContentSize().width;
|
||||
}
|
||||
|
||||
return touchLocation;
|
||||
}
|
||||
|
||||
|
||||
bool CCControlSlider::ccTouchBegan(CCTouch* touch, CCEvent* pEvent)
|
||||
{
|
||||
if (!isTouchInside(touch) || !isEnabled())
|
||||
return false;
|
||||
|
||||
CCPoint location = getTouchLocationInControl(touch);
|
||||
CCPoint location = locationFromTouch(touch);
|
||||
sliderBegan(location);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCControlSlider::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
CCPoint location = getTouchLocationInControl(pTouch);
|
||||
CCPoint location = locationFromTouch(pTouch);
|
||||
sliderMoved(location);
|
||||
}
|
||||
|
||||
void CCControlSlider::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
CCPoint location = getTouchLocationInControl(pTouch);
|
||||
sliderEnded(CCPointZero);
|
||||
}
|
||||
|
||||
void CCControlSlider::needsLayout()
|
||||
{
|
||||
if (NULL == m_thumbSprite || NULL == m_backgroundSprite || NULL == m_progressSprite)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Update thumb position for new value
|
||||
float percent = (m_value - m_minimumValue) / (m_maximumValue - m_minimumValue);
|
||||
|
||||
CCPoint pos = m_thumbSprite->getPosition();
|
||||
pos.x = percent * m_backgroundSprite->getContentSize().width;
|
||||
m_thumbSprite->setPosition(pos);
|
||||
|
||||
// Stretches content proportional to newLevel
|
||||
CCRect textureRect = m_progressSprite->getTextureRect();
|
||||
textureRect = CCRectMake(textureRect.origin.x, textureRect.origin.y, pos.x, textureRect.size.height);
|
||||
m_progressSprite->setTextureRect(textureRect, m_progressSprite->isTextureRectRotated(), textureRect.size);
|
||||
}
|
||||
|
||||
void CCControlSlider::sliderBegan(CCPoint location)
|
||||
{
|
||||
m_thumbItem->selected();
|
||||
this->setSelected(true);
|
||||
this->getThumbSprite()->setColor(ccGRAY);
|
||||
setValue(valueForLocation(location));
|
||||
}
|
||||
|
||||
|
@ -216,16 +268,17 @@ void CCControlSlider::sliderMoved(CCPoint location)
|
|||
|
||||
void CCControlSlider::sliderEnded(CCPoint location)
|
||||
{
|
||||
if (m_thumbItem->isSelected())
|
||||
if (this->isSelected())
|
||||
{
|
||||
m_thumbItem->unselected();
|
||||
setValue(valueForLocation(m_thumbItem->getPosition()));
|
||||
setValue(valueForLocation(m_thumbSprite->getPosition()));
|
||||
}
|
||||
this->getThumbSprite()->setColor(ccWHITE);
|
||||
this->setSelected(false);
|
||||
}
|
||||
|
||||
float CCControlSlider::valueForLocation(CCPoint location)
|
||||
{
|
||||
float percent = (location.x-SLIDER_MARGIN_H)/ m_backgroundSprite->getContentSize().width;
|
||||
float percent = location.x/ m_backgroundSprite->getContentSize().width;
|
||||
return MAX(MIN(m_minimumValue + percent * (m_maximumValue - m_minimumValue), m_maximumAllowedValue), m_minimumAllowedValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlSlider
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2011 Yannick Loriot. All rights reserved.
|
||||
* http://yannickloriot.com
|
||||
|
@ -31,11 +32,6 @@
|
|||
|
||||
#include "CCControl.h"
|
||||
#include "CCInvocation.h"
|
||||
#include "sprite_nodes/CCSprite.h"
|
||||
#include "menu_nodes/CCMenuItem.h"
|
||||
|
||||
#define SLIDER_MARGIN_H 24
|
||||
#define SLIDER_MARGIN_V 8
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
@ -49,27 +45,31 @@ NS_CC_EXT_BEGIN
|
|||
class CCControlSlider: public CCControl
|
||||
{
|
||||
//maunally put in the setters
|
||||
/** Contains the receiver¡¯s current value. */
|
||||
CC_SYNTHESIZE_READONLY(float, m_value, Value);
|
||||
virtual void setValue(float val);
|
||||
/** Contains the minimum value of the receiver.
|
||||
* The default value of this property is 0.0. */
|
||||
CC_SYNTHESIZE_READONLY(float, m_minimumValue, MinimumValue);
|
||||
virtual void setMinimumValue(float val);
|
||||
/** Contains the maximum value of the receiver.
|
||||
* The default value of this property is 1.0. */
|
||||
CC_SYNTHESIZE_READONLY(float, m_maximumValue, MaximumValue);
|
||||
virtual void setMaximumValue(float val);
|
||||
|
||||
virtual void setEnabled(bool enabled);
|
||||
virtual bool isTouchInside(CCTouch * touch);
|
||||
CCPoint locationFromTouch(CCTouch* touch);
|
||||
|
||||
CC_SYNTHESIZE(float, m_minimumAllowedValue, MinimumAllowedValue);
|
||||
CC_SYNTHESIZE(float, m_maximumAllowedValue, MaximumAllowedValue);
|
||||
|
||||
|
||||
//interval to snap to
|
||||
CC_SYNTHESIZE(float, m_snappingInterval, SnappingInterval);
|
||||
|
||||
// maybe this should be read-only
|
||||
CC_SYNTHESIZE_READONLY(CCMenuItem*, m_thumbItem, ThumbItem);
|
||||
CC_SYNTHESIZE_READONLY(CCSprite*, m_progressSprite, ProgressSprite);
|
||||
CC_SYNTHESIZE_READONLY(CCSprite*, m_backgroundSprite, BackgroundSprite);
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_thumbSprite, ThumbSprite);
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_progressSprite, ProgressSprite);
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_backgroundSprite, BackgroundSprite);
|
||||
|
||||
public:
|
||||
|
||||
CCControlSlider();
|
||||
virtual ~CCControlSlider();
|
||||
|
||||
/**
|
||||
|
@ -78,9 +78,9 @@ public:
|
|||
*
|
||||
* @param backgroundSprite CCSprite, that is used as a background.
|
||||
* @param progressSprite CCSprite, that is used as a progress bar.
|
||||
* @param thumbItem CCMenuItem, that is used as a thumb.
|
||||
* @param thumbItem CCSprite, that is used as a thumb.
|
||||
*/
|
||||
virtual bool initWithSprites(CCSprite * backgroundSprite, CCSprite* progessSprite, CCMenuItem* thumbItem);
|
||||
virtual bool initWithSprites(CCSprite * backgroundSprite, CCSprite* progressSprite, CCSprite* thumbSprite);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
*@deprecated: This interface will be deprecated sooner or later.
|
||||
* @see initWithBackgroundSprite:progressSprite:thumbMenuItem:
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static CCControlSlider* sliderWithSprites(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem);
|
||||
CC_DEPRECATED_ATTRIBUTE static CCControlSlider* sliderWithSprites(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCSprite* thumbSprite);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -111,22 +111,18 @@ public:
|
|||
*
|
||||
* @see initWithBackgroundSprite:progressSprite:thumbMenuItem:
|
||||
*/
|
||||
static CCControlSlider* create(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem);
|
||||
|
||||
static CCControlSlider* create(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCSprite* thumbSprite);
|
||||
|
||||
virtual void needsLayout();
|
||||
protected:
|
||||
void sliderBegan(CCPoint location);
|
||||
void sliderMoved(CCPoint location);
|
||||
void sliderEnded(CCPoint location);
|
||||
|
||||
virtual CCPoint getTouchLocationInControl(CCTouch* touch);
|
||||
|
||||
virtual bool ccTouchBegan(CCTouch* touch, CCEvent* pEvent);
|
||||
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
|
||||
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
|
||||
|
||||
|
||||
|
||||
/** Returns the value for the given location. */
|
||||
float valueForLocation(CCPoint location);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Yannick Loriot. All rights reserved.
|
||||
* http://yannickloriot.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT falseT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND falseNINFRINGEMENT. IN false EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CCControlStepper.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
#define CCControlStepperLabelColorEnabled ccc3(55, 55, 55)
|
||||
#define CCControlStepperLabelColorDisabled ccc3(147, 147, 147)
|
||||
|
||||
#define CCControlStepperLabelFont "CourierNewPSMT"
|
||||
|
||||
|
||||
#define kAutorepeatDeltaTime 0.15f
|
||||
#define kAutorepeatIncreaseTimeIncrement 12
|
||||
|
||||
CCControlStepper::CCControlStepper()
|
||||
: m_dValue(0.0)
|
||||
, m_bContinuous(false)
|
||||
, m_bAutorepeat(false)
|
||||
, m_bWraps(false)
|
||||
, m_dMinimumValue(0.0)
|
||||
, m_dMaximumValue(0.0)
|
||||
, m_dStepValue(0.0)
|
||||
, m_pMinusSprite(NULL)
|
||||
, m_pPlusSprite(NULL)
|
||||
, m_pMinusLabel(NULL)
|
||||
, m_pPlusLabel(NULL)
|
||||
, m_bTouchInsideFlag(false)
|
||||
, m_eTouchedPart(kCCControlStepperPartNone)
|
||||
, m_nAutorepeatCount(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlStepper::~CCControlStepper()
|
||||
{
|
||||
unscheduleAllSelectors();
|
||||
|
||||
CC_SAFE_RELEASE(m_pMinusSprite);
|
||||
CC_SAFE_RELEASE(m_pPlusSprite);
|
||||
CC_SAFE_RELEASE(m_pMinusLabel);
|
||||
CC_SAFE_RELEASE(m_pPlusLabel);
|
||||
}
|
||||
|
||||
bool CCControlStepper::initWithMinusSpriteAndPlusSprite(CCSprite *minusSprite, CCSprite *plusSprite)
|
||||
{
|
||||
if (CCControl::init())
|
||||
{
|
||||
CCAssert(minusSprite, "Minus sprite must be not nil");
|
||||
CCAssert(plusSprite, "Plus sprite must be not nil");
|
||||
|
||||
setTouchEnabled(true);
|
||||
|
||||
// Set the default values
|
||||
m_bAutorepeat = true;
|
||||
m_bContinuous = true;
|
||||
m_dMinimumValue = 0;
|
||||
m_dMaximumValue = 100;
|
||||
m_dValue = 0;
|
||||
m_dStepValue = 1;
|
||||
m_bWraps = false;
|
||||
this->ignoreAnchorPointForPosition( false );
|
||||
|
||||
// Add the minus components
|
||||
this->setMinusSprite(minusSprite);
|
||||
m_pMinusSprite->setPosition( ccp(minusSprite->getContentSize().width / 2, minusSprite->getContentSize().height / 2) );
|
||||
this->addChild(m_pMinusSprite);
|
||||
|
||||
this->setMinusLabel( CCLabelTTF::create("-", CCControlStepperLabelFont, 40));
|
||||
m_pMinusLabel->setColor(CCControlStepperLabelColorDisabled);
|
||||
m_pMinusLabel->setPosition(CCPointMake(m_pMinusSprite->getContentSize().width / 2, m_pMinusSprite->getContentSize().height / 2) );
|
||||
m_pMinusSprite->addChild(m_pMinusLabel);
|
||||
|
||||
// Add the plus components
|
||||
this->setPlusSprite( plusSprite );
|
||||
m_pPlusSprite->setPosition( ccp(minusSprite->getContentSize().width + plusSprite->getContentSize().width / 2,
|
||||
minusSprite->getContentSize().height / 2) );
|
||||
this->addChild(m_pPlusSprite);
|
||||
|
||||
this->setPlusLabel( CCLabelTTF::create("+", CCControlStepperLabelFont, 40 ));
|
||||
m_pPlusLabel->setColor( CCControlStepperLabelColorEnabled );
|
||||
m_pPlusLabel->setPosition( CCPointMake(m_pPlusSprite->getContentSize().width / 2, m_pPlusSprite->getContentSize().height / 2) );
|
||||
m_pPlusSprite->addChild(m_pPlusLabel);
|
||||
|
||||
// Defines the content size
|
||||
CCRect maxRect = CCControlUtils::CCRectUnion(m_pMinusSprite->boundingBox(), m_pPlusSprite->boundingBox());
|
||||
this->setContentSize( CCSizeMake(m_pMinusSprite->getContentSize().width + m_pPlusSprite->getContentSize().height, maxRect.size.height) );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CCControlStepper* CCControlStepper::create(CCSprite *minusSprite, CCSprite *plusSprite)
|
||||
{
|
||||
CCControlStepper* pRet = new CCControlStepper();
|
||||
if (pRet != NULL && pRet->initWithMinusSpriteAndPlusSprite(minusSprite, plusSprite))
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_DELETE(pRet);
|
||||
}
|
||||
return pRet;
|
||||
}
|
||||
|
||||
//#pragma mark Properties
|
||||
|
||||
void CCControlStepper::setWraps(bool wraps)
|
||||
{
|
||||
m_bWraps = wraps;
|
||||
|
||||
if (m_bWraps)
|
||||
{
|
||||
m_pMinusLabel->setColor( CCControlStepperLabelColorEnabled );
|
||||
m_pPlusLabel->setColor(CCControlStepperLabelColorEnabled );
|
||||
}
|
||||
|
||||
this->setValue( m_dValue );
|
||||
}
|
||||
|
||||
void CCControlStepper::setMinimumValue(double minimumValue)
|
||||
{
|
||||
if (minimumValue >= m_dMaximumValue)
|
||||
{
|
||||
CCAssert(0, "Must be numerically less than maximumValue.");
|
||||
}
|
||||
|
||||
m_dMinimumValue = minimumValue;
|
||||
this->setValue( m_dValue );
|
||||
}
|
||||
|
||||
void CCControlStepper::setMaximumValue(double maximumValue)
|
||||
{
|
||||
if (maximumValue <= m_dMinimumValue)
|
||||
{
|
||||
CCAssert(0, "Must be numerically greater than minimumValue.");
|
||||
}
|
||||
|
||||
m_dMaximumValue = maximumValue;
|
||||
this->setValue(m_dValue);
|
||||
}
|
||||
|
||||
void CCControlStepper::setValue(double value)
|
||||
{
|
||||
this->setValueWithSendingEvent(value, true);
|
||||
}
|
||||
|
||||
double CCControlStepper::getValue()
|
||||
{
|
||||
return m_dValue;
|
||||
}
|
||||
|
||||
void CCControlStepper::setStepValue(double stepValue)
|
||||
{
|
||||
if (stepValue <= 0)
|
||||
{
|
||||
CCAssert(0,"Must be numerically greater than 0.");
|
||||
}
|
||||
|
||||
m_dStepValue = stepValue;
|
||||
}
|
||||
|
||||
bool CCControlStepper::isContinuous()
|
||||
{
|
||||
return m_bContinuous;
|
||||
}
|
||||
//#pragma mark -
|
||||
//#pragma mark CCControlStepper Public Methods
|
||||
|
||||
void CCControlStepper::setValueWithSendingEvent(double value, bool send)
|
||||
{
|
||||
if (value < m_dMinimumValue)
|
||||
{
|
||||
value = m_bWraps ? m_dMaximumValue : m_dMinimumValue;
|
||||
} else if (value > m_dMaximumValue)
|
||||
{
|
||||
value = m_bWraps ? m_dMinimumValue : m_dMaximumValue;
|
||||
}
|
||||
|
||||
m_dValue = value;
|
||||
|
||||
if (!m_bWraps)
|
||||
{
|
||||
m_pMinusLabel->setColor((value == m_dMinimumValue) ? CCControlStepperLabelColorDisabled : CCControlStepperLabelColorEnabled);
|
||||
m_pPlusLabel->setColor((value == m_dMaximumValue) ? CCControlStepperLabelColorDisabled : CCControlStepperLabelColorEnabled);
|
||||
}
|
||||
|
||||
if (send)
|
||||
{
|
||||
this->sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlStepper::startAutorepeat()
|
||||
{
|
||||
m_nAutorepeatCount = -1;
|
||||
|
||||
this->schedule(schedule_selector(CCControlStepper::update), kAutorepeatDeltaTime, kCCRepeatForever, kAutorepeatDeltaTime * 3);
|
||||
}
|
||||
|
||||
/** Stop the autorepeat. */
|
||||
void CCControlStepper::stopAutorepeat()
|
||||
{
|
||||
this->unschedule(schedule_selector(CCControlStepper::update));
|
||||
}
|
||||
|
||||
void CCControlStepper::update(float dt)
|
||||
{
|
||||
m_nAutorepeatCount++;
|
||||
|
||||
if ((m_nAutorepeatCount < kAutorepeatIncreaseTimeIncrement) && (m_nAutorepeatCount % 3) != 0)
|
||||
return;
|
||||
|
||||
if (m_eTouchedPart == kCCControlStepperPartMinus)
|
||||
{
|
||||
this->setValueWithSendingEvent(m_dValue - m_dStepValue, m_bContinuous);
|
||||
} else if (m_eTouchedPart == kCCControlStepperPartPlus)
|
||||
{
|
||||
this->setValueWithSendingEvent(m_dValue + m_dStepValue, m_bContinuous);
|
||||
}
|
||||
}
|
||||
|
||||
//#pragma mark CCControlStepper Private Methods
|
||||
|
||||
void CCControlStepper::updateLayoutUsingTouchLocation(CCPoint location)
|
||||
{
|
||||
if (location.x < m_pMinusSprite->getContentSize().width
|
||||
&& m_dValue > m_dMinimumValue)
|
||||
{
|
||||
m_eTouchedPart = kCCControlStepperPartMinus;
|
||||
|
||||
m_pMinusSprite->setColor(ccGRAY);
|
||||
m_pPlusSprite->setColor(ccWHITE);
|
||||
} else if (location.x >= m_pMinusSprite->getContentSize().width
|
||||
&& m_dValue < m_dMaximumValue)
|
||||
{
|
||||
m_eTouchedPart = kCCControlStepperPartPlus;
|
||||
|
||||
m_pMinusSprite->setColor(ccWHITE);
|
||||
m_pPlusSprite->setColor(ccGRAY);
|
||||
} else
|
||||
{
|
||||
m_eTouchedPart = kCCControlStepperPartNone;
|
||||
|
||||
m_pMinusSprite->setColor(ccWHITE);
|
||||
m_pPlusSprite->setColor(ccWHITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CCControlStepper::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
if (!this->isTouchInside(pTouch)
|
||||
|| !this->isEnabled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CCPoint location = this->getTouchLocation(pTouch);
|
||||
this->updateLayoutUsingTouchLocation(location);
|
||||
|
||||
m_bTouchInsideFlag = true;
|
||||
|
||||
if (m_bAutorepeat)
|
||||
{
|
||||
this->startAutorepeat();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCControlStepper::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
if (this->isTouchInside(pTouch))
|
||||
{
|
||||
CCPoint location = this->getTouchLocation(pTouch);
|
||||
this->updateLayoutUsingTouchLocation(location);
|
||||
|
||||
if (!m_bTouchInsideFlag)
|
||||
{
|
||||
m_bTouchInsideFlag = true;
|
||||
|
||||
if (m_bAutorepeat)
|
||||
{
|
||||
this->startAutorepeat();
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
m_bTouchInsideFlag = false;
|
||||
|
||||
m_eTouchedPart = kCCControlStepperPartNone;
|
||||
|
||||
m_pMinusSprite->setColor(ccWHITE);
|
||||
m_pPlusSprite->setColor(ccWHITE);
|
||||
|
||||
if (m_bAutorepeat)
|
||||
{
|
||||
this->stopAutorepeat();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlStepper::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
|
||||
{
|
||||
m_pMinusSprite->setColor(ccWHITE);
|
||||
m_pPlusSprite->setColor(ccWHITE);
|
||||
|
||||
if (m_bAutorepeat)
|
||||
{
|
||||
this->stopAutorepeat();
|
||||
}
|
||||
|
||||
if (this->isTouchInside(pTouch))
|
||||
{
|
||||
CCPoint location = this->getTouchLocation(pTouch);
|
||||
|
||||
this->setValue(m_dValue + ((location.x < m_pMinusSprite->getContentSize().width) ? (0.0-m_dStepValue) : m_dStepValue));
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Yannick Loriot. All rights reserved.
|
||||
* http://yannickloriot.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CCCONTROLSTEPPER_H__
|
||||
#define __CCCONTROLSTEPPER_H__
|
||||
|
||||
#include "CCControl.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup GUI
|
||||
* @{
|
||||
* @addtogroup control_extension
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kCCControlStepperPartMinus,
|
||||
kCCControlStepperPartPlus,
|
||||
kCCControlStepperPartNone,
|
||||
} CCControlStepperPart;
|
||||
|
||||
class CCControlStepper : public CCControl
|
||||
{
|
||||
public:
|
||||
CCControlStepper();
|
||||
virtual ~CCControlStepper();
|
||||
|
||||
bool initWithMinusSpriteAndPlusSprite(CCSprite *minusSprite, CCSprite *plusSprite);
|
||||
static CCControlStepper* create(CCSprite *minusSprite, CCSprite *plusSprite);
|
||||
virtual void setWraps(bool wraps);
|
||||
virtual void setMinimumValue(double minimumValue);
|
||||
virtual void setMaximumValue(double maximumValue);
|
||||
virtual void setValue(double value);
|
||||
virtual double getValue();
|
||||
virtual void setStepValue(double stepValue);
|
||||
virtual void setValueWithSendingEvent(double value, bool send);
|
||||
virtual bool isContinuous();
|
||||
void update(float dt);
|
||||
|
||||
//events
|
||||
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
||||
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
|
||||
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
|
||||
|
||||
protected:
|
||||
// Weak links to children
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_pMinusSprite, MinusSprite)
|
||||
CC_SYNTHESIZE_RETAIN(CCSprite*, m_pPlusSprite, PlusSprite)
|
||||
CC_SYNTHESIZE_RETAIN(CCLabelTTF*, m_pMinusLabel, MinusLabel)
|
||||
CC_SYNTHESIZE_RETAIN(CCLabelTTF*, m_pPlusLabel, PlusLabel)
|
||||
|
||||
/** Update the layout of the stepper with the given touch location. */
|
||||
void updateLayoutUsingTouchLocation(CCPoint location);
|
||||
|
||||
/** Set the numeric value of the stepper. If send is true, the CCControlEventValueChanged is sent. */
|
||||
void setValue(double value, bool send);
|
||||
|
||||
/** Start the autorepeat increment/decrement. */
|
||||
void startAutorepeat();
|
||||
|
||||
/** Stop the autorepeat. */
|
||||
void stopAutorepeat();
|
||||
|
||||
/** The numeric value of the stepper. */
|
||||
double m_dValue;
|
||||
/** The continuous vs. noncontinuous state of the stepper. */
|
||||
bool m_bContinuous;
|
||||
/** The automatic vs. nonautomatic repeat state of the stepper. */
|
||||
bool m_bAutorepeat;
|
||||
/** The wrap vs. no-wrap state of the stepper. */
|
||||
bool m_bWraps;
|
||||
/** The lowest possible numeric value for the stepper. */
|
||||
double m_dMinimumValue;
|
||||
/** The highest possible numeric value for the stepper. */
|
||||
double m_dMaximumValue;
|
||||
/** The step, or increment, value for the stepper. */
|
||||
double m_dStepValue;
|
||||
bool m_bTouchInsideFlag;
|
||||
CCControlStepperPart m_eTouchedPart;
|
||||
int m_nAutorepeatCount;
|
||||
};
|
||||
|
||||
// end of GUI group
|
||||
/// @}
|
||||
/// @}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif /* __CCCONTROLSTEPPER_H__ */
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Yannick Loriot. All rights reserved.
|
||||
* http://yannickloriot.com
|
||||
*
|
||||
|
@ -259,6 +261,10 @@ float CCControlSwitchSprite::offSideWidth()
|
|||
// CCControlSwitch
|
||||
|
||||
CCControlSwitch::CCControlSwitch()
|
||||
: m_pSwitchSprite(NULL)
|
||||
, m_fInitialTouchXPosition(0.0f)
|
||||
, m_bMoved(false)
|
||||
, m_bOn(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -367,8 +373,10 @@ void CCControlSwitch::setOn(bool isOn, bool animated)
|
|||
void CCControlSwitch::setEnabled(bool enabled)
|
||||
{
|
||||
m_bEnabled = enabled;
|
||||
|
||||
m_pSwitchSprite->setOpacity((enabled) ? 255 : 128);
|
||||
if (m_pSwitchSprite != NULL)
|
||||
{
|
||||
m_pSwitchSprite->setOpacity((enabled) ? 255 : 128);
|
||||
}
|
||||
}
|
||||
|
||||
CCPoint CCControlSwitch::locationFromTouch(CCTouch* pTouch)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* CCControlSwitch.h
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Copyright 2012 Yannick Loriot. All rights reserved.
|
||||
* http://yannickloriot.com
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCControlUtils.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
* ColourUtils.h
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
*
|
||||
* Copyright 2012 Stewart Hamilton-Arrandale.
|
||||
* http://creativewax.co.uk
|
||||
|
|
|
@ -1,7 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* Converted to c++ / cocos2d-x by Angus C
|
||||
*/
|
||||
|
||||
#include "CCInvocation.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
CCInvocation* CCInvocation::create(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent)
|
||||
{
|
||||
CCInvocation* pRet = new CCInvocation(target, action, controlEvent);
|
||||
if (pRet != NULL)
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
return pRet;
|
||||
}
|
||||
|
||||
CCInvocation::CCInvocation(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent)
|
||||
{
|
||||
m_target=target;
|
||||
|
|
|
@ -1,4 +1,29 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* http://www.cocos2d-x.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* Converted to c++ / cocos2d-x by Angus C
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* Helper class to store targets and selectors (and eventually, params?) in the same CCMutableArray. Basically a very crude form of a NSInvocation
|
||||
*/
|
||||
|
@ -30,6 +55,7 @@ class CCInvocation : public CCObject
|
|||
CC_SYNTHESIZE_READONLY(CCControlEvent, m_controlEvent, ControlEvent);
|
||||
|
||||
public:
|
||||
static CCInvocation* create(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
|
||||
CCInvocation(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
|
||||
|
||||
void invoke(CCObject* sender);
|
||||
|
|
|
@ -1,465 +0,0 @@
|
|||
#include "CCMenuPassive.h"
|
||||
#include "CCDirector.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "menu_nodes/CCMenuItem.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
enum
|
||||
{
|
||||
kDefaultPadding = 5,
|
||||
};
|
||||
|
||||
//
|
||||
//CCMenu
|
||||
//
|
||||
CCMenuPassive* CCMenuPassive::node()
|
||||
{
|
||||
return CCMenuPassive::create();
|
||||
}
|
||||
|
||||
CCMenuPassive* CCMenuPassive::create()
|
||||
{
|
||||
return create(NULL, NULL);
|
||||
}
|
||||
|
||||
CCMenuPassive * CCMenuPassive::menuWithItems(CCNode* item, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,item);
|
||||
CCMenuPassive *pRet = new CCMenuPassive();
|
||||
if (pRet && pRet->initWithItems(item, args))
|
||||
{
|
||||
pRet->autorelease();
|
||||
va_end(args);
|
||||
return pRet;
|
||||
}
|
||||
va_end(args);
|
||||
CC_SAFE_DELETE(pRet);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCMenuPassive * CCMenuPassive::create(CCNode* item, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,item);
|
||||
CCMenuPassive *pRet = new CCMenuPassive();
|
||||
if (pRet && pRet->initWithItems(item, args))
|
||||
{
|
||||
pRet->autorelease();
|
||||
va_end(args);
|
||||
return pRet;
|
||||
}
|
||||
va_end(args);
|
||||
CC_SAFE_DELETE(pRet);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCMenuPassive* CCMenuPassive::menuWithItem(CCNode* item)
|
||||
{
|
||||
return CCMenuPassive::createWithItem(item);
|
||||
}
|
||||
|
||||
CCMenuPassive* CCMenuPassive::createWithItem(CCNode* item)
|
||||
{
|
||||
return create(item, NULL);
|
||||
}
|
||||
|
||||
bool CCMenuPassive::initWithItems(CCNode* item, va_list args)
|
||||
{
|
||||
if (CCLayer::init())
|
||||
{
|
||||
//this->m_bIsTouchEnabled = false;
|
||||
|
||||
// menu in the center of the screen
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// Set the default anchor point
|
||||
ignoreAnchorPointForPosition(true);
|
||||
setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
this->setContentSize(s);
|
||||
|
||||
setPosition(ccp(s.width/2, s.height/2));
|
||||
|
||||
int z=0;
|
||||
|
||||
if (item)
|
||||
{
|
||||
this->addChild(item, z);
|
||||
CCMenuItem *i = va_arg(args, CCMenuItem*);
|
||||
while (i)
|
||||
{
|
||||
z++;
|
||||
this->addChild(i, z);
|
||||
i = va_arg(args, CCMenuItem*);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//Menu - Alignment
|
||||
void CCMenuPassive::alignItemsVertically()
|
||||
{
|
||||
this->alignItemsVerticallyWithPadding(kDefaultPadding);
|
||||
}
|
||||
|
||||
void CCMenuPassive::alignItemsVerticallyWithPadding(float padding)
|
||||
{
|
||||
float height = -padding;
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
height += pChild->getContentSize().height * pChild->getScaleY() + padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
float width=0;
|
||||
float y = height / 2.0f;
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
width=max(width, pChild->getContentSize().width);
|
||||
pChild->setPosition(ccp(0, y - pChild->getContentSize().height * pChild->getScaleY() / 2.0f));
|
||||
y -= pChild->getContentSize().height * pChild->getScaleY() + padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
setContentSize(CCSizeMake(width, height));
|
||||
}
|
||||
|
||||
void CCMenuPassive::alignItemsHorizontally(void)
|
||||
{
|
||||
this->alignItemsHorizontallyWithPadding(kDefaultPadding);
|
||||
}
|
||||
|
||||
void CCMenuPassive::alignItemsHorizontallyWithPadding(float padding)
|
||||
{
|
||||
|
||||
float width = -padding;
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
width += pChild->getContentSize().width * pChild->getScaleX() + padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float height=0;
|
||||
float x = -width / 2.0f;
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
height=max(height, pChild->getContentSize().height);
|
||||
pChild->setPosition(ccp(x + pChild->getContentSize().width * pChild->getScaleX() / 2.0f, 0));
|
||||
x += pChild->getContentSize().width * pChild->getScaleX() + padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
setContentSize(CCSizeMake(width, height));
|
||||
}
|
||||
|
||||
void CCMenuPassive::alignItemsInColumns(unsigned int columns, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, columns);
|
||||
|
||||
this->alignItemsInColumns(columns, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void CCMenuPassive::alignItemsInColumns(unsigned int columns, va_list args)
|
||||
{
|
||||
vector<unsigned int> rows;
|
||||
while (columns)
|
||||
{
|
||||
rows.push_back(columns);
|
||||
columns = va_arg(args, unsigned int);
|
||||
}
|
||||
|
||||
int height = -5;
|
||||
unsigned int row = 0;
|
||||
unsigned int rowHeight = 0;
|
||||
unsigned int columnsOccupied = 0;
|
||||
unsigned int rowColumns;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
CCAssert(row < rows.size(), "");
|
||||
|
||||
rowColumns = rows[row];
|
||||
// can not have zero columns on a row
|
||||
CCAssert(rowColumns, "");
|
||||
|
||||
float tmp = pChild->getContentSize().height;
|
||||
rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp);
|
||||
|
||||
++columnsOccupied;
|
||||
if (columnsOccupied >= rowColumns)
|
||||
{
|
||||
height += rowHeight + 5;
|
||||
|
||||
columnsOccupied = 0;
|
||||
rowHeight = 0;
|
||||
++row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if too many rows/columns for available menu items
|
||||
CCAssert(! columnsOccupied, "");
|
||||
|
||||
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
row = 0;
|
||||
rowHeight = 0;
|
||||
rowColumns = 0;
|
||||
float w = 0.0;
|
||||
float x = 0.0;
|
||||
float y = (float)(height / 2);
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
if (rowColumns == 0)
|
||||
{
|
||||
rowColumns = rows[row];
|
||||
w = winSize.width / (1 + rowColumns);
|
||||
x = w;
|
||||
}
|
||||
|
||||
float tmp = pChild->getContentSize().height;
|
||||
rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp);
|
||||
|
||||
pChild->setPosition(ccp(x - winSize.width / 2,
|
||||
y - pChild->getContentSize().height / 2));
|
||||
|
||||
x += w;
|
||||
++columnsOccupied;
|
||||
|
||||
if (columnsOccupied >= rowColumns)
|
||||
{
|
||||
y -= rowHeight + 5;
|
||||
|
||||
columnsOccupied = 0;
|
||||
rowColumns = 0;
|
||||
rowHeight = 0;
|
||||
++row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCMenuPassive::alignItemsInRows(unsigned int rows, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, rows);
|
||||
|
||||
this->alignItemsInRows(rows, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void CCMenuPassive::alignItemsInRows(unsigned int rows, va_list args)
|
||||
{
|
||||
vector<unsigned int> columns;
|
||||
while (rows)
|
||||
{
|
||||
columns.push_back(rows);
|
||||
rows = va_arg(args, unsigned int);
|
||||
}
|
||||
|
||||
vector<unsigned int> columnWidths;
|
||||
vector<unsigned int> columnHeights;
|
||||
|
||||
int width = -10;
|
||||
int columnHeight = -5;
|
||||
unsigned int column = 0;
|
||||
unsigned int columnWidth = 0;
|
||||
unsigned int rowsOccupied = 0;
|
||||
unsigned int columnRows;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
// check if too many menu items for the amount of rows/columns
|
||||
CCAssert(column < columns.size(), "");
|
||||
|
||||
columnRows = columns[column];
|
||||
// can't have zero rows on a column
|
||||
CCAssert(columnRows, "");
|
||||
|
||||
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
|
||||
float tmp = pChild->getContentSize().width;
|
||||
columnWidth = (unsigned int)((columnWidth >= tmp || isnan(tmp)) ? columnWidth : tmp);
|
||||
|
||||
columnHeight += (int)(pChild->getContentSize().height + 5);
|
||||
++rowsOccupied;
|
||||
|
||||
if (rowsOccupied >= columnRows)
|
||||
{
|
||||
columnWidths.push_back(columnWidth);
|
||||
columnHeights.push_back(columnHeight);
|
||||
width += columnWidth + 10;
|
||||
|
||||
rowsOccupied = 0;
|
||||
columnWidth = 0;
|
||||
columnHeight = -5;
|
||||
++column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if too many rows/columns for available menu items.
|
||||
CCAssert(! rowsOccupied, "");
|
||||
|
||||
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
column = 0;
|
||||
columnWidth = 0;
|
||||
columnRows = 0;
|
||||
float x = (float)(-width / 2);
|
||||
float y = 0.0;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
if (columnRows == 0)
|
||||
{
|
||||
columnRows = columns[column];
|
||||
y = (float) columnHeights[column];
|
||||
}
|
||||
|
||||
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
|
||||
float tmp = pChild->getContentSize().width;
|
||||
columnWidth = (unsigned int)((columnWidth >= tmp || isnan(tmp)) ? columnWidth : tmp);
|
||||
|
||||
pChild->setPosition(ccp(x + columnWidths[column] / 2,
|
||||
y - winSize.height / 2));
|
||||
|
||||
y -= pChild->getContentSize().height + 10;
|
||||
++rowsOccupied;
|
||||
|
||||
if (rowsOccupied >= columnRows)
|
||||
{
|
||||
x += columnWidth + 5;
|
||||
rowsOccupied = 0;
|
||||
columnRows = 0;
|
||||
columnWidth = 0;
|
||||
++column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Opacity Protocol
|
||||
|
||||
/** Override synthesized setOpacity to recurse items */
|
||||
void CCMenuPassive::setOpacity(GLubyte var)
|
||||
{
|
||||
m_cOpacity = var;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(pChild);
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacity(m_cOpacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GLubyte CCMenuPassive::getOpacity(void)
|
||||
{
|
||||
return m_cOpacity;
|
||||
}
|
||||
|
||||
void CCMenuPassive::setColor(const ccColor3B& var)
|
||||
{
|
||||
m_tColor = var;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCObject* pObject = NULL;
|
||||
CCARRAY_FOREACH(m_pChildren, pObject)
|
||||
{
|
||||
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
|
||||
if (pChild)
|
||||
{
|
||||
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(pChild);
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setColor(m_tColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ccColor3B& CCMenuPassive::getColor(void)
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* A menu that does not send any events, it's simply a passive container (lets the contents do their own thing) of CCNodes
|
||||
*/
|
||||
#ifndef __CCMENU_PASSIVE_H__
|
||||
#define __CCMENU_PASSIVE_H__
|
||||
|
||||
#include "CCControl.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup GUI
|
||||
* @{
|
||||
* @addtogroup control_extension
|
||||
* @{
|
||||
*/
|
||||
|
||||
class CCMenuPassive : public CCLayer, public CCRGBAProtocol
|
||||
{
|
||||
/** Color: conforms with CCRGBAProtocol protocol */
|
||||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
|
||||
/** Opacity: conforms with CCRGBAProtocol protocol */
|
||||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
|
||||
|
||||
public:
|
||||
/** creates an empty CCMenu
|
||||
@deprecated: This interface will be deprecated sooner or later.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static CCMenuPassive* node();
|
||||
|
||||
/** creates a CCMenu with it's items
|
||||
@deprecated: This interface will be deprecated sooner or later.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static CCMenuPassive* menuWithItems(CCNode* item, ...);
|
||||
|
||||
/** creates a CCMenu with it's item, then use addChild() to add
|
||||
* other items. It is used for script, it can't init with undetermined
|
||||
* number of variables.
|
||||
@deprecated: This interface will be deprecated sooner or later.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static CCMenuPassive* menuWithItem(CCNode* item);
|
||||
|
||||
/** creates an empty CCMenu */
|
||||
static CCMenuPassive* create();
|
||||
|
||||
/** creates a CCMenu with it's items */
|
||||
static CCMenuPassive* create(CCNode* item, ...);
|
||||
|
||||
/** creates a CCMenu with it's item, then use addChild() to add
|
||||
* other items. It is used for script, it can't init with undetermined
|
||||
* number of variables.
|
||||
*/
|
||||
static CCMenuPassive* createWithItem(CCNode* item);
|
||||
|
||||
/** initializes a CCMenu with it's items */
|
||||
bool initWithItems(CCNode* item, va_list args);
|
||||
|
||||
/** align items vertically */
|
||||
void alignItemsVertically();
|
||||
/** align items vertically with padding
|
||||
@since v0.7.2
|
||||
*/
|
||||
void alignItemsVerticallyWithPadding(float padding);
|
||||
|
||||
/** align items horizontally */
|
||||
void alignItemsHorizontally();
|
||||
/** align items horizontally with padding
|
||||
@since v0.7.2
|
||||
*/
|
||||
void alignItemsHorizontallyWithPadding(float padding);
|
||||
|
||||
/** align items in rows of columns */
|
||||
void alignItemsInColumns(unsigned int columns, ...);
|
||||
void alignItemsInColumns(unsigned int columns, va_list args);
|
||||
|
||||
/** align items in columns of rows */
|
||||
void alignItemsInRows(unsigned int rows, ...);
|
||||
void alignItemsInRows(unsigned int rows, va_list args);
|
||||
|
||||
//RGBA protocol
|
||||
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
|
||||
virtual bool isOpacityModifyRGB(void) { return false;}
|
||||
};
|
||||
|
||||
// end of GUI group
|
||||
/// @}
|
||||
/// @}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif
|
|
@ -1,32 +1,83 @@
|
|||
//
|
||||
// CCScale9Sprite.cpp
|
||||
// PlantCaring
|
||||
//
|
||||
// Created by Jung Sang-Taik on 12. 3. 16..
|
||||
// Copyright (c) 2012 Neofect. All rights reserved.
|
||||
//
|
||||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Created by Jung Sang-Taik on 12. 3. 16..
|
||||
Copyright (c) 2012 Neofect. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCScale9Sprite.h"
|
||||
#include "sprite_nodes/CCSpriteBatchNode.h"
|
||||
#include "sprite_nodes/CCSpriteFrame.h"
|
||||
#include "sprite_nodes/CCSpriteFrameCache.h"
|
||||
#include "sprite_nodes/CCSprite.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
enum positions
|
||||
{
|
||||
pCentre = 0,
|
||||
pTop,
|
||||
pLeft,
|
||||
pRight,
|
||||
pBottom,
|
||||
pTopRight,
|
||||
pTopLeft,
|
||||
pBottomRight,
|
||||
pBottomLeft
|
||||
};
|
||||
|
||||
CCScale9Sprite::CCScale9Sprite()
|
||||
: m_insetLeft(0)
|
||||
, m_insetTop(0)
|
||||
, m_insetRight(0)
|
||||
, m_insetBottom(0)
|
||||
, m_cOpacity(0)
|
||||
, m_bSpritesGenerated(false)
|
||||
, m_bSpriteFrameRotated(false)
|
||||
, m_positionsAreDirty(false)
|
||||
, scale9Image(NULL)
|
||||
, topLeft(NULL)
|
||||
, top(NULL)
|
||||
, topRight(NULL)
|
||||
, left(NULL)
|
||||
, centre(NULL)
|
||||
, right(NULL)
|
||||
, bottomLeft(NULL)
|
||||
, bottom(NULL)
|
||||
, bottomRight(NULL)
|
||||
, m_bIsOpacityModifyRGB(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCScale9Sprite::~CCScale9Sprite()
|
||||
{
|
||||
|
||||
CC_SAFE_RELEASE(topLeft);
|
||||
CC_SAFE_RELEASE(top);
|
||||
CC_SAFE_RELEASE(topRight);
|
||||
CC_SAFE_RELEASE(left);
|
||||
CC_SAFE_RELEASE(centre);
|
||||
CC_SAFE_RELEASE(right);
|
||||
CC_SAFE_RELEASE(bottomLeft);
|
||||
CC_SAFE_RELEASE(bottom);
|
||||
CC_SAFE_RELEASE(bottomRight);
|
||||
CC_SAFE_RELEASE(scale9Image);
|
||||
}
|
||||
|
||||
bool CCScale9Sprite::init()
|
||||
|
@ -35,10 +86,15 @@ bool CCScale9Sprite::init()
|
|||
}
|
||||
|
||||
bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, CCRect capInsets)
|
||||
{
|
||||
return this->initWithBatchNode(batchnode, rect, false, capInsets);
|
||||
}
|
||||
|
||||
bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets)
|
||||
{
|
||||
if(batchnode)
|
||||
{
|
||||
this->updateWithBatchNode(batchnode, rect, capInsets);
|
||||
this->updateWithBatchNode(batchnode, rect, rotated, capInsets);
|
||||
this->setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
}
|
||||
this->m_positionsAreDirty = true;
|
||||
|
@ -46,37 +102,30 @@ bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, CCRect capInsets)
|
||||
bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets)
|
||||
{
|
||||
GLubyte opacity = m_cOpacity;
|
||||
ccColor3B color = m_tColor;
|
||||
|
||||
// Release old sprites
|
||||
this->removeAllChildrenWithCleanup(true);
|
||||
|
||||
// TODO Is this needed?
|
||||
/*
|
||||
if(this->topLeft != NULL)
|
||||
{
|
||||
CC_SAFE_RELEASE(this->topLeft);
|
||||
CC_SAFE_RELEASE(this->top);
|
||||
CC_SAFE_RELEASE(this->topRight);
|
||||
CC_SAFE_RELEASE(this->left);
|
||||
CC_SAFE_RELEASE(this->centre);
|
||||
CC_SAFE_RELEASE(this->right);
|
||||
CC_SAFE_RELEASE(this->bottomLeft);
|
||||
CC_SAFE_RELEASE(this->bottom);
|
||||
CC_SAFE_RELEASE(this->bottomRight);
|
||||
}
|
||||
*/
|
||||
CC_SAFE_RELEASE(this->centre);
|
||||
CC_SAFE_RELEASE(this->top);
|
||||
CC_SAFE_RELEASE(this->topLeft);
|
||||
CC_SAFE_RELEASE(this->topRight);
|
||||
CC_SAFE_RELEASE(this->left);
|
||||
CC_SAFE_RELEASE(this->right);
|
||||
CC_SAFE_RELEASE(this->bottomLeft);
|
||||
CC_SAFE_RELEASE(this->bottom);
|
||||
CC_SAFE_RELEASE(this->bottomRight);
|
||||
|
||||
|
||||
if(this->scale9Image != batchnode)
|
||||
{
|
||||
// TODO Is this needed?
|
||||
/*
|
||||
if(this->scale9Image != NULL)
|
||||
{
|
||||
CC_SAFE_RELEASE(this->scale9Image);
|
||||
}
|
||||
*/
|
||||
scale9Image = batchnode; // TODO No retain on purpose?
|
||||
CC_SAFE_RELEASE(this->scale9Image);
|
||||
scale9Image = batchnode;
|
||||
CC_SAFE_RETAIN(scale9Image);
|
||||
}
|
||||
|
||||
scale9Image->removeAllChildrenWithCleanup(true);
|
||||
|
@ -98,99 +147,219 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re
|
|||
m_preferredSize = m_originalSize;
|
||||
m_capInsetsInternal = capInsets;
|
||||
|
||||
// If there is no specified center region
|
||||
if ( m_capInsetsInternal.equals(CCRectZero) )
|
||||
{
|
||||
// Apply the 3x3 grid format
|
||||
m_capInsetsInternal = CCRectMake(
|
||||
rect.origin.x + m_originalSize.width / 3,
|
||||
rect.origin.y + m_originalSize.height / 3,
|
||||
m_originalSize.width / 3,
|
||||
m_originalSize.height / 3);
|
||||
}
|
||||
|
||||
// Get the image edges
|
||||
float l = rect.origin.x;
|
||||
float t = rect.origin.y;
|
||||
float h = rect.size.height;
|
||||
float w = rect.size.width;
|
||||
|
||||
// If there is no specified center region
|
||||
if ( m_capInsetsInternal.equals(CCRectZero) )
|
||||
{
|
||||
// Apply the 3x3 grid format
|
||||
if (rotated)
|
||||
{
|
||||
m_capInsetsInternal = CCRectMake(l+h/3, t+w/3, w/3, h/3);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_capInsetsInternal = CCRectMake(l+w/3, t+h/3, w/3, h/3);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set up the image
|
||||
//
|
||||
|
||||
// Centre
|
||||
centre = CCSprite::createWithTexture(scale9Image->getTexture(), m_capInsetsInternal);
|
||||
scale9Image->addChild(centre, 0, pCentre);
|
||||
|
||||
// Top
|
||||
top = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x,
|
||||
t,
|
||||
m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.origin.y - t));
|
||||
scale9Image->addChild(top, 1, pTop);
|
||||
|
||||
// Bottom
|
||||
bottom = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x,
|
||||
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height,
|
||||
m_capInsetsInternal.size.width,
|
||||
h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height) ));
|
||||
scale9Image->addChild(bottom, 1, pBottom);
|
||||
|
||||
// Left
|
||||
left = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
l,
|
||||
m_capInsetsInternal.origin.y,
|
||||
m_capInsetsInternal.origin.x - l,
|
||||
m_capInsetsInternal.size.height) );
|
||||
scale9Image->addChild(left, 1, pLeft);
|
||||
|
||||
// Right
|
||||
right = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.origin.y,
|
||||
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
|
||||
m_capInsetsInternal.size.height));
|
||||
scale9Image->addChild(right, 1, pRight);
|
||||
|
||||
// Top left
|
||||
topLeft = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
l,
|
||||
t,
|
||||
m_capInsetsInternal.origin.x - l,
|
||||
m_capInsetsInternal.origin.y - t));
|
||||
if (rotated)
|
||||
{
|
||||
// Sprite frame is rotated
|
||||
|
||||
scale9Image->addChild(topLeft, 2, pTopLeft);
|
||||
|
||||
// Top right
|
||||
topRight = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
|
||||
// Centre
|
||||
centre = new CCSprite();
|
||||
centre->initWithTexture(scale9Image->getTexture(), m_capInsetsInternal, true);
|
||||
scale9Image->addChild(centre, 0, pCentre);
|
||||
|
||||
// Bottom
|
||||
bottom = new CCSprite();
|
||||
bottom->initWithTexture(scale9Image->getTexture(), CCRectMake(l,
|
||||
m_capInsetsInternal.origin.y,
|
||||
m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.origin.x - l),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(bottom, 1, pBottom);
|
||||
|
||||
// Top
|
||||
top = new CCSprite();
|
||||
top->initWithTexture(scale9Image->getTexture(),CCRectMake(m_capInsetsInternal.origin.x + m_capInsetsInternal.size.height,
|
||||
m_capInsetsInternal.origin.y,
|
||||
m_capInsetsInternal.size.width,
|
||||
h - m_capInsetsInternal.size.height - (m_capInsetsInternal.origin.x - l)),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(top, 1, pTop);
|
||||
|
||||
// Right
|
||||
right = new CCSprite();
|
||||
right->initWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x,
|
||||
m_capInsetsInternal.origin.y+m_capInsetsInternal.size.width,
|
||||
w - (m_capInsetsInternal.origin.y-t)-m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.size.height),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(right, 1, pRight);
|
||||
|
||||
// Left
|
||||
left = new CCSprite();
|
||||
left->initWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x,
|
||||
t,
|
||||
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
|
||||
m_capInsetsInternal.origin.y - t));
|
||||
|
||||
scale9Image->addChild(topRight, 2, pTopRight);
|
||||
|
||||
// Bottom left
|
||||
bottomLeft = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
l,
|
||||
m_capInsetsInternal.origin.y - t,
|
||||
m_capInsetsInternal.size.height),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(left ,1, pLeft);
|
||||
|
||||
// Top right
|
||||
topRight = new CCSprite();
|
||||
topRight->initWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x + m_capInsetsInternal.size.height,
|
||||
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.width,
|
||||
w - (m_capInsetsInternal.origin.y-t)-m_capInsetsInternal.size.width,
|
||||
h - m_capInsetsInternal.size.height - (m_capInsetsInternal.origin.x - l)),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(topRight ,2 ,pTopRight);
|
||||
|
||||
// Top left
|
||||
topLeft = new CCSprite();
|
||||
topLeft->initWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x + m_capInsetsInternal.size.height,
|
||||
t,
|
||||
m_capInsetsInternal.origin.y - t,
|
||||
h - m_capInsetsInternal.size.height - (m_capInsetsInternal.origin.x - l)),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(topLeft, 2, pTopLeft);
|
||||
|
||||
// Bottom right
|
||||
bottomRight = new CCSprite();
|
||||
bottomRight->initWithTexture(scale9Image->getTexture(),CCRectMake(l,
|
||||
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.width,
|
||||
w - (m_capInsetsInternal.origin.y-t)-m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.origin.x - l),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(bottomRight, 2, pBottomRight);
|
||||
|
||||
// Bottom left
|
||||
bottomLeft = new CCSprite();
|
||||
bottomLeft->initWithTexture(scale9Image->getTexture(), CCRectMake(l,
|
||||
t,
|
||||
m_capInsetsInternal.origin.y - t,
|
||||
m_capInsetsInternal.origin.x - l),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(bottomLeft, 2, pBottomLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sprite frame is not rotated
|
||||
// Centre
|
||||
centre = new CCSprite();
|
||||
centre->initWithTexture(scale9Image->getTexture(), m_capInsetsInternal, rotated);
|
||||
scale9Image->addChild(centre, 0, pCentre);
|
||||
|
||||
// Top
|
||||
top = new CCSprite();
|
||||
top->initWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x,
|
||||
t,
|
||||
m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.origin.y - t),
|
||||
rotated
|
||||
);
|
||||
scale9Image->addChild(top, 1, pTop);
|
||||
|
||||
// Bottom
|
||||
bottom = new CCSprite();
|
||||
bottom->initWithTexture(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x,
|
||||
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height,
|
||||
m_capInsetsInternal.origin.x - l,
|
||||
h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height)) );
|
||||
scale9Image->addChild(bottomLeft, 2, pBottomLeft);
|
||||
|
||||
// Bottom right
|
||||
bottomRight = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height,
|
||||
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
|
||||
h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height)) );
|
||||
scale9Image->addChild(bottomRight, 2, pBottomRight);
|
||||
|
||||
m_capInsetsInternal.size.width,
|
||||
h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height)),
|
||||
rotated);
|
||||
scale9Image->addChild(bottom, 1, pBottom);
|
||||
|
||||
// Left
|
||||
left = new CCSprite();
|
||||
left->initWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
l,
|
||||
m_capInsetsInternal.origin.y,
|
||||
m_capInsetsInternal.origin.x - l,
|
||||
m_capInsetsInternal.size.height),
|
||||
rotated);
|
||||
scale9Image->addChild(left, 1, pLeft);
|
||||
|
||||
// Right
|
||||
right = new CCSprite();
|
||||
right->initWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.origin.y,
|
||||
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
|
||||
m_capInsetsInternal.size.height),
|
||||
rotated);
|
||||
scale9Image->addChild(right, 1, pRight);
|
||||
|
||||
// Top left
|
||||
topLeft = new CCSprite();
|
||||
topLeft->initWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
l,
|
||||
t,
|
||||
m_capInsetsInternal.origin.x - l,
|
||||
m_capInsetsInternal.origin.y - t),
|
||||
rotated);
|
||||
|
||||
scale9Image->addChild(topLeft, 2, pTopLeft);
|
||||
|
||||
// Top right
|
||||
topRight = new CCSprite();
|
||||
topRight->initWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
|
||||
t,
|
||||
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
|
||||
m_capInsetsInternal.origin.y - t),
|
||||
rotated);
|
||||
|
||||
scale9Image->addChild(topRight, 2, pTopRight);
|
||||
|
||||
// Bottom left
|
||||
bottomLeft = new CCSprite();
|
||||
bottomLeft->initWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
l,
|
||||
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height,
|
||||
m_capInsetsInternal.origin.x - l,
|
||||
h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height)),
|
||||
rotated);
|
||||
scale9Image->addChild(bottomLeft, 2, pBottomLeft);
|
||||
|
||||
// Bottom right
|
||||
bottomRight = new CCSprite();
|
||||
bottomRight->initWithTexture(scale9Image->getTexture(), CCRectMake(
|
||||
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
|
||||
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height,
|
||||
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
|
||||
h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height)),
|
||||
rotated);
|
||||
scale9Image->addChild(bottomRight, 2, pBottomRight);
|
||||
}
|
||||
|
||||
this->setContentSize(rect.size);
|
||||
this->addChild(scale9Image);
|
||||
|
||||
if (m_bSpritesGenerated)
|
||||
{
|
||||
// Restore color and opacity
|
||||
this->setOpacity(opacity);
|
||||
this->setColor(color);
|
||||
}
|
||||
m_bSpritesGenerated = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -206,10 +375,13 @@ void CCScale9Sprite::updatePositions()
|
|||
|
||||
float sizableWidth = size.width - topLeft->getContentSize().width - topRight->getContentSize().width;
|
||||
float sizableHeight = size.height - topLeft->getContentSize().height - bottomRight->getContentSize().height;
|
||||
|
||||
float horizontalScale = sizableWidth/centre->getContentSize().width;
|
||||
float verticalScale = sizableHeight/centre->getContentSize().height;
|
||||
|
||||
centre->setScaleX(horizontalScale);
|
||||
centre->setScaleY(verticalScale);
|
||||
|
||||
float rescaledWidth = centre->getContentSize().width * horizontalScale;
|
||||
float rescaledHeight = centre->getContentSize().height * verticalScale;
|
||||
|
||||
|
@ -274,6 +446,7 @@ CCScale9Sprite* CCScale9Sprite::create(const char* file, CCRect rect, CCRect ca
|
|||
|
||||
bool CCScale9Sprite::initWithFile(const char* file, CCRect rect)
|
||||
{
|
||||
CCAssert(file != NULL, "Invalid file for sprite");
|
||||
bool pReturn = this->initWithFile(file, rect, CCRectZero);
|
||||
return pReturn;
|
||||
}
|
||||
|
@ -348,7 +521,7 @@ bool CCScale9Sprite::initWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capI
|
|||
CCAssert(spriteFrame != NULL, "Sprite frame must be not nil");
|
||||
|
||||
CCSpriteBatchNode *batchnode = CCSpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9);
|
||||
bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), capInsets);
|
||||
bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), spriteFrame->isRotated(), capInsets);
|
||||
return pReturn;
|
||||
}
|
||||
|
||||
|
@ -370,6 +543,7 @@ CCScale9Sprite* CCScale9Sprite::createWithSpriteFrame(CCSpriteFrame* spriteFrame
|
|||
}
|
||||
bool CCScale9Sprite::initWithSpriteFrame(CCSpriteFrame* spriteFrame)
|
||||
{
|
||||
CCAssert(spriteFrame != NULL, "Invalid spriteFrame for sprite");
|
||||
bool pReturn = this->initWithSpriteFrame(spriteFrame, CCRectZero);
|
||||
return pReturn;
|
||||
}
|
||||
|
@ -508,15 +682,6 @@ void CCScale9Sprite::setOpacity(GLubyte var)
|
|||
{
|
||||
pNode->setOpacity(m_cOpacity);
|
||||
}
|
||||
//CCNode* pNode = (CCNode*) child;
|
||||
//if (pNode)
|
||||
//{
|
||||
// CCRGBAProtocol *pRGBAProtocol = (CCRGBAProtocol *)pNode;
|
||||
// if (pRGBAProtocol)
|
||||
// {
|
||||
// pRGBAProtocol->setOpacity(m_cOpacity);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -544,7 +709,7 @@ CCSize CCScale9Sprite::getPreferredSize()
|
|||
void CCScale9Sprite::setCapInsets(CCRect capInsets)
|
||||
{
|
||||
CCSize contentSize = this->m_tContentSize;
|
||||
this->updateWithBatchNode(this->scale9Image, this->m_spriteRect, capInsets);
|
||||
this->updateWithBatchNode(this->scale9Image, this->m_spriteRect, m_bSpriteFrameRotated, capInsets);
|
||||
this->setContentSize(contentSize);
|
||||
}
|
||||
|
||||
|
@ -562,10 +727,20 @@ void CCScale9Sprite::updateCapInset()
|
|||
}
|
||||
else
|
||||
{
|
||||
insets = CCRectMake(this->m_insetLeft,
|
||||
this->m_insetTop,
|
||||
this->m_spriteRect.size.width-this->m_insetLeft-this->m_insetRight,
|
||||
this->m_spriteRect.size.height-this->m_insetTop-this->m_insetBottom);
|
||||
if (m_bSpriteFrameRotated)
|
||||
{
|
||||
insets = CCRectMake(m_spriteRect.origin.x + m_insetBottom,
|
||||
m_spriteRect.origin.y + m_insetLeft,
|
||||
m_spriteRect.size.width-m_insetRight-m_insetLeft,
|
||||
m_spriteRect.size.height-m_insetTop-m_insetBottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
insets = CCRectMake(m_spriteRect.origin.x + m_insetLeft,
|
||||
m_spriteRect.origin.y + m_insetTop,
|
||||
m_spriteRect.size.width-m_insetLeft-m_insetRight,
|
||||
m_spriteRect.size.height-m_insetTop-m_insetBottom);
|
||||
}
|
||||
}
|
||||
this->setCapInsets(insets);
|
||||
}
|
||||
|
@ -583,15 +758,6 @@ void CCScale9Sprite::setOpacityModifyRGB(bool var)
|
|||
{
|
||||
pNode->setOpacityModifyRGB(m_bIsOpacityModifyRGB);
|
||||
}
|
||||
//CCNode* pNode = (CCNode*) child;
|
||||
//if (pNode)
|
||||
//{
|
||||
// CCRGBAProtocol *pRGBAProtocol = (CCRGBAProtocol *)pNode;
|
||||
// if (pRGBAProtocol)
|
||||
// {
|
||||
// pRGBAProtocol->setOpacityModifyRGB(m_bIsOpacityModifyRGB);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -603,7 +769,7 @@ bool CCScale9Sprite::isOpacityModifyRGB()
|
|||
void CCScale9Sprite::setSpriteFrame(CCSpriteFrame * spriteFrame)
|
||||
{
|
||||
CCSpriteBatchNode * batchnode = CCSpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9);
|
||||
this->updateWithBatchNode(batchnode, spriteFrame->getRect(), CCRectZero);
|
||||
this->updateWithBatchNode(batchnode, spriteFrame->getRect(), spriteFrame->isRotated(), CCRectZero);
|
||||
|
||||
// Reset insets
|
||||
this->m_insetLeft = 0;
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
//
|
||||
// CCScale9Sprite.h
|
||||
// PlantCaring
|
||||
//
|
||||
// Created by Jung Sang-Taik on 12. 3. 16..
|
||||
// Copyright (c) 2012 Neofect. All rights reserved.
|
||||
//
|
||||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Created by Jung Sang-Taik on 12. 3. 16..
|
||||
Copyright (c) 2012 Neofect. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCScale9Sprite_H__
|
||||
#define __CCScale9Sprite_H__
|
||||
|
||||
#include "base_nodes/CCNode.h"
|
||||
#include "CCProtocols.h"
|
||||
#include "cocos2d.h"
|
||||
#include "ExtensionMacros.h"
|
||||
|
||||
|
||||
namespace cocos2d { class CCSprite; }
|
||||
namespace cocos2d { class CCSpriteBatchNode; }
|
||||
namespace cocos2d { class CCSpriteFrame; }
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
enum positions
|
||||
{
|
||||
pCentre = 0,
|
||||
pTop,
|
||||
pLeft,
|
||||
pRight,
|
||||
pBottom,
|
||||
pTopRight,
|
||||
pTopLeft,
|
||||
pBottomRight,
|
||||
pBottomLeft
|
||||
};
|
||||
|
||||
/**
|
||||
* @addtogroup GUI
|
||||
* @{
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
public:
|
||||
/** Original sprite's size. */
|
||||
CC_SYNTHESIZE(CCSize, m_originalSize, OriginalSize);
|
||||
CC_SYNTHESIZE_READONLY(CCSize, m_originalSize, OriginalSize);
|
||||
/** Prefered sprite's size. By default the prefered size is the original size. */
|
||||
|
||||
//if the preferredSize component is given as -1, it is ignored
|
||||
|
@ -58,19 +58,25 @@ public:
|
|||
* On a non-resizeable sprite, this property is set to CGRectZero; the sprite
|
||||
* does not use end caps and the entire sprite is subject to stretching.
|
||||
*/
|
||||
|
||||
CC_PROPERTY(CCRect, m_capInsets, CapInsets);
|
||||
/** Sets the left side inset */
|
||||
CC_PROPERTY(float, m_insetLeft, InsetLeft);
|
||||
/** Sets the top side inset */
|
||||
CC_PROPERTY(float, m_insetTop, InsetTop);
|
||||
/** Sets the right side inset */
|
||||
CC_PROPERTY(float, m_insetRight, InsetRight);
|
||||
/** Sets the bottom side inset */
|
||||
CC_PROPERTY(float, m_insetBottom, InsetBottom);
|
||||
|
||||
/** Opacity: conforms to CCRGBAProtocol protocol */
|
||||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity)
|
||||
/** Color: conforms to CCRGBAProtocol protocol */
|
||||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
|
||||
CC_PROPERTY(CCRect, m_capInsets, CapInsets);
|
||||
CC_PROPERTY(float, m_insetLeft, InsetLeft);
|
||||
CC_PROPERTY(float, m_insetTop, InsetTop);
|
||||
CC_PROPERTY(float, m_insetRight, InsetRight);
|
||||
CC_PROPERTY(float, m_insetBottom, InsetBottom);
|
||||
|
||||
|
||||
protected:
|
||||
bool m_bSpritesGenerated;
|
||||
CCRect m_spriteRect;
|
||||
bool m_bSpriteFrameRotated;
|
||||
CCRect m_capInsetsInternal;
|
||||
bool m_positionsAreDirty;
|
||||
|
||||
|
@ -99,6 +105,7 @@ public:
|
|||
|
||||
virtual bool init();
|
||||
|
||||
virtual bool initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets);
|
||||
virtual bool initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, CCRect capInsets);
|
||||
/**
|
||||
* Initializes a 9-slice sprite with a texture file, a delimitation zone and
|
||||
|
@ -153,7 +160,7 @@ public:
|
|||
* @see initWithFile:rect:
|
||||
@deprecated: This interface will be deprecated sooner or later.
|
||||
*/
|
||||
static CCScale9Sprite* spriteWithFile(const char* file, CCRect rect);
|
||||
CC_DEPRECATED_ATTRIBUTE static CCScale9Sprite* spriteWithFile(const char* file, CCRect rect);
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with a texture file and a delimitation zone. The
|
||||
|
@ -378,7 +385,7 @@ public:
|
|||
*/
|
||||
virtual bool isOpacityModifyRGB(void);
|
||||
|
||||
virtual bool updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, CCRect capInsets);
|
||||
virtual bool updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets);
|
||||
|
||||
virtual void setSpriteFrame(CCSpriteFrame * spriteFrame);
|
||||
};
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#include "CCSpacer.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
CCSpacer* CCSpacer::verticalSpacer(float space)
|
||||
{
|
||||
CCSpacer *pRet = new CCSpacer();
|
||||
pRet->init();
|
||||
pRet->setContentSize(CCSizeMake(0, space));
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
||||
CCSpacer* CCSpacer::horizontalSpacer(float space)
|
||||
{
|
||||
CCSpacer *pRet = new CCSpacer();
|
||||
pRet->init();
|
||||
pRet->setContentSize(CCSizeMake(space, 0));
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef __CCSPACER_H__
|
||||
#define __CCSPACER_H__
|
||||
|
||||
#include "layers_scenes_transitions_nodes/CCLayer.h"
|
||||
#include "ExtensionMacros.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup GUI
|
||||
* @{
|
||||
* @addtogroup control_extension
|
||||
* @{
|
||||
*/
|
||||
|
||||
class CCSpacer: public CCLayer
|
||||
{
|
||||
public:
|
||||
static CCSpacer* verticalSpacer(float space);
|
||||
static CCSpacer* horizontalSpacer(float space);
|
||||
};
|
||||
|
||||
// end of GUI group
|
||||
/// @}
|
||||
/// @}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif
|
|
@ -401,6 +401,14 @@
|
|||
RelativePath="..\GUI\CCControlExtension\CCControlHuePicker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCControlPotentiometer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCControlPotentiometer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.cpp"
|
||||
>
|
||||
|
@ -417,6 +425,14 @@
|
|||
RelativePath="..\GUI\CCControlExtension\CCControlSlider.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCControlStepper.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCControlStepper.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCControlSwitch.cpp"
|
||||
>
|
||||
|
@ -441,14 +457,6 @@
|
|||
RelativePath="..\GUI\CCControlExtension\CCInvocation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCMenuPassive.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCMenuPassive.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCScale9Sprite.cpp"
|
||||
>
|
||||
|
@ -457,14 +465,6 @@
|
|||
RelativePath="..\GUI\CCControlExtension\CCScale9Sprite.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCSpacer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GUI\CCControlExtension\CCSpacer.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="CCScrollView"
|
||||
|
|
|
@ -107,14 +107,14 @@
|
|||
<ClCompile Include="..\GUI\CCControlExtension\CCControlButton.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlColourPicker.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlHuePicker.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlPotentiometer.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSlider.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlStepper.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSwitch.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlUtils.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCInvocation.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCMenuPassive.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCScale9Sprite.cpp" />
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCSpacer.cpp" />
|
||||
<ClCompile Include="..\GUI\CCScrollView\CCScrollView.cpp" />
|
||||
<ClCompile Include="..\GUI\CCScrollView\CCSorting.cpp" />
|
||||
<ClCompile Include="..\GUI\CCScrollView\CCTableView.cpp" />
|
||||
|
@ -155,14 +155,14 @@
|
|||
<ClInclude Include="..\GUI\CCControlExtension\CCControlColourPicker.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlExtensions.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlHuePicker.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlPotentiometer.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSlider.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlStepper.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSwitch.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlUtils.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCInvocation.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCMenuPassive.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCScale9Sprite.h" />
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCSpacer.h" />
|
||||
<ClInclude Include="..\GUI\CCScrollView\CCScrollView.h" />
|
||||
<ClInclude Include="..\cocos-ext.h" />
|
||||
<ClInclude Include="..\ExtensionMacros.h" />
|
||||
|
|
|
@ -18,42 +18,6 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControl.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlButton.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlColourPicker.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlHuePicker.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSlider.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSwitch.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlUtils.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCInvocation.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCMenuPassive.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCScale9Sprite.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCSpacer.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCScrollView\CCScrollView.cpp">
|
||||
<Filter>GUI\CCScrollView</Filter>
|
||||
</ClCompile>
|
||||
|
@ -141,47 +105,44 @@
|
|||
<ClCompile Include="..\CCBReader\CCSpriteLoader.cpp">
|
||||
<Filter>CCBReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlColourPicker.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlHuePicker.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlPotentiometer.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSlider.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlStepper.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlSwitch.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlUtils.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCInvocation.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCScale9Sprite.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControl.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GUI\CCControlExtension\CCControlButton.cpp">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControl.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlButton.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlColourPicker.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlExtensions.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlHuePicker.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSlider.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSwitch.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlUtils.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCInvocation.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCMenuPassive.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCScale9Sprite.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCSpacer.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCScrollView\CCScrollView.h">
|
||||
<Filter>GUI\CCScrollView</Filter>
|
||||
</ClInclude>
|
||||
|
@ -289,5 +250,44 @@
|
|||
<ClInclude Include="..\CCBReader\CCSpriteLoader.h">
|
||||
<Filter>CCBReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlButton.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlColourPicker.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlExtensions.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlHuePicker.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlPotentiometer.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSlider.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlStepper.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlSwitch.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControlUtils.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCInvocation.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCScale9Sprite.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUI\CCControlExtension\CCControl.h">
|
||||
<Filter>GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2012 Yannick Loriot.
|
||||
* http://yannickloriot.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
|
@ -42,7 +42,9 @@ Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp \
|
|||
Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourPickerTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp \
|
||||
|
|
|
@ -136,14 +136,14 @@ bool CCControlButtonTest_Event::init()
|
|||
addChild(background);
|
||||
|
||||
// Sets up event handlers
|
||||
controlButton->addTargetWithActionForControlEvent(this, cccontrol_selector(CCControlButtonTest_Event::touchDownAction), CCControlEventTouchDown);
|
||||
controlButton->addTargetWithActionForControlEvent(this, cccontrol_selector(CCControlButtonTest_Event::touchDragInsideAction), CCControlEventTouchDragInside);
|
||||
controlButton->addTargetWithActionForControlEvent(this, cccontrol_selector(CCControlButtonTest_Event::touchDragOutsideAction), CCControlEventTouchDragOutside);
|
||||
controlButton->addTargetWithActionForControlEvent(this, cccontrol_selector(CCControlButtonTest_Event::touchDragEnterAction), CCControlEventTouchDragEnter);
|
||||
controlButton->addTargetWithActionForControlEvent(this, cccontrol_selector(CCControlButtonTest_Event::touchDragExitAction), CCControlEventTouchDragExit);
|
||||
controlButton->addTargetWithActionForControlEvent(this, cccontrol_selector(CCControlButtonTest_Event::touchUpInsideAction), CCControlEventTouchUpInside);
|
||||
controlButton->addTargetWithActionForControlEvent(this, cccontrol_selector(CCControlButtonTest_Event::touchUpOutsideAction), CCControlEventTouchUpOutside);
|
||||
controlButton->addTargetWithActionForControlEvent(this, cccontrol_selector(CCControlButtonTest_Event::touchCancelAction), CCControlEventTouchCancel);
|
||||
controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlButtonTest_Event::touchDownAction), CCControlEventTouchDown);
|
||||
controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlButtonTest_Event::touchDragInsideAction), CCControlEventTouchDragInside);
|
||||
controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlButtonTest_Event::touchDragOutsideAction), CCControlEventTouchDragOutside);
|
||||
controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlButtonTest_Event::touchDragEnterAction), CCControlEventTouchDragEnter);
|
||||
controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlButtonTest_Event::touchDragExitAction), CCControlEventTouchDragExit);
|
||||
controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlButtonTest_Event::touchUpInsideAction), CCControlEventTouchUpInside);
|
||||
controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlButtonTest_Event::touchUpOutsideAction), CCControlEventTouchUpOutside);
|
||||
controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlButtonTest_Event::touchCancelAction), CCControlEventTouchCancel);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -92,7 +92,7 @@ CCControlColourPickerTest::~CCControlColourPickerTest()
|
|||
void CCControlColourPickerTest::colourValueChanged(CCObject *sender, CCControlEvent controlEvent)
|
||||
{
|
||||
CCControlColourPicker* pPicker = (CCControlColourPicker*)sender;
|
||||
m_pColorLabel->setString(CCString::createWithFormat("#%02X%02X%02X",pPicker->getColorValue().r, pPicker->getColorValue().g, pPicker->getColorValue().b)->getCString());
|
||||
m_pColorLabel->setString(CCString::createWithFormat("#%02X%02X%02X",pPicker->getColor().r, pPicker->getColor().g, pPicker->getColor().b)->getCString());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2012 Yannick Loriot
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CCControlPotentiometerTest.h"
|
||||
|
||||
CCControlPotentiometerTest::CCControlPotentiometerTest()
|
||||
: m_pDisplayValueLabel(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlPotentiometerTest::~CCControlPotentiometerTest()
|
||||
{
|
||||
CC_SAFE_RELEASE(m_pDisplayValueLabel);
|
||||
}
|
||||
|
||||
bool CCControlPotentiometerTest::init()
|
||||
{
|
||||
if (CCControlScene::init())
|
||||
{
|
||||
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCNode *layer = CCNode::create();
|
||||
layer->setPosition(ccp (screenSize.width / 2, screenSize.height / 2));
|
||||
this->addChild(layer, 1);
|
||||
|
||||
double layer_width = 0;
|
||||
|
||||
// Add the black background for the text
|
||||
CCScale9Sprite *background = CCScale9Sprite::create("extensions/buttonBackground.png");
|
||||
background->setContentSize(CCSizeMake(80, 50));
|
||||
background->setPosition(ccp(layer_width + background->getContentSize().width / 2.0f, 0));
|
||||
layer->addChild(background);
|
||||
|
||||
layer_width += background->getContentSize().width;
|
||||
|
||||
this->setDisplayValueLabel(CCLabelTTF::create("", "HelveticaNeue-Bold", 30));
|
||||
|
||||
m_pDisplayValueLabel->setPosition(background->getPosition());
|
||||
layer->addChild(m_pDisplayValueLabel);
|
||||
|
||||
// Add the slider
|
||||
CCControlPotentiometer *potentiometer = CCControlPotentiometer::create("extensions/potentiometerTrack.png"
|
||||
,"extensions/potentiometerProgress.png"
|
||||
,"extensions/potentiometerButton.png");
|
||||
potentiometer->setPosition(ccp (layer_width + 10 + potentiometer->getContentSize().width / 2, 0));
|
||||
|
||||
// When the value of the slider will change, the given selector will be call
|
||||
potentiometer->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlPotentiometerTest::valueChanged), CCControlEventValueChanged);
|
||||
|
||||
layer->addChild(potentiometer);
|
||||
|
||||
layer_width += potentiometer->getContentSize().width;
|
||||
|
||||
// Set the layer size
|
||||
layer->setContentSize(CCSizeMake(layer_width, 0));
|
||||
layer->setAnchorPoint(ccp (0.5f, 0.5f));
|
||||
|
||||
// Update the value label
|
||||
this->valueChanged(potentiometer, CCControlEventValueChanged);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCControlPotentiometerTest::valueChanged(CCObject *sender, CCControlEvent controlEvent)
|
||||
{
|
||||
CCControlPotentiometer* pControl = (CCControlPotentiometer*)sender;
|
||||
// Change value of label.
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("%.02f", pControl->getValue())->getCString());
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2012 Yannick Loriot
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CCCONTROLPOTENTIOMETERTEST_H__
|
||||
#define __CCCONTROLPOTENTIOMETERTEST_H__
|
||||
|
||||
#include "../CCControlScene.h"
|
||||
|
||||
class CCControlPotentiometerTest : public CCControlScene
|
||||
{
|
||||
public:
|
||||
CCControlPotentiometerTest();
|
||||
virtual ~CCControlPotentiometerTest();
|
||||
bool init();
|
||||
CC_SYNTHESIZE_RETAIN(CCLabelTTF*, m_pDisplayValueLabel, DisplayValueLabel)
|
||||
|
||||
void valueChanged(CCObject *sender, CCControlEvent controlEvent);
|
||||
|
||||
CONTROL_SCENE_CREATE_FUNC(CCControlPotentiometerTest)
|
||||
};
|
||||
|
||||
|
||||
#endif /* __CCCONTROLPOTENTIOMETERTEST_H__ */
|
||||
|
|
@ -29,6 +29,8 @@
|
|||
#include "CCControlColourPicker/CCControlColourPickerTest.h"
|
||||
#include "CCControlSliderTest/CCControlSliderTest.h"
|
||||
#include "CCControlSwitchTest/CCControlSwitchTest.h"
|
||||
#include "CCControlPotentiometerTest/CCControlPotentiometerTest.h"
|
||||
#include "CCControlStepperTest/CCControlStepperTest.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
|
@ -40,6 +42,8 @@ enum
|
|||
kCCControlButtonTest_HelloVariableSize,
|
||||
kCCControlButtonTest_Event,
|
||||
kCCControlButtonTest_Styling,
|
||||
kCCControlPotentiometerTest,
|
||||
kCCControlStepperTest,
|
||||
kCCControlTestMax
|
||||
};
|
||||
|
||||
|
@ -49,7 +53,9 @@ static const char* s_testArray[] = {
|
|||
"ControlSwitchTest",
|
||||
"ControlButtonTest_HelloVariableSize",
|
||||
"ControlButtonTest_Event",
|
||||
"ControlButtonTest_Styling"
|
||||
"ControlButtonTest_Styling",
|
||||
"ControlPotentiometerTest",
|
||||
"CCControlStepperTest"
|
||||
};
|
||||
|
||||
static CCControlSceneManager *sharedInstance = NULL;
|
||||
|
@ -102,6 +108,8 @@ CCScene *CCControlSceneManager::currentControlScene()
|
|||
case kCCControlButtonTest_HelloVariableSize:return CCControlButtonTest_HelloVariableSize::sceneWithTitle(s_testArray[m_nCurrentControlSceneId]);
|
||||
case kCCControlButtonTest_Event:return CCControlButtonTest_Event::sceneWithTitle(s_testArray[m_nCurrentControlSceneId]);
|
||||
case kCCControlButtonTest_Styling:return CCControlButtonTest_Styling::sceneWithTitle(s_testArray[m_nCurrentControlSceneId]);
|
||||
case kCCControlPotentiometerTest:return CCControlPotentiometerTest::sceneWithTitle(s_testArray[m_nCurrentControlSceneId]);
|
||||
case kCCControlStepperTest:return CCControlStepperTest::sceneWithTitle(s_testArray[m_nCurrentControlSceneId]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2012 Yannick Loriot
|
||||
* http://yannickloriot.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CCControlStepperTest.h"
|
||||
|
||||
CCControlStepperTest::CCControlStepperTest()
|
||||
: m_pDisplayValueLabel(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCControlStepperTest::~CCControlStepperTest()
|
||||
{
|
||||
CC_SAFE_RELEASE(m_pDisplayValueLabel);
|
||||
}
|
||||
|
||||
bool CCControlStepperTest::init()
|
||||
{
|
||||
if (CCControlScene::init())
|
||||
{
|
||||
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCNode *layer = CCNode::create();
|
||||
layer->setPosition(ccp (screenSize.width / 2, screenSize.height / 2));
|
||||
this->addChild(layer, 1);
|
||||
|
||||
double layer_width = 0;
|
||||
|
||||
// Add the black background for the text
|
||||
CCScale9Sprite *background = CCScale9Sprite::create("extensions/buttonBackground.png");
|
||||
background->setContentSize(CCSizeMake(100, 50));
|
||||
background->setPosition(ccp(layer_width + background->getContentSize().width / 2.0f, 0));
|
||||
layer->addChild(background);
|
||||
|
||||
this->setDisplayValueLabel(CCLabelTTF::create("0", "HelveticaNeue-Bold", 30));
|
||||
|
||||
m_pDisplayValueLabel->setPosition(background->getPosition());
|
||||
layer->addChild(m_pDisplayValueLabel);
|
||||
|
||||
layer_width += background->getContentSize().width;
|
||||
|
||||
CCControlStepper *stepper = this->makeControlStepper();
|
||||
stepper->setPosition(ccp (layer_width + 10 + stepper->getContentSize().width / 2, 0));
|
||||
stepper->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlStepperTest::valueChanged), CCControlEventValueChanged);
|
||||
layer->addChild(stepper);
|
||||
|
||||
layer_width += stepper->getContentSize().width;
|
||||
|
||||
// Set the layer size
|
||||
layer->setContentSize(CCSizeMake(layer_width, 0));
|
||||
layer->setAnchorPoint(ccp (0.5f, 0.5f));
|
||||
|
||||
// Update the value label
|
||||
this->valueChanged(stepper, CCControlEventValueChanged);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CCControlStepper *CCControlStepperTest::makeControlStepper()
|
||||
{
|
||||
CCSprite *minusSprite = CCSprite::create("extensions/stepper-minus.png");
|
||||
CCSprite *plusSprite = CCSprite::create("extensions/stepper-plus.png");
|
||||
|
||||
return CCControlStepper::create(minusSprite, plusSprite);
|
||||
}
|
||||
|
||||
void CCControlStepperTest::valueChanged(CCObject *sender, CCControlEvent controlEvent)
|
||||
{
|
||||
CCControlStepper* pControl = (CCControlStepper*)sender;
|
||||
// Change value of label.
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("%0.02f", (float)pControl->getValue())->getCString());
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2012 cocos2d-x.org
|
||||
* Copyright (c) 2012 Yannick Loriot
|
||||
* http://yannickloriot.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CCCONTROLSTEPPERTEST_H__
|
||||
#define __CCCONTROLSTEPPERTEST_H__
|
||||
|
||||
#include "../CCControlScene.h"
|
||||
|
||||
class CCControlStepperTest : public CCControlScene
|
||||
{
|
||||
public:
|
||||
CCControlStepperTest();
|
||||
virtual ~CCControlStepperTest();
|
||||
bool init();
|
||||
/** Creates and returns a new ControlStepper. */
|
||||
CCControlStepper* makeControlStepper();
|
||||
|
||||
/** Callback for the change value. */
|
||||
void valueChanged(CCObject *sender, CCControlEvent controlEvent);
|
||||
protected:
|
||||
CC_SYNTHESIZE_RETAIN(CCLabelTTF*, m_pDisplayValueLabel, DisplayValueLabel)
|
||||
CONTROL_SCENE_CREATE_FUNC(CCControlStepperTest)
|
||||
};
|
||||
|
||||
#endif /* __CCCONTROLSTEPPERTEST_H__ */
|
||||
|
|
@ -1 +1 @@
|
|||
cbe8a4c43be345c2fcb9b0e46e02ef3a1fc21c80
|
||||
ac3dd574a71d609ed13ae44389209e35f22d6392
|
|
@ -874,6 +874,30 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="CCControlPotentiometerTest"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="CCControlStepperTest"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="NotificationCenterTest"
|
||||
|
|
|
@ -108,6 +108,8 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocosBuilderTest\AnimationsTest\AnimationsTestLayer.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.cpp" />
|
||||
|
@ -194,6 +196,8 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocosBuilderTest\AnimationsTest\AnimationsLayerLoader.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocosBuilderTest\AnimationsTest\AnimationsTestLayer.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.h" />
|
||||
|
|
|
@ -196,6 +196,12 @@
|
|||
<Filter Include="Classes\ExtensionsTest\AnimationsTest">
|
||||
<UniqueIdentifier>{e8752620-8414-4f43-a572-5fa82650f223}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest">
|
||||
<UniqueIdentifier>{08850f9d-e7e5-4bca-ae90-cf8df391479f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest">
|
||||
<UniqueIdentifier>{7e809230-9bb5-45bb-a26c-b5cdd1390914}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
|
@ -447,6 +453,12 @@
|
|||
<ClCompile Include="..\Classes\ExtensionsTest\CocosBuilderTest\AnimationsTest\AnimationsTestLayer.cpp">
|
||||
<Filter>Classes\ExtensionsTest\AnimationsTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.cpp">
|
||||
<Filter>Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.cpp">
|
||||
<Filter>Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="main.h">
|
||||
|
@ -875,5 +887,11 @@
|
|||
<ClInclude Include="..\Classes\ExtensionsTest\CocosBuilderTest\AnimationsTest\AnimationsTestLayer.h">
|
||||
<Filter>Classes\ExtensionsTest\AnimationsTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.h">
|
||||
<Filter>Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.h">
|
||||
<Filter>Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -7,6 +7,58 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
15384E5716119CC30021DC07 /* CCPhysicsSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E3E16119CC30021DC07 /* CCPhysicsSprite.cpp */; };
|
||||
15384E5816119CC30021DC07 /* cocos2d_specifics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E4016119CC30021DC07 /* cocos2d_specifics.cpp */; };
|
||||
15384E5916119CC30021DC07 /* cocosjs_manual_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E4216119CC30021DC07 /* cocosjs_manual_conversions.cpp */; };
|
||||
15384E5A16119CC30021DC07 /* cocos2dx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E4516119CC30021DC07 /* cocos2dx.cpp */; };
|
||||
15384E5D16119CC30021DC07 /* js_bindings_ccbreader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E4916119CC30021DC07 /* js_bindings_ccbreader.cpp */; };
|
||||
15384E5E16119CC30021DC07 /* js_bindings_chipmunk_functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E4B16119CC30021DC07 /* js_bindings_chipmunk_functions.cpp */; };
|
||||
15384E5F16119CC30021DC07 /* js_bindings_chipmunk_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E4D16119CC30021DC07 /* js_bindings_chipmunk_manual.cpp */; };
|
||||
15384E6016119CC30021DC07 /* js_manual_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E5016119CC30021DC07 /* js_manual_conversions.cpp */; };
|
||||
15384E6116119CC30021DC07 /* ScriptingCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E5216119CC30021DC07 /* ScriptingCore.cpp */; };
|
||||
15384ED716119D5E0021DC07 /* CCBAnimationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E6516119D5E0021DC07 /* CCBAnimationManager.cpp */; };
|
||||
15384ED816119D5E0021DC07 /* CCBFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E6716119D5E0021DC07 /* CCBFileLoader.cpp */; };
|
||||
15384ED916119D5E0021DC07 /* CCBKeyframe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E6916119D5E0021DC07 /* CCBKeyframe.cpp */; };
|
||||
15384EDA16119D5E0021DC07 /* CCBReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E6C16119D5E0021DC07 /* CCBReader.cpp */; };
|
||||
15384EDB16119D5E0021DC07 /* CCBSequence.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E6F16119D5E0021DC07 /* CCBSequence.cpp */; };
|
||||
15384EDC16119D5E0021DC07 /* CCBSequenceProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E7116119D5E0021DC07 /* CCBSequenceProperty.cpp */; };
|
||||
15384EDD16119D5E0021DC07 /* CCBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E7316119D5E0021DC07 /* CCBValue.cpp */; };
|
||||
15384EDE16119D5E0021DC07 /* CCControlButtonLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E7516119D5E0021DC07 /* CCControlButtonLoader.cpp */; };
|
||||
15384EDF16119D5E0021DC07 /* CCControlLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E7716119D5E0021DC07 /* CCControlLoader.cpp */; };
|
||||
15384EE016119D5E0021DC07 /* CCData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E7916119D5E0021DC07 /* CCData.cpp */; };
|
||||
15384EE116119D5E0021DC07 /* CCLabelBMFontLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E7B16119D5E0021DC07 /* CCLabelBMFontLoader.cpp */; };
|
||||
15384EE216119D5E0021DC07 /* CCLabelTTFLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E7D16119D5E0021DC07 /* CCLabelTTFLoader.cpp */; };
|
||||
15384EE316119D5E0021DC07 /* CCLayerColorLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E7F16119D5E0021DC07 /* CCLayerColorLoader.cpp */; };
|
||||
15384EE416119D5E0021DC07 /* CCLayerGradientLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E8116119D5E0021DC07 /* CCLayerGradientLoader.cpp */; };
|
||||
15384EE516119D5E0021DC07 /* CCLayerLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E8316119D5E0021DC07 /* CCLayerLoader.cpp */; };
|
||||
15384EE616119D5E0021DC07 /* CCMenuItemImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E8516119D5E0021DC07 /* CCMenuItemImageLoader.cpp */; };
|
||||
15384EE716119D5E0021DC07 /* CCMenuItemLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E8716119D5E0021DC07 /* CCMenuItemLoader.cpp */; };
|
||||
15384EE816119D5E0021DC07 /* CCNode+CCBRelativePositioning.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E8A16119D5E0021DC07 /* CCNode+CCBRelativePositioning.cpp */; };
|
||||
15384EE916119D5E0021DC07 /* CCNodeLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E8C16119D5E0021DC07 /* CCNodeLoader.cpp */; };
|
||||
15384EEA16119D5E0021DC07 /* CCNodeLoaderLibrary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E8E16119D5E0021DC07 /* CCNodeLoaderLibrary.cpp */; };
|
||||
15384EEB16119D5E0021DC07 /* CCParticleSystemQuadLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E9116119D5E0021DC07 /* CCParticleSystemQuadLoader.cpp */; };
|
||||
15384EEC16119D5E0021DC07 /* CCScale9SpriteLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E9316119D5E0021DC07 /* CCScale9SpriteLoader.cpp */; };
|
||||
15384EED16119D5E0021DC07 /* CCScrollViewLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E9516119D5E0021DC07 /* CCScrollViewLoader.cpp */; };
|
||||
15384EEE16119D5E0021DC07 /* CCSpriteLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E9716119D5E0021DC07 /* CCSpriteLoader.cpp */; };
|
||||
15384EEF16119D5E0021DC07 /* CCControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E9D16119D5E0021DC07 /* CCControl.cpp */; };
|
||||
15384EF016119D5E0021DC07 /* CCControlButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384E9F16119D5E0021DC07 /* CCControlButton.cpp */; };
|
||||
15384EF116119D5E0021DC07 /* CCControlColourPicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EA116119D5E0021DC07 /* CCControlColourPicker.cpp */; };
|
||||
15384EF216119D5E0021DC07 /* CCControlHuePicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EA416119D5E0021DC07 /* CCControlHuePicker.cpp */; };
|
||||
15384EF316119D5E0021DC07 /* CCControlSaturationBrightnessPicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EA616119D5E0021DC07 /* CCControlSaturationBrightnessPicker.cpp */; };
|
||||
15384EF416119D5E0021DC07 /* CCControlSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EA816119D5E0021DC07 /* CCControlSlider.cpp */; };
|
||||
15384EF516119D5E0021DC07 /* CCControlSwitch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EAA16119D5E0021DC07 /* CCControlSwitch.cpp */; };
|
||||
15384EF616119D5E0021DC07 /* CCControlUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EAC16119D5E0021DC07 /* CCControlUtils.cpp */; };
|
||||
15384EF716119D5E0021DC07 /* CCInvocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EAE16119D5E0021DC07 /* CCInvocation.cpp */; };
|
||||
15384EF816119D5E0021DC07 /* CCMenuPassive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EB016119D5E0021DC07 /* CCMenuPassive.cpp */; };
|
||||
15384EF916119D5E0021DC07 /* CCScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EB216119D5E0021DC07 /* CCScale9Sprite.cpp */; };
|
||||
15384EFA16119D5E0021DC07 /* CCSpacer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EB416119D5E0021DC07 /* CCSpacer.cpp */; };
|
||||
15384EFB16119D5E0021DC07 /* CCEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EB716119D5E0021DC07 /* CCEditBox.cpp */; };
|
||||
15384EFD16119D5E0021DC07 /* CCEditBoxImplIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15384EBD16119D5E0021DC07 /* CCEditBoxImplIOS.mm */; };
|
||||
15384EFE16119D5E0021DC07 /* EditBoxImplIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15384EBF16119D5E0021DC07 /* EditBoxImplIOS.mm */; };
|
||||
15384EFF16119D5E0021DC07 /* CCScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EC116119D5E0021DC07 /* CCScrollView.cpp */; };
|
||||
15384F0016119D5E0021DC07 /* CCSorting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EC316119D5E0021DC07 /* CCSorting.cpp */; };
|
||||
15384F0116119D5E0021DC07 /* CCTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EC516119D5E0021DC07 /* CCTableView.cpp */; };
|
||||
15384F0216119D5E0021DC07 /* CCTableViewCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15384EC716119D5E0021DC07 /* CCTableViewCell.cpp */; };
|
||||
15426FC315B5742200712A7F /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15426AF115B5733200712A7F /* libcocos2dx.a */; };
|
||||
15426FE615B5743C00712A7F /* CDAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 15426FD015B5743C00712A7F /* CDAudioManager.m */; };
|
||||
15426FE715B5743C00712A7F /* CDOpenALSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 15426FD315B5743C00712A7F /* CDOpenALSupport.m */; };
|
||||
|
@ -28,13 +80,6 @@
|
|||
15628F7815F0F5E5000CF24B /* tank1.png in Resources */ = {isa = PBXBuildFile; fileRef = 15628F6915F0F5E5000CF24B /* tank1.png */; };
|
||||
15628F7915F0F5E5000CF24B /* TileMaps in Resources */ = {isa = PBXBuildFile; fileRef = 15628F6A15F0F5E5000CF24B /* TileMaps */; };
|
||||
15628FA915F1057E000CF24B /* animations in Resources */ = {isa = PBXBuildFile; fileRef = 15628FA815F1057E000CF24B /* animations */; };
|
||||
2628296215EC6C1B002C4240 /* ScriptingCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2628295315EC6C1B002C4240 /* ScriptingCore.cpp */; };
|
||||
2628296315EC6C1B002C4240 /* js_manual_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2628295515EC6C1B002C4240 /* js_manual_conversions.cpp */; };
|
||||
2628296415EC6C1B002C4240 /* js_bindings_chipmunk_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2628295815EC6C1B002C4240 /* js_bindings_chipmunk_manual.cpp */; };
|
||||
2628296515EC6C1B002C4240 /* js_bindings_chipmunk_functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2628295A15EC6C1B002C4240 /* js_bindings_chipmunk_functions.cpp */; };
|
||||
2628296615EC6C1B002C4240 /* cocos2dx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2628295C15EC6C1B002C4240 /* cocos2dx.cpp */; };
|
||||
2628296715EC6C1B002C4240 /* cocos2d_specifics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2628295E15EC6C1B002C4240 /* cocos2d_specifics.cpp */; };
|
||||
2628296815EC6C1B002C4240 /* CCPhysicsSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2628296015EC6C1B002C4240 /* CCPhysicsSprite.cpp */; };
|
||||
262829CC15EC7196002C4240 /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 2628297D15EC7196002C4240 /* .gitignore */; };
|
||||
262829CD15EC7196002C4240 /* Android.mk in Resources */ = {isa = PBXBuildFile; fileRef = 2628297E15EC7196002C4240 /* Android.mk */; };
|
||||
262829CE15EC7196002C4240 /* chipmunk-docs.html in Resources */ = {isa = PBXBuildFile; fileRef = 2628297F15EC7196002C4240 /* chipmunk-docs.html */; };
|
||||
|
@ -117,6 +162,121 @@
|
|||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
15384E3E16119CC30021DC07 /* CCPhysicsSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsSprite.cpp; sourceTree = "<group>"; };
|
||||
15384E3F16119CC30021DC07 /* CCPhysicsSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsSprite.h; sourceTree = "<group>"; };
|
||||
15384E4016119CC30021DC07 /* cocos2d_specifics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2d_specifics.cpp; sourceTree = "<group>"; };
|
||||
15384E4116119CC30021DC07 /* cocos2d_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2d_specifics.hpp; sourceTree = "<group>"; };
|
||||
15384E4216119CC30021DC07 /* cocosjs_manual_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocosjs_manual_conversions.cpp; sourceTree = "<group>"; };
|
||||
15384E4316119CC30021DC07 /* cocosjs_manual_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocosjs_manual_conversions.h; sourceTree = "<group>"; };
|
||||
15384E4516119CC30021DC07 /* cocos2dx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2dx.cpp; sourceTree = "<group>"; };
|
||||
15384E4616119CC30021DC07 /* cocos2dx.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2dx.hpp; sourceTree = "<group>"; };
|
||||
15384E4916119CC30021DC07 /* js_bindings_ccbreader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_ccbreader.cpp; sourceTree = "<group>"; };
|
||||
15384E4A16119CC30021DC07 /* js_bindings_ccbreader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_ccbreader.h; sourceTree = "<group>"; };
|
||||
15384E4B16119CC30021DC07 /* js_bindings_chipmunk_functions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_functions.cpp; sourceTree = "<group>"; };
|
||||
15384E4C16119CC30021DC07 /* js_bindings_chipmunk_functions.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = js_bindings_chipmunk_functions.hpp; sourceTree = "<group>"; };
|
||||
15384E4D16119CC30021DC07 /* js_bindings_chipmunk_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_manual.cpp; sourceTree = "<group>"; };
|
||||
15384E4E16119CC30021DC07 /* js_bindings_chipmunk_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = js_bindings_chipmunk_manual.hpp; sourceTree = "<group>"; };
|
||||
15384E4F16119CC30021DC07 /* js_bindings_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_config.h; sourceTree = "<group>"; };
|
||||
15384E5016119CC30021DC07 /* js_manual_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_manual_conversions.cpp; sourceTree = "<group>"; };
|
||||
15384E5116119CC30021DC07 /* js_manual_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_manual_conversions.h; sourceTree = "<group>"; };
|
||||
15384E5216119CC30021DC07 /* ScriptingCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptingCore.cpp; sourceTree = "<group>"; };
|
||||
15384E5316119CC30021DC07 /* ScriptingCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptingCore.h; sourceTree = "<group>"; };
|
||||
15384E5416119CC30021DC07 /* spidermonkey_specifics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spidermonkey_specifics.h; sourceTree = "<group>"; };
|
||||
15384E5516119CC30021DC07 /* uthash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uthash.h; sourceTree = "<group>"; };
|
||||
15384E6516119D5E0021DC07 /* CCBAnimationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBAnimationManager.cpp; sourceTree = "<group>"; };
|
||||
15384E6616119D5E0021DC07 /* CCBAnimationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBAnimationManager.h; sourceTree = "<group>"; };
|
||||
15384E6716119D5E0021DC07 /* CCBFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBFileLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E6816119D5E0021DC07 /* CCBFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBFileLoader.h; sourceTree = "<group>"; };
|
||||
15384E6916119D5E0021DC07 /* CCBKeyframe.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBKeyframe.cpp; sourceTree = "<group>"; };
|
||||
15384E6A16119D5E0021DC07 /* CCBKeyframe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBKeyframe.h; sourceTree = "<group>"; };
|
||||
15384E6B16119D5E0021DC07 /* CCBMemberVariableAssigner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBMemberVariableAssigner.h; sourceTree = "<group>"; };
|
||||
15384E6C16119D5E0021DC07 /* CCBReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBReader.cpp; sourceTree = "<group>"; };
|
||||
15384E6D16119D5E0021DC07 /* CCBReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBReader.h; sourceTree = "<group>"; };
|
||||
15384E6E16119D5E0021DC07 /* CCBSelectorResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBSelectorResolver.h; sourceTree = "<group>"; };
|
||||
15384E6F16119D5E0021DC07 /* CCBSequence.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBSequence.cpp; sourceTree = "<group>"; };
|
||||
15384E7016119D5E0021DC07 /* CCBSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBSequence.h; sourceTree = "<group>"; };
|
||||
15384E7116119D5E0021DC07 /* CCBSequenceProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBSequenceProperty.cpp; sourceTree = "<group>"; };
|
||||
15384E7216119D5E0021DC07 /* CCBSequenceProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBSequenceProperty.h; sourceTree = "<group>"; };
|
||||
15384E7316119D5E0021DC07 /* CCBValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBValue.cpp; sourceTree = "<group>"; };
|
||||
15384E7416119D5E0021DC07 /* CCBValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBValue.h; sourceTree = "<group>"; };
|
||||
15384E7516119D5E0021DC07 /* CCControlButtonLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlButtonLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E7616119D5E0021DC07 /* CCControlButtonLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlButtonLoader.h; sourceTree = "<group>"; };
|
||||
15384E7716119D5E0021DC07 /* CCControlLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E7816119D5E0021DC07 /* CCControlLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlLoader.h; sourceTree = "<group>"; };
|
||||
15384E7916119D5E0021DC07 /* CCData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCData.cpp; sourceTree = "<group>"; };
|
||||
15384E7A16119D5E0021DC07 /* CCData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCData.h; sourceTree = "<group>"; };
|
||||
15384E7B16119D5E0021DC07 /* CCLabelBMFontLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLabelBMFontLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E7C16119D5E0021DC07 /* CCLabelBMFontLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLabelBMFontLoader.h; sourceTree = "<group>"; };
|
||||
15384E7D16119D5E0021DC07 /* CCLabelTTFLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLabelTTFLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E7E16119D5E0021DC07 /* CCLabelTTFLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLabelTTFLoader.h; sourceTree = "<group>"; };
|
||||
15384E7F16119D5E0021DC07 /* CCLayerColorLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLayerColorLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E8016119D5E0021DC07 /* CCLayerColorLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLayerColorLoader.h; sourceTree = "<group>"; };
|
||||
15384E8116119D5E0021DC07 /* CCLayerGradientLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLayerGradientLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E8216119D5E0021DC07 /* CCLayerGradientLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLayerGradientLoader.h; sourceTree = "<group>"; };
|
||||
15384E8316119D5E0021DC07 /* CCLayerLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLayerLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E8416119D5E0021DC07 /* CCLayerLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLayerLoader.h; sourceTree = "<group>"; };
|
||||
15384E8516119D5E0021DC07 /* CCMenuItemImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMenuItemImageLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E8616119D5E0021DC07 /* CCMenuItemImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMenuItemImageLoader.h; sourceTree = "<group>"; };
|
||||
15384E8716119D5E0021DC07 /* CCMenuItemLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMenuItemLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E8816119D5E0021DC07 /* CCMenuItemLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMenuItemLoader.h; sourceTree = "<group>"; };
|
||||
15384E8916119D5E0021DC07 /* CCMenuLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMenuLoader.h; sourceTree = "<group>"; };
|
||||
15384E8A16119D5E0021DC07 /* CCNode+CCBRelativePositioning.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "CCNode+CCBRelativePositioning.cpp"; sourceTree = "<group>"; };
|
||||
15384E8B16119D5E0021DC07 /* CCNode+CCBRelativePositioning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CCNode+CCBRelativePositioning.h"; sourceTree = "<group>"; };
|
||||
15384E8C16119D5E0021DC07 /* CCNodeLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCNodeLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E8D16119D5E0021DC07 /* CCNodeLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNodeLoader.h; sourceTree = "<group>"; };
|
||||
15384E8E16119D5E0021DC07 /* CCNodeLoaderLibrary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCNodeLoaderLibrary.cpp; sourceTree = "<group>"; };
|
||||
15384E8F16119D5E0021DC07 /* CCNodeLoaderLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNodeLoaderLibrary.h; sourceTree = "<group>"; };
|
||||
15384E9016119D5E0021DC07 /* CCNodeLoaderListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNodeLoaderListener.h; sourceTree = "<group>"; };
|
||||
15384E9116119D5E0021DC07 /* CCParticleSystemQuadLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCParticleSystemQuadLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E9216119D5E0021DC07 /* CCParticleSystemQuadLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCParticleSystemQuadLoader.h; sourceTree = "<group>"; };
|
||||
15384E9316119D5E0021DC07 /* CCScale9SpriteLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScale9SpriteLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E9416119D5E0021DC07 /* CCScale9SpriteLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScale9SpriteLoader.h; sourceTree = "<group>"; };
|
||||
15384E9516119D5E0021DC07 /* CCScrollViewLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScrollViewLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E9616119D5E0021DC07 /* CCScrollViewLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScrollViewLoader.h; sourceTree = "<group>"; };
|
||||
15384E9716119D5E0021DC07 /* CCSpriteLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSpriteLoader.cpp; sourceTree = "<group>"; };
|
||||
15384E9816119D5E0021DC07 /* CCSpriteLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSpriteLoader.h; sourceTree = "<group>"; };
|
||||
15384E9916119D5E0021DC07 /* cocos-ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "cocos-ext.h"; sourceTree = "<group>"; };
|
||||
15384E9A16119D5E0021DC07 /* ExtensionMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionMacros.h; sourceTree = "<group>"; };
|
||||
15384E9D16119D5E0021DC07 /* CCControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControl.cpp; sourceTree = "<group>"; };
|
||||
15384E9E16119D5E0021DC07 /* CCControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControl.h; sourceTree = "<group>"; };
|
||||
15384E9F16119D5E0021DC07 /* CCControlButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlButton.cpp; sourceTree = "<group>"; };
|
||||
15384EA016119D5E0021DC07 /* CCControlButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlButton.h; sourceTree = "<group>"; };
|
||||
15384EA116119D5E0021DC07 /* CCControlColourPicker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlColourPicker.cpp; sourceTree = "<group>"; };
|
||||
15384EA216119D5E0021DC07 /* CCControlColourPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlColourPicker.h; sourceTree = "<group>"; };
|
||||
15384EA316119D5E0021DC07 /* CCControlExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlExtensions.h; sourceTree = "<group>"; };
|
||||
15384EA416119D5E0021DC07 /* CCControlHuePicker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlHuePicker.cpp; sourceTree = "<group>"; };
|
||||
15384EA516119D5E0021DC07 /* CCControlHuePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlHuePicker.h; sourceTree = "<group>"; };
|
||||
15384EA616119D5E0021DC07 /* CCControlSaturationBrightnessPicker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlSaturationBrightnessPicker.cpp; sourceTree = "<group>"; };
|
||||
15384EA716119D5E0021DC07 /* CCControlSaturationBrightnessPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlSaturationBrightnessPicker.h; sourceTree = "<group>"; };
|
||||
15384EA816119D5E0021DC07 /* CCControlSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlSlider.cpp; sourceTree = "<group>"; };
|
||||
15384EA916119D5E0021DC07 /* CCControlSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlSlider.h; sourceTree = "<group>"; };
|
||||
15384EAA16119D5E0021DC07 /* CCControlSwitch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlSwitch.cpp; sourceTree = "<group>"; };
|
||||
15384EAB16119D5E0021DC07 /* CCControlSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlSwitch.h; sourceTree = "<group>"; };
|
||||
15384EAC16119D5E0021DC07 /* CCControlUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlUtils.cpp; sourceTree = "<group>"; };
|
||||
15384EAD16119D5E0021DC07 /* CCControlUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlUtils.h; sourceTree = "<group>"; };
|
||||
15384EAE16119D5E0021DC07 /* CCInvocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCInvocation.cpp; sourceTree = "<group>"; };
|
||||
15384EAF16119D5E0021DC07 /* CCInvocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCInvocation.h; sourceTree = "<group>"; };
|
||||
15384EB016119D5E0021DC07 /* CCMenuPassive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMenuPassive.cpp; sourceTree = "<group>"; };
|
||||
15384EB116119D5E0021DC07 /* CCMenuPassive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMenuPassive.h; sourceTree = "<group>"; };
|
||||
15384EB216119D5E0021DC07 /* CCScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScale9Sprite.cpp; sourceTree = "<group>"; };
|
||||
15384EB316119D5E0021DC07 /* CCScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScale9Sprite.h; sourceTree = "<group>"; };
|
||||
15384EB416119D5E0021DC07 /* CCSpacer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSpacer.cpp; sourceTree = "<group>"; };
|
||||
15384EB516119D5E0021DC07 /* CCSpacer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSpacer.h; sourceTree = "<group>"; };
|
||||
15384EB716119D5E0021DC07 /* CCEditBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCEditBox.cpp; sourceTree = "<group>"; };
|
||||
15384EB816119D5E0021DC07 /* CCEditBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEditBox.h; sourceTree = "<group>"; };
|
||||
15384EB916119D5E0021DC07 /* CCEditBoxImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImpl.h; sourceTree = "<group>"; };
|
||||
15384EBC16119D5E0021DC07 /* CCEditBoxImplIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImplIOS.h; sourceTree = "<group>"; };
|
||||
15384EBD16119D5E0021DC07 /* CCEditBoxImplIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCEditBoxImplIOS.mm; sourceTree = "<group>"; };
|
||||
15384EBE16119D5E0021DC07 /* EditBoxImplIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditBoxImplIOS.h; sourceTree = "<group>"; };
|
||||
15384EBF16119D5E0021DC07 /* EditBoxImplIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditBoxImplIOS.mm; sourceTree = "<group>"; };
|
||||
15384EC116119D5E0021DC07 /* CCScrollView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScrollView.cpp; sourceTree = "<group>"; };
|
||||
15384EC216119D5E0021DC07 /* CCScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScrollView.h; sourceTree = "<group>"; };
|
||||
15384EC316119D5E0021DC07 /* CCSorting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSorting.cpp; sourceTree = "<group>"; };
|
||||
15384EC416119D5E0021DC07 /* CCSorting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSorting.h; sourceTree = "<group>"; };
|
||||
15384EC516119D5E0021DC07 /* CCTableView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTableView.cpp; sourceTree = "<group>"; };
|
||||
15384EC616119D5E0021DC07 /* CCTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTableView.h; sourceTree = "<group>"; };
|
||||
15384EC716119D5E0021DC07 /* CCTableViewCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTableViewCell.cpp; sourceTree = "<group>"; };
|
||||
15384EC816119D5E0021DC07 /* CCTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTableViewCell.h; sourceTree = "<group>"; };
|
||||
15426AE915B5733200712A7F /* cocos2dx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2dx.xcodeproj; path = ../../../cocos2dx/proj.ios/cocos2dx.xcodeproj; sourceTree = "<group>"; };
|
||||
15426FCC15B5743C00712A7F /* Export.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Export.h; sourceTree = "<group>"; };
|
||||
15426FCD15B5743C00712A7F /* SimpleAudioEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine.h; sourceTree = "<group>"; };
|
||||
|
@ -145,23 +305,6 @@
|
|||
15628F6915F0F5E5000CF24B /* tank1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = tank1.png; path = ../Resources/tank1.png; sourceTree = "<group>"; };
|
||||
15628F6A15F0F5E5000CF24B /* TileMaps */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TileMaps; path = ../Resources/TileMaps; sourceTree = "<group>"; };
|
||||
15628FA815F1057E000CF24B /* animations */ = {isa = PBXFileReference; lastKnownFileType = folder; name = animations; path = ../Resources/animations; sourceTree = "<group>"; };
|
||||
2628295015EC6C1B002C4240 /* uthash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uthash.h; sourceTree = "<group>"; };
|
||||
2628295115EC6C1B002C4240 /* spidermonkey_specifics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spidermonkey_specifics.h; sourceTree = "<group>"; };
|
||||
2628295215EC6C1B002C4240 /* ScriptingCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptingCore.h; sourceTree = "<group>"; };
|
||||
2628295315EC6C1B002C4240 /* ScriptingCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptingCore.cpp; sourceTree = "<group>"; };
|
||||
2628295415EC6C1B002C4240 /* js_manual_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_manual_conversions.h; sourceTree = "<group>"; };
|
||||
2628295515EC6C1B002C4240 /* js_manual_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_manual_conversions.cpp; sourceTree = "<group>"; };
|
||||
2628295615EC6C1B002C4240 /* js_bindings_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_config.h; sourceTree = "<group>"; };
|
||||
2628295715EC6C1B002C4240 /* js_bindings_chipmunk_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = js_bindings_chipmunk_manual.hpp; sourceTree = "<group>"; };
|
||||
2628295815EC6C1B002C4240 /* js_bindings_chipmunk_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_manual.cpp; sourceTree = "<group>"; };
|
||||
2628295915EC6C1B002C4240 /* js_bindings_chipmunk_functions.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = js_bindings_chipmunk_functions.hpp; sourceTree = "<group>"; };
|
||||
2628295A15EC6C1B002C4240 /* js_bindings_chipmunk_functions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_functions.cpp; sourceTree = "<group>"; };
|
||||
2628295B15EC6C1B002C4240 /* cocos2dx.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2dx.hpp; sourceTree = "<group>"; };
|
||||
2628295C15EC6C1B002C4240 /* cocos2dx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2dx.cpp; sourceTree = "<group>"; };
|
||||
2628295D15EC6C1B002C4240 /* cocos2d_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2d_specifics.hpp; sourceTree = "<group>"; };
|
||||
2628295E15EC6C1B002C4240 /* cocos2d_specifics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2d_specifics.cpp; sourceTree = "<group>"; };
|
||||
2628295F15EC6C1B002C4240 /* CCPhysicsSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsSprite.h; sourceTree = "<group>"; };
|
||||
2628296015EC6C1B002C4240 /* CCPhysicsSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsSprite.cpp; sourceTree = "<group>"; };
|
||||
2628297D15EC7196002C4240 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
|
||||
2628297E15EC7196002C4240 /* Android.mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Android.mk; sourceTree = "<group>"; };
|
||||
2628297F15EC7196002C4240 /* chipmunk-docs.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "chipmunk-docs.html"; sourceTree = "<group>"; };
|
||||
|
@ -280,6 +423,185 @@
|
|||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
15384E3C16119CC30021DC07 /* bindings */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384E3E16119CC30021DC07 /* CCPhysicsSprite.cpp */,
|
||||
15384E3F16119CC30021DC07 /* CCPhysicsSprite.h */,
|
||||
15384E4016119CC30021DC07 /* cocos2d_specifics.cpp */,
|
||||
15384E4116119CC30021DC07 /* cocos2d_specifics.hpp */,
|
||||
15384E4216119CC30021DC07 /* cocosjs_manual_conversions.cpp */,
|
||||
15384E4316119CC30021DC07 /* cocosjs_manual_conversions.h */,
|
||||
15384E4416119CC30021DC07 /* generated */,
|
||||
15384E4916119CC30021DC07 /* js_bindings_ccbreader.cpp */,
|
||||
15384E4A16119CC30021DC07 /* js_bindings_ccbreader.h */,
|
||||
15384E4B16119CC30021DC07 /* js_bindings_chipmunk_functions.cpp */,
|
||||
15384E4C16119CC30021DC07 /* js_bindings_chipmunk_functions.hpp */,
|
||||
15384E4D16119CC30021DC07 /* js_bindings_chipmunk_manual.cpp */,
|
||||
15384E4E16119CC30021DC07 /* js_bindings_chipmunk_manual.hpp */,
|
||||
15384E4F16119CC30021DC07 /* js_bindings_config.h */,
|
||||
15384E5016119CC30021DC07 /* js_manual_conversions.cpp */,
|
||||
15384E5116119CC30021DC07 /* js_manual_conversions.h */,
|
||||
15384E5216119CC30021DC07 /* ScriptingCore.cpp */,
|
||||
15384E5316119CC30021DC07 /* ScriptingCore.h */,
|
||||
15384E5416119CC30021DC07 /* spidermonkey_specifics.h */,
|
||||
15384E5516119CC30021DC07 /* uthash.h */,
|
||||
);
|
||||
name = bindings;
|
||||
path = ../../../scripting/javascript/bindings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
15384E4416119CC30021DC07 /* generated */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384E4516119CC30021DC07 /* cocos2dx.cpp */,
|
||||
15384E4616119CC30021DC07 /* cocos2dx.hpp */,
|
||||
);
|
||||
path = generated;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
15384E6216119D5E0021DC07 /* extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384E6416119D5E0021DC07 /* CCBReader */,
|
||||
15384E9916119D5E0021DC07 /* cocos-ext.h */,
|
||||
15384E9A16119D5E0021DC07 /* ExtensionMacros.h */,
|
||||
15384E9B16119D5E0021DC07 /* GUI */,
|
||||
);
|
||||
name = extensions;
|
||||
path = ../../../extensions;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
15384E6416119D5E0021DC07 /* CCBReader */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384E6516119D5E0021DC07 /* CCBAnimationManager.cpp */,
|
||||
15384E6616119D5E0021DC07 /* CCBAnimationManager.h */,
|
||||
15384E6716119D5E0021DC07 /* CCBFileLoader.cpp */,
|
||||
15384E6816119D5E0021DC07 /* CCBFileLoader.h */,
|
||||
15384E6916119D5E0021DC07 /* CCBKeyframe.cpp */,
|
||||
15384E6A16119D5E0021DC07 /* CCBKeyframe.h */,
|
||||
15384E6B16119D5E0021DC07 /* CCBMemberVariableAssigner.h */,
|
||||
15384E6C16119D5E0021DC07 /* CCBReader.cpp */,
|
||||
15384E6D16119D5E0021DC07 /* CCBReader.h */,
|
||||
15384E6E16119D5E0021DC07 /* CCBSelectorResolver.h */,
|
||||
15384E6F16119D5E0021DC07 /* CCBSequence.cpp */,
|
||||
15384E7016119D5E0021DC07 /* CCBSequence.h */,
|
||||
15384E7116119D5E0021DC07 /* CCBSequenceProperty.cpp */,
|
||||
15384E7216119D5E0021DC07 /* CCBSequenceProperty.h */,
|
||||
15384E7316119D5E0021DC07 /* CCBValue.cpp */,
|
||||
15384E7416119D5E0021DC07 /* CCBValue.h */,
|
||||
15384E7516119D5E0021DC07 /* CCControlButtonLoader.cpp */,
|
||||
15384E7616119D5E0021DC07 /* CCControlButtonLoader.h */,
|
||||
15384E7716119D5E0021DC07 /* CCControlLoader.cpp */,
|
||||
15384E7816119D5E0021DC07 /* CCControlLoader.h */,
|
||||
15384E7916119D5E0021DC07 /* CCData.cpp */,
|
||||
15384E7A16119D5E0021DC07 /* CCData.h */,
|
||||
15384E7B16119D5E0021DC07 /* CCLabelBMFontLoader.cpp */,
|
||||
15384E7C16119D5E0021DC07 /* CCLabelBMFontLoader.h */,
|
||||
15384E7D16119D5E0021DC07 /* CCLabelTTFLoader.cpp */,
|
||||
15384E7E16119D5E0021DC07 /* CCLabelTTFLoader.h */,
|
||||
15384E7F16119D5E0021DC07 /* CCLayerColorLoader.cpp */,
|
||||
15384E8016119D5E0021DC07 /* CCLayerColorLoader.h */,
|
||||
15384E8116119D5E0021DC07 /* CCLayerGradientLoader.cpp */,
|
||||
15384E8216119D5E0021DC07 /* CCLayerGradientLoader.h */,
|
||||
15384E8316119D5E0021DC07 /* CCLayerLoader.cpp */,
|
||||
15384E8416119D5E0021DC07 /* CCLayerLoader.h */,
|
||||
15384E8516119D5E0021DC07 /* CCMenuItemImageLoader.cpp */,
|
||||
15384E8616119D5E0021DC07 /* CCMenuItemImageLoader.h */,
|
||||
15384E8716119D5E0021DC07 /* CCMenuItemLoader.cpp */,
|
||||
15384E8816119D5E0021DC07 /* CCMenuItemLoader.h */,
|
||||
15384E8916119D5E0021DC07 /* CCMenuLoader.h */,
|
||||
15384E8A16119D5E0021DC07 /* CCNode+CCBRelativePositioning.cpp */,
|
||||
15384E8B16119D5E0021DC07 /* CCNode+CCBRelativePositioning.h */,
|
||||
15384E8C16119D5E0021DC07 /* CCNodeLoader.cpp */,
|
||||
15384E8D16119D5E0021DC07 /* CCNodeLoader.h */,
|
||||
15384E8E16119D5E0021DC07 /* CCNodeLoaderLibrary.cpp */,
|
||||
15384E8F16119D5E0021DC07 /* CCNodeLoaderLibrary.h */,
|
||||
15384E9016119D5E0021DC07 /* CCNodeLoaderListener.h */,
|
||||
15384E9116119D5E0021DC07 /* CCParticleSystemQuadLoader.cpp */,
|
||||
15384E9216119D5E0021DC07 /* CCParticleSystemQuadLoader.h */,
|
||||
15384E9316119D5E0021DC07 /* CCScale9SpriteLoader.cpp */,
|
||||
15384E9416119D5E0021DC07 /* CCScale9SpriteLoader.h */,
|
||||
15384E9516119D5E0021DC07 /* CCScrollViewLoader.cpp */,
|
||||
15384E9616119D5E0021DC07 /* CCScrollViewLoader.h */,
|
||||
15384E9716119D5E0021DC07 /* CCSpriteLoader.cpp */,
|
||||
15384E9816119D5E0021DC07 /* CCSpriteLoader.h */,
|
||||
);
|
||||
path = CCBReader;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
15384E9B16119D5E0021DC07 /* GUI */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384E9C16119D5E0021DC07 /* CCControlExtension */,
|
||||
15384EB616119D5E0021DC07 /* CCEditBox */,
|
||||
15384EC016119D5E0021DC07 /* CCScrollView */,
|
||||
);
|
||||
path = GUI;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
15384E9C16119D5E0021DC07 /* CCControlExtension */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384E9D16119D5E0021DC07 /* CCControl.cpp */,
|
||||
15384E9E16119D5E0021DC07 /* CCControl.h */,
|
||||
15384E9F16119D5E0021DC07 /* CCControlButton.cpp */,
|
||||
15384EA016119D5E0021DC07 /* CCControlButton.h */,
|
||||
15384EA116119D5E0021DC07 /* CCControlColourPicker.cpp */,
|
||||
15384EA216119D5E0021DC07 /* CCControlColourPicker.h */,
|
||||
15384EA316119D5E0021DC07 /* CCControlExtensions.h */,
|
||||
15384EA416119D5E0021DC07 /* CCControlHuePicker.cpp */,
|
||||
15384EA516119D5E0021DC07 /* CCControlHuePicker.h */,
|
||||
15384EA616119D5E0021DC07 /* CCControlSaturationBrightnessPicker.cpp */,
|
||||
15384EA716119D5E0021DC07 /* CCControlSaturationBrightnessPicker.h */,
|
||||
15384EA816119D5E0021DC07 /* CCControlSlider.cpp */,
|
||||
15384EA916119D5E0021DC07 /* CCControlSlider.h */,
|
||||
15384EAA16119D5E0021DC07 /* CCControlSwitch.cpp */,
|
||||
15384EAB16119D5E0021DC07 /* CCControlSwitch.h */,
|
||||
15384EAC16119D5E0021DC07 /* CCControlUtils.cpp */,
|
||||
15384EAD16119D5E0021DC07 /* CCControlUtils.h */,
|
||||
15384EAE16119D5E0021DC07 /* CCInvocation.cpp */,
|
||||
15384EAF16119D5E0021DC07 /* CCInvocation.h */,
|
||||
15384EB016119D5E0021DC07 /* CCMenuPassive.cpp */,
|
||||
15384EB116119D5E0021DC07 /* CCMenuPassive.h */,
|
||||
15384EB216119D5E0021DC07 /* CCScale9Sprite.cpp */,
|
||||
15384EB316119D5E0021DC07 /* CCScale9Sprite.h */,
|
||||
15384EB416119D5E0021DC07 /* CCSpacer.cpp */,
|
||||
15384EB516119D5E0021DC07 /* CCSpacer.h */,
|
||||
);
|
||||
path = CCControlExtension;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
15384EB616119D5E0021DC07 /* CCEditBox */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384EB716119D5E0021DC07 /* CCEditBox.cpp */,
|
||||
15384EB816119D5E0021DC07 /* CCEditBox.h */,
|
||||
15384EB916119D5E0021DC07 /* CCEditBoxImpl.h */,
|
||||
15384EBC16119D5E0021DC07 /* CCEditBoxImplIOS.h */,
|
||||
15384EBD16119D5E0021DC07 /* CCEditBoxImplIOS.mm */,
|
||||
15384EBE16119D5E0021DC07 /* EditBoxImplIOS.h */,
|
||||
15384EBF16119D5E0021DC07 /* EditBoxImplIOS.mm */,
|
||||
);
|
||||
path = CCEditBox;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
15384EC016119D5E0021DC07 /* CCScrollView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384EC116119D5E0021DC07 /* CCScrollView.cpp */,
|
||||
15384EC216119D5E0021DC07 /* CCScrollView.h */,
|
||||
15384EC316119D5E0021DC07 /* CCSorting.cpp */,
|
||||
15384EC416119D5E0021DC07 /* CCSorting.h */,
|
||||
15384EC516119D5E0021DC07 /* CCTableView.cpp */,
|
||||
15384EC616119D5E0021DC07 /* CCTableView.h */,
|
||||
15384EC716119D5E0021DC07 /* CCTableViewCell.cpp */,
|
||||
15384EC816119D5E0021DC07 /* CCTableViewCell.h */,
|
||||
);
|
||||
path = CCScrollView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
15426AEA15B5733200712A7F /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -495,10 +817,11 @@
|
|||
A92275321517C094001B78AA = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15384E6216119D5E0021DC07 /* extensions */,
|
||||
15384E3C16119CC30021DC07 /* bindings */,
|
||||
15426AE915B5733200712A7F /* cocos2dx.xcodeproj */,
|
||||
15628F5B15F0F5C2000CF24B /* Resources */,
|
||||
2628297C15EC7196002C4240 /* chipmunk */,
|
||||
F2837A9C15B9639100A5707B /* bindings */,
|
||||
D4545214156E28EF00887EB5 /* Classes */,
|
||||
15426FC415B5743C00712A7F /* CocosDenshion */,
|
||||
A92275401517C094001B78AA /* Frameworks */,
|
||||
|
@ -556,31 +879,6 @@
|
|||
path = ../Classes;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F2837A9C15B9639100A5707B /* bindings */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2628295015EC6C1B002C4240 /* uthash.h */,
|
||||
2628295115EC6C1B002C4240 /* spidermonkey_specifics.h */,
|
||||
2628295215EC6C1B002C4240 /* ScriptingCore.h */,
|
||||
2628295315EC6C1B002C4240 /* ScriptingCore.cpp */,
|
||||
2628295415EC6C1B002C4240 /* js_manual_conversions.h */,
|
||||
2628295515EC6C1B002C4240 /* js_manual_conversions.cpp */,
|
||||
2628295615EC6C1B002C4240 /* js_bindings_config.h */,
|
||||
2628295715EC6C1B002C4240 /* js_bindings_chipmunk_manual.hpp */,
|
||||
2628295815EC6C1B002C4240 /* js_bindings_chipmunk_manual.cpp */,
|
||||
2628295915EC6C1B002C4240 /* js_bindings_chipmunk_functions.hpp */,
|
||||
2628295A15EC6C1B002C4240 /* js_bindings_chipmunk_functions.cpp */,
|
||||
2628295B15EC6C1B002C4240 /* cocos2dx.hpp */,
|
||||
2628295C15EC6C1B002C4240 /* cocos2dx.cpp */,
|
||||
2628295D15EC6C1B002C4240 /* cocos2d_specifics.hpp */,
|
||||
2628295E15EC6C1B002C4240 /* cocos2d_specifics.cpp */,
|
||||
2628295F15EC6C1B002C4240 /* CCPhysicsSprite.h */,
|
||||
2628296015EC6C1B002C4240 /* CCPhysicsSprite.cpp */,
|
||||
);
|
||||
name = bindings;
|
||||
path = ../../../scripting/javascript/bindings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
@ -700,13 +998,6 @@
|
|||
15426FE815B5743C00712A7F /* CocosDenshion.m in Sources */,
|
||||
15426FE915B5743C00712A7F /* SimpleAudioEngine.mm in Sources */,
|
||||
15426FEA15B5743C00712A7F /* SimpleAudioEngine_objc.m in Sources */,
|
||||
2628296215EC6C1B002C4240 /* ScriptingCore.cpp in Sources */,
|
||||
2628296315EC6C1B002C4240 /* js_manual_conversions.cpp in Sources */,
|
||||
2628296415EC6C1B002C4240 /* js_bindings_chipmunk_manual.cpp in Sources */,
|
||||
2628296515EC6C1B002C4240 /* js_bindings_chipmunk_functions.cpp in Sources */,
|
||||
2628296615EC6C1B002C4240 /* cocos2dx.cpp in Sources */,
|
||||
2628296715EC6C1B002C4240 /* cocos2d_specifics.cpp in Sources */,
|
||||
2628296815EC6C1B002C4240 /* CCPhysicsSprite.cpp in Sources */,
|
||||
262829D415EC7196002C4240 /* Makefile in Sources */,
|
||||
262829DB15EC7196002C4240 /* chipmunk.c in Sources */,
|
||||
262829DD15EC7196002C4240 /* cpConstraint.c in Sources */,
|
||||
|
@ -737,6 +1028,58 @@
|
|||
262829F615EC7196002C4240 /* cpSpatialIndex.c in Sources */,
|
||||
262829F715EC7196002C4240 /* cpSweep1D.c in Sources */,
|
||||
262829F815EC7196002C4240 /* cpVect.c in Sources */,
|
||||
15384E5716119CC30021DC07 /* CCPhysicsSprite.cpp in Sources */,
|
||||
15384E5816119CC30021DC07 /* cocos2d_specifics.cpp in Sources */,
|
||||
15384E5916119CC30021DC07 /* cocosjs_manual_conversions.cpp in Sources */,
|
||||
15384E5A16119CC30021DC07 /* cocos2dx.cpp in Sources */,
|
||||
15384E5D16119CC30021DC07 /* js_bindings_ccbreader.cpp in Sources */,
|
||||
15384E5E16119CC30021DC07 /* js_bindings_chipmunk_functions.cpp in Sources */,
|
||||
15384E5F16119CC30021DC07 /* js_bindings_chipmunk_manual.cpp in Sources */,
|
||||
15384E6016119CC30021DC07 /* js_manual_conversions.cpp in Sources */,
|
||||
15384E6116119CC30021DC07 /* ScriptingCore.cpp in Sources */,
|
||||
15384ED716119D5E0021DC07 /* CCBAnimationManager.cpp in Sources */,
|
||||
15384ED816119D5E0021DC07 /* CCBFileLoader.cpp in Sources */,
|
||||
15384ED916119D5E0021DC07 /* CCBKeyframe.cpp in Sources */,
|
||||
15384EDA16119D5E0021DC07 /* CCBReader.cpp in Sources */,
|
||||
15384EDB16119D5E0021DC07 /* CCBSequence.cpp in Sources */,
|
||||
15384EDC16119D5E0021DC07 /* CCBSequenceProperty.cpp in Sources */,
|
||||
15384EDD16119D5E0021DC07 /* CCBValue.cpp in Sources */,
|
||||
15384EDE16119D5E0021DC07 /* CCControlButtonLoader.cpp in Sources */,
|
||||
15384EDF16119D5E0021DC07 /* CCControlLoader.cpp in Sources */,
|
||||
15384EE016119D5E0021DC07 /* CCData.cpp in Sources */,
|
||||
15384EE116119D5E0021DC07 /* CCLabelBMFontLoader.cpp in Sources */,
|
||||
15384EE216119D5E0021DC07 /* CCLabelTTFLoader.cpp in Sources */,
|
||||
15384EE316119D5E0021DC07 /* CCLayerColorLoader.cpp in Sources */,
|
||||
15384EE416119D5E0021DC07 /* CCLayerGradientLoader.cpp in Sources */,
|
||||
15384EE516119D5E0021DC07 /* CCLayerLoader.cpp in Sources */,
|
||||
15384EE616119D5E0021DC07 /* CCMenuItemImageLoader.cpp in Sources */,
|
||||
15384EE716119D5E0021DC07 /* CCMenuItemLoader.cpp in Sources */,
|
||||
15384EE816119D5E0021DC07 /* CCNode+CCBRelativePositioning.cpp in Sources */,
|
||||
15384EE916119D5E0021DC07 /* CCNodeLoader.cpp in Sources */,
|
||||
15384EEA16119D5E0021DC07 /* CCNodeLoaderLibrary.cpp in Sources */,
|
||||
15384EEB16119D5E0021DC07 /* CCParticleSystemQuadLoader.cpp in Sources */,
|
||||
15384EEC16119D5E0021DC07 /* CCScale9SpriteLoader.cpp in Sources */,
|
||||
15384EED16119D5E0021DC07 /* CCScrollViewLoader.cpp in Sources */,
|
||||
15384EEE16119D5E0021DC07 /* CCSpriteLoader.cpp in Sources */,
|
||||
15384EEF16119D5E0021DC07 /* CCControl.cpp in Sources */,
|
||||
15384EF016119D5E0021DC07 /* CCControlButton.cpp in Sources */,
|
||||
15384EF116119D5E0021DC07 /* CCControlColourPicker.cpp in Sources */,
|
||||
15384EF216119D5E0021DC07 /* CCControlHuePicker.cpp in Sources */,
|
||||
15384EF316119D5E0021DC07 /* CCControlSaturationBrightnessPicker.cpp in Sources */,
|
||||
15384EF416119D5E0021DC07 /* CCControlSlider.cpp in Sources */,
|
||||
15384EF516119D5E0021DC07 /* CCControlSwitch.cpp in Sources */,
|
||||
15384EF616119D5E0021DC07 /* CCControlUtils.cpp in Sources */,
|
||||
15384EF716119D5E0021DC07 /* CCInvocation.cpp in Sources */,
|
||||
15384EF816119D5E0021DC07 /* CCMenuPassive.cpp in Sources */,
|
||||
15384EF916119D5E0021DC07 /* CCScale9Sprite.cpp in Sources */,
|
||||
15384EFA16119D5E0021DC07 /* CCSpacer.cpp in Sources */,
|
||||
15384EFB16119D5E0021DC07 /* CCEditBox.cpp in Sources */,
|
||||
15384EFD16119D5E0021DC07 /* CCEditBoxImplIOS.mm in Sources */,
|
||||
15384EFE16119D5E0021DC07 /* EditBoxImplIOS.mm in Sources */,
|
||||
15384EFF16119D5E0021DC07 /* CCScrollView.cpp in Sources */,
|
||||
15384F0016119D5E0021DC07 /* CCSorting.cpp in Sources */,
|
||||
15384F0116119D5E0021DC07 /* CCTableView.cpp in Sources */,
|
||||
15384F0216119D5E0021DC07 /* CCTableViewCell.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -828,6 +1171,7 @@
|
|||
"$(SRCROOT)/../../../cocos2dx/platform/ios",
|
||||
"$(SRCROOT)/../../../external/chipmunk/include/chipmunk",
|
||||
"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/include",
|
||||
"$(SRCROOT)/../../../scripting/javascript/bindings",
|
||||
);
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
|
@ -866,6 +1210,7 @@
|
|||
"$(SRCROOT)/../../../cocos2dx/platform/ios",
|
||||
"$(SRCROOT)/../../../external/chipmunk/include/chipmunk",
|
||||
"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/include",
|
||||
"$(SRCROOT)/../../../scripting/javascript/bindings",
|
||||
);
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
|
|
Loading…
Reference in New Issue