mirror of https://github.com/axmolengine/axmol.git
Merge branch 'gles20' of https://github.com/cocos2d/cocos2d-x into gles20
This commit is contained in:
commit
f8fcc608c9
3
AUTHORS
3
AUTHORS
|
@ -12,6 +12,9 @@ Developers:
|
|||
Rolando Abarca
|
||||
Javascript Binding and testjs
|
||||
|
||||
sburavtsov
|
||||
fix for correct unscheduling and instance destruction of extensions/network/HttpClient.cpp
|
||||
|
||||
wenbin wang
|
||||
add korean language support
|
||||
fix getDeviceModel bug in android CocosDenshion
|
||||
|
|
|
@ -131,7 +131,7 @@ bool CCDirector::init(void)
|
|||
// purge ?
|
||||
m_bPurgeDirecotorInNextLoop = false;
|
||||
|
||||
m_obWinSizeInPixels = m_obWinSizeInPoints = CCSizeZero;
|
||||
m_obWinSizeInPoints = CCSizeZero;
|
||||
|
||||
m_pobOpenGLView = NULL;
|
||||
|
||||
|
@ -301,8 +301,7 @@ void CCDirector::setOpenGLView(CCEGLView *pobOpenGLView)
|
|||
m_pobOpenGLView = pobOpenGLView;
|
||||
|
||||
// set size
|
||||
m_obWinSizeInPoints = m_pobOpenGLView->getSize();
|
||||
m_obWinSizeInPixels = CCSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor);
|
||||
m_obWinSizeInPoints = m_pobOpenGLView->getDesignResolutionSize();
|
||||
|
||||
createStatsLabel();
|
||||
|
||||
|
@ -454,7 +453,7 @@ CCSize CCDirector::getWinSize(void)
|
|||
|
||||
CCSize CCDirector::getWinSizeInPixels()
|
||||
{
|
||||
return m_obWinSizeInPixels;
|
||||
return CCSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor);
|
||||
}
|
||||
|
||||
CCSize CCDirector::getVisibleSize()
|
||||
|
@ -481,20 +480,6 @@ CCPoint CCDirector::getVisibleOrigin()
|
|||
}
|
||||
}
|
||||
|
||||
void CCDirector::reshapeProjection(const CCSize& newWindowSize)
|
||||
{
|
||||
CC_UNUSED_PARAM(newWindowSize);
|
||||
if (m_pobOpenGLView)
|
||||
{
|
||||
m_obWinSizeInPoints = m_pobOpenGLView->getSize();
|
||||
m_obWinSizeInPixels = CCSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor,
|
||||
m_obWinSizeInPoints.height * m_fContentScaleFactor);
|
||||
|
||||
setProjection(m_eProjection);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// scene management
|
||||
|
||||
void CCDirector::runWithScene(CCScene *pScene)
|
||||
|
@ -775,7 +760,16 @@ void CCDirector::createStatsLabel()
|
|||
m_pDrawsLabel = new CCLabelAtlas();
|
||||
m_pDrawsLabel->initWithString("000", "fps_images.png", 12, 32, '.');
|
||||
*/
|
||||
int fontSize = (int)(m_obWinSizeInPoints.height / 320.0f * 24);
|
||||
int fontSize = 0;
|
||||
if (m_obWinSizeInPoints.width > m_obWinSizeInPoints.height)
|
||||
{
|
||||
fontSize = (int)(m_obWinSizeInPoints.height / 320.0f * 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
fontSize = (int)(m_obWinSizeInPoints.width / 320.0f * 24);
|
||||
}
|
||||
|
||||
m_pFPSLabel = CCLabelTTF::create("00.0", "Arial", fontSize);
|
||||
m_pFPSLabel->retain();
|
||||
m_pSPFLabel = CCLabelTTF::create("0.000", "Arial", fontSize);
|
||||
|
@ -809,6 +803,7 @@ void CCDirector::setContentScaleFactor(float scaleFactor)
|
|||
if (scaleFactor != m_fContentScaleFactor)
|
||||
{
|
||||
m_fContentScaleFactor = scaleFactor;
|
||||
createStatsLabel();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,9 +180,6 @@ public:
|
|||
*/
|
||||
CCPoint getVisibleOrigin();
|
||||
|
||||
/** changes the projection size */
|
||||
void reshapeProjection(const CCSize& newWindowSize);
|
||||
|
||||
/** converts a UIKit coordinate to an OpenGL coordinate
|
||||
Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)
|
||||
*/
|
||||
|
@ -389,9 +386,6 @@ protected:
|
|||
|
||||
/* window size in points */
|
||||
CCSize m_obWinSizeInPoints;
|
||||
|
||||
/* window size in pixels */
|
||||
CCSize m_obWinSizeInPixels;
|
||||
|
||||
/* content scale factor */
|
||||
float m_fContentScaleFactor;
|
||||
|
|
|
@ -88,13 +88,12 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height, Resol
|
|||
m_eResolutionPolicy = resolutionPolicy;
|
||||
|
||||
// reset director's member variables to fit visible rect
|
||||
CCDirector::sharedDirector()->m_obWinSizeInPoints = getSize();
|
||||
CCDirector::sharedDirector()->m_obWinSizeInPixels = CCSizeMake(m_obDesignResolutionSize.width*CC_CONTENT_SCALE_FACTOR(), m_obDesignResolutionSize.height*CC_CONTENT_SCALE_FACTOR());
|
||||
CCDirector::sharedDirector()->m_obWinSizeInPoints = getDesignResolutionSize();
|
||||
CCDirector::sharedDirector()->createStatsLabel();
|
||||
CCDirector::sharedDirector()->setGLDefaultValues();
|
||||
}
|
||||
|
||||
const CCSize& CCEGLViewProtocol::getSize() const
|
||||
const CCSize& CCEGLViewProtocol::getDesignResolutionSize() const
|
||||
{
|
||||
return m_obDesignResolutionSize;
|
||||
}
|
||||
|
|
|
@ -48,13 +48,6 @@ public:
|
|||
/** Open or close IME keyboard , subclass must implement this method. */
|
||||
virtual void setIMEKeyboardState(bool bOpen) = 0;
|
||||
|
||||
/**
|
||||
* Get design resolution size.
|
||||
* If setDesignResolutionSize wasn't invoked, the result of this function return is the same as 'getFrameSize'
|
||||
*/
|
||||
|
||||
virtual const CCSize& getSize() const;
|
||||
|
||||
/**
|
||||
* Get the frame size of EGL view.
|
||||
* In general, it returns the screen size since the EGL view is a fullscreen view.
|
||||
|
@ -78,16 +71,20 @@ public:
|
|||
|
||||
/**
|
||||
* Set the design resolution size.
|
||||
* Behavior undefined when enableRetina == true.
|
||||
* @param width Design resolution width.
|
||||
* @param height Design resolution height.
|
||||
* @param resolutionPolicy The resolution policy desired, you may choose:
|
||||
* [1] kCCResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched.
|
||||
* [2] kCCResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut.
|
||||
* [3] kCCResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.
|
||||
* [1] kResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched.
|
||||
* [2] kResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut.
|
||||
* [3] kResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.
|
||||
*/
|
||||
virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy);
|
||||
|
||||
/** Get design resolution size.
|
||||
* Default resolution size is the same as 'getFrameSize'.
|
||||
*/
|
||||
virtual const CCSize& getDesignResolutionSize() const;
|
||||
|
||||
/** Set touch delegate */
|
||||
virtual void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
|
||||
#include "cocoa/CCGeometry.h"
|
||||
#include "platform/CCEGLViewProtocol.h"
|
||||
#include "platform/CCPlatFormMacros.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ static EAGLView *view = 0;
|
|||
cocos2d::CCSize size;
|
||||
size.width = size_.width;
|
||||
size.height = size_.height;
|
||||
cocos2d::CCDirector::sharedDirector()->reshapeProjection(size);
|
||||
//cocos2d::CCDirector::sharedDirector()->reshapeProjection(size);
|
||||
|
||||
// Avoid flicker. Issue #350
|
||||
//[director performSelectorOnMainThread:@selector(drawScene) withObject:nil waitUntilDone:YES];
|
||||
|
|
|
@ -261,6 +261,15 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
|
|||
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
|
||||
}
|
||||
|
||||
void CCEGLView::setScissorInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glScissor((GLint)(x * m_fScaleX * m_fFrameZoomFactor + m_obViewPortRect.origin.x * m_fFrameZoomFactor),
|
||||
(GLint)(y * m_fScaleY * m_fFrameZoomFactor + m_obViewPortRect.origin.y * m_fFrameZoomFactor),
|
||||
(GLsizei)(w * m_fScaleX * m_fFrameZoomFactor),
|
||||
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
|
||||
}
|
||||
|
||||
|
||||
bool CCEGLView::isOpenGLReady()
|
||||
{
|
||||
return bIsInit;
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
*/
|
||||
virtual void setFrameSize(float width, float height);
|
||||
virtual void setViewPortInPoints(float x , float y , float w , float h);
|
||||
virtual void setScissorInPoints(float x , float y , float w , float h);
|
||||
|
||||
/*
|
||||
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
||||
*/
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
* Set opengl view port rectangle with points.
|
||||
*/
|
||||
virtual void setViewPortInPoints(float x , float y , float w , float h);
|
||||
virtual void setScissorInPoints(float x , float y , float w , float h);
|
||||
|
||||
virtual void setIMEKeyboardState(bool bOpen);
|
||||
virtual void setMultiTouchMask(bool mask);
|
||||
|
|
|
@ -98,6 +98,16 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
|
|||
(GLsizei)(h * m_fScaleY * frameZoomFactor));
|
||||
}
|
||||
|
||||
void CCEGLView::setScissorInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
float frameZoomFactor = [[EAGLView sharedEGLView] frameZoomFactor];
|
||||
|
||||
glScissor((GLint)(x * m_fScaleX * frameZoomFactor + m_obViewPortRect.origin.x * frameZoomFactor),
|
||||
(GLint)(y * m_fScaleY * frameZoomFactor + m_obViewPortRect.origin.y * frameZoomFactor),
|
||||
(GLsizei)(w * m_fScaleX * frameZoomFactor),
|
||||
(GLsizei)(h * m_fScaleY * frameZoomFactor));
|
||||
}
|
||||
|
||||
void CCEGLView::setMultiTouchMask(bool mask)
|
||||
{
|
||||
//EAGLView *glView = [EAGLView sharedEGLView];
|
||||
|
|
|
@ -158,7 +158,7 @@ static EAGLView *view;
|
|||
cocos2d::CCDirector *director = cocos2d::CCDirector::sharedDirector();
|
||||
CGSize size = NSSizeToCGSize(rect.size);
|
||||
cocos2d::CCSize ccsize = cocos2d::CCSizeMake(size.width, size.height);
|
||||
director->reshapeProjection(ccsize);
|
||||
//director->reshapeProjection(ccsize);
|
||||
|
||||
// avoid flicker
|
||||
director->drawScene();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
@ -55,34 +55,32 @@
|
|||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
|
||||
!defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
|
||||
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
|
||||
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))
|
||||
/* The check above prevents the winsock2 inclusion if winsock.h already was
|
||||
included, since they can't co-exist without problems */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#else
|
||||
#endif
|
||||
|
||||
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
|
||||
libc5-based Linux systems. Only include it on system that are known to
|
||||
libc5-based Linux systems. Only include it on systems that are known to
|
||||
require it! */
|
||||
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
|
||||
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
|
||||
defined(ANDROID) || \
|
||||
defined(ANDROID) || defined(__ANDROID__) || \
|
||||
(defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#if !defined(WIN32) && !defined(_WIN32_WCE)
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
#include <support/SupportDefs.h>
|
||||
|
@ -122,7 +120,7 @@ typedef void CURL;
|
|||
|
||||
#ifndef curl_socket_typedef
|
||||
/* socket typedef */
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__LWIP_OPT_H__)
|
||||
typedef SOCKET curl_socket_t;
|
||||
#define CURL_SOCKET_BAD INVALID_SOCKET
|
||||
#else
|
||||
|
@ -189,10 +187,10 @@ typedef int (*curl_progress_callback)(void *clientp,
|
|||
#define CURL_MAX_HTTP_HEADER (100*1024)
|
||||
#endif
|
||||
|
||||
|
||||
/* This is a magic return code for the write callback that, when returned,
|
||||
will signal libcurl to pause receiving on the current transfer. */
|
||||
#define CURL_WRITEFUNC_PAUSE 0x10000001
|
||||
|
||||
typedef size_t (*curl_write_callback)(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
|
@ -315,6 +313,13 @@ typedef enum {
|
|||
CURLSOCKTYPE_LAST /* never use */
|
||||
} curlsocktype;
|
||||
|
||||
/* The return code from the sockopt_callback can signal information back
|
||||
to libcurl: */
|
||||
#define CURL_SOCKOPT_OK 0
|
||||
#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return
|
||||
CURLE_ABORTED_BY_CALLBACK */
|
||||
#define CURL_SOCKOPT_ALREADY_CONNECTED 2
|
||||
|
||||
typedef int (*curl_sockopt_callback)(void *clientp,
|
||||
curl_socket_t curlfd,
|
||||
curlsocktype purpose);
|
||||
|
@ -334,6 +339,9 @@ typedef curl_socket_t
|
|||
curlsocktype purpose,
|
||||
struct curl_sockaddr *address);
|
||||
|
||||
typedef int
|
||||
(*curl_closesocket_callback)(void *clientp, curl_socket_t item);
|
||||
|
||||
typedef enum {
|
||||
CURLIOE_OK, /* I/O operation successful */
|
||||
CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
|
||||
|
@ -394,7 +402,8 @@ typedef enum {
|
|||
CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
|
||||
CURLE_FAILED_INIT, /* 2 */
|
||||
CURLE_URL_MALFORMAT, /* 3 */
|
||||
CURLE_OBSOLETE4, /* 4 - NOT USED */
|
||||
CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for
|
||||
7.17.0, reused in April 2011 for 7.21.5] */
|
||||
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
|
||||
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
|
||||
CURLE_COULDNT_CONNECT, /* 7 */
|
||||
|
@ -402,9 +411,12 @@ typedef enum {
|
|||
CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
|
||||
due to lack of access - when login fails
|
||||
this is not returned. */
|
||||
CURLE_OBSOLETE10, /* 10 - NOT USED */
|
||||
CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for
|
||||
7.15.4, reused in Dec 2011 for 7.24.0]*/
|
||||
CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
|
||||
CURLE_OBSOLETE12, /* 12 - NOT USED */
|
||||
CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server
|
||||
[was obsoleted in August 2007 for 7.17.0,
|
||||
reused in Dec 2011 for 7.24.0]*/
|
||||
CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
|
||||
CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
|
||||
CURLE_FTP_CANT_GET_HOST, /* 15 */
|
||||
|
@ -444,7 +456,7 @@ typedef enum {
|
|||
CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
|
||||
CURLE_OBSOLETE46, /* 46 - NOT USED */
|
||||
CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
|
||||
CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
|
||||
CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */
|
||||
CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
|
||||
CURLE_OBSOLETE50, /* 50 - NOT USED */
|
||||
CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
|
||||
|
@ -459,7 +471,7 @@ typedef enum {
|
|||
CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
|
||||
CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
|
||||
CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
|
||||
CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */
|
||||
CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
|
||||
CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
|
||||
CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
|
||||
CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
|
||||
|
@ -499,17 +511,24 @@ typedef enum {
|
|||
7.19.0) */
|
||||
CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */
|
||||
CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */
|
||||
CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Identifiers */
|
||||
CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */
|
||||
CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */
|
||||
CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */
|
||||
|
||||
CURL_LAST /* never use! */
|
||||
} CURLcode;
|
||||
|
||||
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
|
||||
the obsolete stuff removed! */
|
||||
|
||||
/* Backwards compatibility with older names */
|
||||
/* Previously obsoletes error codes re-used in 7.24.0 */
|
||||
#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED
|
||||
#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT
|
||||
|
||||
/* compatibility with older names */
|
||||
#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
|
||||
|
||||
/* The following were added in 7.21.5, April 2011 */
|
||||
#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
|
||||
|
||||
/* The following were added in 7.17.1 */
|
||||
/* These are scheduled to disappear by 2009 */
|
||||
|
@ -517,7 +536,7 @@ typedef enum {
|
|||
|
||||
/* The following were added in 7.17.0 */
|
||||
/* These are scheduled to disappear by 2009 */
|
||||
#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */
|
||||
#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
|
||||
#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
|
||||
#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
|
||||
#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
|
||||
|
@ -529,7 +548,7 @@ typedef enum {
|
|||
#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
|
||||
#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
|
||||
#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
|
||||
#define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4
|
||||
#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN
|
||||
|
||||
#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
|
||||
#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
|
||||
|
@ -579,17 +598,32 @@ typedef enum {
|
|||
in 7.18.0 */
|
||||
} curl_proxytype; /* this enum was added in 7.10 */
|
||||
|
||||
#define CURLAUTH_NONE 0 /* nothing */
|
||||
#define CURLAUTH_BASIC (1<<0) /* Basic (default) */
|
||||
#define CURLAUTH_DIGEST (1<<1) /* Digest */
|
||||
#define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
|
||||
#define CURLAUTH_NTLM (1<<3) /* NTLM */
|
||||
#define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */
|
||||
#define CURLAUTH_ONLY (1<<31) /* used together with a single other
|
||||
type to force no auth or just that
|
||||
single type */
|
||||
#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */
|
||||
#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
|
||||
/*
|
||||
* Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:
|
||||
*
|
||||
* CURLAUTH_NONE - No HTTP authentication
|
||||
* CURLAUTH_BASIC - HTTP Basic authentication (default)
|
||||
* CURLAUTH_DIGEST - HTTP Digest authentication
|
||||
* CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication
|
||||
* CURLAUTH_NTLM - HTTP NTLM authentication
|
||||
* CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour
|
||||
* CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper
|
||||
* CURLAUTH_ONLY - Use together with a single other type to force no
|
||||
* authentication or just that single type
|
||||
* CURLAUTH_ANY - All fine types set
|
||||
* CURLAUTH_ANYSAFE - All fine types except Basic
|
||||
*/
|
||||
|
||||
#define CURLAUTH_NONE ((unsigned long)0)
|
||||
#define CURLAUTH_BASIC (((unsigned long)1)<<0)
|
||||
#define CURLAUTH_DIGEST (((unsigned long)1)<<1)
|
||||
#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)
|
||||
#define CURLAUTH_NTLM (((unsigned long)1)<<3)
|
||||
#define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4)
|
||||
#define CURLAUTH_NTLM_WB (((unsigned long)1)<<5)
|
||||
#define CURLAUTH_ONLY (((unsigned long)1)<<31)
|
||||
#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)
|
||||
#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
|
||||
|
||||
#define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
|
||||
#define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
|
||||
|
@ -599,6 +633,10 @@ typedef enum {
|
|||
#define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
|
||||
#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
|
||||
|
||||
#define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */
|
||||
#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */
|
||||
#define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */
|
||||
|
||||
#define CURL_ERROR_SIZE 256
|
||||
|
||||
struct curl_khkey {
|
||||
|
@ -649,6 +687,15 @@ typedef enum {
|
|||
CURLUSESSL_LAST /* not an option, never use */
|
||||
} curl_usessl;
|
||||
|
||||
/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */
|
||||
|
||||
/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the
|
||||
name of improving interoperability with older servers. Some SSL libraries
|
||||
have introduced work-arounds for this flaw but those work-arounds sometimes
|
||||
make the SSL communication fail. To regain functionality with those broken
|
||||
servers, a user can this way allow the vulnerability back. */
|
||||
#define CURLSSLOPT_ALLOW_BEAST (1<<0)
|
||||
|
||||
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
|
||||
the obsolete stuff removed! */
|
||||
|
||||
|
@ -743,7 +790,7 @@ typedef enum {
|
|||
#endif
|
||||
|
||||
#ifdef CURL_ISOCPP
|
||||
#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
|
||||
#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
|
||||
#else
|
||||
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
|
||||
#define LONG CURLOPTTYPE_LONG
|
||||
|
@ -901,9 +948,7 @@ typedef enum {
|
|||
/* send linked-list of post-transfer QUOTE commands */
|
||||
CINIT(POSTQUOTE, OBJECTPOINT, 39),
|
||||
|
||||
/* Pass a pointer to string of the output using full variable-replacement
|
||||
as described elsewhere. */
|
||||
CINIT(WRITEINFO, OBJECTPOINT, 40),
|
||||
CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */
|
||||
|
||||
CINIT(VERBOSE, LONG, 41), /* talk a lot */
|
||||
CINIT(HEADER, LONG, 42), /* throw the header out too */
|
||||
|
@ -912,7 +957,7 @@ typedef enum {
|
|||
CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
|
||||
CINIT(UPLOAD, LONG, 46), /* this is an upload */
|
||||
CINIT(POST, LONG, 47), /* HTTP POST method */
|
||||
CINIT(DIRLISTONLY, LONG, 48), /* return bare names when listing directories */
|
||||
CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */
|
||||
|
||||
CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */
|
||||
|
||||
|
@ -979,9 +1024,7 @@ typedef enum {
|
|||
/* Max amount of cached alive connections */
|
||||
CINIT(MAXCONNECTS, LONG, 71),
|
||||
|
||||
/* What policy to use when closing connections when the cache is filled
|
||||
up */
|
||||
CINIT(CLOSEPOLICY, LONG, 72),
|
||||
CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */
|
||||
|
||||
/* 73 = OBSOLETE */
|
||||
|
||||
|
@ -1055,7 +1098,7 @@ typedef enum {
|
|||
CINIT(SSLENGINE_DEFAULT, LONG, 90),
|
||||
|
||||
/* Non-zero value means to use the global dns cache */
|
||||
CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
|
||||
CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */
|
||||
|
||||
/* DNS cache timeout */
|
||||
CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
|
||||
|
@ -1092,8 +1135,9 @@ typedef enum {
|
|||
CINIT(PROXYTYPE, LONG, 101),
|
||||
|
||||
/* Set the Accept-Encoding string. Use this to tell a server you would like
|
||||
the response to be compressed. */
|
||||
CINIT(ENCODING, OBJECTPOINT, 102),
|
||||
the response to be compressed. Before 7.21.6, this was known as
|
||||
CURLOPT_ENCODING */
|
||||
CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),
|
||||
|
||||
/* Set pointer to private data */
|
||||
CINIT(PRIVATE, OBJECTPOINT, 103),
|
||||
|
@ -1106,8 +1150,8 @@ typedef enum {
|
|||
and password to whatever host the server decides. */
|
||||
CINIT(UNRESTRICTED_AUTH, LONG, 105),
|
||||
|
||||
/* Specifically switch on or off the FTP engine's use of the EPRT command ( it
|
||||
also disables the LPRT attempt). By default, those ones will always be
|
||||
/* Specifically switch on or off the FTP engine's use of the EPRT command (
|
||||
it also disables the LPRT attempt). By default, those ones will always be
|
||||
attempted before the good old traditional PORT command. */
|
||||
CINIT(FTP_USE_EPRT, LONG, 106),
|
||||
|
||||
|
@ -1451,6 +1495,46 @@ typedef enum {
|
|||
/* Set authentication type for authenticated TLS */
|
||||
CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),
|
||||
|
||||
/* Set to 1 to enable the "TE:" header in HTTP requests to ask for
|
||||
compressed transfer-encoded responses. Set to 0 to disable the use of TE:
|
||||
in outgoing requests. The current default is 0, but it might change in a
|
||||
future libcurl release.
|
||||
|
||||
libcurl will ask for the compressed methods it knows of, and if that
|
||||
isn't any, it will not ask for transfer-encoding at all even if this
|
||||
option is set to 1.
|
||||
|
||||
*/
|
||||
CINIT(TRANSFER_ENCODING, LONG, 207),
|
||||
|
||||
/* Callback function for closing socket (instead of close(2)). The callback
|
||||
should have type curl_closesocket_callback */
|
||||
CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
|
||||
CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
|
||||
|
||||
/* allow GSSAPI credential delegation */
|
||||
CINIT(GSSAPI_DELEGATION, LONG, 210),
|
||||
|
||||
/* Set the name servers to use for DNS resolution */
|
||||
CINIT(DNS_SERVERS, OBJECTPOINT, 211),
|
||||
|
||||
/* Time-out accept operations (currently for FTP only) after this amount
|
||||
of miliseconds. */
|
||||
CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
|
||||
|
||||
/* Set TCP keepalive */
|
||||
CINIT(TCP_KEEPALIVE, LONG, 213),
|
||||
|
||||
/* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
|
||||
CINIT(TCP_KEEPIDLE, LONG, 214),
|
||||
CINIT(TCP_KEEPINTVL, LONG, 215),
|
||||
|
||||
/* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
|
||||
CINIT(SSL_OPTIONS, LONG, 216),
|
||||
|
||||
/* set the SMTP auth originator */
|
||||
CINIT(MAIL_AUTH, OBJECTPOINT, 217),
|
||||
|
||||
CURLOPT_LASTENTRY /* the last unused */
|
||||
} CURLoption;
|
||||
|
||||
|
@ -1554,13 +1638,16 @@ enum CURL_TLSAUTH {
|
|||
};
|
||||
|
||||
/* symbols to use with CURLOPT_POSTREDIR.
|
||||
CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that
|
||||
CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */
|
||||
CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
|
||||
can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302
|
||||
| CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */
|
||||
|
||||
#define CURL_REDIR_GET_ALL 0
|
||||
#define CURL_REDIR_POST_301 1
|
||||
#define CURL_REDIR_POST_302 2
|
||||
#define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302)
|
||||
#define CURL_REDIR_POST_303 4
|
||||
#define CURL_REDIR_POST_ALL \
|
||||
(CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)
|
||||
|
||||
typedef enum {
|
||||
CURL_TIMECOND_NONE,
|
||||
|
@ -1679,7 +1766,8 @@ CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
|
|||
* Should return the buffer length passed to it as the argument "len" on
|
||||
* success.
|
||||
*/
|
||||
typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len);
|
||||
typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
|
||||
size_t len);
|
||||
|
||||
/*
|
||||
* NAME curl_formget()
|
||||
|
@ -1978,8 +2066,9 @@ typedef enum {
|
|||
CURLSHE_BAD_OPTION, /* 1 */
|
||||
CURLSHE_IN_USE, /* 2 */
|
||||
CURLSHE_INVALID, /* 3 */
|
||||
CURLSHE_NOMEM, /* out of memory */
|
||||
CURLSHE_LAST /* never use */
|
||||
CURLSHE_NOMEM, /* 4 out of memory */
|
||||
CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */
|
||||
CURLSHE_LAST /* never use */
|
||||
} CURLSHcode;
|
||||
|
||||
typedef enum {
|
||||
|
@ -2059,8 +2148,9 @@ typedef struct {
|
|||
#define CURL_VERSION_CONV (1<<12) /* character conversions supported */
|
||||
#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */
|
||||
#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
|
||||
#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegating to winbind helper */
|
||||
|
||||
/*
|
||||
/*
|
||||
* NAME curl_version_info()
|
||||
*
|
||||
* DESCRIPTION
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
@ -59,52 +59,52 @@
|
|||
/* ================================================================ */
|
||||
|
||||
#ifdef CURL_SIZEOF_LONG
|
||||
# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||
# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SIZEOF_CURL_SOCKLEN_T
|
||||
# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_OFF_T
|
||||
# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_CURL_OFF_T
|
||||
# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_CURL_OFF_TU
|
||||
# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_OFF_T
|
||||
# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SIZEOF_CURL_OFF_T
|
||||
# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SUFFIX_CURL_OFF_T
|
||||
# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SUFFIX_CURL_OFF_TU
|
||||
# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
@ -26,17 +26,17 @@
|
|||
a script at release-time. This was made its own header file in 7.11.2 */
|
||||
|
||||
/* This is the global package copyright */
|
||||
#define LIBCURL_COPYRIGHT "1996 - 2010 Daniel Stenberg, <daniel@haxx.se>."
|
||||
#define LIBCURL_COPYRIGHT "1996 - 2012 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.21.4"
|
||||
#define LIBCURL_VERSION "7.26.0"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 21
|
||||
#define LIBCURL_VERSION_PATCH 4
|
||||
#define LIBCURL_VERSION_MINOR 26
|
||||
#define LIBCURL_VERSION_PATCH 0
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
|
@ -53,7 +53,7 @@
|
|||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x071504
|
||||
#define LIBCURL_VERSION_NUM 0x071a00
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
|
@ -64,6 +64,6 @@
|
|||
*
|
||||
* "Mon Feb 12 11:35:33 UTC 2007"
|
||||
*/
|
||||
#define LIBCURL_TIMESTAMP "Thu Feb 17 12:19:40 UTC 2011"
|
||||
#define LIBCURL_TIMESTAMP "Thu May 24 16:05:42 UTC 2012"
|
||||
|
||||
#endif /* __CURL_CURLVER_H */
|
||||
|
|
|
@ -53,8 +53,8 @@ CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
|
|||
*
|
||||
* Creates a new curl session handle with the same options set for the handle
|
||||
* passed in. Duplicating a handle could only be a matter of cloning data and
|
||||
* options, internal state info and things like persistant connections cannot
|
||||
* be transfered. It is useful in multithreaded applications when you can run
|
||||
* options, internal state info and things like persistent connections cannot
|
||||
* be transferred. It is useful in multithreaded applications when you can run
|
||||
* curl_easy_duphandle() for each new thread to avoid a series of identical
|
||||
* curl_easy_setopt() invokes in every thread.
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
@ -41,66 +41,66 @@
|
|||
#define curl_easy_setopt(handle, option, value) \
|
||||
__extension__ ({ \
|
||||
__typeof__ (option) _curl_opt = option; \
|
||||
if (__builtin_constant_p(_curl_opt)) { \
|
||||
if (_curl_is_long_option(_curl_opt)) \
|
||||
if (!_curl_is_long(value)) \
|
||||
if(__builtin_constant_p(_curl_opt)) { \
|
||||
if(_curl_is_long_option(_curl_opt)) \
|
||||
if(!_curl_is_long(value)) \
|
||||
_curl_easy_setopt_err_long(); \
|
||||
if (_curl_is_off_t_option(_curl_opt)) \
|
||||
if (!_curl_is_off_t(value)) \
|
||||
if(_curl_is_off_t_option(_curl_opt)) \
|
||||
if(!_curl_is_off_t(value)) \
|
||||
_curl_easy_setopt_err_curl_off_t(); \
|
||||
if (_curl_is_string_option(_curl_opt)) \
|
||||
if (!_curl_is_string(value)) \
|
||||
if(_curl_is_string_option(_curl_opt)) \
|
||||
if(!_curl_is_string(value)) \
|
||||
_curl_easy_setopt_err_string(); \
|
||||
if (_curl_is_write_cb_option(_curl_opt)) \
|
||||
if (!_curl_is_write_cb(value)) \
|
||||
if(_curl_is_write_cb_option(_curl_opt)) \
|
||||
if(!_curl_is_write_cb(value)) \
|
||||
_curl_easy_setopt_err_write_callback(); \
|
||||
if ((_curl_opt) == CURLOPT_READFUNCTION) \
|
||||
if (!_curl_is_read_cb(value)) \
|
||||
if((_curl_opt) == CURLOPT_READFUNCTION) \
|
||||
if(!_curl_is_read_cb(value)) \
|
||||
_curl_easy_setopt_err_read_cb(); \
|
||||
if ((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
|
||||
if (!_curl_is_ioctl_cb(value)) \
|
||||
if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
|
||||
if(!_curl_is_ioctl_cb(value)) \
|
||||
_curl_easy_setopt_err_ioctl_cb(); \
|
||||
if ((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
|
||||
if (!_curl_is_sockopt_cb(value)) \
|
||||
if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
|
||||
if(!_curl_is_sockopt_cb(value)) \
|
||||
_curl_easy_setopt_err_sockopt_cb(); \
|
||||
if ((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
|
||||
if (!_curl_is_opensocket_cb(value)) \
|
||||
if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
|
||||
if(!_curl_is_opensocket_cb(value)) \
|
||||
_curl_easy_setopt_err_opensocket_cb(); \
|
||||
if ((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
|
||||
if (!_curl_is_progress_cb(value)) \
|
||||
if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
|
||||
if(!_curl_is_progress_cb(value)) \
|
||||
_curl_easy_setopt_err_progress_cb(); \
|
||||
if ((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
|
||||
if (!_curl_is_debug_cb(value)) \
|
||||
if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
|
||||
if(!_curl_is_debug_cb(value)) \
|
||||
_curl_easy_setopt_err_debug_cb(); \
|
||||
if ((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
|
||||
if (!_curl_is_ssl_ctx_cb(value)) \
|
||||
if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
|
||||
if(!_curl_is_ssl_ctx_cb(value)) \
|
||||
_curl_easy_setopt_err_ssl_ctx_cb(); \
|
||||
if (_curl_is_conv_cb_option(_curl_opt)) \
|
||||
if (!_curl_is_conv_cb(value)) \
|
||||
if(_curl_is_conv_cb_option(_curl_opt)) \
|
||||
if(!_curl_is_conv_cb(value)) \
|
||||
_curl_easy_setopt_err_conv_cb(); \
|
||||
if ((_curl_opt) == CURLOPT_SEEKFUNCTION) \
|
||||
if (!_curl_is_seek_cb(value)) \
|
||||
if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
|
||||
if(!_curl_is_seek_cb(value)) \
|
||||
_curl_easy_setopt_err_seek_cb(); \
|
||||
if (_curl_is_cb_data_option(_curl_opt)) \
|
||||
if (!_curl_is_cb_data(value)) \
|
||||
if(_curl_is_cb_data_option(_curl_opt)) \
|
||||
if(!_curl_is_cb_data(value)) \
|
||||
_curl_easy_setopt_err_cb_data(); \
|
||||
if ((_curl_opt) == CURLOPT_ERRORBUFFER) \
|
||||
if (!_curl_is_error_buffer(value)) \
|
||||
if((_curl_opt) == CURLOPT_ERRORBUFFER) \
|
||||
if(!_curl_is_error_buffer(value)) \
|
||||
_curl_easy_setopt_err_error_buffer(); \
|
||||
if ((_curl_opt) == CURLOPT_STDERR) \
|
||||
if (!_curl_is_FILE(value)) \
|
||||
if((_curl_opt) == CURLOPT_STDERR) \
|
||||
if(!_curl_is_FILE(value)) \
|
||||
_curl_easy_setopt_err_FILE(); \
|
||||
if (_curl_is_postfields_option(_curl_opt)) \
|
||||
if (!_curl_is_postfields(value)) \
|
||||
if(_curl_is_postfields_option(_curl_opt)) \
|
||||
if(!_curl_is_postfields(value)) \
|
||||
_curl_easy_setopt_err_postfields(); \
|
||||
if ((_curl_opt) == CURLOPT_HTTPPOST) \
|
||||
if (!_curl_is_arr((value), struct curl_httppost)) \
|
||||
if((_curl_opt) == CURLOPT_HTTPPOST) \
|
||||
if(!_curl_is_arr((value), struct curl_httppost)) \
|
||||
_curl_easy_setopt_err_curl_httpost(); \
|
||||
if (_curl_is_slist_option(_curl_opt)) \
|
||||
if (!_curl_is_arr((value), struct curl_slist)) \
|
||||
if(_curl_is_slist_option(_curl_opt)) \
|
||||
if(!_curl_is_arr((value), struct curl_slist)) \
|
||||
_curl_easy_setopt_err_curl_slist(); \
|
||||
if ((_curl_opt) == CURLOPT_SHARE) \
|
||||
if (!_curl_is_ptr((value), CURLSH)) \
|
||||
if((_curl_opt) == CURLOPT_SHARE) \
|
||||
if(!_curl_is_ptr((value), CURLSH)) \
|
||||
_curl_easy_setopt_err_CURLSH(); \
|
||||
} \
|
||||
curl_easy_setopt(handle, _curl_opt, value); \
|
||||
|
@ -111,18 +111,18 @@ __extension__ ({ \
|
|||
#define curl_easy_getinfo(handle, info, arg) \
|
||||
__extension__ ({ \
|
||||
__typeof__ (info) _curl_info = info; \
|
||||
if (__builtin_constant_p(_curl_info)) { \
|
||||
if (_curl_is_string_info(_curl_info)) \
|
||||
if (!_curl_is_arr((arg), char *)) \
|
||||
if(__builtin_constant_p(_curl_info)) { \
|
||||
if(_curl_is_string_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), char *)) \
|
||||
_curl_easy_getinfo_err_string(); \
|
||||
if (_curl_is_long_info(_curl_info)) \
|
||||
if (!_curl_is_arr((arg), long)) \
|
||||
if(_curl_is_long_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), long)) \
|
||||
_curl_easy_getinfo_err_long(); \
|
||||
if (_curl_is_double_info(_curl_info)) \
|
||||
if (!_curl_is_arr((arg), double)) \
|
||||
if(_curl_is_double_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), double)) \
|
||||
_curl_easy_getinfo_err_double(); \
|
||||
if (_curl_is_slist_info(_curl_info)) \
|
||||
if (!_curl_is_arr((arg), struct curl_slist *)) \
|
||||
if(_curl_is_slist_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), struct curl_slist *)) \
|
||||
_curl_easy_getinfo_err_curl_slist(); \
|
||||
} \
|
||||
curl_easy_getinfo(handle, _curl_info, arg); \
|
||||
|
@ -141,15 +141,17 @@ __extension__ ({ \
|
|||
|
||||
/* To define a new warning, use _CURL_WARNING(identifier, "message") */
|
||||
#define _CURL_WARNING(id, message) \
|
||||
static void __attribute__((warning(message))) __attribute__((unused)) \
|
||||
__attribute__((noinline)) id(void) { __asm__(""); }
|
||||
static void __attribute__((__warning__(message))) \
|
||||
__attribute__((__unused__)) __attribute__((__noinline__)) \
|
||||
id(void) { __asm__(""); }
|
||||
|
||||
_CURL_WARNING(_curl_easy_setopt_err_long,
|
||||
"curl_easy_setopt expects a long argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
|
||||
"curl_easy_setopt expects a curl_off_t argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_string,
|
||||
"curl_easy_setopt expects a string (char* or char[]) argument for this option"
|
||||
"curl_easy_setopt expects a "
|
||||
"string (char* or char[]) argument for this option"
|
||||
)
|
||||
_CURL_WARNING(_curl_easy_setopt_err_write_callback,
|
||||
"curl_easy_setopt expects a curl_write_callback argument for this option")
|
||||
|
@ -160,7 +162,8 @@ _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
|
|||
_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
|
||||
"curl_easy_setopt expects a curl_sockopt_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
|
||||
"curl_easy_setopt expects a curl_opensocket_callback argument for this option"
|
||||
"curl_easy_setopt expects a "
|
||||
"curl_opensocket_callback argument for this option"
|
||||
)
|
||||
_CURL_WARNING(_curl_easy_setopt_err_progress_cb,
|
||||
"curl_easy_setopt expects a curl_progress_callback argument for this option")
|
||||
|
@ -173,9 +176,11 @@ _CURL_WARNING(_curl_easy_setopt_err_conv_cb,
|
|||
_CURL_WARNING(_curl_easy_setopt_err_seek_cb,
|
||||
"curl_easy_setopt expects a curl_seek_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_cb_data,
|
||||
"curl_easy_setopt expects a private data pointer as argument for this option")
|
||||
"curl_easy_setopt expects a "
|
||||
"private data pointer as argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_error_buffer,
|
||||
"curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE as argument for this option")
|
||||
"curl_easy_setopt expects a "
|
||||
"char buffer of CURL_ERROR_SIZE as argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_FILE,
|
||||
"curl_easy_setopt expects a FILE* argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_postfields,
|
||||
|
@ -224,7 +229,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
|
|||
(option) == CURLOPT_PROXYUSERNAME || \
|
||||
(option) == CURLOPT_PROXYPASSWORD || \
|
||||
(option) == CURLOPT_NOPROXY || \
|
||||
(option) == CURLOPT_ENCODING || \
|
||||
(option) == CURLOPT_ACCEPT_ENCODING || \
|
||||
(option) == CURLOPT_REFERER || \
|
||||
(option) == CURLOPT_USERAGENT || \
|
||||
(option) == CURLOPT_COOKIE || \
|
||||
|
@ -388,7 +393,8 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
|
|||
/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
|
||||
/* XXX: also check size of an char[] array? */
|
||||
#define _curl_is_error_buffer(expr) \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), char *) || \
|
||||
(_curl_is_NULL(expr) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), char *) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), char[]))
|
||||
|
||||
/* evaluates to true if expr is of type (const) void* or (const) FILE* */
|
||||
|
@ -481,7 +487,8 @@ typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
|
|||
typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,
|
||||
curlsocktype);
|
||||
|
||||
/* evaluates to true if expr is of type curl_opensocket_callback or "similar" */
|
||||
/* evaluates to true if expr is of type curl_opensocket_callback or
|
||||
"similar" */
|
||||
#define _curl_is_opensocket_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\
|
||||
|
@ -516,7 +523,11 @@ typedef int (_curl_progress_callback2)(const void *,
|
|||
_curl_callback_compatible((expr), _curl_debug_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback4))
|
||||
_curl_callback_compatible((expr), _curl_debug_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback6) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback7) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback8))
|
||||
typedef int (_curl_debug_callback1) (CURL *,
|
||||
curl_infotype, char *, size_t, void *);
|
||||
typedef int (_curl_debug_callback2) (CURL *,
|
||||
|
@ -525,6 +536,14 @@ typedef int (_curl_debug_callback3) (CURL *,
|
|||
curl_infotype, const char *, size_t, void *);
|
||||
typedef int (_curl_debug_callback4) (CURL *,
|
||||
curl_infotype, const char *, size_t, const void *);
|
||||
typedef int (_curl_debug_callback5) (CURL *,
|
||||
curl_infotype, unsigned char *, size_t, void *);
|
||||
typedef int (_curl_debug_callback6) (CURL *,
|
||||
curl_infotype, unsigned char *, size_t, const void *);
|
||||
typedef int (_curl_debug_callback7) (CURL *,
|
||||
curl_infotype, const unsigned char *, size_t, void *);
|
||||
typedef int (_curl_debug_callback8) (CURL *,
|
||||
curl_infotype, const unsigned char *, size_t, const void *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
|
||||
/* this is getting even messier... */
|
||||
|
@ -550,7 +569,8 @@ typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);
|
|||
typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
|
||||
typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
|
||||
typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
|
||||
typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, const void *);
|
||||
typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
|
||||
const void *);
|
||||
#else
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
|
||||
|
|
|
@ -1 +1 @@
|
|||
89c49d395ece44cf2d891cd5c2a84f819e229d30
|
||||
a62cf1a73b170a4fee840de349019fd33e9970f4
|
|
@ -1 +1 @@
|
|||
4dc0690a9f8419b4aba821eeb739d6beb4242cda
|
||||
e83a0838166d5ccccc914361fc7d98f2b6e12e1e
|
|
@ -1 +1 @@
|
|||
fca1b81187a22728c6c352f121ac03f8abf2ae75
|
||||
bfedd8e90d438c9fcf1c469fa7bb0ff2a59167af
|
|
@ -1 +1 @@
|
|||
68aaf2639b745d8479ad875745409f9cf65f4b93
|
||||
e3bc493ab52f7a8d3da445e15f43c0c775740192
|
|
@ -1 +1 @@
|
|||
0319233cc1a28ea568fdc4ced57f2d1cfe11e81f
|
||||
78e9ef9f9794da2d2098e733fd90ecad403ed735
|
|
@ -1 +1 @@
|
|||
54d8098e43887d3bb3a773542d869491d77d8e45
|
||||
e8d210cb8607af7aa98219fce89ea1e6c14f8fc2
|
|
@ -1 +1 @@
|
|||
2f84bee7e68f8b6766688634d6a35221cd006a66
|
||||
527a6e940f83b5d54b37b193af2081647cea4e90
|
|
@ -1 +1 @@
|
|||
67df2bca4c4bdf2c53f0ae219f55ad5efdd8dd48
|
||||
7fc417297c12c4199a31febebb0e9c53abb5f762
|
|
@ -1 +1 @@
|
|||
03f601480de32bbcc70313b8afda1bbf0194944c
|
||||
649d8a9d888a3368eeb0b63ac2832b9faebc3502
|
|
@ -1 +1 @@
|
|||
08568c709e115ac77d96705d4b5cb47c1f494514
|
||||
ee2bf5ad51a3a637deeee985082760f9b843bbe7
|
|
@ -1 +1 @@
|
|||
8ae8c1465f02581e5f557c549ccbd31f77ac392e
|
||||
3e4d0de19a158758f19a5b65db8b7f14c314771a
|
|
@ -1 +1 @@
|
|||
829ad7281999aff0543b4aca6574779ef6c48644
|
||||
f14376ce9ace14d386cb5a3b2178454bad786fb6
|
|
@ -1 +1 @@
|
|||
813164629a16c93ebc3ff20a39072f2cae2aee3a
|
||||
7a291da70df8112d8be685fd326a4171a9eff66c
|
|
@ -1 +1 @@
|
|||
936f891620a0dbe86ae34809f3472d57497a6098
|
||||
f2063d0cb885da76b53ff7278eb34635c460d09e
|
|
@ -1 +1 @@
|
|||
e9908a726968236013dd4a7488211f936d1eb406
|
||||
22740a73cdc408d9a8557d0f462f0a49bd29e26e
|
|
@ -697,6 +697,14 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h)
|
|||
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
|
||||
}
|
||||
|
||||
void CCEGLView::setScissorInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glScissor((GLint)(x * m_fScaleX * m_fFrameZoomFactor + m_obViewPortRect.origin.x * m_fFrameZoomFactor),
|
||||
(GLint)(y * m_fScaleY * m_fFrameZoomFactor + m_obViewPortRect.origin.y * m_fFrameZoomFactor),
|
||||
(GLsizei)(w * m_fScaleX * m_fFrameZoomFactor),
|
||||
(GLsizei)(h * m_fScaleY * m_fFrameZoomFactor));
|
||||
}
|
||||
|
||||
CCEGLView* CCEGLView::sharedOpenGLView()
|
||||
{
|
||||
static CCEGLView* s_pEglView = NULL;
|
||||
|
|
|
@ -73,6 +73,8 @@ public:
|
|||
void setAccelerometerKeyHook( LPFN_ACCELEROMETER_KEYHOOK lpfnAccelerometerKeyHook );
|
||||
|
||||
virtual void setViewPortInPoints(float x , float y , float w , float h);
|
||||
virtual void setScissorInPoints(float x , float y , float w , float h);
|
||||
|
||||
// static function
|
||||
/**
|
||||
@brief get the shared main open gl window
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
<link>
|
||||
<name>tilemap_parallax_nodes</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/tileMap_parallax_nodes</locationURI>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/tilemap_parallax_nodes</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>touch_dispatcher</name>
|
||||
|
|
|
@ -29,7 +29,7 @@ THE SOFTWARE.
|
|||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_BEGIN;
|
||||
NS_CC_BEGIN
|
||||
|
||||
static CCNotificationCenter *s_sharedNotifCenter = NULL;
|
||||
|
||||
|
@ -214,4 +214,4 @@ CCObject *CCNotificationObserver::getObject()
|
|||
return m_object;
|
||||
}
|
||||
|
||||
NS_CC_END;
|
||||
NS_CC_END
|
||||
|
|
|
@ -28,38 +28,71 @@ THE SOFTWARE.
|
|||
#include "cocoa/CCObject.h"
|
||||
#include "cocoa/CCArray.h"
|
||||
|
||||
NS_CC_BEGIN;
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL CCNotificationCenter : public CCObject
|
||||
{
|
||||
public:
|
||||
/** CCNotificationCenter constructor */
|
||||
CCNotificationCenter();
|
||||
|
||||
/** CCNotificationCenter destructor */
|
||||
~CCNotificationCenter();
|
||||
|
||||
/** Gets the single instance of CCNotificationCenter. */
|
||||
static CCNotificationCenter *sharedNotificationCenter(void);
|
||||
|
||||
/** Destroys the single instance of CCNotificationCenter. */
|
||||
static void purgeNotificationCenter(void);
|
||||
|
||||
/** @brief Adds an observer for the specified target.
|
||||
* @param target The target which wants to observe notification events.
|
||||
* @param selector The callback function which will be invoked when the specified notification event was posted.
|
||||
* @param name The name of this notification.
|
||||
* @param obj The extra parameter which will be passed to the callback function.
|
||||
*/
|
||||
void addObserver(CCObject *target,
|
||||
SEL_CallFuncO selector,
|
||||
const char *name,
|
||||
CCObject *obj);
|
||||
|
||||
|
||||
/** @brief Removes the observer by the specified target and name.
|
||||
* @param target The target of this notification.
|
||||
* @param name The name of this notification.
|
||||
*/
|
||||
void removeObserver(CCObject *target,const char *name);
|
||||
|
||||
/** @brief Registers one hander for script binding.
|
||||
* @note Only supports Lua Binding now.
|
||||
* @param handler The lua handler.
|
||||
*/
|
||||
void registerScriptObserver(int handler);
|
||||
|
||||
/** Unregisters script observer */
|
||||
void unregisterScriptObserver(void);
|
||||
|
||||
/** @brief Posts one notification event by name.
|
||||
* @param name The name of this notification.
|
||||
*/
|
||||
void postNotification(const char *name);
|
||||
|
||||
/** @brief Posts one notification event by name.
|
||||
* @param name The name of this notification.
|
||||
* @param object The extra parameter.
|
||||
*/
|
||||
void postNotification(const char *name, CCObject *object);
|
||||
|
||||
/** @brief Gets script handler.
|
||||
* @note Only supports Lua Binding now.
|
||||
* @return The script handle.
|
||||
*/
|
||||
inline int getScriptHandler() { return m_scriptHandler; };
|
||||
private:
|
||||
//
|
||||
// internal functions
|
||||
//
|
||||
|
||||
// Check whether the observer exists by the specified target and name.
|
||||
bool observerExisted(CCObject *target,const char *name);
|
||||
|
||||
//
|
||||
// variables
|
||||
//
|
||||
CCArray *m_observers;
|
||||
|
@ -69,12 +102,21 @@ private:
|
|||
class CC_DLL CCNotificationObserver : public CCObject
|
||||
{
|
||||
public:
|
||||
/** @brief CCNotificationObserver constructor
|
||||
* @param target The target which wants to observer notification events.
|
||||
* @param selector The callback function which will be invoked when the specified notification event was posted.
|
||||
* @param name The name of this notification.
|
||||
* @param obj The extra parameter which will be passed to the callback function.
|
||||
*/
|
||||
CCNotificationObserver(CCObject *target,
|
||||
SEL_CallFuncO selector,
|
||||
const char *name,
|
||||
CCObject *obj);
|
||||
|
||||
/** CCNotificationObserver destructor function */
|
||||
~CCNotificationObserver();
|
||||
|
||||
/** Invokes the callback function of this observer */
|
||||
void performSelector(CCObject *obj);
|
||||
private:
|
||||
CC_PROPERTY_READONLY(CCObject *, m_target, Target);
|
||||
|
@ -83,6 +125,6 @@ private:
|
|||
CC_PROPERTY_READONLY(CCObject *, m_object, Object);
|
||||
};
|
||||
|
||||
NS_CC_END;
|
||||
NS_CC_END
|
||||
|
||||
#endif//__CCNOTIFICATIONCENTER_H__
|
|
@ -398,9 +398,9 @@ CCHttpClient* CCHttpClient::getInstance()
|
|||
|
||||
void CCHttpClient::destroyInstance()
|
||||
{
|
||||
CCDirector::sharedDirector()->getScheduler()->unscheduleSelector(schedule_selector(CCHttpClient::dispatchResponseCallbacks),
|
||||
CCHttpClient::getInstance());
|
||||
CC_SAFE_RELEASE_NULL(s_pHttpClient);
|
||||
CC_ASSERT(s_pHttpClient);
|
||||
CCDirector::sharedDirector()->getScheduler()->unscheduleSelector(schedule_selector(CCHttpClient::dispatchResponseCallbacks), s_pHttpClient);
|
||||
s_pHttpClient->release();
|
||||
}
|
||||
|
||||
CCHttpClient::CCHttpClient()
|
||||
|
@ -420,7 +420,7 @@ CCHttpClient::~CCHttpClient()
|
|||
sem_post(s_pSem);
|
||||
}
|
||||
|
||||
CCDirector::sharedDirector()->getScheduler()->unscheduleSelector(schedule_selector(CCHttpClient::dispatchResponseCallbacks), this);
|
||||
s_pHttpClient = NULL;
|
||||
}
|
||||
|
||||
//Lazy create semaphore & mutex & thread
|
||||
|
|
|
@ -14,30 +14,40 @@ AppDelegate::~AppDelegate()
|
|||
|
||||
bool AppDelegate::applicationDidFinishLaunching() {
|
||||
// initialize director
|
||||
CCDirector *pDirector = CCDirector::sharedDirector();
|
||||
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
|
||||
|
||||
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
|
||||
//pDirector->setProjection(kCCDirectorProjection2D);
|
||||
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
|
||||
|
||||
if (screenSize.height > 768)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd");
|
||||
pDirector->setContentScaleFactor(1536.0f/kDesignResolutionSize_height);
|
||||
pDirector->setOpenGLView(pEGLView);
|
||||
|
||||
// Set the design resolution
|
||||
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
|
||||
|
||||
CCSize frameSize = pEGLView->getFrameSize();
|
||||
|
||||
// In this demo, we select resource according to the frame's height.
|
||||
// If the resource size is different from design resolution size, you need to set contentScaleFactor.
|
||||
// We use the ratio of resource's height to the height of design resolution,
|
||||
// this can make sure that the resource's height could fit for the height of design resolution.
|
||||
|
||||
// if the frame's height is larger than the height of medium resource size, select large resource.
|
||||
if (frameSize.height > mediumResource.size.height)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory(largeResource.directory);
|
||||
pDirector->setContentScaleFactor(largeResource.size.height/designResolutionSize.height);
|
||||
}
|
||||
else if (screenSize.height > 320)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad");
|
||||
pDirector->setContentScaleFactor(768.0f/kDesignResolutionSize_height);
|
||||
// if the frame's height is larger than the height of small resource size, select medium resource.
|
||||
else if (frameSize.height > smallResource.size.height)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory(mediumResource.directory);
|
||||
pDirector->setContentScaleFactor(mediumResource.size.height/designResolutionSize.height);
|
||||
}
|
||||
// if the frame's height is smaller than the height of medium resource size, select small resource.
|
||||
else
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("iphone");
|
||||
pDirector->setContentScaleFactor(320.0f/kDesignResolutionSize_height);
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory(smallResource.directory);
|
||||
pDirector->setContentScaleFactor(smallResource.size.height/designResolutionSize.height);
|
||||
}
|
||||
|
||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(kDesignResolutionSize_width, kDesignResolutionSize_height, kResolutionNoBorder);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayStats(true);
|
||||
|
||||
|
|
|
@ -1,30 +1,56 @@
|
|||
#ifndef __APPMACROS_H__
|
||||
#define __APPMACROS_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#define kDesignResolution_480x320 0
|
||||
#define kDesignResolution_1024x768 1
|
||||
#define kDesignResolution_2048x1536 2
|
||||
/* For demonstrating using one design resolution to match different resources,
|
||||
or one resource to match different design resolutions.
|
||||
|
||||
#define kTargetDesignResolutionSize kDesignResolution_2048x1536
|
||||
[Situation 1] Using one design resolution to match different resources.
|
||||
Please look into Appdelegate::applicationDidFinishLaunching.
|
||||
We check current device frame size to decide which resource need to be selected.
|
||||
So if you want to test this situation which said in title '[Situation 1]',
|
||||
you should change ios simulator to different device(e.g. iphone, iphone-retina3.5, iphone-retina4.0, ipad, ipad-retina),
|
||||
or change the window size in "proj.XXX/main.cpp" by "CCEGLView::setFrameSize" if you are using win32 or linux plaform
|
||||
and modify "proj.mac/AppController.mm" by changing the window rectangle.
|
||||
|
||||
#if (kTargetDesignResolutionSize == kDesignResolution_480x320)
|
||||
#define kDesignResolutionSize_width 480.0f
|
||||
#define kDesignResolutionSize_height 320.0f
|
||||
[Situation 2] Using one resource to match different design resolutions.
|
||||
The coordinates in your codes is based on your current design resolution rather than resource size.
|
||||
Therefore, your design resolution could be very large and your resource size could be small.
|
||||
To test this, just define the marco 'TARGET_DESIGN_RESOLUTION_SIZE' to 'DESIGN_RESOLUTION_2048X1536'
|
||||
and open iphone simulator or create a window of 480x320 size.
|
||||
|
||||
[Note] Normally, developer just need to define one design resolution(e.g. 960x640) with one or more resources.
|
||||
*/
|
||||
|
||||
#elif (kTargetDesignResolutionSize == kDesignResolution_1024x768)
|
||||
#define kDesignResolutionSize_width 1024.0f
|
||||
#define kDesignResolutionSize_height 768.0f
|
||||
#define DESIGN_RESOLUTION_480X320 0
|
||||
#define DESIGN_RESOLUTION_1024X768 1
|
||||
#define DESIGN_RESOLUTION_2048X1536 2
|
||||
|
||||
#elif (kTargetDesignResolutionSize == kDesignResolution_2048x1536)
|
||||
#define kDesignResolutionSize_width 2048.0f
|
||||
#define kDesignResolutionSize_height 1536.0f
|
||||
/* If you want to switch design resolution, change next line */
|
||||
#define TARGET_DESIGN_RESOLUTION_SIZE DESIGN_RESOLUTION_2048X1536
|
||||
|
||||
typedef struct tagResource
|
||||
{
|
||||
cocos2d::CCSize size;
|
||||
char directory[100];
|
||||
}Resource;
|
||||
|
||||
static Resource smallResource = { cocos2d::CCSizeMake(480, 320), "iphone" };
|
||||
static Resource mediumResource = { cocos2d::CCSizeMake(1024, 768), "ipad" };
|
||||
static Resource largeResource = { cocos2d::CCSizeMake(2048, 1536), "ipadhd" };
|
||||
|
||||
#if (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_480X320)
|
||||
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(480, 320);
|
||||
#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_1024X768)
|
||||
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(1024, 768);
|
||||
#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_2048X1536)
|
||||
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(2048, 1536);
|
||||
#else
|
||||
#error unknown target design resolution!
|
||||
#endif
|
||||
|
||||
#define kTitleFontSize (kDesignResolutionSize_width / 480.0f * 24)
|
||||
// The font size 24 is designed for small resolution, so we should change it to fit for current design resolution
|
||||
#define TITLE_FONT_SIZE (cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width / smallResource.size.width * 24)
|
||||
|
||||
#endif /* __APPMACROS_H__ */
|
||||
|
|
|
@ -56,7 +56,7 @@ bool HelloWorld::init()
|
|||
// add a label shows "Hello World"
|
||||
// create and initialize a label
|
||||
|
||||
CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", kTitleFontSize);
|
||||
CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", TITLE_FONT_SIZE);
|
||||
|
||||
// position the label on the center of the screen
|
||||
pLabel->setPosition(ccp(origin.x + visibleSize.width/2,
|
||||
|
|
|
@ -190,6 +190,10 @@
|
|||
RelativePath="..\Classes\AppDelegate.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Classes\AppMacros.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Classes\HelloWorldScene.cpp"
|
||||
>
|
||||
|
|
|
@ -28,9 +28,6 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
|
||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320, kResolutionNoBorder);
|
||||
|
||||
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
|
||||
// pDirector->enableRetinaDisplay(true);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayStats(true);
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
// initialize director
|
||||
CCDirector *pDirector = CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
|
||||
|
||||
// Set the design resolution
|
||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(320, 480, kResolutionShowAll);
|
||||
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
|
||||
// pDirector->enableRetinaDisplay(true);
|
||||
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayStats(true);
|
||||
|
||||
|
|
|
@ -91,7 +91,8 @@ Classes/UserDefaultTest/UserDefaultTest.cpp \
|
|||
Classes/ZwoptexTest/ZwoptexTest.cpp \
|
||||
Classes/controller.cpp \
|
||||
Classes/testBasic.cpp \
|
||||
Classes/AppDelegate.cpp
|
||||
Classes/AppDelegate.cpp \
|
||||
Classes/VisibleRect.cpp
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
|
||||
|
|
|
@ -34,14 +34,13 @@ void AccelerometerTest::onEnter()
|
|||
|
||||
setAccelerometerEnabled(true);
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y-50) );
|
||||
|
||||
m_pBall = CCSprite::create("Images/ball.png");
|
||||
m_pBall->setPosition(ccp(s.width / 2, s.height / 2));
|
||||
m_pBall->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y));
|
||||
addChild(m_pBall);
|
||||
|
||||
m_pBall->retain();
|
||||
|
@ -59,7 +58,6 @@ void AccelerometerTest::didAccelerate(CCAcceleration* pAccelerationValue)
|
|||
// m_fLastTime = fNow;
|
||||
|
||||
CCDirector* pDir = CCDirector::sharedDirector();
|
||||
CCSize winSize = pDir->getWinSize();
|
||||
|
||||
/*FIXME: Testing on the Nexus S sometimes m_pBall is NULL */
|
||||
if ( m_pBall == NULL ) {
|
||||
|
@ -75,8 +73,8 @@ void AccelerometerTest::didAccelerate(CCAcceleration* pAccelerationValue)
|
|||
ptTemp.y -= pAccelerationValue->y * 9.81f;
|
||||
|
||||
CCPoint ptNext = pDir->convertToGL(ptTemp);
|
||||
FIX_POS(ptNext.x, (ballSize.width / 2.0), (winSize.width - ballSize.width / 2.0));
|
||||
FIX_POS(ptNext.y, (ballSize.height / 2.0), (winSize.height - ballSize.height / 2.0));
|
||||
FIX_POS(ptNext.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0));
|
||||
FIX_POS(ptNext.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0));
|
||||
m_pBall->setPosition(ptNext);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,11 +86,9 @@ void ActionManagerTest::onEnter()
|
|||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(CCPointMake(s.width/2, s.height-50));
|
||||
label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ActionManagerTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ActionManagerTest::restartCallback) );
|
||||
|
@ -99,9 +97,9 @@ void ActionManagerTest::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(CCPointMake(s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(CCPointMake(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
@ -142,7 +140,7 @@ void CrashTest::onEnter()
|
|||
ActionManagerTest::onEnter();
|
||||
|
||||
CCSprite* child = CCSprite::create(s_pPathGrossini);
|
||||
child->setPosition( CCPointMake(200,200) );
|
||||
child->setPosition( VisibleRect::center() );
|
||||
addChild(child, 1);
|
||||
|
||||
//Sum of all action's duration is 1.5 second.
|
||||
|
@ -184,10 +182,10 @@ void LogicTest::onEnter()
|
|||
|
||||
CCSprite* grossini = CCSprite::create(s_pPathGrossini);
|
||||
addChild(grossini, 0, 2);
|
||||
grossini->setPosition(CCPointMake(200,200));
|
||||
grossini->setPosition(VisibleRect::center());
|
||||
|
||||
grossini->runAction( CCSequence::create(
|
||||
CCMoveBy::create(1, CCPointMake(150,0)),
|
||||
CCMoveBy::create(1, ccp(150,0)),
|
||||
CCCallFuncN::create(this, callfuncN_selector(LogicTest::bugMe)),
|
||||
NULL)
|
||||
);
|
||||
|
@ -218,11 +216,10 @@ void PauseTest::onEnter()
|
|||
//
|
||||
ActionManagerTest::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* l = CCLabelTTF::create("After 5 seconds grossini should move", "Thonburi", 16);
|
||||
addChild(l);
|
||||
l->setPosition( CCPointMake(s.width/2, 245) );
|
||||
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y-75) );
|
||||
|
||||
|
||||
//
|
||||
|
@ -230,9 +227,9 @@ void PauseTest::onEnter()
|
|||
//
|
||||
CCSprite* grossini = CCSprite::create(s_pPathGrossini);
|
||||
addChild(grossini, 0, kTagGrossini);
|
||||
grossini->setPosition( CCPointMake(200,200) );
|
||||
grossini->setPosition(VisibleRect::center() );
|
||||
|
||||
CCAction* action = CCMoveBy::create(1, CCPointMake(150,0));
|
||||
CCAction* action = CCMoveBy::create(1, ccp(150,0));
|
||||
|
||||
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||
pDirector->getActionManager()->addAction(action, grossini, true);
|
||||
|
@ -262,19 +259,17 @@ void RemoveTest::onEnter()
|
|||
{
|
||||
ActionManagerTest::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* l = CCLabelTTF::create("Should not crash", "Thonburi", 16);
|
||||
addChild(l);
|
||||
l->setPosition( CCPointMake(s.width/2, 245) );
|
||||
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 75) );
|
||||
|
||||
CCMoveBy* pMove = CCMoveBy::create(2, CCPointMake(200, 0));
|
||||
CCMoveBy* pMove = CCMoveBy::create(2, ccp(200, 0));
|
||||
CCCallFunc* pCallback = CCCallFunc::create(this, callfunc_selector(RemoveTest::stopAction));
|
||||
CCActionInterval* pSequence = (CCActionInterval*) CCSequence::create(pMove, pCallback, NULL);
|
||||
pSequence->setTag(kTagSequence);
|
||||
|
||||
CCSprite* pChild = CCSprite::create(s_pPathGrossini);
|
||||
pChild->setPosition(CCPointMake(200, 200));
|
||||
pChild->setPosition( VisibleRect::center() );
|
||||
|
||||
addChild(pChild, 1, kTagGrossini);
|
||||
pChild->runAction(pSequence);
|
||||
|
@ -305,15 +300,13 @@ void ResumeTest::onEnter()
|
|||
{
|
||||
ActionManagerTest::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* l = CCLabelTTF::create("Grossini only rotate/scale in 3 seconds", "Thonburi", 16);
|
||||
addChild(l);
|
||||
l->setPosition( CCPointMake(s.width/2, 245));
|
||||
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 75));
|
||||
|
||||
CCSprite* pGrossini = CCSprite::create(s_pPathGrossini);
|
||||
addChild(pGrossini, 0, kTagGrossini);
|
||||
pGrossini->setPosition(CCPointMake(s.width / 2, s.height / 2));
|
||||
pGrossini->setPosition(VisibleRect::center());
|
||||
|
||||
pGrossini->runAction(CCScaleBy::create(2, 2));
|
||||
|
||||
|
|
|
@ -21,9 +21,7 @@ void SpriteEase::onEnter()
|
|||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130,0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseIn::create((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
|
||||
|
@ -74,10 +72,8 @@ std::string SpriteEase::title()
|
|||
void SpriteEaseInOut::onEnter()
|
||||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130,0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
|
||||
// id move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_inout1 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.65f);
|
||||
|
@ -116,9 +112,7 @@ void SpriteEaseExponential::onEnter()
|
|||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130,0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseExponentialIn::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
|
@ -153,10 +147,8 @@ std::string SpriteEaseExponential::title()
|
|||
void SpriteEaseExponentialInOut::onEnter()
|
||||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease = CCEaseExponentialInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
|
@ -188,10 +180,8 @@ std::string SpriteEaseExponentialInOut::title()
|
|||
void SpriteEaseSine::onEnter()
|
||||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseSineIn::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
|
@ -227,10 +217,8 @@ std::string SpriteEaseSine::title()
|
|||
void SpriteEaseSineInOut::onEnter()
|
||||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130,0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease = CCEaseSineInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
|
@ -262,9 +250,7 @@ void SpriteEaseElastic::onEnter()
|
|||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseElasticIn::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
|
@ -300,9 +286,7 @@ void SpriteEaseElasticInOut::onEnter()
|
|||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
|
||||
CCActionInterval* move_ease_inout1 = CCEaseElasticInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.3f);
|
||||
CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse();
|
||||
|
@ -341,9 +325,7 @@ void SpriteEaseBounce::onEnter()
|
|||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseBounceIn::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
|
@ -379,10 +361,8 @@ std::string SpriteEaseBounce::title()
|
|||
void SpriteEaseBounceInOut::onEnter()
|
||||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease = CCEaseBounceInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
|
@ -415,9 +395,7 @@ void SpriteEaseBack::onEnter()
|
|||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseBackIn::create((CCActionInterval*)(move->copy()->autorelease()));
|
||||
|
@ -453,9 +431,7 @@ void SpriteEaseBackInOut::onEnter()
|
|||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease = CCEaseBackInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
|
@ -491,7 +467,7 @@ void SpeedTest::onEnter()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// rotate and jump
|
||||
CCActionInterval *jump1 = CCJumpBy::create(4, CCPointMake(-s.width+80, 0), 100, 4);
|
||||
CCActionInterval *jump1 = CCJumpBy::create(4, ccp(-s.width+80, 0), 100, 4);
|
||||
CCActionInterval *jump2 = jump1->reverse();
|
||||
CCActionInterval *rot1 = CCRotateBy::create(4, 360*2);
|
||||
CCActionInterval *rot2 = rot1->reverse();
|
||||
|
@ -617,10 +593,8 @@ EaseSpriteDemo::~EaseSpriteDemo(void)
|
|||
|
||||
void EaseSpriteDemo::positionForTwo()
|
||||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
m_grossini->setPosition(CCPointMake(60, s.height*1/5));
|
||||
m_tamara->setPosition(CCPointMake( 60, s.height*4/5));
|
||||
m_grossini->setPosition(ccp(VisibleRect::left().x+60, VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height*1/5));
|
||||
m_tamara->setPosition(ccp( VisibleRect::left().x+60, VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height*4/5));
|
||||
m_kathia->setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -643,15 +617,13 @@ void EaseSpriteDemo::onEnter()
|
|||
addChild( m_kathia, 2);
|
||||
addChild( m_tamara, 1);
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
m_grossini->setPosition(CCPointMake(60, s.height*1/5));
|
||||
m_kathia->setPosition(CCPointMake(60, s.height*2.5f/5));
|
||||
m_tamara->setPosition(CCPointMake(60, s.height*4/5));
|
||||
m_grossini->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*1/5));
|
||||
m_kathia->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2.5f/5));
|
||||
m_tamara->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*4/5));
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label);
|
||||
label->setPosition(CCPointMake(s.width/2, s.height-50));
|
||||
label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(EaseSpriteDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(EaseSpriteDemo::restartCallback) );
|
||||
|
@ -660,9 +632,9 @@ void EaseSpriteDemo::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(CCPointMake( s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(CCPointMake( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
|
|
@ -96,14 +96,14 @@ void SpriteDemo::onEnter()
|
|||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 18);
|
||||
addChild(label, 1);
|
||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 22);
|
||||
addChild(l, 1);
|
||||
l->setPosition( CCPointMake(s.width/2, s.height-80) );
|
||||
l->setPosition( ccp(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(SpriteDemo::backCallback) );
|
||||
|
@ -112,9 +112,9 @@ void SpriteDemo::onEnter()
|
|||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(CCPointMake( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(CCPointMake( s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(CCPointMake( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
|
||||
CCLayerColor *background = CCLayerColor::create(ccc4(255,0,0,255));
|
||||
|
@ -163,7 +163,7 @@ void SpriteProgressToRadial::onEnter()
|
|||
CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
|
||||
left->setType( kCCProgressTimerTypeRadial );
|
||||
addChild(left);
|
||||
left->setPosition(CCPointMake(100, s.height/2));
|
||||
left->setPosition(ccp(100, s.height/2));
|
||||
left->runAction( CCRepeatForever::create(to1));
|
||||
|
||||
CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathBlock));
|
||||
|
@ -171,7 +171,7 @@ void SpriteProgressToRadial::onEnter()
|
|||
// Makes the ridial CCW
|
||||
right->setReverseProgress(true);
|
||||
addChild(right);
|
||||
right->setPosition(CCPointMake(s.width-100, s.height/2));
|
||||
right->setPosition(ccp(s.width-100, s.height/2));
|
||||
right->runAction( CCRepeatForever::create(to2));
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ void SpriteProgressToHorizontal::onEnter()
|
|||
// Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
|
||||
left->setBarChangeRate(ccp(1, 0));
|
||||
addChild(left);
|
||||
left->setPosition(CCPointMake(100, s.height/2));
|
||||
left->setPosition(ccp(100, s.height/2));
|
||||
left->runAction( CCRepeatForever::create(to1));
|
||||
|
||||
CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
|
||||
|
@ -212,7 +212,7 @@ void SpriteProgressToHorizontal::onEnter()
|
|||
// Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
|
||||
right->setBarChangeRate(ccp(1, 0));
|
||||
addChild(right);
|
||||
right->setPosition(CCPointMake(s.width-100, s.height/2));
|
||||
right->setPosition(ccp(s.width-100, s.height/2));
|
||||
right->runAction( CCRepeatForever::create(to2));
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ void SpriteProgressToVertical::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left->setBarChangeRate(ccp(0, 1));
|
||||
addChild(left);
|
||||
left->setPosition(CCPointMake(100, s.height/2));
|
||||
left->setPosition(ccp(100, s.height/2));
|
||||
left->runAction( CCRepeatForever::create(to1));
|
||||
|
||||
CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
|
||||
|
@ -253,7 +253,7 @@ void SpriteProgressToVertical::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right->setBarChangeRate(ccp(0, 1));
|
||||
addChild(right);
|
||||
right->setPosition(CCPointMake(s.width-100, s.height/2));
|
||||
right->setPosition(ccp(s.width-100, s.height/2));
|
||||
right->runAction( CCRepeatForever::create(to2));
|
||||
}
|
||||
|
||||
|
|
|
@ -164,27 +164,23 @@ void ActionsDemo::onEnter()
|
|||
addChild(m_tamara, 2);
|
||||
addChild(m_kathia, 3);
|
||||
|
||||
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||
CCPoint visibleOrigin = pDirector->getVisibleOrigin();
|
||||
CCSize visibleSize = pDirector->getVisibleSize();
|
||||
|
||||
m_grossini->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/3));
|
||||
m_tamara->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+2*visibleSize.height/3));
|
||||
m_kathia->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||
m_grossini->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/3));
|
||||
m_tamara->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2/3));
|
||||
m_kathia->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/2));
|
||||
|
||||
// add title and subtitle
|
||||
std::string str = title();
|
||||
const char * pTitle = str.c_str();
|
||||
CCLabelTTF* label = CCLabelTTF::create(pTitle, "Arial", 18);
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height - 30) );
|
||||
label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 22);
|
||||
addChild(l, 1);
|
||||
l->setPosition( ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height - 60) );
|
||||
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
}
|
||||
|
||||
// add menu
|
||||
|
@ -195,9 +191,9 @@ void ActionsDemo::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(visibleOrigin.x+visibleSize.width/2 - item2->getContentSize().width*2, visibleOrigin.y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(visibleOrigin.x+visibleSize.width/2 + item2->getContentSize().width*2, visibleOrigin.y+item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
@ -249,19 +245,19 @@ void ActionsDemo::centerSprites(unsigned int numberOfSprites)
|
|||
{
|
||||
m_tamara->setVisible(false);
|
||||
m_kathia->setVisible(false);
|
||||
m_grossini->setPosition(CCPointMake(s.width/2, s.height/2));
|
||||
m_grossini->setPosition(ccp(s.width/2, s.height/2));
|
||||
}
|
||||
else if( numberOfSprites == 2 )
|
||||
{
|
||||
m_kathia->setPosition( CCPointMake(s.width/3, s.height/2));
|
||||
m_tamara->setPosition( CCPointMake(2*s.width/3, s.height/2));
|
||||
m_kathia->setPosition( ccp(s.width/3, s.height/2));
|
||||
m_tamara->setPosition( ccp(2*s.width/3, s.height/2));
|
||||
m_grossini->setVisible(false);
|
||||
}
|
||||
else if( numberOfSprites == 3 )
|
||||
{
|
||||
m_grossini->setPosition( CCPointMake(s.width/2, s.height/2));
|
||||
m_tamara->setPosition( CCPointMake(s.width/4, s.height/2));
|
||||
m_kathia->setPosition( CCPointMake(3 * s.width/4, s.height/2));
|
||||
m_grossini->setPosition( ccp(s.width/2, s.height/2));
|
||||
m_tamara->setPosition( ccp(s.width/4, s.height/2));
|
||||
m_kathia->setPosition( ccp(3 * s.width/4, s.height/2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,19 +269,19 @@ void ActionsDemo::alignSpritesLeft(unsigned int numberOfSprites)
|
|||
{
|
||||
m_tamara->setVisible(false);
|
||||
m_kathia->setVisible(false);
|
||||
m_grossini->setPosition(CCPointMake(60, s.height/2));
|
||||
m_grossini->setPosition(ccp(60, s.height/2));
|
||||
}
|
||||
else if( numberOfSprites == 2 )
|
||||
{
|
||||
m_kathia->setPosition( CCPointMake(60, s.height/3));
|
||||
m_tamara->setPosition( CCPointMake(60, 2*s.height/3));
|
||||
m_kathia->setPosition( ccp(60, s.height/3));
|
||||
m_tamara->setPosition( ccp(60, 2*s.height/3));
|
||||
m_grossini->setVisible( false );
|
||||
}
|
||||
else if( numberOfSprites == 3 )
|
||||
{
|
||||
m_grossini->setPosition( CCPointMake(60, s.height/2));
|
||||
m_tamara->setPosition( CCPointMake(60, 2*s.height/3));
|
||||
m_kathia->setPosition( CCPointMake(60, s.height/3));
|
||||
m_grossini->setPosition( ccp(60, s.height/2));
|
||||
m_tamara->setPosition( ccp(60, 2*s.height/3));
|
||||
m_kathia->setPosition( ccp(60, s.height/3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,14 +298,14 @@ void ActionManual::onEnter()
|
|||
|
||||
m_tamara->setScaleX( 2.5f);
|
||||
m_tamara->setScaleY( -1.0f);
|
||||
m_tamara->setPosition( CCPointMake(100,70) );
|
||||
m_tamara->setPosition( ccp(100,70) );
|
||||
m_tamara->setOpacity( 128);
|
||||
|
||||
m_grossini->setRotation( 120);
|
||||
m_grossini->setPosition( CCPointMake(s.width/2, s.height/2));
|
||||
m_grossini->setPosition( ccp(s.width/2, s.height/2));
|
||||
m_grossini->setColor( ccc3( 255,0,0));
|
||||
|
||||
m_kathia->setPosition( CCPointMake(s.width-100, s.height/2));
|
||||
m_kathia->setPosition( ccp(s.width-100, s.height/2));
|
||||
m_kathia->setColor( ccBLUE);
|
||||
}
|
||||
|
||||
|
@ -331,13 +327,13 @@ void ActionMove::onEnter()
|
|||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCActionInterval* actionTo = CCMoveTo::create(2, CCPointMake(s.width-40, s.height-40));
|
||||
CCActionInterval* actionBy = CCMoveBy::create(2, CCPointMake(80,80));
|
||||
CCActionInterval* actionTo = CCMoveTo::create(2, ccp(s.width-40, s.height-40));
|
||||
CCActionInterval* actionBy = CCMoveBy::create(2, ccp(80,80));
|
||||
CCActionInterval* actionByBack = actionBy->reverse();
|
||||
|
||||
m_tamara->runAction( actionTo);
|
||||
m_grossini->runAction( CCSequence::create(actionBy, actionByBack, NULL));
|
||||
m_kathia->runAction(CCMoveTo::create(1, CCPointMake(40,40)));
|
||||
m_kathia->runAction(CCMoveTo::create(1, ccp(40,40)));
|
||||
}
|
||||
|
||||
std::string ActionMove::subtitle()
|
||||
|
@ -484,9 +480,9 @@ void ActionJump::onEnter()
|
|||
|
||||
centerSprites(3);
|
||||
|
||||
CCActionInterval* actionTo = CCJumpTo::create(2, CCPointMake(300,300), 50, 4);
|
||||
CCActionInterval* actionBy = CCJumpBy::create(2, CCPointMake(300,0), 50, 4);
|
||||
CCActionInterval* actionUp = CCJumpBy::create(2, CCPointMake(0,0), 80, 4);
|
||||
CCActionInterval* actionTo = CCJumpTo::create(2, ccp(300,300), 50, 4);
|
||||
CCActionInterval* actionBy = CCJumpBy::create(2, ccp(300,0), 50, 4);
|
||||
CCActionInterval* actionUp = CCJumpBy::create(2, ccp(0,0), 80, 4);
|
||||
CCActionInterval* actionByBack = actionBy->reverse();
|
||||
|
||||
m_tamara->runAction( actionTo);
|
||||
|
@ -518,9 +514,9 @@ void ActionBezier::onEnter()
|
|||
|
||||
// sprite 1
|
||||
ccBezierConfig bezier;
|
||||
bezier.controlPoint_1 = CCPointMake(0, s.height/2);
|
||||
bezier.controlPoint_2 = CCPointMake(300, -s.height/2);
|
||||
bezier.endPosition = CCPointMake(300,100);
|
||||
bezier.controlPoint_1 = ccp(0, s.height/2);
|
||||
bezier.controlPoint_2 = ccp(300, -s.height/2);
|
||||
bezier.endPosition = ccp(300,100);
|
||||
|
||||
CCActionInterval* bezierForward = CCBezierBy::create(3, bezier);
|
||||
CCActionInterval* bezierBack = bezierForward->reverse();
|
||||
|
@ -528,16 +524,16 @@ void ActionBezier::onEnter()
|
|||
|
||||
|
||||
// sprite 2
|
||||
m_tamara->setPosition(CCPointMake(80,160));
|
||||
m_tamara->setPosition(ccp(80,160));
|
||||
ccBezierConfig bezier2;
|
||||
bezier2.controlPoint_1 = CCPointMake(100, s.height/2);
|
||||
bezier2.controlPoint_2 = CCPointMake(200, -s.height/2);
|
||||
bezier2.endPosition = CCPointMake(240,160);
|
||||
bezier2.controlPoint_1 = ccp(100, s.height/2);
|
||||
bezier2.controlPoint_2 = ccp(200, -s.height/2);
|
||||
bezier2.endPosition = ccp(240,160);
|
||||
|
||||
CCActionInterval* bezierTo1 = CCBezierTo::create(2, bezier2);
|
||||
|
||||
// sprite 3
|
||||
m_kathia->setPosition(CCPointMake(400,160));
|
||||
m_kathia->setPosition(ccp(400,160));
|
||||
CCActionInterval* bezierTo2 = CCBezierTo::create(2, bezier2);
|
||||
|
||||
m_grossini->runAction( rep);
|
||||
|
@ -714,7 +710,7 @@ void ActionSequence::onEnter()
|
|||
alignSpritesLeft(1);
|
||||
|
||||
CCFiniteTimeAction* action = CCSequence::create(
|
||||
CCMoveBy::create( 2, CCPointMake(240,0)),
|
||||
CCMoveBy::create( 2, ccp(240,0)),
|
||||
CCRotateBy::create( 2, 540),
|
||||
NULL);
|
||||
|
||||
|
@ -740,9 +736,9 @@ void ActionSequence2::onEnter()
|
|||
m_grossini->setVisible(false);
|
||||
|
||||
CCFiniteTimeAction* action = CCSequence::create(
|
||||
CCPlace::create(CCPointMake(200,200)),
|
||||
CCPlace::create(ccp(200,200)),
|
||||
CCShow::create(),
|
||||
CCMoveBy::create(1, CCPointMake(100,0)),
|
||||
CCMoveBy::create(1, ccp(100,0)),
|
||||
CCCallFunc::create(this, callfunc_selector(ActionSequence2::callback1)),
|
||||
CCCallFuncN::create(this, callfuncN_selector(ActionSequence2::callback2)),
|
||||
CCCallFuncND::create(this, callfuncND_selector(ActionSequence2::callback3), (void*)0xbebabeba),
|
||||
|
@ -755,7 +751,7 @@ void ActionSequence2::callback1()
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF *label = CCLabelTTF::create("callback 1 called", "Marker Felt", 16);
|
||||
label->setPosition(CCPointMake( s.width/4*1,s.height/2));
|
||||
label->setPosition(ccp( s.width/4*1,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -764,7 +760,7 @@ void ActionSequence2::callback2(CCNode* sender)
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF *label = CCLabelTTF::create("callback 2 called", "Marker Felt", 16);
|
||||
label->setPosition(CCPointMake( s.width/4*2,s.height/2));
|
||||
label->setPosition(ccp( s.width/4*2,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -773,7 +769,7 @@ void ActionSequence2::callback3(CCNode* sender, void* data)
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF *label = CCLabelTTF::create("callback 3 called", "Marker Felt", 16);
|
||||
label->setPosition(CCPointMake( s.width/4*3,s.height/2));
|
||||
label->setPosition(ccp( s.width/4*3,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -795,7 +791,7 @@ void ActionCallFunc::onEnter()
|
|||
centerSprites(3);
|
||||
|
||||
CCFiniteTimeAction* action = CCSequence::create(
|
||||
CCMoveBy::create(2, CCPointMake(200,0)),
|
||||
CCMoveBy::create(2, ccp(200,0)),
|
||||
CCCallFunc::create(this, callfunc_selector(ActionCallFunc::callback1)),
|
||||
NULL);
|
||||
|
||||
|
@ -821,7 +817,7 @@ void ActionCallFunc::callback1()
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF *label = CCLabelTTF::create("callback 1 called", "Marker Felt", 16);
|
||||
label->setPosition(CCPointMake( s.width/4*1,s.height/2));
|
||||
label->setPosition(ccp( s.width/4*1,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -830,7 +826,7 @@ void ActionCallFunc::callback2(CCNode* pSender)
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF *label = CCLabelTTF::create("callback 2 called", "Marker Felt", 16);
|
||||
label->setPosition(CCPointMake( s.width/4*2,s.height/2));
|
||||
label->setPosition(ccp( s.width/4*2,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -839,7 +835,7 @@ void ActionCallFunc::callback3(CCNode* pTarget, void* data)
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF *label = CCLabelTTF::create("callback 3 called", "Marker Felt", 16);
|
||||
label->setPosition(CCPointMake( s.width/4*3,s.height/2));
|
||||
label->setPosition(ccp( s.width/4*3,s.height/2));
|
||||
addChild(label);
|
||||
}
|
||||
|
||||
|
@ -896,7 +892,7 @@ void ActionSpawn::onEnter()
|
|||
|
||||
|
||||
CCAction* action = CCSpawn::create(
|
||||
CCJumpBy::create(2, CCPointMake(300,0), 50, 4),
|
||||
CCJumpBy::create(2, ccp(300,0), 50, 4),
|
||||
CCRotateBy::create( 2, 720),
|
||||
NULL);
|
||||
|
||||
|
@ -1007,7 +1003,7 @@ void ActionReverse::onEnter()
|
|||
|
||||
alignSpritesLeft(1);
|
||||
|
||||
CCActionInterval* jump = CCJumpBy::create(2, CCPointMake(300,0), 50, 4);
|
||||
CCActionInterval* jump = CCJumpBy::create(2, ccp(300,0), 50, 4);
|
||||
CCFiniteTimeAction* action = CCSequence::create( jump, jump->reverse(), NULL);
|
||||
|
||||
m_grossini->runAction(action);
|
||||
|
@ -1030,7 +1026,7 @@ void ActionDelayTime::onEnter()
|
|||
|
||||
alignSpritesLeft(1);
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(1, CCPointMake(150,0));
|
||||
CCActionInterval* move = CCMoveBy::create(1, ccp(150,0));
|
||||
CCFiniteTimeAction* action = CCSequence::create( move, CCDelayTime::create(2), move, NULL);
|
||||
|
||||
m_grossini->runAction(action);
|
||||
|
@ -1053,8 +1049,8 @@ void ActionReverseSequence::onEnter()
|
|||
|
||||
alignSpritesLeft(1);
|
||||
|
||||
CCActionInterval* move1 = CCMoveBy::create(1, CCPointMake(250,0));
|
||||
CCActionInterval* move2 = CCMoveBy::create(1, CCPointMake(0,50));
|
||||
CCActionInterval* move1 = CCMoveBy::create(1, ccp(250,0));
|
||||
CCActionInterval* move2 = CCMoveBy::create(1, ccp(0,50));
|
||||
CCFiniteTimeAction* seq = CCSequence::create( move1, move2, move1->reverse(), NULL);
|
||||
CCFiniteTimeAction* action = CCSequence::create( seq, seq->reverse(), NULL);
|
||||
|
||||
|
@ -1081,8 +1077,8 @@ void ActionReverseSequence2::onEnter()
|
|||
|
||||
// Test:
|
||||
// Sequence should work both with IntervalAction and InstantActions
|
||||
CCActionInterval* move1 = CCMoveBy::create(1, CCPointMake(250,0));
|
||||
CCActionInterval* move2 = CCMoveBy::create(1, CCPointMake(0,50));
|
||||
CCActionInterval* move1 = CCMoveBy::create(1, ccp(250,0));
|
||||
CCActionInterval* move2 = CCMoveBy::create(1, ccp(0,50));
|
||||
CCToggleVisibility* tog1 = new CCToggleVisibility();
|
||||
CCToggleVisibility* tog2 = new CCToggleVisibility();
|
||||
tog1->autorelease();
|
||||
|
@ -1096,8 +1092,8 @@ void ActionReverseSequence2::onEnter()
|
|||
// Also test that the reverse of Hide is Show, and vice-versa
|
||||
m_kathia->runAction(action);
|
||||
|
||||
CCActionInterval* move_tamara = CCMoveBy::create(1, CCPointMake(100,0));
|
||||
CCActionInterval* move_tamara2 = CCMoveBy::create(1, CCPointMake(50,0));
|
||||
CCActionInterval* move_tamara = CCMoveBy::create(1, ccp(100,0));
|
||||
CCActionInterval* move_tamara2 = CCMoveBy::create(1, ccp(50,0));
|
||||
CCActionInstant* hide = new CCHide();
|
||||
hide->autorelease();
|
||||
CCFiniteTimeAction* seq_tamara = CCSequence::create( move_tamara, hide, move_tamara2, NULL);
|
||||
|
@ -1121,9 +1117,9 @@ void ActionRepeat::onEnter()
|
|||
alignSpritesLeft(2);
|
||||
|
||||
|
||||
CCActionInterval* a1 = CCMoveBy::create(1, CCPointMake(150,0));
|
||||
CCActionInterval* a1 = CCMoveBy::create(1, ccp(150,0));
|
||||
CCActionInterval* action1 = CCRepeat::create(
|
||||
CCSequence::create( CCPlace::create(CCPointMake(60,60)), a1, NULL) ,
|
||||
CCSequence::create( CCPlace::create(ccp(60,60)), a1, NULL) ,
|
||||
3);
|
||||
CCAction* action2 = CCRepeatForever::create(
|
||||
(CCActionInterval*)(CCSequence::create((CCActionInterval*)(a1->copy()->autorelease()), a1->reverse(), NULL))
|
||||
|
@ -1171,7 +1167,7 @@ void ActionOrbit::onEnter()
|
|||
m_tamara->runAction(CCRepeatForever::create((CCActionInterval*)action2));
|
||||
m_grossini->runAction(CCRepeatForever::create((CCActionInterval*)action3));
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(100,-100));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(100,-100));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
CCFiniteTimeAction* seq = CCSequence::create(move, move_back, NULL);
|
||||
CCAction* rfe = CCRepeatForever::create((CCActionInterval*)seq);
|
||||
|
@ -1197,8 +1193,8 @@ void ActionFollow::onEnter()
|
|||
centerSprites(1);
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
m_grossini->setPosition(CCPointMake(-200, s.height / 2));
|
||||
CCActionInterval* move = CCMoveBy::create(2, CCPointMake(s.width * 3, 0));
|
||||
m_grossini->setPosition(ccp(-200, s.height / 2));
|
||||
CCActionInterval* move = CCMoveBy::create(2, ccp(s.width * 3, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
CCFiniteTimeAction* seq = CCSequence::create(move, move_back, NULL);
|
||||
CCAction* rep = CCRepeatForever::create((CCActionInterval*)seq);
|
||||
|
|
|
@ -23,22 +23,14 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
|
||||
|
||||
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
|
||||
CCSize designSize = CCSizeMake(480, 320);
|
||||
|
||||
if (screenSize.height > 768)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd");
|
||||
pDirector->setContentScaleFactor(1536.0f/designSize.height);
|
||||
}
|
||||
else if (screenSize.height > 640)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad");
|
||||
pDirector->setContentScaleFactor(768.0f/designSize.height);
|
||||
}
|
||||
else if (screenSize.height > 320)
|
||||
CCSize designSize = CCSizeMake(480, 320);
|
||||
|
||||
if (screenSize.height > 320)
|
||||
{
|
||||
CCSize resourceSize = CCSizeMake(960, 640);
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
|
||||
pDirector->setContentScaleFactor(640.0f/designSize.height);
|
||||
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
|
||||
}
|
||||
|
||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
|
||||
|
|
|
@ -63,7 +63,6 @@ Box2DTestLayer::Box2DTestLayer()
|
|||
setTouchEnabled( true );
|
||||
setAccelerometerEnabled( true );
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
// init physics
|
||||
this->initPhysics();
|
||||
// create reset button
|
||||
|
@ -82,12 +81,12 @@ Box2DTestLayer::Box2DTestLayer()
|
|||
addChild(parent, 0, kTagParentNode);
|
||||
|
||||
|
||||
addNewSpriteAtPosition(ccp(s.width/2, s.height/2));
|
||||
addNewSpriteAtPosition(VisibleRect::center());
|
||||
|
||||
CCLabelTTF *label = CCLabelTTF::create("Tap screen", "Marker Felt", 32);
|
||||
addChild(label, 0);
|
||||
label->setColor(ccc3(0,0,255));
|
||||
label->setPosition(ccp( s.width/2, s.height-50));
|
||||
label->setPosition(ccp( VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
@ -102,9 +101,6 @@ Box2DTestLayer::~Box2DTestLayer()
|
|||
|
||||
void Box2DTestLayer::initPhysics()
|
||||
{
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
b2Vec2 gravity;
|
||||
gravity.Set(0.0f, -10.0f);
|
||||
world = new b2World(gravity);
|
||||
|
@ -139,20 +135,19 @@ void Box2DTestLayer::initPhysics()
|
|||
b2EdgeShape groundBox;
|
||||
|
||||
// bottom
|
||||
|
||||
groundBox.Set(b2Vec2(0,0), b2Vec2(s.width/PTM_RATIO,0));
|
||||
groundBox.Set(b2Vec2(VisibleRect::leftBottom().x/PTM_RATIO,VisibleRect::leftBottom().y/PTM_RATIO), b2Vec2(VisibleRect::rightBottom().x/PTM_RATIO,VisibleRect::rightBottom().y/PTM_RATIO));
|
||||
groundBody->CreateFixture(&groundBox,0);
|
||||
|
||||
// top
|
||||
groundBox.Set(b2Vec2(0,s.height/PTM_RATIO), b2Vec2(s.width/PTM_RATIO,s.height/PTM_RATIO));
|
||||
groundBox.Set(b2Vec2(VisibleRect::leftTop().x/PTM_RATIO,VisibleRect::leftTop().y/PTM_RATIO), b2Vec2(VisibleRect::rightTop().x/PTM_RATIO,VisibleRect::rightTop().y/PTM_RATIO));
|
||||
groundBody->CreateFixture(&groundBox,0);
|
||||
|
||||
// left
|
||||
groundBox.Set(b2Vec2(0,s.height/PTM_RATIO), b2Vec2(0,0));
|
||||
groundBox.Set(b2Vec2(VisibleRect::leftTop().x/PTM_RATIO,VisibleRect::leftTop().y/PTM_RATIO), b2Vec2(VisibleRect::leftBottom().x/PTM_RATIO,VisibleRect::leftBottom().y/PTM_RATIO));
|
||||
groundBody->CreateFixture(&groundBox,0);
|
||||
|
||||
// right
|
||||
groundBox.Set(b2Vec2(s.width/PTM_RATIO,s.height/PTM_RATIO), b2Vec2(s.width/PTM_RATIO,0));
|
||||
groundBox.Set(b2Vec2(VisibleRect::rightBottom().x/PTM_RATIO,VisibleRect::rightBottom().y/PTM_RATIO), b2Vec2(VisibleRect::rightTop().x/PTM_RATIO,VisibleRect::rightTop().y/PTM_RATIO));
|
||||
groundBody->CreateFixture(&groundBox,0);
|
||||
}
|
||||
|
||||
|
@ -162,9 +157,7 @@ void Box2DTestLayer::createResetButton()
|
|||
|
||||
CCMenu *menu = CCMenu::create(reset, NULL);
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
menu->setPosition(ccp(s.width/2, 30));
|
||||
menu->setPosition(ccp(VisibleRect::bottom().x, VisibleRect::bottom().y + 30));
|
||||
this->addChild(menu, -1);
|
||||
|
||||
}
|
||||
|
@ -212,7 +205,7 @@ void Box2DTestLayer::addNewSpriteAtPosition(CCPoint p)
|
|||
|
||||
parent->addChild(sprite);
|
||||
|
||||
sprite->setPosition( CCPointMake( p.x, p.y) );
|
||||
sprite->setPosition( ccp( p.x, p.y) );
|
||||
|
||||
// Define the dynamic body.
|
||||
//Set up a 1m squared box in the physics world
|
||||
|
|
|
@ -74,9 +74,9 @@ bool MenuLayer::initWithEntryID(int entryId)
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( visibleOrigin.x+visibleSize.width/2 - 100,visibleOrigin.y+30) );
|
||||
item2->setPosition( ccp( visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+30) );
|
||||
item3->setPosition( ccp( visibleOrigin.x+visibleSize.width/2 + 100,visibleOrigin.y+30) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ void BugsTestBaseLayer::onEnter()
|
|||
CCMenuItemFont::setFontSize(24);
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", this,
|
||||
menu_selector(BugsTestBaseLayer::backCallback));
|
||||
pMainItem->setPosition(ccp(s.width - 50, 25));
|
||||
pMainItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu* pMenu = CCMenu::create(pMainItem, NULL);
|
||||
pMenu->setPosition( CCPointZero );
|
||||
addChild(pMenu);
|
||||
|
|
|
@ -74,11 +74,9 @@ ChipmunkAccelTouchTestLayer::ChipmunkAccelTouchTestLayer()
|
|||
setTouchEnabled(true);
|
||||
setAccelerometerEnabled(true);
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// title
|
||||
CCLabelTTF *label = CCLabelTTF::create("Multi touch the screen", "Marker Felt", 36);
|
||||
label->setPosition(ccp( s.width / 2, s.height - 30));
|
||||
label->setPosition(ccp( VisibleRect::center().x, VisibleRect::bottom().y - 30));
|
||||
this->addChild(label, -1);
|
||||
|
||||
// reset button
|
||||
|
@ -116,8 +114,6 @@ ChipmunkAccelTouchTestLayer::~ChipmunkAccelTouchTestLayer()
|
|||
|
||||
void ChipmunkAccelTouchTestLayer::initPhysics()
|
||||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// init chipmunk
|
||||
//cpInitChipmunk();
|
||||
|
||||
|
@ -130,16 +126,24 @@ void ChipmunkAccelTouchTestLayer::initPhysics()
|
|||
// We have to free them manually
|
||||
//
|
||||
// bottom
|
||||
m_pWalls[0] = cpSegmentShapeNew( m_pSpace->staticBody, cpv(0,0), cpv(s.width,0), 0.0f);
|
||||
m_pWalls[0] = cpSegmentShapeNew( m_pSpace->staticBody,
|
||||
cpv(VisibleRect::leftBottom().x,VisibleRect::leftBottom().y),
|
||||
cpv(VisibleRect::rightBottom().x, VisibleRect::rightBottom().y), 0.0f);
|
||||
|
||||
// top
|
||||
m_pWalls[1] = cpSegmentShapeNew( m_pSpace->staticBody, cpv(0,s.height), cpv(s.width,s.height), 0.0f);
|
||||
m_pWalls[1] = cpSegmentShapeNew( m_pSpace->staticBody,
|
||||
cpv(VisibleRect::leftTop().x, VisibleRect::leftTop().y),
|
||||
cpv(VisibleRect::rightTop().x, VisibleRect::rightTop().y), 0.0f);
|
||||
|
||||
// left
|
||||
m_pWalls[2] = cpSegmentShapeNew( m_pSpace->staticBody, cpv(0,0), cpv(0,s.height), 0.0f);
|
||||
m_pWalls[2] = cpSegmentShapeNew( m_pSpace->staticBody,
|
||||
cpv(VisibleRect::leftBottom().x,VisibleRect::leftBottom().y),
|
||||
cpv(VisibleRect::leftTop().x,VisibleRect::leftTop().y), 0.0f);
|
||||
|
||||
// right
|
||||
m_pWalls[3] = cpSegmentShapeNew( m_pSpace->staticBody, cpv(s.width,0), cpv(s.width,s.height), 0.0f);
|
||||
m_pWalls[3] = cpSegmentShapeNew( m_pSpace->staticBody,
|
||||
cpv(VisibleRect::rightBottom().x, VisibleRect::rightBottom().y),
|
||||
cpv(VisibleRect::rightTop().x, VisibleRect::rightTop().y), 0.0f);
|
||||
|
||||
for( int i=0;i<4;i++) {
|
||||
m_pWalls[i]->e = 1.0f;
|
||||
|
@ -165,9 +169,7 @@ void ChipmunkAccelTouchTestLayer::createResetButton()
|
|||
|
||||
CCMenu *menu = CCMenu::create(reset, NULL);
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
menu->setPosition(ccp(s.width/2, 30));
|
||||
menu->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y + 30));
|
||||
this->addChild(menu, -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ MainLayer::MainLayer()
|
|||
addChild(layer, -1);
|
||||
|
||||
addChild(sprite, 0, kTagSprite);
|
||||
sprite->setPosition( CCPointMake(20,150) );
|
||||
sprite->setPosition( ccp(20,150) );
|
||||
|
||||
sprite->runAction( CCJumpTo::create(4, CCPointMake(300,48), 100, 4) );
|
||||
sprite->runAction( CCJumpTo::create(4, ccp(300,48), 100, 4) );
|
||||
|
||||
layer->runAction( CCRepeatForever::create(
|
||||
(CCActionInterval*)( CCSequence::create(
|
||||
|
@ -46,7 +46,7 @@ void MainLayer::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent)
|
|||
|
||||
CCNode* s = getChildByTag(kTagSprite);
|
||||
s->stopAllActions();
|
||||
s->runAction( CCMoveTo::create(1, CCPointMake(location.x, location.y) ) );
|
||||
s->runAction( CCMoveTo::create(1, ccp(location.x, location.y) ) );
|
||||
float o = location.x - s->getPosition().x;
|
||||
float a = location.y - s->getPosition().y;
|
||||
float at = (float) CC_RADIANS_TO_DEGREES( atanf( o/a) );
|
||||
|
|
|
@ -53,7 +53,7 @@ m_nSoundId(0)
|
|||
|
||||
// add menu items for tests
|
||||
m_pItmeMenu = CCMenu::create();
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
m_nTestCount = sizeof(testItems) / sizeof(testItems[0]);
|
||||
|
||||
for (int i = 0; i < m_nTestCount; ++i)
|
||||
|
@ -66,10 +66,10 @@ m_nSoundId(0)
|
|||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(CocosDenshionTest::menuCallback));
|
||||
|
||||
m_pItmeMenu->addChild(pMenuItem, i + 10000);
|
||||
pMenuItem->setPosition( CCPointMake( s.width / 2, (s.height - (i + 1) * LINE_SPACE) ));
|
||||
pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) ));
|
||||
}
|
||||
|
||||
m_pItmeMenu->setContentSize(CCSizeMake(s.width, (m_nTestCount + 1) * LINE_SPACE));
|
||||
m_pItmeMenu->setContentSize(CCSizeMake(VisibleRect::getVisibleRect().size.width, (m_nTestCount + 1) * LINE_SPACE));
|
||||
m_pItmeMenu->setPosition(CCPointZero);
|
||||
addChild(m_pItmeMenu);
|
||||
|
||||
|
@ -204,16 +204,16 @@ void CocosDenshionTest::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
|
|||
|
||||
CCPoint curPos = m_pItmeMenu->getPosition();
|
||||
CCPoint nextPos = ccp(curPos.x, curPos.y + nMoveY);
|
||||
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
if (nextPos.y < 0.0f)
|
||||
{
|
||||
m_pItmeMenu->setPosition(CCPointZero);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextPos.y > ((m_nTestCount + 1)* LINE_SPACE - winSize.height))
|
||||
if (nextPos.y > ((m_nTestCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||
{
|
||||
m_pItmeMenu->setPosition(ccp(0, ((m_nTestCount + 1)* LINE_SPACE - winSize.height)));
|
||||
m_pItmeMenu->setPosition(ccp(0, ((m_nTestCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,16 +5,15 @@
|
|||
|
||||
CurlTest::CurlTest()
|
||||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF* label = CCLabelTTF::create("Curl Test", "Arial", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y-50) );
|
||||
|
||||
setTouchEnabled(true);
|
||||
|
||||
// create a label to display the tip string
|
||||
m_pLabel = CCLabelTTF::create("Touch the screen to connect", "Arial", 22);
|
||||
m_pLabel->setPosition(ccp(s.width / 2, s.height / 2));
|
||||
m_pLabel->setPosition(VisibleRect::center());
|
||||
addChild(m_pLabel, 0);
|
||||
|
||||
m_pLabel->retain();
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
CurrentLanguageTest::CurrentLanguageTest()
|
||||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF* label = CCLabelTTF::create("Current language Test", "Arial", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y-50) );
|
||||
|
||||
CCLabelTTF *labelLanguage = CCLabelTTF::create("", "Arial", 20);
|
||||
labelLanguage->setPosition(ccp(s.width/2, s.height/2));
|
||||
labelLanguage->setPosition(VisibleRect::center());
|
||||
|
||||
ccLanguageType currentLanguageType = CCApplication::sharedApplication()->getCurrentLanguage();
|
||||
switch (currentLanguageType)
|
||||
|
|
|
@ -6,8 +6,6 @@ DrawPrimitivesTest::DrawPrimitivesTest()
|
|||
|
||||
void DrawPrimitivesTest::draw()
|
||||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw a simple line
|
||||
|
@ -16,7 +14,7 @@ void DrawPrimitivesTest::draw()
|
|||
// color: 255,255,255,255 (white, non-transparent)
|
||||
// Anti-Aliased
|
||||
// glEnable(GL_LINE_SMOOTH);
|
||||
ccDrawLine( ccp(0, 0), ccp(s.width, s.height) );
|
||||
ccDrawLine( VisibleRect::leftBottom(), VisibleRect::rightTop() );
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
|
@ -26,7 +24,7 @@ void DrawPrimitivesTest::draw()
|
|||
// glDisable(GL_LINE_SMOOTH);
|
||||
glLineWidth( 5.0f );
|
||||
ccDrawColor4B(255,0,0,255);
|
||||
ccDrawLine( ccp(0, s.height), ccp(s.width, 0) );
|
||||
ccDrawLine( VisibleRect::leftTop(), VisibleRect::rightBottom() );
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
|
@ -39,7 +37,7 @@ void DrawPrimitivesTest::draw()
|
|||
// draw big point in the center
|
||||
ccPointSize(64);
|
||||
ccDrawColor4B(0,0,255,128);
|
||||
ccDrawPoint( ccp(s.width / 2, s.height / 2) );
|
||||
ccDrawPoint( VisibleRect::center() );
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
|
@ -54,14 +52,14 @@ void DrawPrimitivesTest::draw()
|
|||
// draw a green circle with 10 segments
|
||||
glLineWidth(16);
|
||||
ccDrawColor4B(0, 255, 0, 255);
|
||||
ccDrawCircle( ccp(s.width/2, s.height/2), 100, 0, 10, false);
|
||||
ccDrawCircle( VisibleRect::center(), 100, 0, 10, false);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw a green circle with 50 segments with line to center
|
||||
glLineWidth(2);
|
||||
ccDrawColor4B(0, 255, 255, 255);
|
||||
ccDrawCircle( ccp(s.width/2, s.height/2), 50, CC_DEGREES_TO_RADIANS(90), 50, true);
|
||||
ccDrawCircle( VisibleRect::center(), 50, CC_DEGREES_TO_RADIANS(90), 50, true);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
|
@ -87,12 +85,12 @@ void DrawPrimitivesTest::draw()
|
|||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw quad bezier path
|
||||
ccDrawQuadBezier(ccp(0,s.height), ccp(s.width/2,s.height/2), ccp(s.width,s.height), 50);
|
||||
ccDrawQuadBezier(VisibleRect::leftTop(), VisibleRect::center(), VisibleRect::rightTop(), 50);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw cubic bezier path
|
||||
ccDrawCubicBezier(ccp(s.width/2, s.height/2), ccp(s.width/2+30,s.height/2+50), ccp(s.width/2+60,s.height/2-50),ccp(s.width, s.height/2),100);
|
||||
ccDrawCubicBezier(VisibleRect::center(), ccp(VisibleRect::center().x+30,VisibleRect::center().y+50), ccp(VisibleRect::center().x+60,VisibleRect::center().y-50),VisibleRect::right(),100);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
|
|
|
@ -329,33 +329,28 @@ CCLayer* restartEffectAdvanceAction()
|
|||
void EffectAdvanceTextLayer::onEnter(void)
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
float x,y;
|
||||
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
x = size.width;
|
||||
y = size.height;
|
||||
|
||||
CCSprite *bg = CCSprite::create("Images/background3.png");
|
||||
addChild(bg, 0, kTagBackground);
|
||||
bg->setPosition( ccp(x/2,y/2) );
|
||||
bg->setPosition( VisibleRect::center() );
|
||||
|
||||
CCSprite* grossini = CCSprite::create("Images/grossinis_sister2.png");
|
||||
bg->addChild(grossini, 1, kTagSprite1);
|
||||
grossini->setPosition( ccp(x/3.0f,200) );
|
||||
grossini->setPosition( ccp(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3.0f, VisibleRect::bottom().y+ 200) );
|
||||
CCActionInterval* sc = CCScaleBy::create(2, 5);
|
||||
CCActionInterval* sc_back = sc->reverse();
|
||||
grossini->runAction( CCRepeatForever::create( (CCActionInterval*)(CCSequence::create(sc, sc_back, NULL)) ) );
|
||||
|
||||
CCSprite* tamara = CCSprite::create("Images/grossinis_sister1.png");
|
||||
bg->addChild(tamara, 1, kTagSprite2);
|
||||
tamara->setPosition( ccp(2*x/3.0f,200) );
|
||||
tamara->setPosition( ccp(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3.0f,VisibleRect::bottom().y+200) );
|
||||
CCActionInterval* sc2 = CCScaleBy::create(2, 5);
|
||||
CCActionInterval* sc2_back = sc2->reverse();
|
||||
tamara->runAction( CCRepeatForever::create( (CCActionInterval*)(CCSequence::create(sc2, sc2_back, NULL)) ) );
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Marker Felt", 28);
|
||||
|
||||
label->setPosition( ccp(x/2,y-80) );
|
||||
label->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) );
|
||||
addChild(label);
|
||||
label->setTag( kTagLabel );
|
||||
|
||||
|
@ -364,7 +359,7 @@ void EffectAdvanceTextLayer::onEnter(void)
|
|||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 101);
|
||||
l->setPosition( ccp(size.width/2, size.height-80) );
|
||||
l->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(EffectAdvanceTextLayer::backCallback) );
|
||||
|
@ -374,9 +369,9 @@ void EffectAdvanceTextLayer::onEnter(void)
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(size.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(size.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(size.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
static CCActionInterval* create(float t)
|
||||
{
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
return CCLens3D::create(CCPointMake(size.width/2,size.height/2), 240, ccg(15,10), t);
|
||||
return CCLens3D::create(ccp(size.width/2,size.height/2), 240, ccg(15,10), t);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
static CCActionInterval* create(float t)
|
||||
{
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
return CCRipple3D::create(CCPointMake(size.width/2,size.height/2), 240, 4, 160, ccg(32,24), t);
|
||||
return CCRipple3D::create(ccp(size.width/2,size.height/2), 240, 4, 160, ccg(32,24), t);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
static CCActionInterval* create(float t)
|
||||
{
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
return CCTwirl::create(CCPointMake(size.width/2, size.height/2), 1, 2.5f, ccg(12,8), t);
|
||||
return CCTwirl::create(ccp(size.width/2, size.height/2), 1, 2.5f, ccg(12,8), t);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -340,12 +340,6 @@ void EffectTestScene::runThisTest()
|
|||
TextLayer::TextLayer(void)
|
||||
{
|
||||
initWithColor( ccc4(32,128,32,255) );
|
||||
|
||||
float x,y;
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
x = s.width;
|
||||
y = s.height;
|
||||
|
||||
CCNode* node = CCNode::create();
|
||||
CCActionInterval* effect = getAction();
|
||||
|
@ -355,25 +349,25 @@ TextLayer::TextLayer(void)
|
|||
CCSprite *bg = CCSprite::create(s_back3);
|
||||
node->addChild(bg, 0);
|
||||
// bg->setAnchorPoint( CCPointZero );
|
||||
bg->setPosition(ccp(s.width/2, s.height/2));
|
||||
bg->setPosition(VisibleRect::center());
|
||||
|
||||
CCSprite* grossini = CCSprite::create(s_pPathSister2);
|
||||
node->addChild(grossini, 1);
|
||||
grossini->setPosition( CCPointMake(x/3,y/2) );
|
||||
grossini->setPosition( ccp(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
|
||||
CCActionInterval* sc = CCScaleBy::create(2, 5);
|
||||
CCActionInterval* sc_back = sc->reverse();
|
||||
grossini->runAction( CCRepeatForever::create((CCActionInterval*)(CCSequence::create(sc, sc_back, NULL)) ) );
|
||||
|
||||
CCSprite* tamara = CCSprite::create(s_pPathSister1);
|
||||
node->addChild(tamara, 1);
|
||||
tamara->setPosition( CCPointMake(2*x/3,y/2) );
|
||||
tamara->setPosition( ccp(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
|
||||
CCActionInterval* sc2 = CCScaleBy::create(2, 5);
|
||||
CCActionInterval* sc2_back = sc2->reverse();
|
||||
tamara->runAction( CCRepeatForever::create((CCActionInterval*)(CCSequence::create(sc2, sc2_back, NULL))) );
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create((effectsList[actionIdx]).c_str(), "Marker Felt", 32);
|
||||
|
||||
label->setPosition( CCPointMake(x/2,y-80) );
|
||||
label->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) );
|
||||
addChild(label);
|
||||
label->setTag( kTagLabel );
|
||||
|
||||
|
@ -384,9 +378,9 @@ TextLayer::TextLayer(void)
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(CCPointMake( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(CCPointMake( s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(CCPointMake( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
|
|
|
@ -42,30 +42,27 @@ bool CCControlScene::init()
|
|||
{
|
||||
if (CCLayer::init())
|
||||
{
|
||||
// Get the sceensize
|
||||
CCSize screensize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCMenuItemFont* pBackItem = CCMenuItemFont::create("Back", this,
|
||||
menu_selector(CCControlScene::toExtensionsMainLayer));
|
||||
pBackItem->setPosition(ccp(screensize.width - 50, 25));
|
||||
pBackItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu* pBackMenu = CCMenu::create(pBackItem, NULL);
|
||||
pBackMenu->setPosition( CCPointZero );
|
||||
addChild(pBackMenu, 10);
|
||||
|
||||
// Add the generated background
|
||||
CCSprite *background = CCSprite::create("extensions/background.png");
|
||||
background->setPosition(ccp(screensize.width / 2, screensize.height / 2));
|
||||
background->setPosition(VisibleRect::center());
|
||||
addChild(background);
|
||||
|
||||
// Add the ribbon
|
||||
CCScale9Sprite *ribbon = CCScale9Sprite::create("extensions/ribbon.png", CCRectMake(1, 1, 48, 55));
|
||||
ribbon->setContentSize(CCSizeMake(screensize.width, 57));
|
||||
ribbon->setPosition(ccp(screensize.width / 2.0f, screensize.height - ribbon->getContentSize().height / 2.0f));
|
||||
ribbon->setContentSize(CCSizeMake(VisibleRect::getVisibleRect().size.width, 57));
|
||||
ribbon->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y - ribbon->getContentSize().height / 2.0f));
|
||||
addChild(ribbon);
|
||||
|
||||
// Add the title
|
||||
setSceneTitleLabel(CCLabelTTF::create("Title", "Arial", 12));
|
||||
m_pSceneTitleLabel->setPosition(ccp (screensize.width / 2, screensize.height - m_pSceneTitleLabel->getContentSize().height / 2 - 5));
|
||||
m_pSceneTitleLabel->setPosition(ccp (VisibleRect::center().x, VisibleRect::top().y - m_pSceneTitleLabel->getContentSize().height / 2 - 5));
|
||||
addChild(m_pSceneTitleLabel, 1);
|
||||
|
||||
// Add the menu
|
||||
|
@ -75,9 +72,9 @@ bool CCControlScene::init()
|
|||
|
||||
CCMenu *menu = CCMenu::create(item1, item3, item2, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(screensize.width / 2 - 100, 37));
|
||||
item2->setPosition(ccp(screensize.width / 2, 35));
|
||||
item3->setPosition(ccp(screensize.width / 2 + 100, 37));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu ,1);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ HttpClientTest::HttpClientTest()
|
|||
|
||||
// Back Menu
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(HttpClientTest::toExtensionsMainLayer));
|
||||
itemBack->setPosition(ccp(winSize.width - 50, 25));
|
||||
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
|
||||
menuBack->setPosition(CCPointZero);
|
||||
addChild(menuBack);
|
||||
|
|
|
@ -84,7 +84,7 @@ NotificationCenterTest::NotificationCenterTest()
|
|||
|
||||
CCMenuItemFont* pBackItem = CCMenuItemFont::create("Back", this,
|
||||
menu_selector(NotificationCenterTest::toExtensionsMainLayer));
|
||||
pBackItem->setPosition(ccp(s.width - 50, 25));
|
||||
pBackItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu* pBackMenu = CCMenu::create(pBackItem, NULL);
|
||||
pBackMenu->setPosition( CCPointZero );
|
||||
addChild(pBackMenu);
|
||||
|
|
|
@ -40,7 +40,7 @@ bool TableViewTestLayer::init()
|
|||
|
||||
// Back Menu
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(TableViewTestLayer::toExtensionsMainLayer));
|
||||
itemBack->setPosition(ccp(winSize.width - 50, 25));
|
||||
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
|
||||
menuBack->setPosition(CCPointZero);
|
||||
addChild(menuBack);
|
||||
|
|
|
@ -74,16 +74,15 @@ static const char* restartAction(void)
|
|||
|
||||
FontTest::FontTest()
|
||||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(FontTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(FontTest::restartCallback));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(FontTest::nextCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp( s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
|
||||
showFont(restartAction());
|
||||
|
|
|
@ -17,7 +17,7 @@ IntervalLayer::IntervalLayer()
|
|||
// sun
|
||||
CCParticleSystem* sun = CCParticleSun::create();
|
||||
sun->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png"));
|
||||
sun->setPosition( CCPointMake(s.width-32,s.height-32) );
|
||||
sun->setPosition( ccp(VisibleRect::rightTop().x-32,VisibleRect::rightTop().y-32) );
|
||||
|
||||
sun->setTotalParticles(130);
|
||||
sun->setLife(0.6f);
|
||||
|
@ -36,11 +36,11 @@ IntervalLayer::IntervalLayer()
|
|||
schedule(schedule_selector(IntervalLayer::step3), 1.0f);
|
||||
schedule(schedule_selector(IntervalLayer::step4), 2.0f);
|
||||
|
||||
m_label0->setPosition(CCPointMake(s.width*1/6, s.height/2));
|
||||
m_label1->setPosition(CCPointMake(s.width*2/6, s.height/2));
|
||||
m_label2->setPosition(CCPointMake(s.width*3/6, s.height/2));
|
||||
m_label3->setPosition(CCPointMake(s.width*4/6, s.height/2));
|
||||
m_label4->setPosition(CCPointMake(s.width*5/6, s.height/2));
|
||||
m_label0->setPosition(ccp(s.width*1/6, s.height/2));
|
||||
m_label1->setPosition(ccp(s.width*2/6, s.height/2));
|
||||
m_label2->setPosition(ccp(s.width*3/6, s.height/2));
|
||||
m_label3->setPosition(ccp(s.width*4/6, s.height/2));
|
||||
m_label4->setPosition(ccp(s.width*5/6, s.height/2));
|
||||
|
||||
addChild(m_label0);
|
||||
addChild(m_label1);
|
||||
|
@ -50,9 +50,9 @@ IntervalLayer::IntervalLayer()
|
|||
|
||||
// Sprite
|
||||
CCSprite* sprite = CCSprite::create(s_pPathGrossini);
|
||||
sprite->setPosition( CCPointMake(40,50) );
|
||||
sprite->setPosition( ccp(VisibleRect::left().x + 40, VisibleRect::bottom().y + 50) );
|
||||
|
||||
CCJumpBy* jump = CCJumpBy::create(3, CCPointMake(s.width-80,0), 50, 4);
|
||||
CCJumpBy* jump = CCJumpBy::create(3, ccp(s.width-80,0), 50, 4);
|
||||
|
||||
addChild(sprite);
|
||||
sprite->runAction( CCRepeatForever::create(
|
||||
|
@ -62,7 +62,7 @@ IntervalLayer::IntervalLayer()
|
|||
// pause button
|
||||
CCMenuItem* item1 = CCMenuItemFont::create("Pause", this, menu_selector(IntervalLayer::onPause) );
|
||||
CCMenu* menu = CCMenu::create(item1, NULL);
|
||||
menu->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
menu->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
addChild( menu );
|
||||
}
|
||||
|
|
|
@ -155,9 +155,9 @@ void AtlasDemo::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));;
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
@ -447,9 +447,9 @@ Atlas3::Atlas3()
|
|||
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
label1->setPosition( ccp( 0,0) );
|
||||
label2->setPosition( ccp( s.width/2, s.height/2) );
|
||||
label3->setPosition( ccp( s.width, s.height) );
|
||||
label1->setPosition( VisibleRect::leftBottom() );
|
||||
label2->setPosition( VisibleRect::center() );
|
||||
label3->setPosition( VisibleRect::rightTop() );
|
||||
|
||||
schedule( schedule_selector(Atlas3::step) );//:@selector(step:)];
|
||||
}
|
||||
|
@ -776,10 +776,9 @@ BitmapFontMultiLine::BitmapFontMultiLine()
|
|||
s = label3->getContentSize();
|
||||
CCLOG("content size: %.2fx%.2f", s.width, s.height);
|
||||
|
||||
s = CCDirector::sharedDirector()->getWinSize();
|
||||
label1->setPosition(ccp( 0,0));
|
||||
label2->setPosition(ccp( s.width/2, s.height/2));
|
||||
label3->setPosition(ccp( s.width, s.height));
|
||||
label1->setPosition(VisibleRect::leftBottom());
|
||||
label2->setPosition(VisibleRect::center());
|
||||
label3->setPosition(VisibleRect::rightTop());
|
||||
}
|
||||
|
||||
std::string BitmapFontMultiLine::title()
|
||||
|
|
|
@ -94,7 +94,7 @@ void LayerTest::onEnter()
|
|||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
string subtitle_ = subtitle();
|
||||
if (subtitle_.size() > 0)
|
||||
|
@ -111,9 +111,9 @@ void LayerTest::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void LayerTest1::onEnter()
|
|||
CCLayerColor* layer = CCLayerColor::create( ccc4(0xFF, 0x00, 0x00, 0x80), 200, 200);
|
||||
|
||||
layer->ignoreAnchorPointForPosition(false);
|
||||
layer->setPosition( CCPointMake(s.width/2, s.height/2) );
|
||||
layer->setPosition( ccp(s.width/2, s.height/2) );
|
||||
addChild(layer, 1, kTagLayer);
|
||||
}
|
||||
|
||||
|
@ -218,12 +218,12 @@ void LayerTest2::onEnter()
|
|||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLayerColor* layer1 = CCLayerColor::create( ccc4(255, 255, 0, 80), 100, 300);
|
||||
layer1->setPosition(CCPointMake(s.width/3, s.height/2));
|
||||
layer1->setPosition(ccp(s.width/3, s.height/2));
|
||||
layer1->ignoreAnchorPointForPosition(false);
|
||||
addChild(layer1, 1);
|
||||
|
||||
CCLayerColor* layer2 = CCLayerColor::create( ccc4(0, 0, 255, 255), 100, 300);
|
||||
layer2->setPosition(CCPointMake((s.width/3)*2, s.height/2));
|
||||
layer2->setPosition(ccp((s.width/3)*2, s.height/2));
|
||||
layer2->ignoreAnchorPointForPosition(false);
|
||||
addChild(layer2, 1);
|
||||
|
||||
|
@ -261,8 +261,8 @@ LayerTestBlend::LayerTestBlend()
|
|||
addChild(sister2);
|
||||
addChild(layer1, 100, kTagLayer);
|
||||
|
||||
sister1->setPosition( CCPointMake( 160, s.height/2) );
|
||||
sister2->setPosition( CCPointMake( 320, s.height/2) );
|
||||
sister1->setPosition( ccp( 160, s.height/2) );
|
||||
sister2->setPosition( ccp( 320, s.height/2) );
|
||||
|
||||
schedule( schedule_selector(LayerTestBlend::newBlend), 1.0f);
|
||||
}
|
||||
|
|
|
@ -97,11 +97,9 @@ MenuLayerMainMenu::MenuLayerMainMenu()
|
|||
if( i % 2 == 0)
|
||||
offset = -offset;
|
||||
|
||||
child->setPosition( CCPointMake( dstPoint.x + offset, dstPoint.y) );
|
||||
child->setPosition( ccp( dstPoint.x + offset, dstPoint.y) );
|
||||
child->runAction(
|
||||
CCEaseElasticOut::create(
|
||||
CCMoveBy::create(2, CCPointMake(dstPoint.x - offset,0)), 0.35f
|
||||
)
|
||||
CCEaseElasticOut::create(CCMoveBy::create(2, ccp(dstPoint.x - offset,0)), 0.35f)
|
||||
);
|
||||
i++;
|
||||
}
|
||||
|
@ -237,7 +235,7 @@ void MenuLayer2::alignMenusH()
|
|||
// TIP: if no padding, padding = 5
|
||||
menu->alignItemsHorizontally();
|
||||
CCPoint p = menu->getPosition();
|
||||
menu->setPosition( ccpAdd(p, CCPointMake(0,30)) );
|
||||
menu->setPosition( ccpAdd(p, ccp(0,30)) );
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -245,7 +243,7 @@ void MenuLayer2::alignMenusH()
|
|||
// TIP: but padding is configurable
|
||||
menu->alignItemsHorizontallyWithPadding(40);
|
||||
CCPoint p = menu->getPosition();
|
||||
menu->setPosition( ccpSub(p, CCPointMake(0,30)) );
|
||||
menu->setPosition( ccpSub(p, ccp(0,30)) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,14 +259,14 @@ void MenuLayer2::alignMenusV()
|
|||
// TIP: if no padding, padding = 5
|
||||
menu->alignItemsVertically();
|
||||
CCPoint p = menu->getPosition();
|
||||
menu->setPosition( ccpAdd(p, CCPointMake(100,0)) );
|
||||
menu->setPosition( ccpAdd(p, ccp(100,0)) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// TIP: but padding is configurable
|
||||
menu->alignItemsVerticallyWithPadding(40);
|
||||
CCPoint p = menu->getPosition();
|
||||
menu->setPosition( ccpSub(p, CCPointMake(100,0)) );
|
||||
menu->setPosition( ccpSub(p, ccp(100,0)) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,15 +320,15 @@ MenuLayer3::MenuLayer3()
|
|||
m_disabledItem->setEnabled( false );
|
||||
|
||||
CCMenu *menu = CCMenu::create( item1, item2, item3, NULL);
|
||||
menu->setPosition( CCPointMake(0,0) );
|
||||
menu->setPosition( ccp(0,0) );
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
item1->setPosition( CCPointMake(s.width/2 - 150, s.height/2) );
|
||||
item2->setPosition( CCPointMake(s.width/2 - 200, s.height/2) );
|
||||
item3->setPosition( CCPointMake(s.width/2, s.height/2 - 100) );
|
||||
item1->setPosition( ccp(s.width/2 - 150, s.height/2) );
|
||||
item2->setPosition( ccp(s.width/2 - 200, s.height/2) );
|
||||
item3->setPosition( ccp(s.width/2, s.height/2 - 100) );
|
||||
|
||||
CCJumpBy* jump = CCJumpBy::create(3, CCPointMake(400,0), 50, 4);
|
||||
CCJumpBy* jump = CCJumpBy::create(3, ccp(400,0), 50, 4);
|
||||
item2->runAction( CCRepeatForever::create(
|
||||
(CCActionInterval*)(CCSequence::create( jump, jump->reverse(), NULL))
|
||||
)
|
||||
|
|
|
@ -42,7 +42,7 @@ void MotionStreakTest1::onEnter()
|
|||
CCActionInterval* a1 = CCRotateBy::create(2, 360);
|
||||
|
||||
CCAction* action1 = CCRepeatForever::create(a1);
|
||||
CCActionInterval* motion = CCMoveBy::create(2, CCPointMake(100,0) );
|
||||
CCActionInterval* motion = CCMoveBy::create(2, ccp(100,0) );
|
||||
m_root->runAction( CCRepeatForever::create((CCActionInterval*)(CCSequence::create(motion, motion->reverse(), NULL)) ) );
|
||||
m_root->runAction( action1 );
|
||||
|
||||
|
@ -87,7 +87,7 @@ void MotionStreakTest2::onEnter()
|
|||
streak = CCMotionStreak::create(3, 3, 64, ccWHITE, s_streak );
|
||||
addChild(streak);
|
||||
|
||||
streak->setPosition( CCPointMake(s.width/2, s.height/2) );
|
||||
streak->setPosition( ccp(s.width/2, s.height/2) );
|
||||
}
|
||||
|
||||
void MotionStreakTest2::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
||||
|
@ -234,7 +234,7 @@ void MotionStreakTest::onEnter()
|
|||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 0, kTagLabel);
|
||||
label->setPosition(CCPointMake(s.width/2, s.height-50));
|
||||
label->setPosition(ccp(s.width/2, s.height-50));
|
||||
|
||||
string subTitle = this->subtitle();
|
||||
if (subTitle.size() > 0)
|
||||
|
@ -251,9 +251,9 @@ void MotionStreakTest::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(CCPointMake(s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(CCPointMake(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
|
|
|
@ -106,14 +106,14 @@ void TestCocosNodeDemo::onEnter()
|
|||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label, 10);
|
||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition( CCPointMake(s.width/2, s.height-80) );
|
||||
l->setPosition( ccp(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TestCocosNodeDemo::backCallback) );
|
||||
|
@ -123,9 +123,9 @@ void TestCocosNodeDemo::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 11);
|
||||
}
|
||||
|
@ -172,8 +172,8 @@ void Test2::onEnter()
|
|||
CCSprite *sp3 = CCSprite::create(s_pPathSister1);
|
||||
CCSprite *sp4 = CCSprite::create(s_pPathSister2);
|
||||
|
||||
sp1->setPosition(CCPointMake(100, s.height /2 ));
|
||||
sp2->setPosition(CCPointMake(380, s.height /2 ));
|
||||
sp1->setPosition(ccp(100, s.height /2 ));
|
||||
sp2->setPosition(ccp(380, s.height /2 ));
|
||||
addChild(sp1);
|
||||
addChild(sp2);
|
||||
|
||||
|
@ -197,7 +197,7 @@ void Test2::onEnter()
|
|||
NULL) )
|
||||
);
|
||||
|
||||
sp2->setAnchorPoint(CCPointMake(0,0));
|
||||
sp2->setAnchorPoint(ccp(0,0));
|
||||
|
||||
sp1->runAction(action1);
|
||||
sp2->runAction(action2);
|
||||
|
@ -222,8 +222,8 @@ Test4::Test4()
|
|||
CCSprite *sp1 = CCSprite::create(s_pPathSister1);
|
||||
CCSprite *sp2 = CCSprite::create(s_pPathSister2);
|
||||
|
||||
sp1->setPosition( CCPointMake(100,160) );
|
||||
sp2->setPosition( CCPointMake(380,160) );
|
||||
sp1->setPosition( ccp(100,160) );
|
||||
sp2->setPosition( ccp(380,160) );
|
||||
|
||||
addChild(sp1, 0, 2);
|
||||
addChild(sp2, 0, 3);
|
||||
|
@ -261,8 +261,8 @@ Test5::Test5()
|
|||
CCSprite* sp1 = CCSprite::create(s_pPathSister1);
|
||||
CCSprite* sp2 = CCSprite::create(s_pPathSister2);
|
||||
|
||||
sp1->setPosition(CCPointMake(100,160));
|
||||
sp2->setPosition(CCPointMake(380,160));
|
||||
sp1->setPosition(ccp(100,160));
|
||||
sp2->setPosition(ccp(380,160));
|
||||
|
||||
CCRotateBy* rot = CCRotateBy::create(2, 360);
|
||||
CCActionInterval* rot_back = rot->reverse();
|
||||
|
@ -318,8 +318,8 @@ Test6::Test6()
|
|||
CCSprite* sp2 = CCSprite::create(s_pPathSister2);
|
||||
CCSprite* sp21 = CCSprite::create(s_pPathSister2);
|
||||
|
||||
sp1->setPosition(CCPointMake(100,160));
|
||||
sp2->setPosition(CCPointMake(380,160));
|
||||
sp1->setPosition(ccp(100,160));
|
||||
sp2->setPosition(ccp(380,160));
|
||||
|
||||
CCActionInterval* rot = CCRotateBy::create(2, 360);
|
||||
CCActionInterval* rot_back = rot->reverse();
|
||||
|
@ -379,7 +379,7 @@ StressTest1::StressTest1()
|
|||
CCSprite *sp1 = CCSprite::create(s_pPathSister1);
|
||||
addChild(sp1, 0, kTagSprite1);
|
||||
|
||||
sp1->setPosition( CCPointMake(s.width/2, s.height/2) );
|
||||
sp1->setPosition( ccp(s.width/2, s.height/2) );
|
||||
|
||||
schedule( schedule_selector(StressTest1::shouldNotCrash), 1.0f);
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ void StressTest1::shouldNotCrash(float dt)
|
|||
// if it doesn't, it works Ok.
|
||||
// CocosNode *explosion = [Sprite create:@"grossinis_sister2.png");
|
||||
|
||||
explosion->setPosition( CCPointMake(s.width/2, s.height/2) );
|
||||
explosion->setPosition( ccp(s.width/2, s.height/2) );
|
||||
|
||||
runAction( CCSequence::create(
|
||||
CCRotateBy::create(2, 360),
|
||||
|
@ -432,9 +432,9 @@ StressTest2::StressTest2()
|
|||
CCLayer* sublayer = CCLayer::create();
|
||||
|
||||
CCSprite *sp1 = CCSprite::create(s_pPathSister1);
|
||||
sp1->setPosition( CCPointMake(80, s.height/2) );
|
||||
sp1->setPosition( ccp(80, s.height/2) );
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(350,0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(350,0));
|
||||
CCActionInterval* move_ease_inout3 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 2.0f);
|
||||
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
|
||||
CCFiniteTimeAction* seq3 = CCSequence::create( move_ease_inout3, move_ease_inout_back3, NULL);
|
||||
|
@ -443,7 +443,7 @@ StressTest2::StressTest2()
|
|||
|
||||
CCParticleFire* fire = CCParticleFire::create();
|
||||
fire->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png"));
|
||||
fire->setPosition( CCPointMake(80, s.height/2-50) );
|
||||
fire->setPosition( ccp(80, s.height/2-50) );
|
||||
|
||||
CCActionInterval* copy_seq3 = (CCActionInterval*)(seq3->copy()->autorelease());
|
||||
|
||||
|
@ -512,20 +512,20 @@ NodeToWorld::NodeToWorld()
|
|||
|
||||
CCSprite *back = CCSprite::create(s_back3);
|
||||
addChild( back, -10);
|
||||
back->setAnchorPoint( CCPointMake(0,0) );
|
||||
back->setAnchorPoint( ccp(0,0) );
|
||||
CCSize backSize = back->getContentSize();
|
||||
|
||||
CCMenuItem *item = CCMenuItemImage::create(s_PlayNormal, s_PlaySelect);
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
menu->alignItemsVertically();
|
||||
menu->setPosition( CCPointMake(backSize.width/2, backSize.height/2));
|
||||
menu->setPosition( ccp(backSize.width/2, backSize.height/2));
|
||||
back->addChild(menu);
|
||||
|
||||
CCActionInterval* rot = CCRotateBy::create(5, 360);
|
||||
CCAction* fe = CCRepeatForever::create( rot);
|
||||
item->runAction( fe );
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(200,0));
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(200,0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
CCFiniteTimeAction* seq = CCSequence::create( move, move_back, NULL);
|
||||
CCAction* fe2 = CCRepeatForever::create((CCActionInterval*)seq);
|
||||
|
@ -560,7 +560,7 @@ CameraOrbitTest::CameraOrbitTest()
|
|||
|
||||
CCSprite *p = CCSprite::create(s_back3);
|
||||
addChild( p, 0);
|
||||
p->setPosition( CCPointMake(s.width/2, s.height/2) );
|
||||
p->setPosition( ccp(s.width/2, s.height/2) );
|
||||
p->setOpacity( 128 );
|
||||
|
||||
CCSprite* sprite;
|
||||
|
@ -573,7 +573,7 @@ CameraOrbitTest::CameraOrbitTest()
|
|||
sprite = CCSprite::create(s_pPathGrossini);
|
||||
sprite->setScale(0.5f);
|
||||
p->addChild(sprite, 0);
|
||||
sprite->setPosition( CCPointMake(s.width/4*1, s.height/2) );
|
||||
sprite->setPosition( ccp(s.width/4*1, s.height/2) );
|
||||
cam = sprite->getCamera();
|
||||
orbit = CCOrbitCamera::create(2, 1, 0, 0, 360, 0, 0);
|
||||
sprite->runAction( CCRepeatForever::create( orbit ) );
|
||||
|
@ -582,7 +582,7 @@ CameraOrbitTest::CameraOrbitTest()
|
|||
sprite = CCSprite::create(s_pPathGrossini);
|
||||
sprite->setScale( 1.0f );
|
||||
p->addChild(sprite, 0);
|
||||
sprite->setPosition( CCPointMake(s.width/4*2, s.height/2) );
|
||||
sprite->setPosition( ccp(s.width/4*2, s.height/2) );
|
||||
orbit = CCOrbitCamera::create(2, 1, 0, 0, 360, 45, 0);
|
||||
sprite->runAction( CCRepeatForever::create( orbit ) );
|
||||
|
||||
|
@ -591,7 +591,7 @@ CameraOrbitTest::CameraOrbitTest()
|
|||
sprite = CCSprite::create(s_pPathGrossini);
|
||||
sprite->setScale( 2.0f );
|
||||
p->addChild(sprite, 0);
|
||||
sprite->setPosition( CCPointMake(s.width/4*3, s.height/2) );
|
||||
sprite->setPosition( ccp(s.width/4*3, s.height/2) );
|
||||
ss = sprite->getContentSize();
|
||||
orbit = CCOrbitCamera::create(2, 1, 0, 0, 360, 90, -45),
|
||||
sprite->runAction( CCRepeatForever::create(orbit) );
|
||||
|
@ -638,7 +638,7 @@ CameraZoomTest::CameraZoomTest()
|
|||
// LEFT
|
||||
sprite = CCSprite::create(s_pPathGrossini);
|
||||
addChild( sprite, 0);
|
||||
sprite->setPosition( CCPointMake(s.width/4*1, s.height/2) );
|
||||
sprite->setPosition( ccp(s.width/4*1, s.height/2) );
|
||||
cam = sprite->getCamera();
|
||||
cam->setEyeXYZ(0, 0, 415/2);
|
||||
cam->setCenterXYZ(0, 0, 0);
|
||||
|
@ -646,12 +646,12 @@ CameraZoomTest::CameraZoomTest()
|
|||
// CENTER
|
||||
sprite = CCSprite::create(s_pPathGrossini);
|
||||
addChild( sprite, 0, 40);
|
||||
sprite->setPosition(CCPointMake(s.width/4*2, s.height/2));
|
||||
sprite->setPosition(ccp(s.width/4*2, s.height/2));
|
||||
|
||||
// RIGHT
|
||||
sprite = CCSprite::create(s_pPathGrossini);
|
||||
addChild( sprite, 0, 20);
|
||||
sprite->setPosition(CCPointMake(s.width/4*3, s.height/2));
|
||||
sprite->setPosition(ccp(s.width/4*3, s.height/2));
|
||||
|
||||
m_z = 0;
|
||||
scheduleUpdate();
|
||||
|
@ -693,19 +693,19 @@ CameraCenterTest::CameraCenterTest()
|
|||
// LEFT-TOP
|
||||
sprite = CCSprite::create("Images/white-512x512.png");
|
||||
addChild( sprite, 0);
|
||||
sprite->setPosition(CCPointMake(s.width/5*1, s.height/5*1));
|
||||
sprite->setPosition(ccp(s.width/5*1, s.height/5*1));
|
||||
sprite->setColor(ccRED);
|
||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||
orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0);
|
||||
sprite->runAction(CCRepeatForever::create( orbit ));
|
||||
// [sprite setAnchorPoint: CCPointMake(0,1));
|
||||
// [sprite setAnchorPoint: ccp(0,1));
|
||||
|
||||
|
||||
|
||||
// LEFT-BOTTOM
|
||||
sprite = CCSprite::create("Images/white-512x512.png");
|
||||
addChild( sprite, 0, 40);
|
||||
sprite->setPosition(CCPointMake(s.width/5*1, s.height/5*4));
|
||||
sprite->setPosition(ccp(s.width/5*1, s.height/5*4));
|
||||
sprite->setColor(ccBLUE);
|
||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||
orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0);
|
||||
|
@ -715,7 +715,7 @@ CameraCenterTest::CameraCenterTest()
|
|||
// RIGHT-TOP
|
||||
sprite = CCSprite::create("Images/white-512x512.png");
|
||||
addChild( sprite, 0);
|
||||
sprite->setPosition(CCPointMake(s.width/5*4, s.height/5*1));
|
||||
sprite->setPosition(ccp(s.width/5*4, s.height/5*1));
|
||||
sprite->setColor(ccYELLOW);
|
||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||
orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0);
|
||||
|
@ -725,7 +725,7 @@ CameraCenterTest::CameraCenterTest()
|
|||
// RIGHT-BOTTOM
|
||||
sprite = CCSprite::create("Images/white-512x512.png");
|
||||
addChild( sprite, 0, 40);
|
||||
sprite->setPosition(CCPointMake(s.width/5*4, s.height/5*4));
|
||||
sprite->setPosition(ccp(s.width/5*4, s.height/5*4));
|
||||
sprite->setColor(ccGREEN);
|
||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||
orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0);
|
||||
|
@ -734,7 +734,7 @@ CameraCenterTest::CameraCenterTest()
|
|||
// CENTER
|
||||
sprite = CCSprite::create("Images/white-512x512.png");
|
||||
addChild( sprite, 0, 40);
|
||||
sprite->setPosition(CCPointMake(s.width/2, s.height/2));
|
||||
sprite->setPosition(ccp(s.width/2, s.height/2));
|
||||
sprite->setColor(ccWHITE);
|
||||
sprite->setTextureRect(CCRectMake(0, 0, 120, 50));
|
||||
orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0);
|
||||
|
|
|
@ -249,9 +249,9 @@ void ParallaxDemo::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ void DemoFire::onEnter()
|
|||
|
||||
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );//.pvr");
|
||||
CCPoint p = m_emitter->getPosition();
|
||||
m_emitter->setPosition( CCPointMake(p.x, 100) );
|
||||
m_emitter->setPosition( ccp(p.x, 100) );
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void DemoBigFlower::onEnter()
|
|||
m_emitter->setTangentialAccelVar(0);
|
||||
|
||||
// emitter position
|
||||
m_emitter->setPosition( CCPointMake(160,240) );
|
||||
m_emitter->setPosition( ccp(160,240) );
|
||||
m_emitter->setPosVar(CCPointZero);
|
||||
|
||||
// life of particles
|
||||
|
@ -256,7 +256,7 @@ void DemoRotFlower::onEnter()
|
|||
m_emitter->setTangentialAccelVar(0);
|
||||
|
||||
// emitter position
|
||||
m_emitter->setPosition( CCPointMake(160,240) );
|
||||
m_emitter->setPosition( ccp(160,240) );
|
||||
m_emitter->setPosVar(CCPointZero);
|
||||
|
||||
// life of particles
|
||||
|
@ -387,7 +387,7 @@ void DemoSmoke::onEnter()
|
|||
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
|
||||
|
||||
CCPoint p = m_emitter->getPosition();
|
||||
m_emitter->setPosition( CCPointMake( p.x, 100) );
|
||||
m_emitter->setPosition( ccp( p.x, 100) );
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
@ -411,12 +411,12 @@ void DemoSnow::onEnter()
|
|||
m_background->addChild(m_emitter, 10);
|
||||
|
||||
CCPoint p = m_emitter->getPosition();
|
||||
m_emitter->setPosition( CCPointMake( p.x, p.y-110) );
|
||||
m_emitter->setPosition( ccp( p.x, p.y-110) );
|
||||
m_emitter->setLife(3);
|
||||
m_emitter->setLifeVar(1);
|
||||
|
||||
// gravity
|
||||
m_emitter->setGravity(CCPointMake(0,-10));
|
||||
m_emitter->setGravity(ccp(0,-10));
|
||||
|
||||
// speed of particles
|
||||
m_emitter->setSpeed(130);
|
||||
|
@ -459,7 +459,7 @@ void DemoRain::onEnter()
|
|||
m_background->addChild(m_emitter, 10);
|
||||
|
||||
CCPoint p = m_emitter->getPosition();
|
||||
m_emitter->setPosition( CCPointMake( p.x, p.y-100) );
|
||||
m_emitter->setPosition( ccp( p.x, p.y-100) );
|
||||
m_emitter->setLife(4);
|
||||
|
||||
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
|
||||
|
@ -497,7 +497,7 @@ void DemoModernArt::onEnter()
|
|||
m_emitter->setDuration(-1);
|
||||
|
||||
// gravity
|
||||
m_emitter->setGravity(CCPointMake(0,0));
|
||||
m_emitter->setGravity(ccp(0,0));
|
||||
|
||||
// angle
|
||||
m_emitter->setAngle(0);
|
||||
|
@ -516,7 +516,7 @@ void DemoModernArt::onEnter()
|
|||
m_emitter->setSpeedVar(10);
|
||||
|
||||
// emitter position
|
||||
m_emitter->setPosition( CCPointMake( s.width/2, s.height/2) );
|
||||
m_emitter->setPosition( ccp( s.width/2, s.height/2) );
|
||||
m_emitter->setPosVar(CCPointZero);
|
||||
|
||||
// life of particles
|
||||
|
@ -606,21 +606,21 @@ void ParallaxParticle::onEnter()
|
|||
CCSprite *p1 = CCSprite::create(s_back3);
|
||||
CCSprite *p2 = CCSprite::create(s_back3);
|
||||
|
||||
p->addChild( p1, 1, CCPointMake(0.5f,1), CCPointMake(0,250) );
|
||||
p->addChild(p2, 2, CCPointMake(1.5f,1), CCPointMake(0,50) );
|
||||
p->addChild( p1, 1, ccp(0.5f,1), ccp(0,250) );
|
||||
p->addChild(p2, 2, ccp(1.5f,1), ccp(0,50) );
|
||||
|
||||
m_emitter = CCParticleFlower::create();
|
||||
m_emitter->retain();
|
||||
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
|
||||
|
||||
p1->addChild(m_emitter, 10);
|
||||
m_emitter->setPosition( CCPointMake(250,200) );
|
||||
m_emitter->setPosition( ccp(250,200) );
|
||||
|
||||
CCParticleSun* par = CCParticleSun::create();
|
||||
p2->addChild(par, 10);
|
||||
par->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(4, CCPointMake(300,0));
|
||||
CCActionInterval* move = CCMoveBy::create(4, ccp(300,0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
CCFiniteTimeAction* seq = CCSequence::create( move, move_back, NULL);
|
||||
p->runAction(CCRepeatForever::create((CCActionInterval*)seq));
|
||||
|
@ -1077,11 +1077,11 @@ void ParticleDemo::onEnter(void)
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 28);
|
||||
addChild(label, 100, 1000);
|
||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
CCLabelTTF *sub = CCLabelTTF::create(subtitle().c_str(), "Arial", 16);
|
||||
addChild(sub, 100);
|
||||
sub->setPosition(CCPointMake(s.width/2, s.height-80));
|
||||
sub->setPosition(ccp(s.width/2, s.height-80));
|
||||
|
||||
|
||||
CCMenuItemImage* item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ParticleDemo::backCallback) );
|
||||
|
@ -1098,10 +1098,10 @@ void ParticleDemo::onEnter(void)
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, item4, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item4->setPosition( ccp( 0, 100) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item4->setPosition( ccp( VisibleRect::left().x, VisibleRect::bottom().y+ 100) );
|
||||
item4->setAnchorPoint( ccp(0,0) );
|
||||
|
||||
addChild( menu, 100 );
|
||||
|
@ -1222,7 +1222,7 @@ void ParticleDemo::setEmitterPosition()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
if (m_emitter != NULL)
|
||||
{
|
||||
m_emitter->setPosition( CCPointMake(s.width / 2, s.height / 2) );
|
||||
m_emitter->setPosition( ccp(s.width / 2, s.height / 2) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void PerformBasicLayer::onEnter()
|
|||
CCMenuItemFont::setFontSize(24);
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", this,
|
||||
menu_selector(PerformBasicLayer::toMainLayer));
|
||||
pMainItem->setPosition(ccp(s.width - 50, 25));
|
||||
pMainItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu* pMenu = CCMenu::create(pMainItem, NULL);
|
||||
pMenu->setPosition( CCPointZero );
|
||||
|
||||
|
@ -107,9 +107,9 @@ void PerformBasicLayer::onEnter()
|
|||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(PerformBasicLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(PerformBasicLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(PerformBasicLayer::nextCallback) );
|
||||
item1->setPosition( ccp( s.width/2 - 100,30) );
|
||||
item2->setPosition( ccp( s.width/2, 30) );
|
||||
item3->setPosition( ccp( s.width/2 + 100,30) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
pMenu->addChild(item1, kItemTagBasic);
|
||||
pMenu->addChild(item2, kItemTagBasic);
|
||||
|
|
|
@ -79,9 +79,9 @@ void RenderTextureTest::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ RenderTextureSave::RenderTextureSave()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, NULL);
|
||||
this->addChild(menu);
|
||||
menu->alignItemsVertically();
|
||||
menu->setPosition(ccp(s.width - 80, s.height - 30));
|
||||
menu->setPosition(ccp(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 30));
|
||||
}
|
||||
|
||||
string RenderTextureSave::title()
|
||||
|
|
|
@ -21,7 +21,7 @@ void TestLayer::onEnter()
|
|||
// NSLog( s );
|
||||
CCLabelTTF* label = CCLabelTTF::create("cocos2d", "Tahoma", 64);
|
||||
|
||||
label->setPosition( CCPointMake(x/2,y/2) );
|
||||
label->setPosition( ccp(x/2,y/2) );
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ void SpriteLayer::onEnter()
|
|||
spriteSister1->setScale(1.5f);
|
||||
spriteSister2->setScale(1.5f);
|
||||
|
||||
sprite->setPosition(CCPointMake(x/2,y/2));
|
||||
spriteSister1->setPosition(CCPointMake(40,y/2));
|
||||
spriteSister2->setPosition(CCPointMake(x-40,y/2));
|
||||
sprite->setPosition(ccp(x/2,y/2));
|
||||
spriteSister1->setPosition(ccp(40,y/2));
|
||||
spriteSister2->setPosition(ccp(x-40,y/2));
|
||||
|
||||
CCAction *rot = CCRotateBy::create(16, -3600);
|
||||
|
||||
|
@ -61,7 +61,7 @@ void SpriteLayer::onEnter()
|
|||
|
||||
sprite->runAction(rot);
|
||||
|
||||
CCActionInterval *jump1 = CCJumpBy::create(4, CCPointMake(-400,0), 100, 4);
|
||||
CCActionInterval *jump1 = CCJumpBy::create(4, ccp(-400,0), 100, 4);
|
||||
CCActionInterval *jump2 = jump1->reverse();
|
||||
|
||||
CCActionInterval *rot1 = CCRotateBy::create(4, 360*2);
|
||||
|
@ -96,14 +96,14 @@ void RotateWorldMainLayer::onEnter()
|
|||
CCNode* white = CCLayerColor::create(ccc4(255,255,255,255));
|
||||
|
||||
blue->setScale(0.5f);
|
||||
blue->setPosition(CCPointMake(-x/4,-y/4));
|
||||
blue->setPosition(ccp(-x/4,-y/4));
|
||||
blue->addChild( SpriteLayer::create() );
|
||||
|
||||
red->setScale(0.5f);
|
||||
red->setPosition(CCPointMake(x/4,-y/4));
|
||||
red->setPosition(ccp(x/4,-y/4));
|
||||
|
||||
green->setScale(0.5f);
|
||||
green->setPosition(CCPointMake(-x/4,y/4));
|
||||
green->setPosition(ccp(-x/4,y/4));
|
||||
green->addChild(TestLayer::create());
|
||||
|
||||
white->setScale(0.5f);
|
||||
|
|
|
@ -30,7 +30,7 @@ SceneTestLayer1::SceneTestLayer1()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCSprite* sprite = CCSprite::create(s_pPathGrossini);
|
||||
addChild(sprite);
|
||||
sprite->setPosition( CCPointMake(s.width-40, s.height/2) );
|
||||
sprite->setPosition( ccp(s.width-40, s.height/2) );
|
||||
CCActionInterval* rotate = CCRotateBy::create(2, 360);
|
||||
CCAction* repeat = CCRepeatForever::create(rotate);
|
||||
sprite->runAction(repeat);
|
||||
|
@ -115,7 +115,7 @@ SceneTestLayer2::SceneTestLayer2()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCSprite* sprite = CCSprite::create(s_pPathGrossini);
|
||||
addChild(sprite);
|
||||
sprite->setPosition( CCPointMake(s.width-40, s.height/2) );
|
||||
sprite->setPosition( ccp(s.width-40, s.height/2) );
|
||||
CCActionInterval* rotate = CCRotateBy::create(2, 360);
|
||||
CCAction* repeat = CCRepeatForever::create(rotate);
|
||||
sprite->runAction(repeat);
|
||||
|
@ -184,7 +184,7 @@ bool SceneTestLayer3::init()
|
|||
|
||||
CCSprite* sprite = CCSprite::create(s_pPathGrossini);
|
||||
addChild(sprite);
|
||||
sprite->setPosition( CCPointMake(s.width/2, 40) );
|
||||
sprite->setPosition( ccp(s.width/2, 40) );
|
||||
CCActionInterval* rotate = CCRotateBy::create(2, 360);
|
||||
CCAction* repeat = CCRepeatForever::create(rotate);
|
||||
sprite->runAction(repeat);
|
||||
|
|
|
@ -84,18 +84,16 @@ void SchedulerTestLayer::onEnter()
|
|||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label);
|
||||
label->setPosition(ccp(s.width/2, s.height-50));
|
||||
label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
std::string subTitle = subtitle();
|
||||
if(! subTitle.empty())
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(subTitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
l->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(SchedulerTestLayer::backCallback));
|
||||
|
@ -104,9 +102,9 @@ void SchedulerTestLayer::onEnter()
|
|||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp( s.width/2, item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
@ -250,12 +248,10 @@ SchedulerPauseResumeAll::~SchedulerPauseResumeAll()
|
|||
|
||||
void SchedulerPauseResumeAll::onEnter()
|
||||
{
|
||||
SchedulerTestLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
SchedulerTestLayer::onEnter();
|
||||
|
||||
CCSprite *sprite = CCSprite::create("Images/grossinis_sister1.png");
|
||||
sprite->setPosition(ccp(s.width/2, s.height/2));
|
||||
sprite->setPosition(VisibleRect::center());
|
||||
this->addChild(sprite);
|
||||
sprite->runAction(CCRepeatForever::create(CCRotateBy::create(3.0, 360)));
|
||||
|
||||
|
@ -1058,12 +1054,12 @@ void TwoSchedulers::onEnter()
|
|||
sliderCtl1 = sliderCtl();
|
||||
addChild(sliderCtl1);
|
||||
sliderCtl1->retain();
|
||||
sliderCtl1->setPosition(ccp(s.width / 4.0f, s.height - 20));
|
||||
sliderCtl1->setPosition(ccp(s.width / 4.0f, VisibleRect::top().y - 20));
|
||||
|
||||
sliderCtl2 = sliderCtl();
|
||||
addChild(sliderCtl2);
|
||||
sliderCtl2->retain();
|
||||
sliderCtl2->setPosition(ccp(s.width / 4.0f*3.0f, s.height-20));
|
||||
sliderCtl2->setPosition(ccp(s.width / 4.0f*3.0f, VisibleRect::top().y-20));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -85,9 +85,9 @@ bool ShaderTestDemo::init()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(ccp(0, 0));
|
||||
item1->setPosition(s.width/2- item2->getContentSize().width*2, item2->getContentSize().height/2);
|
||||
item2->setPosition(s.width/2, item2->getContentSize().height/2);
|
||||
item3->setPosition(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1 +1 @@
|
|||
df160f753d51ed74299d3410c03f775116c9ba27
|
||||
ce6df80aa5c6af9053f975aeb41f028bc9701f00
|
|
@ -138,9 +138,9 @@ void TextInputTest::onEnter()
|
|||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp( s.width/2 - 100,30));
|
||||
item2->setPosition(ccp( s.width/2, 30));
|
||||
item3->setPosition(ccp( s.width/2 + 100,30));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
|
|
@ -154,9 +154,9 @@ void TextureDemo::onEnter()
|
|||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp( s.width/2 - 100,30));
|
||||
item2->setPosition(ccp( s.width/2, 30));
|
||||
item3->setPosition(ccp( s.width/2 + 100,30));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo();
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ TextureCacheTest::TextureCacheTest()
|
|||
m_pLabelLoading = CCLabelTTF::create("loading...", "Arial", 15);
|
||||
m_pLabelPercent = CCLabelTTF::create("%0", "Arial", 15);
|
||||
|
||||
m_pLabelLoading->setPosition(CCPointMake(size.width / 2, size.height / 2 - 20));
|
||||
m_pLabelPercent->setPosition(CCPointMake(size.width / 2, size.height / 2 + 20));
|
||||
m_pLabelLoading->setPosition(ccp(size.width / 2, size.height / 2 - 20));
|
||||
m_pLabelPercent->setPosition(ccp(size.width / 2, size.height / 2 + 20));
|
||||
|
||||
this->addChild(m_pLabelLoading);
|
||||
this->addChild(m_pLabelPercent);
|
||||
|
@ -65,7 +65,7 @@ void TextureCacheTest::addSprite()
|
|||
// create sprites
|
||||
|
||||
CCSprite *bg = CCSprite::create("Images/HelloWorld.png");
|
||||
bg->setPosition(CCPointMake(size.width / 2, size.height / 2));
|
||||
bg->setPosition(ccp(size.width / 2, size.height / 2));
|
||||
|
||||
CCSprite *s1 = CCSprite::create("Images/grossini.png");
|
||||
CCSprite *s2 = CCSprite::create("Images/grossini_dance_01.png");
|
||||
|
@ -89,23 +89,23 @@ void TextureCacheTest::addSprite()
|
|||
CCSprite::create("Images/background3.png");
|
||||
CCSprite::create("Images/blocks.png");
|
||||
|
||||
s1->setPosition(CCPointMake(50, 50));
|
||||
s2->setPosition(CCPointMake(60, 50));
|
||||
s3->setPosition(CCPointMake(70, 50));
|
||||
s4->setPosition(CCPointMake(80, 50));
|
||||
s5->setPosition(CCPointMake(90, 50));
|
||||
s6->setPosition(CCPointMake(100, 50));
|
||||
s1->setPosition(ccp(50, 50));
|
||||
s2->setPosition(ccp(60, 50));
|
||||
s3->setPosition(ccp(70, 50));
|
||||
s4->setPosition(ccp(80, 50));
|
||||
s5->setPosition(ccp(90, 50));
|
||||
s6->setPosition(ccp(100, 50));
|
||||
|
||||
s7->setPosition(CCPointMake(50, 180));
|
||||
s8->setPosition(CCPointMake(60, 180));
|
||||
s9->setPosition(CCPointMake(70, 180));
|
||||
s10->setPosition(CCPointMake(80, 180));
|
||||
s11->setPosition(CCPointMake(90, 180));
|
||||
s12->setPosition(CCPointMake(100, 180));
|
||||
s7->setPosition(ccp(50, 180));
|
||||
s8->setPosition(ccp(60, 180));
|
||||
s9->setPosition(ccp(70, 180));
|
||||
s10->setPosition(ccp(80, 180));
|
||||
s11->setPosition(ccp(90, 180));
|
||||
s12->setPosition(ccp(100, 180));
|
||||
|
||||
s13->setPosition(CCPointMake(50, 270));
|
||||
s14->setPosition(CCPointMake(60, 270));
|
||||
s15->setPosition(CCPointMake(70, 270));
|
||||
s13->setPosition(ccp(50, 270));
|
||||
s14->setPosition(ccp(60, 270));
|
||||
s15->setPosition(ccp(70, 270));
|
||||
|
||||
this->addChild(bg);
|
||||
|
||||
|
|
|
@ -1456,9 +1456,9 @@ TileDemo::TileDemo(void)
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "Ball.h"
|
||||
#include "Paddle.h"
|
||||
#include "../VisibleRect.h"
|
||||
|
||||
Ball::Ball(void)
|
||||
{
|
||||
|
@ -25,18 +26,16 @@ Ball* Ball::ballWithTexture(CCTexture2D* aTexture)
|
|||
|
||||
void Ball::move(float delta)
|
||||
{
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
this->setPosition( ccpAdd(getPosition(), ccpMult(m_velocity, delta)) );
|
||||
|
||||
if (getPosition().x > size.width - radius())
|
||||
if (getPosition().x > VisibleRect::right().x - radius())
|
||||
{
|
||||
setPosition( ccp( size.width - radius(), getPosition().y) );
|
||||
setPosition( ccp( VisibleRect::right().x - radius(), getPosition().y) );
|
||||
m_velocity.x *= -1;
|
||||
}
|
||||
else if (getPosition().x < radius())
|
||||
else if (getPosition().x < VisibleRect::left().x + radius())
|
||||
{
|
||||
setPosition( ccp(radius(), getPosition().y) );
|
||||
setPosition( ccp(VisibleRect::left().x + radius(), getPosition().y) );
|
||||
m_velocity.x *= -1;
|
||||
}
|
||||
}
|
||||
|
@ -61,13 +60,13 @@ void Ball::collideWithPaddle(Paddle* paddle)
|
|||
|
||||
if (getPosition().y > midY && getPosition().y <= highY + radius())
|
||||
{
|
||||
setPosition( CCPointMake(getPosition().x, highY + radius()) );
|
||||
setPosition( ccp(getPosition().x, highY + radius()) );
|
||||
hit = true;
|
||||
angleOffset = (float)M_PI / 2;
|
||||
}
|
||||
else if (getPosition().y < midY && getPosition().y >= lowY - radius())
|
||||
{
|
||||
setPosition( CCPointMake(getPosition().x, lowY - radius()) );
|
||||
setPosition( ccp(getPosition().x, lowY - radius()) );
|
||||
hit = true;
|
||||
angleOffset = -(float)M_PI / 2;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ void Paddle::ccTouchMoved(CCTouch* touch, CCEvent* event)
|
|||
|
||||
CCPoint touchPoint = touch->getLocation();
|
||||
|
||||
setPosition( CCPointMake(touchPoint.x, getPosition().y) );
|
||||
setPosition( ccp(touchPoint.x, getPosition().y) );
|
||||
}
|
||||
|
||||
CCObject* Paddle::copyWithZone(CCZone *pZone)
|
||||
|
|
|
@ -42,12 +42,10 @@ void PongScene::MainMenuCallback(CCObject* pSender)
|
|||
//------------------------------------------------------------------
|
||||
PongLayer::PongLayer()
|
||||
{
|
||||
m_tWinSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
m_ballStartingVelocity = CCPointMake(20.0f, -100.0f);
|
||||
m_ballStartingVelocity = ccp(20.0f, -100.0f);
|
||||
|
||||
m_ball = Ball::ballWithTexture( CCTextureCache::sharedTextureCache()->addImage(s_Ball) );
|
||||
m_ball->setPosition( CCPointMake(m_tWinSize.width/2, m_tWinSize.height/2) );
|
||||
m_ball->setPosition( VisibleRect::center() );
|
||||
m_ball->setVelocity( m_ballStartingVelocity );
|
||||
addChild( m_ball );
|
||||
m_ball->retain();
|
||||
|
@ -57,19 +55,19 @@ PongLayer::PongLayer()
|
|||
CCArray *paddlesM = CCArray::createWithCapacity(4);
|
||||
|
||||
Paddle* paddle = Paddle::paddleWithTexture(paddleTexture);
|
||||
paddle->setPosition( CCPointMake(m_tWinSize.width/2, 15) );
|
||||
paddle->setPosition( ccp(VisibleRect::center().x, VisibleRect::bottom().y + 15) );
|
||||
paddlesM->addObject( paddle );
|
||||
|
||||
paddle = Paddle::paddleWithTexture( paddleTexture );
|
||||
paddle->setPosition( CCPointMake(m_tWinSize.width/2, m_tWinSize.height - kStatusBarHeight - 15) );
|
||||
paddle->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - kStatusBarHeight - 15) );
|
||||
paddlesM->addObject( paddle );
|
||||
|
||||
paddle = Paddle::paddleWithTexture( paddleTexture );
|
||||
paddle->setPosition( CCPointMake(m_tWinSize.width/2, 100) );
|
||||
paddle->setPosition( ccp(VisibleRect::center().x, VisibleRect::bottom().y + 100) );
|
||||
paddlesM->addObject( paddle );
|
||||
|
||||
paddle = Paddle::paddleWithTexture( paddleTexture );
|
||||
paddle->setPosition( CCPointMake(m_tWinSize.width/2, m_tWinSize.height - kStatusBarHeight - 100) );
|
||||
paddle->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - kStatusBarHeight - 100) );
|
||||
paddlesM->addObject( paddle );
|
||||
|
||||
m_paddles = (CCArray*)paddlesM->copy();
|
||||
|
@ -98,7 +96,7 @@ void PongLayer::resetAndScoreBallForPlayer(int player)
|
|||
{
|
||||
m_ballStartingVelocity = ccpMult(m_ballStartingVelocity, -1.1f);
|
||||
m_ball->setVelocity( m_ballStartingVelocity );
|
||||
m_ball->setPosition( CCPointMake(m_tWinSize.width/2, m_tWinSize.height/2) );
|
||||
m_ball->setPosition( VisibleRect::center() );
|
||||
|
||||
// TODO -- scoring
|
||||
}
|
||||
|
@ -119,9 +117,9 @@ void PongLayer::doStep(float delta)
|
|||
m_ball->collideWithPaddle( paddle );
|
||||
}
|
||||
|
||||
if (m_ball->getPosition().y > m_tWinSize.height - kStatusBarHeight + m_ball->radius())
|
||||
if (m_ball->getPosition().y > VisibleRect::top().y - kStatusBarHeight + m_ball->radius())
|
||||
resetAndScoreBallForPlayer( kLowPlayer );
|
||||
else if (m_ball->getPosition().y < -m_ball->radius())
|
||||
else if (m_ball->getPosition().y < VisibleRect::bottom().y-m_ball->radius())
|
||||
resetAndScoreBallForPlayer( kHighPlayer );
|
||||
m_ball->draw();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ class Ball;
|
|||
class PongLayer : public CCLayer
|
||||
{
|
||||
private:
|
||||
CCSize m_tWinSize;
|
||||
Ball* m_ball;
|
||||
CCArray* m_paddles;
|
||||
CCPoint m_ballStartingVelocity;
|
||||
|
|
|
@ -283,17 +283,17 @@ TestLayer1::TestLayer1(void)
|
|||
y = size.height;
|
||||
|
||||
CCSprite* bg1 = CCSprite::create(s_back1);
|
||||
bg1->setPosition( CCPointMake(size.width/2, size.height/2) );
|
||||
bg1->setPosition( ccp(size.width/2, size.height/2) );
|
||||
addChild(bg1, -1);
|
||||
|
||||
CCLabelTTF* title = CCLabelTTF::create( (transitions[s_nSceneIdx]).c_str(), "Thonburi", 32 );
|
||||
addChild(title);
|
||||
title->setColor( ccc3(255,32,32) );
|
||||
title->setPosition( CCPointMake(x/2, y-100) );
|
||||
title->setPosition( ccp(x/2, y-100) );
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create("SCENE 1", "Marker Felt", 38);
|
||||
label->setColor( ccc3(16,16,255));
|
||||
label->setPosition( CCPointMake(x/2,y/2));
|
||||
label->setPosition( ccp(x/2,y/2));
|
||||
addChild( label);
|
||||
|
||||
// menu
|
||||
|
@ -304,9 +304,9 @@ TestLayer1::TestLayer1(void)
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( size.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( size.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( size.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
|
@ -412,17 +412,17 @@ TestLayer2::TestLayer2()
|
|||
y = size.height;
|
||||
|
||||
CCSprite* bg1 = CCSprite::create(s_back2);
|
||||
bg1->setPosition( CCPointMake(size.width/2, size.height/2) );
|
||||
bg1->setPosition( ccp(size.width/2, size.height/2) );
|
||||
addChild(bg1, -1);
|
||||
|
||||
CCLabelTTF* title = CCLabelTTF::create((transitions[s_nSceneIdx]).c_str(), "Thonburi", 32 );
|
||||
addChild(title);
|
||||
title->setColor( ccc3(255,32,32) );
|
||||
title->setPosition( CCPointMake(x/2, y-100) );
|
||||
title->setPosition( ccp(x/2, y-100) );
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create("SCENE 2", "Marker Felt", 38);
|
||||
label->setColor( ccc3(16,16,255));
|
||||
label->setPosition( CCPointMake(x/2,y/2));
|
||||
label->setPosition( ccp(x/2,y/2));
|
||||
addChild( label);
|
||||
|
||||
// menu
|
||||
|
@ -433,9 +433,9 @@ TestLayer2::TestLayer2()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CCPointZero );
|
||||
item1->setPosition( ccp( size.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( size.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( size.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
#include "VisibleRect.h"
|
||||
|
||||
CCRect VisibleRect::s_visibleRect;
|
||||
|
||||
void VisibleRect::lazyInit()
|
||||
{
|
||||
if (s_visibleRect.size.width == 0.0f && s_visibleRect.size.height == 0.0f)
|
||||
{
|
||||
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
|
||||
s_visibleRect.origin = pEGLView->getVisibleOrigin();
|
||||
s_visibleRect.size = pEGLView->getVisibleSize();
|
||||
}
|
||||
}
|
||||
|
||||
CCRect VisibleRect::getVisibleRect()
|
||||
{
|
||||
lazyInit();
|
||||
return CCRectMake(s_visibleRect.origin.x, s_visibleRect.origin.y, s_visibleRect.size.width, s_visibleRect.size.height);
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::left()
|
||||
{
|
||||
lazyInit();
|
||||
return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::right()
|
||||
{
|
||||
lazyInit();
|
||||
return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::top()
|
||||
{
|
||||
lazyInit();
|
||||
return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::bottom()
|
||||
{
|
||||
lazyInit();
|
||||
return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y);
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::center()
|
||||
{
|
||||
lazyInit();
|
||||
return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::leftTop()
|
||||
{
|
||||
lazyInit();
|
||||
return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::rightTop()
|
||||
{
|
||||
lazyInit();
|
||||
return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::leftBottom()
|
||||
{
|
||||
lazyInit();
|
||||
return s_visibleRect.origin;
|
||||
}
|
||||
|
||||
CCPoint VisibleRect::rightBottom()
|
||||
{
|
||||
lazyInit();
|
||||
return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef __VISIBLERECT_H__
|
||||
#define __VISIBLERECT_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
USING_NS_CC;
|
||||
|
||||
class VisibleRect
|
||||
{
|
||||
public:
|
||||
static CCRect getVisibleRect();
|
||||
|
||||
static CCPoint left();
|
||||
static CCPoint right();
|
||||
static CCPoint top();
|
||||
static CCPoint bottom();
|
||||
static CCPoint center();
|
||||
static CCPoint leftTop();
|
||||
static CCPoint rightTop();
|
||||
static CCPoint leftBottom();
|
||||
static CCPoint rightBottom();
|
||||
private:
|
||||
static void lazyInit();
|
||||
static CCRect s_visibleRect;
|
||||
};
|
||||
|
||||
#endif /* __VISIBLERECT_H__ */
|
|
@ -81,9 +81,9 @@ void ZwoptexTest::onEnter()
|
|||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) );
|
||||
item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) );
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -135,10 +135,9 @@ TestController::TestController()
|
|||
// add close menu
|
||||
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(s_pPathClose, s_pPathClose, this, menu_selector(TestController::closeCallback) );
|
||||
CCMenu* pMenu =CCMenu::create(pCloseItem, NULL);
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
pMenu->setPosition( CCPointZero );
|
||||
pCloseItem->setPosition(CCPointMake( s.width - 30, s.height - 30));
|
||||
pCloseItem->setPosition(ccp( VisibleRect::right().x - 30, VisibleRect::top().y - 30));
|
||||
|
||||
// add menu items for tests
|
||||
m_pItemMenu = CCMenu::create();
|
||||
|
@ -152,10 +151,10 @@ TestController::TestController()
|
|||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestController::menuCallback));
|
||||
|
||||
m_pItemMenu->addChild(pMenuItem, i + 10000);
|
||||
pMenuItem->setPosition( CCPointMake( s.width / 2, (s.height - (i + 1) * LINE_SPACE) ));
|
||||
pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) ));
|
||||
}
|
||||
|
||||
m_pItemMenu->setContentSize(CCSizeMake(s.width, (TESTS_COUNT + 1) * (LINE_SPACE)));
|
||||
m_pItemMenu->setContentSize(CCSizeMake(VisibleRect::getVisibleRect().size.width, (TESTS_COUNT + 1) * (LINE_SPACE)));
|
||||
m_pItemMenu->setPosition(s_tCurPos);
|
||||
addChild(m_pItemMenu);
|
||||
|
||||
|
@ -210,16 +209,16 @@ void TestController::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
|
|||
|
||||
CCPoint curPos = m_pItemMenu->getPosition();
|
||||
CCPoint nextPos = ccp(curPos.x, curPos.y + nMoveY);
|
||||
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
if (nextPos.y < 0.0f)
|
||||
{
|
||||
m_pItemMenu->setPosition(CCPointZero);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextPos.y > ((TESTS_COUNT + 1)* LINE_SPACE - winSize.height))
|
||||
if (nextPos.y > ((TESTS_COUNT + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||
{
|
||||
m_pItemMenu->setPosition(ccp(0, ((TESTS_COUNT + 1)* LINE_SPACE - winSize.height)));
|
||||
m_pItemMenu->setPosition(ccp(0, ((TESTS_COUNT + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ void TestScene::onEnter()
|
|||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestScene::MainMenuCallback));
|
||||
|
||||
CCMenu* pMenu =CCMenu::create(pMenuItem, NULL);
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
pMenu->setPosition( CCPointZero );
|
||||
pMenuItem->setPosition( CCPointMake( s.width - 50, 25) );
|
||||
pMenuItem->setPosition( ccp( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _TEST_BASIC_H_
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "VisibleRect.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace std;
|
||||
|
|
|
@ -1 +1 @@
|
|||
ac3dd574a71d609ed13ae44389209e35f22d6392
|
||||
5982545917607b9c428c7256b3c983b0526804a5
|
|
@ -121,6 +121,7 @@ OBJECTS = ../Classes/AccelerometerTest/AccelerometerTest.o \
|
|||
../Classes/controller.o \
|
||||
../Classes/testBasic.o \
|
||||
../Classes/AppDelegate.o \
|
||||
../Classes/VisibleRect.o \
|
||||
./main.o
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
bbbb2450a8de63794b1d5e2b00341086f5aee574
|
||||
7150b3ae596f748ee383fb0fb7d59a8c317a7d08
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue