Merge pull request #11102 from WenhaiLin/v3-doxygen

[ci skip]Update comments
This commit is contained in:
minggo 2015-03-24 15:15:40 +08:00
commit 9cb02c800a
33 changed files with 597 additions and 362 deletions

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 Zynga Inc. Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 Zynga Inc. Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 Zynga Inc. Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 Zynga Inc. Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 Zynga Inc. Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 Zynga Inc. Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org

View File

@ -33,11 +33,9 @@
NS_CC_BEGIN NS_CC_BEGIN
/** /**
* @addtogroup GUI * @addtogroup _2d
* @{ * @{
* @addtogroup Label */
* @{
*/
/** /**
* @brief Possible GlyphCollection used by Label. * @brief Possible GlyphCollection used by Label.
@ -616,7 +614,6 @@ private:
// end group // end group
/// @} /// @}
/// @}
NS_CC_END NS_CC_END

View File

@ -2,7 +2,7 @@
Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc. Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -35,9 +35,7 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
/** /**
* @addtogroup GUI * @addtogroup _2d
* @{
* @addtogroup label
* @{ * @{
*/ */
@ -122,8 +120,7 @@ protected:
int _mapStartChar; int _mapStartChar;
}; };
// end of GUI group // end group
/// @}
/// @} /// @}

View File

@ -2,7 +2,7 @@
Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc. Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -42,14 +42,10 @@ NS_CC_BEGIN
class Label; class Label;
/** /**
* @addtogroup GUI * @addtogroup _2d
* @{
* @addtogroup label
* @{ * @{
*/ */
/** @brief LabelTTF is a subclass of TextureNode that knows how to render text labels /** @brief LabelTTF is a subclass of TextureNode that knows how to render text labels
* *
* All features from TextureNode are valid in LabelTTF * All features from TextureNode are valid in LabelTTF
@ -167,8 +163,7 @@ protected:
}; };
// end of GUI group // end of group
/// @}
/// @} /// @}
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic warning "-Wdeprecated-declarations" #pragma GCC diagnostic warning "-Wdeprecated-declarations"

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 Zynga Inc. Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -41,9 +41,9 @@
#endif // ERROR #endif // ERROR
/** /**
* @addtogroup Audio * @addtogroup core
* @{ * @{
*/ */
NS_CC_BEGIN NS_CC_BEGIN
namespace experimental{ namespace experimental{
@ -335,7 +335,9 @@ protected:
} }
NS_CC_END NS_CC_END
// end audio group
// end group
/// @} /// @}
#endif // __AUDIO_ENGINE_H_ #endif // __AUDIO_ENGINE_H_
#endif #endif

View File

@ -38,7 +38,7 @@ THE SOFTWARE.
#endif #endif
/** /**
* @addtogroup Audio * @addtogroup core
* @{ * @{
*/ */

View File

@ -1,6 +1,5 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2010 cocos2d-x.org Copyright (c) 2013-2015 Chukong Technologies Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -42,6 +41,15 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/**
* @addtogroup base
* @{
*/
/**
* @class AsyncTaskPool
* @brief This class allows to perform background operations without having to manipulate threads.
*/
class CC_DLL AsyncTaskPool class CC_DLL AsyncTaskPool
{ {
public: public:
@ -54,28 +62,32 @@ public:
TASK_OTHER, TASK_OTHER,
TASK_MAX_TYPE, TASK_MAX_TYPE,
}; };
/** /**
* get instance * Returns the shared instance of the async task pool.
*/ */
static AsyncTaskPool* getInstance(); static AsyncTaskPool* getInstance();
/** /**
* destroy instance * Destroys the async task pool.
*/ */
static void destoryInstance(); static void destoryInstance();
/** /**
* stop tasks * Stop tasks.
* @param type task type you want to stop *
* @param type Task type you want to stop.
*/ */
void stopTasks(TaskType type); void stopTasks(TaskType type);
/** /**
* enqueue a asynchronous task * Enqueue a asynchronous task.
*
* @param type task type is io task, network task or others, each type of task has a thread to deal with it. * @param type task type is io task, network task or others, each type of task has a thread to deal with it.
* @param callback callback when the task is finished. The callback is called in the main thread instead of task thread * @param callback callback when the task is finished. The callback is called in the main thread instead of task thread.
* @param callbackParam parameter used by the callback * @param callbackParam parameter used by the callback.
* @param f task can be lambda function * @param f task can be lambda function.
* @param args task parameters * @param args task parameters.
*/ */
template<class F> template<class F>
inline void enqueue(TaskType type, const TaskCallBack& callback, void* callbackParam, F&& f); inline void enqueue(TaskType type, const TaskCallBack& callback, void* callbackParam, F&& f);
@ -201,5 +213,8 @@ inline void AsyncTaskPool::enqueue(AsyncTaskPool::TaskType type, const TaskCallB
threadTask.enqueue(callback, callbackParam, f); threadTask.enqueue(callback, callbackParam, f);
} }
// end group
/// @}
NS_CC_END NS_CC_END
#endif //__CCSYNC_TASK_POOL_H_ #endif //__CCSYNC_TASK_POOL_H_

View File

@ -1,6 +1,5 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 cocos2d-x.org Copyright (c) 2014-2015 Chukong Technologies Inc.
Copyright (c) 2014 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -38,6 +37,11 @@ class EventListenerController;
class EventController; class EventController;
class EventDispatcher; class EventDispatcher;
/**
* @addtogroup base
* @{
*/
/** /**
* @class Controller * @class Controller
* @brief A Controller object represents a connected physical game controller. * @brief A Controller object represents a connected physical game controller.
@ -209,6 +213,8 @@ private:
friend class EventListenerController; friend class EventListenerController;
}; };
// end group
/// @}
NS_CC_END NS_CC_END

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Copyright (c) 2013-2015 Chukong Technologies
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -40,33 +40,48 @@
NS_CC_BEGIN NS_CC_BEGIN
/** /**
* @addtogroup data_structures * @addtogroup base
* @{ * @{
*/ */
/**
* Similar to std::unordered_map, but it will manage reference count automatically internally.
* Which means it will invoke Ref::retain() when adding an element, and invoke Ref::release() when removing an element.
* @warn The element should be `Ref` or its sub-class.
* @lua NA
*/
template <class K, class V> template <class K, class V>
class Map class Map
{ {
public: public:
// ------------------------------------------
// Iterators
// ------------------------------------------
#if USE_STD_UNORDERED_MAP #if USE_STD_UNORDERED_MAP
typedef std::unordered_map<K, V> RefMap; typedef std::unordered_map<K, V> RefMap;
#else #else
typedef std::map<K, V> RefMap; typedef std::map<K, V> RefMap;
#endif #endif
// ------------------------------------------
// Iterators
// ------------------------------------------
/** Iterator, can be used to loop the Map. */
typedef typename RefMap::iterator iterator; typedef typename RefMap::iterator iterator;
/** Const iterator, can be used to loop the Map. */
typedef typename RefMap::const_iterator const_iterator; typedef typename RefMap::const_iterator const_iterator;
/** Return iterator to beginning. */
iterator begin() { return _data.begin(); } iterator begin() { return _data.begin(); }
/** Return const_iterator to beginning. */
const_iterator begin() const { return _data.begin(); } const_iterator begin() const { return _data.begin(); }
/** Return iterator to end.*/
iterator end() { return _data.end(); } iterator end() { return _data.end(); }
/** Return const_iterator to end.*/
const_iterator end() const { return _data.end(); } const_iterator end() const { return _data.end(); }
/** Return const_iterator to beginning.*/
const_iterator cbegin() const { return _data.cbegin(); } const_iterator cbegin() const { return _data.cbegin(); }
/** Return const_iterator to end.*/
const_iterator cend() const { return _data.cend(); } const_iterator cend() const { return _data.cend(); }
/** Default constructor */ /** Default constructor */
@ -77,7 +92,7 @@ public:
CCLOGINFO("In the default constructor of Map!"); CCLOGINFO("In the default constructor of Map!");
} }
/** Contructor with capacity */ /** Constructor with capacity. */
explicit Map<K, V>(ssize_t capacity) explicit Map<K, V>(ssize_t capacity)
: _data() : _data()
{ {
@ -86,7 +101,7 @@ public:
_data.reserve(capacity); _data.reserve(capacity);
} }
/** Copy constructor */ /** Copy constructor. */
Map<K, V>(const Map<K, V>& other) Map<K, V>(const Map<K, V>& other)
{ {
static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for cocos2d::Map<K, V>!"); static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for cocos2d::Map<K, V>!");
@ -95,7 +110,7 @@ public:
addRefForAllObjects(); addRefForAllObjects();
} }
/** Move constructor */ /** Move constructor. */
Map<K, V>(Map<K, V>&& other) Map<K, V>(Map<K, V>&& other)
{ {
static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for cocos2d::Map<K, V>!"); static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for cocos2d::Map<K, V>!");
@ -103,7 +118,8 @@ public:
_data = std::move(other._data); _data = std::move(other._data);
} }
/** Destructor /**
* Destructor.
* It will release all objects in map. * It will release all objects in map.
*/ */
~Map<K, V>() ~Map<K, V>()
@ -112,7 +128,7 @@ public:
clear(); clear();
} }
/** Sets capacity of the map */ /** Sets capacity of the map. */
void reserve(ssize_t capacity) void reserve(ssize_t capacity)
{ {
#if USE_STD_UNORDERED_MAP #if USE_STD_UNORDERED_MAP
@ -156,7 +172,8 @@ public:
return _data.size(); return _data.size();
} }
/** Returns a bool value indicating whether the map container is empty, i.e. whether its size is 0. /**
* Returns a bool value indicating whether the map container is empty, i.e. whether its size is 0.
* @note This function does not modify the content of the container in any way. * @note This function does not modify the content of the container in any way.
* To clear the content of an array object, member function unordered_map::clear exists. * To clear the content of an array object, member function unordered_map::clear exists.
*/ */
@ -165,7 +182,7 @@ public:
return _data.empty(); return _data.empty();
} }
/** Returns all keys in the map */ /** Returns all keys in the map. */
std::vector<K> keys() const std::vector<K> keys() const
{ {
std::vector<K> keys; std::vector<K> keys;
@ -182,7 +199,7 @@ public:
return keys; return keys;
} }
/** Returns all keys that matches the object */ /** Returns all keys that matches the object. */
std::vector<K> keys(V object) const std::vector<K> keys(V object) const
{ {
std::vector<K> keys; std::vector<K> keys;
@ -205,7 +222,9 @@ public:
return keys; return keys;
} }
/** @brief Returns a reference to the mapped value of the element with key k in the map. /**
* Returns a reference to the mapped value of the element with key k in the map.
*
* @note If key does not match the key of any element in the container, the function return nullptr. * @note If key does not match the key of any element in the container, the function return nullptr.
* @param key Key value of the element whose mapped value is accessed. * @param key Key value of the element whose mapped value is accessed.
* Member type K is the keys for the elements in the container. defined in Map<K, V> as an alias of its first template parameter (Key). * Member type K is the keys for the elements in the container. defined in Map<K, V> as an alias of its first template parameter (Key).
@ -226,12 +245,13 @@ public:
return nullptr; return nullptr;
} }
/** @brief Searches the container for an element with 'key' as key and returns an iterator to it if found, /**
* Searches the container for an element with 'key' as key and returns an iterator to it if found,
* otherwise it returns an iterator to Map<K, V>::end (the element past the end of the container). * otherwise it returns an iterator to Map<K, V>::end (the element past the end of the container).
*
* @param key Key to be searched for. * @param key Key to be searched for.
* Member type 'K' is the type of the keys for the elements in the container, * Member type 'K' is the type of the keys for the elements in the container,
* defined in Map<K, V> as an alias of its first template parameter (Key). * defined in Map<K, V> as an alias of its first template parameter (Key).
*
*/ */
const_iterator find(const K& key) const const_iterator find(const K& key) const
{ {
@ -243,7 +263,9 @@ public:
return _data.find(key); return _data.find(key);
} }
/** @brief Inserts new elements in the map. /**
* Inserts new elements in the map.
*
* @note If the container has already contained the key, this function will erase the old pair(key, object) and insert the new pair. * @note If the container has already contained the key, this function will erase the old pair(key, object) and insert the new pair.
* @param key The key to be inserted. * @param key The key to be inserted.
* @param object The object to be inserted. * @param object The object to be inserted.
@ -256,7 +278,9 @@ public:
object->retain(); object->retain();
} }
/** @brief Removes an element with an iterator from the Map<K, V> container. /**
* Removes an element with an iterator from the Map<K, V> container.
*
* @param position Iterator pointing to a single element to be removed from the Map<K, V>. * @param position Iterator pointing to a single element to be removed from the Map<K, V>.
* Member type const_iterator is a forward iterator type. * Member type const_iterator is a forward iterator type.
*/ */
@ -267,7 +291,9 @@ public:
return _data.erase(position); return _data.erase(position);
} }
/** @brief Removes an element with an iterator from the Map<K, V> container. /**
* Removes an element with an iterator from the Map<K, V> container.
*
* @param k Key of the element to be erased. * @param k Key of the element to be erased.
* Member type 'K' is the type of the keys for the elements in the container, * Member type 'K' is the type of the keys for the elements in the container,
* defined in Map<K, V> as an alias of its first template parameter (Key). * defined in Map<K, V> as an alias of its first template parameter (Key).
@ -285,7 +311,9 @@ public:
return 0; return 0;
} }
/** @brief Removes some elements with a vector which contains keys in the map. /**
* Removes some elements with a vector which contains keys in the map.
*
* @param keys Keys of elements to be erased. * @param keys Keys of elements to be erased.
*/ */
void erase(const std::vector<K>& keys) void erase(const std::vector<K>& keys)
@ -295,7 +323,8 @@ public:
} }
} }
/** All the elements in the Map<K,V> container are dropped: /**
* All the elements in the Map<K,V> container are dropped:
* their reference count will be decreased, and they are removed from the container, * their reference count will be decreased, and they are removed from the container,
* leaving it with a size of 0. * leaving it with a size of 0.
*/ */
@ -309,7 +338,8 @@ public:
_data.clear(); _data.clear();
} }
/** @brief Gets a random object in the map /**
* Gets a random object in the map.
* @return Returns the random object if the map isn't empty, otherwise it returns nullptr. * @return Returns the random object if the map isn't empty, otherwise it returns nullptr.
*/ */
V getRandomObject() const V getRandomObject() const
@ -349,7 +379,7 @@ public:
// return _data.at(key); // return _data.at(key);
// } // }
/** Copy assignment operator */ /** Copy assignment operator. */
Map<K, V>& operator= ( const Map<K, V>& other ) Map<K, V>& operator= ( const Map<K, V>& other )
{ {
if (this != &other) { if (this != &other) {
@ -361,7 +391,7 @@ public:
return *this; return *this;
} }
/** Move assignment operator */ /** Move assignment operator. */
Map<K, V>& operator= ( Map<K, V>&& other ) Map<K, V>& operator= ( Map<K, V>&& other )
{ {
if (this != &other) { if (this != &other) {
@ -386,7 +416,7 @@ protected:
RefMap _data; RefMap _data;
}; };
// end of data_structure group // end group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -49,7 +49,7 @@ public:
// Iterators // Iterators
// ------------------------------------------ // ------------------------------------------
/** Iterator, can be uesed to loop the Vector. */ /** Iterator, can be used to loop the Vector. */
typedef typename std::vector<T>::iterator iterator; typedef typename std::vector<T>::iterator iterator;
/** Const iterator, can be used to loop the Vector. */ /** Const iterator, can be used to loop the Vector. */
typedef typename std::vector<T>::const_iterator const_iterator; typedef typename std::vector<T>::const_iterator const_iterator;

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -37,122 +37,124 @@ THE SOFTWARE.
#include "platform/CCStdC.h" #include "platform/CCStdC.h"
#endif #endif
/**
* @addtogroup base
* @{
*/
namespace cocos2d namespace cocos2d
{ {
#ifndef _unz64_H #ifndef _unz64_H
typedef struct unz_file_info_s unz_file_info; typedef struct unz_file_info_s unz_file_info;
#endif #endif
/* XXX: pragma pack ??? */ /** XXX: pragma pack ???
/** @struct CCZHeader * @struct CCZHeader
*/ */
struct CCZHeader { struct CCZHeader {
unsigned char sig[4]; // signature. Should be 'CCZ!' 4 bytes unsigned char sig[4]; /** Signature. Should be 'CCZ!' 4 bytes. */
unsigned short compression_type; // should 0 unsigned short compression_type; /** Should be 0. */
unsigned short version; // should be 2 (although version type==1 is also supported) unsigned short version; /** Should be 2 (although version type==1 is also supported). */
unsigned int reserved; // Reserved for users. unsigned int reserved; /** Reserved for users. */
unsigned int len; // size of the uncompressed file unsigned int len; /** Size of the uncompressed file. */
}; };
enum { enum {
CCZ_COMPRESSION_ZLIB, // zlib format. CCZ_COMPRESSION_ZLIB, /** zlib format. */
CCZ_COMPRESSION_BZIP2, // bzip2 format (not supported yet) CCZ_COMPRESSION_BZIP2, /** bzip2 format (not supported yet). */
CCZ_COMPRESSION_GZIP, // gzip format (not supported yet) CCZ_COMPRESSION_GZIP, /** gzip format (not supported yet). */
CCZ_COMPRESSION_NONE, // plain (not supported yet) CCZ_COMPRESSION_NONE, /** plain (not supported yet). */
}; };
class CC_DLL ZipUtils class CC_DLL ZipUtils
{ {
public: public:
/** /**
* Inflates either zlib or gzip deflated memory. The inflated memory is * Inflates either zlib or gzip deflated memory. The inflated memory is expected to be freed by the caller.
* expected to be freed by the caller.
* *
* It will allocate 256k for the destination buffer. If it is not enough it will multiply the previous buffer size per 2, until there is enough memory. * It will allocate 256k for the destination buffer. If it is not enough it will multiply the previous buffer size per 2, until there is enough memory.
* @returns the length of the deflated buffer
* *
@since v0.8.1 * @return The length of the deflated buffer.
* @since v0.8.1
*/ */
CC_DEPRECATED_ATTRIBUTE static ssize_t ccInflateMemory(unsigned char *in, ssize_t inLength, unsigned char **out) { return inflateMemory(in, inLength, out); } CC_DEPRECATED_ATTRIBUTE static ssize_t ccInflateMemory(unsigned char *in, ssize_t inLength, unsigned char **out) { return inflateMemory(in, inLength, out); }
static ssize_t inflateMemory(unsigned char *in, ssize_t inLength, unsigned char **out); static ssize_t inflateMemory(unsigned char *in, ssize_t inLength, unsigned char **out);
/** /**
* Inflates either zlib or gzip deflated memory. The inflated memory is * Inflates either zlib or gzip deflated memory. The inflated memory is expected to be freed by the caller.
* expected to be freed by the caller.
* *
* outLenghtHint is assumed to be the needed room to allocate the inflated buffer. * @param outLenghtHint It is assumed to be the needed room to allocate the inflated buffer.
* *
* @returns the length of the deflated buffer * @return The length of the deflated buffer.
* * @since v1.0.0
@since v1.0.0
*/ */
CC_DEPRECATED_ATTRIBUTE static ssize_t ccInflateMemoryWithHint(unsigned char *in, ssize_t inLength, unsigned char **out, ssize_t outLengthHint) { return inflateMemoryWithHint(in, inLength, out, outLengthHint); } CC_DEPRECATED_ATTRIBUTE static ssize_t ccInflateMemoryWithHint(unsigned char *in, ssize_t inLength, unsigned char **out, ssize_t outLengthHint) { return inflateMemoryWithHint(in, inLength, out, outLengthHint); }
static ssize_t inflateMemoryWithHint(unsigned char *in, ssize_t inLength, unsigned char **out, ssize_t outLengthHint); static ssize_t inflateMemoryWithHint(unsigned char *in, ssize_t inLength, unsigned char **out, ssize_t outLengthHint);
/** inflates a GZip file into memory /**
* * Inflates a GZip file into memory.
* @returns the length of the deflated buffer
* *
* @return The length of the deflated buffer.
* @since v0.99.5 * @since v0.99.5
*/ */
CC_DEPRECATED_ATTRIBUTE static int ccInflateGZipFile(const char *filename, unsigned char **out) { return inflateGZipFile(filename, out); } CC_DEPRECATED_ATTRIBUTE static int ccInflateGZipFile(const char *filename, unsigned char **out) { return inflateGZipFile(filename, out); }
static int inflateGZipFile(const char *filename, unsigned char **out); static int inflateGZipFile(const char *filename, unsigned char **out);
/** test a file is a GZip format file or not /**
* * Test a file is a GZip format file or not.
* @returns true is a GZip format file. false is not
* *
* @return True is a GZip format file. false is not.
* @since v3.0 * @since v3.0
*/ */
CC_DEPRECATED_ATTRIBUTE static bool ccIsGZipFile(const char *filename) { return isGZipFile(filename); } CC_DEPRECATED_ATTRIBUTE static bool ccIsGZipFile(const char *filename) { return isGZipFile(filename); }
static bool isGZipFile(const char *filename); static bool isGZipFile(const char *filename);
/** test the buffer is GZip format or not /**
* * Test the buffer is GZip format or not.
* @returns true is GZip format. false is not
* *
* @return True is GZip format. false is not.
* @since v3.0 * @since v3.0
*/ */
CC_DEPRECATED_ATTRIBUTE static bool ccIsGZipBuffer(const unsigned char *buffer, ssize_t len) { return isGZipBuffer(buffer, len); } CC_DEPRECATED_ATTRIBUTE static bool ccIsGZipBuffer(const unsigned char *buffer, ssize_t len) { return isGZipBuffer(buffer, len); }
static bool isGZipBuffer(const unsigned char *buffer, ssize_t len); static bool isGZipBuffer(const unsigned char *buffer, ssize_t len);
/** inflates a CCZ file into memory /**
* * Inflates a CCZ file into memory.
* @returns the length of the deflated buffer
* *
* @return The length of the deflated buffer.
* @since v0.99.5 * @since v0.99.5
*/ */
CC_DEPRECATED_ATTRIBUTE static int ccInflateCCZFile(const char *filename, unsigned char **out) { return inflateCCZFile(filename, out); } CC_DEPRECATED_ATTRIBUTE static int ccInflateCCZFile(const char *filename, unsigned char **out) { return inflateCCZFile(filename, out); }
static int inflateCCZFile(const char *filename, unsigned char **out); static int inflateCCZFile(const char *filename, unsigned char **out);
/** inflates a buffer with CCZ format into memory /**
* * Inflates a buffer with CCZ format into memory.
* @returns the length of the deflated buffer
* *
* @return The length of the deflated buffer.
* @since v3.0 * @since v3.0
*/ */
CC_DEPRECATED_ATTRIBUTE static int ccInflateCCZBuffer(const unsigned char *buffer, ssize_t len, unsigned char **out) { return inflateCCZBuffer(buffer, len, out); } CC_DEPRECATED_ATTRIBUTE static int ccInflateCCZBuffer(const unsigned char *buffer, ssize_t len, unsigned char **out) { return inflateCCZBuffer(buffer, len, out); }
static int inflateCCZBuffer(const unsigned char *buffer, ssize_t len, unsigned char **out); static int inflateCCZBuffer(const unsigned char *buffer, ssize_t len, unsigned char **out);
/** test a file is a CCZ format file or not /**
* * Test a file is a CCZ format file or not.
* @returns true is a CCZ format file. false is not
* *
* @return True is a CCZ format file. false is not.
* @since v3.0 * @since v3.0
*/ */
CC_DEPRECATED_ATTRIBUTE static bool ccIsCCZFile(const char *filename) { return isCCZFile(filename); } CC_DEPRECATED_ATTRIBUTE static bool ccIsCCZFile(const char *filename) { return isCCZFile(filename); }
static bool isCCZFile(const char *filename); static bool isCCZFile(const char *filename);
/** test the buffer is CCZ format or not /**
* * Test the buffer is CCZ format or not.
* @returns true is CCZ format. false is not
* *
* @return True is CCZ format. false is not.
* @since v3.0 * @since v3.0
*/ */
CC_DEPRECATED_ATTRIBUTE static bool ccIsCCZBuffer(const unsigned char *buffer, ssize_t len) { return isCCZBuffer(buffer, len); } CC_DEPRECATED_ATTRIBUTE static bool ccIsCCZBuffer(const unsigned char *buffer, ssize_t len) { return isCCZBuffer(buffer, len); }
static bool isCCZBuffer(const unsigned char *buffer, ssize_t len); static bool isCCZBuffer(const unsigned char *buffer, ssize_t len);
/** Sets the pvr.ccz encryption key parts separately for added /**
* security. * Sets the pvr.ccz encryption key parts separately for added security.
* *
* Example: If the key used to encrypt the pvr.ccz file is * Example: If the key used to encrypt the pvr.ccz file is
* 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function 4 * 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function 4
@ -163,24 +165,24 @@ typedef struct unz_file_info_s unz_file_info;
* ZipUtils::setPvrEncryptionKeyPart(2, 0xcccccccc); * ZipUtils::setPvrEncryptionKeyPart(2, 0xcccccccc);
* ZipUtils::setPvrEncryptionKeyPart(3, 0xdddddddd); * ZipUtils::setPvrEncryptionKeyPart(3, 0xdddddddd);
* *
* Splitting the key into 4 parts and calling the function * Splitting the key into 4 parts and calling the function from 4 different source
* from 4 different source files increases the difficulty to * files increases the difficulty to reverse engineer the encryption key.
* reverse engineer the encryption key. Be aware that encrpytion * Be aware that encrpytion is *never* 100% secure and the key code
* is *never* 100% secure and the key code can be cracked by * can be cracked by knowledgable persons.
* knowledgable persons.
* *
* IMPORTANT: Be sure to call setPvrEncryptionKey or * IMPORTANT: Be sure to call setPvrEncryptionKey or
* setPvrEncryptionKeyPart with all of the key parts *before* loading * setPvrEncryptionKeyPart with all of the key parts *before* loading
* the spritesheet or decryption will fail and the spritesheet * the sprite sheet or decryption will fail and the sprite sheet
* will fail to load. * will fail to load.
* *
* @param index part of the key [0..3] * @param index Part of the key [0..3].
* @param value value of the key part * @param value Value of the key part.
*/ */
CC_DEPRECATED_ATTRIBUTE static void ccSetPvrEncryptionKeyPart(int index, unsigned int value) { setPvrEncryptionKeyPart(index, value); } CC_DEPRECATED_ATTRIBUTE static void ccSetPvrEncryptionKeyPart(int index, unsigned int value) { setPvrEncryptionKeyPart(index, value); }
static void setPvrEncryptionKeyPart(int index, unsigned int value); static void setPvrEncryptionKeyPart(int index, unsigned int value);
/** Sets the pvr.ccz encryption key. /**
* Sets the pvr.ccz encryption key.
* *
* Example: If the key used to encrypt the pvr.ccz file is * Example: If the key used to encrypt the pvr.ccz file is
* 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function with * 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function with
@ -188,19 +190,17 @@ typedef struct unz_file_info_s unz_file_info;
* *
* ZipUtils::setPvrEncryptionKey(0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd); * ZipUtils::setPvrEncryptionKey(0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd);
* *
* Note that using this function makes it easier to reverse engineer and * Note that using this function makes it easier to reverse engineer and discover
* discover the complete key because the key parts are present in one * the complete key because the key parts are present in one function call.
* function call.
* *
* IMPORTANT: Be sure to call setPvrEncryptionKey or * IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart
* setPvrEncryptionKeyPart with all of the key parts *before* loading * with all of the key parts *before* loading the spritesheet or decryption
* the spritesheet or decryption will fail and the spritesheet * will fail and the sprite sheet will fail to load.
* will fail to load.
* *
* @param keyPart1 the key value part 1. * @param keyPart1 The key value part 1.
* @param keyPart2 the key value part 2. * @param keyPart2 The key value part 2.
* @param keyPart3 the key value part 3. * @param keyPart3 The key value part 3.
* @param keyPart4 the key value part 4. * @param keyPart4 The key value part 4.
*/ */
CC_DEPRECATED_ATTRIBUTE static void ccSetPvrEncryptionKey(unsigned int keyPart1, unsigned int keyPart2, unsigned int keyPart3, unsigned int keyPart4) { setPvrEncryptionKey(keyPart1, keyPart2, keyPart3, keyPart4); } CC_DEPRECATED_ATTRIBUTE static void ccSetPvrEncryptionKey(unsigned int keyPart1, unsigned int keyPart2, unsigned int keyPart3, unsigned int keyPart4) { setPvrEncryptionKey(keyPart1, keyPart2, keyPart3, keyPart4); }
static void setPvrEncryptionKey(unsigned int keyPart1, unsigned int keyPart2, unsigned int keyPart3, unsigned int keyPart4); static void setPvrEncryptionKey(unsigned int keyPart1, unsigned int keyPart2, unsigned int keyPart3, unsigned int keyPart4);
@ -290,5 +290,9 @@ typedef struct unz_file_info_s unz_file_info;
ZipFilePrivate *_data; ZipFilePrivate *_data;
}; };
} // end of namespace cocos2d } // end of namespace cocos2d
// end group
/// @}
#endif // __SUPPORT_ZIPUTILS_H__ #endif // __SUPPORT_ZIPUTILS_H__

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_BASE_H
#define CC_ALLOCATOR_BASE_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -27,11 +23,17 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_BASE_H
#define CC_ALLOCATOR_BASE_H
/// @cond
#include <string> #include <string>
#include "platform/CCPlatformMacros.h" #include "platform/CCPlatformMacros.h"
#include "base/allocator/CCAllocatorMacros.h" #include "base/allocator/CCAllocatorMacros.h"
NS_CC_BEGIN NS_CC_BEGIN
NS_CC_ALLOCATOR_BEGIN NS_CC_ALLOCATOR_BEGIN
@ -110,4 +112,6 @@ public:
NS_CC_ALLOCATOR_END NS_CC_ALLOCATOR_END
NS_CC_END NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_BASE_H #endif//CC_ALLOCATOR_BASE_H

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_DIAGNOSTICS_H
#define CC_ALLOCATOR_DIAGNOSTICS_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_DIAGNOSTICS_H
#define CC_ALLOCATOR_DIAGNOSTICS_H
/// @cond
#include <unordered_set> #include <unordered_set>
#include "base/allocator/CCAllocatorMacros.h" #include "base/allocator/CCAllocatorMacros.h"
@ -58,4 +58,6 @@ protected:
NS_CC_ALLOCATOR_END NS_CC_ALLOCATOR_END
NS_CC_END NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_DIAGNOSTICS_H #endif//CC_ALLOCATOR_DIAGNOSTICS_H

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_GLOBAL_H
#define CC_ALLOCATOR_GLOBAL_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -27,16 +23,22 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_GLOBAL_H
#define CC_ALLOCATOR_GLOBAL_H
/// @cond
#include "base/allocator/CCAllocatorMacros.h" #include "base/allocator/CCAllocatorMacros.h"
#include "base/allocator/CCAllocatorStrategyDefault.h" #include "base/allocator/CCAllocatorStrategyDefault.h"
NS_CC_BEGIN NS_CC_BEGIN
NS_CC_ALLOCATOR_BEGIN NS_CC_ALLOCATOR_BEGIN
// @brief Make visible at the global scope. /** Make visible at the global scope.*/
extern CC_ALLOCATOR_GLOBAL ccAllocatorGlobal; extern CC_ALLOCATOR_GLOBAL ccAllocatorGlobal;
NS_CC_ALLOCATOR_END NS_CC_ALLOCATOR_END
NS_CC_END NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_GLOBAL_H #endif//CC_ALLOCATOR_GLOBAL_H

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_MACROS_H
#define CC_ALLOCATOR_MACROS_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_MACROS_H
#define CC_ALLOCATOR_MACROS_H
/// @cond
#include "base/ccConfig.h" #include "base/ccConfig.h"
#include "platform/CCPlatformMacros.h" #include "platform/CCPlatformMacros.h"
@ -127,4 +127,6 @@
} \ } \
} }
/// @endcond
#endif//CC_ALLOCATOR_MACROS_H #endif//CC_ALLOCATOR_MACROS_H

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_MUTEX_H
#define CC_ALLOCATOR_MUTEX_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_MUTEX_H
#define CC_ALLOCATOR_MUTEX_H
/// @cond
#include "platform/CCPlatformMacros.h" #include "platform/CCPlatformMacros.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX #if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
@ -121,4 +121,6 @@ struct lockless_semantics
NS_CC_ALLOCATOR_END NS_CC_ALLOCATOR_END
NS_CC_END NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_MUTEX_H #endif//CC_ALLOCATOR_MUTEX_H

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_STRATEGY_DEFAULT_H
#define CC_ALLOCATOR_STRATEGY_DEFAULT_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_STRATEGY_DEFAULT_H
#define CC_ALLOCATOR_STRATEGY_DEFAULT_H
/// @cond
#include "base/allocator/CCAllocatorMacros.h" #include "base/allocator/CCAllocatorMacros.h"
#include "base/allocator/CCAllocatorBase.h" #include "base/allocator/CCAllocatorBase.h"
@ -55,4 +55,6 @@ public:
NS_CC_ALLOCATOR_END NS_CC_ALLOCATOR_END
NS_CC_END NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_STRATEGY_DEFAULT_H #endif//CC_ALLOCATOR_STRATEGY_DEFAULT_H

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_STRATEGY_FIXED_BLOCK_H
#define CC_ALLOCATOR_STRATEGY_FIXED_BLOCK_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_STRATEGY_FIXED_BLOCK_H
#define CC_ALLOCATOR_STRATEGY_FIXED_BLOCK_H
/// @cond
/**************************************************************************** /****************************************************************************
WARNING! WARNING!
Do not use Console::log or any other methods that use NEW inside of this Do not use Console::log or any other methods that use NEW inside of this
@ -273,4 +273,6 @@ protected:
NS_CC_ALLOCATOR_END NS_CC_ALLOCATOR_END
NS_CC_END NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_STRATEGY_FIXED_BLOCK_H #endif//CC_ALLOCATOR_STRATEGY_FIXED_BLOCK_H

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_STRATEGY_GLOBAL_SMALL_BLOCK_H
#define CC_ALLOCATOR_STRATEGY_GLOBAL_SMALL_BLOCK_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_STRATEGY_GLOBAL_SMALL_BLOCK_H
#define CC_ALLOCATOR_STRATEGY_GLOBAL_SMALL_BLOCK_H
/// @cond
/**************************************************************************** /****************************************************************************
WARNING! WARNING!
Do not use Console::log or any other methods that use NEW inside of this Do not use Console::log or any other methods that use NEW inside of this
@ -315,4 +315,6 @@ protected:
NS_CC_ALLOCATOR_END NS_CC_ALLOCATOR_END
NS_CC_END NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_STRATEGY_GLOBAL_SMALL_BLOCK_H #endif//CC_ALLOCATOR_STRATEGY_GLOBAL_SMALL_BLOCK_H

View File

@ -1,9 +1,5 @@
#ifndef CC_ALLOCATOR_STRATEGY_POOL_H
#define CC_ALLOCATOR_STRATEGY_POOL_H
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
Author: Justin Graham (https://github.com/mannewalis) Author: Justin Graham (https://github.com/mannewalis)
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -26,6 +22,11 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef CC_ALLOCATOR_STRATEGY_POOL_H
#define CC_ALLOCATOR_STRATEGY_POOL_H
/// @cond
#include <vector> #include <vector>
#include <typeinfo> #include <typeinfo>
#include <sstream> #include <sstream>
@ -39,12 +40,16 @@
NS_CC_BEGIN NS_CC_BEGIN
NS_CC_ALLOCATOR_BEGIN NS_CC_ALLOCATOR_BEGIN
// @brief ObjectTraits describes an allocatable object /**
// Templated class that represents a default allocatable object. * ObjectTraits describes an allocatable object.
// Provide custom implementations to change the constructor/destructor behavior, *
// or to change the default alignment of the object in memory. * Template class that represents a default allocatable object.
// @param T Type of object * Provide custom implementations to change the constructor/destructor behavior,
// @param _alignment Alignment of object T * or to change the default alignment of the object in memory.
*
* @param T Type of object.
* @param _alignment Alignment of object T.
*/
template <typename T, size_t _alignment = sizeof(uint32_t)> template <typename T, size_t _alignment = sizeof(uint32_t)>
class ObjectTraits class ObjectTraits
{ {
@ -57,36 +62,36 @@ public:
virtual ~ObjectTraits() virtual ~ObjectTraits()
{} {}
// @brief constructor implementation for type T /** Constructor implementation for type T.*/
void construct(T* address) void construct(T* address)
{ {
::new(address) T(); ::new(address) T();
} }
// @brief destructor implementation for type T /** Destructor implementation for type T.*/
void destroy(T* address) void destroy(T* address)
{ {
address->~T(); address->~T();
} }
// @brief returns the name of this object type T /** Returns the name of this object type T.*/
const char* name() const const char* name() const
{ {
return typeid(T).name(); return typeid(T).name();
} }
}; };
/**
// @brief * Fixed sized pool allocator strategy for objects of type T.
// Fixed sized pool allocator strategy for objects of type T *
// Optionally takes a page size which determines how many objects * Optionally takes a page size which determines how many objects are added when the allocator needs more storage.
// are added when the allocator needs more storage. * ObjectTraits allows you to control the alignment, construction and destruction of an object in the pool.
// ObjectTraits allows you to control the alignment, construction *
// and destruction of an object in the pool. * @param T Type of object.
// @param T Type of object. * @param _page_size Number of objects of T in each page.
// @param _page_size Number of objects of T in each page. * @param O ObjectTraits for type T
// @param O ObjectTraits for type T * @see CC_USE_ALLOCATOR_POOL
// @see CC_USE_ALLOCATOR_POOL */
template <typename T, typename O = ObjectTraits<T>, typename locking_traits = lockless_semantics> template <typename T, typename O = ObjectTraits<T>, typename locking_traits = lockless_semantics>
class AllocatorStrategyPool class AllocatorStrategyPool
: public AllocatorStrategyFixedBlock<sizeof(T), O::alignment, locking_traits> : public AllocatorStrategyFixedBlock<sizeof(T), O::alignment, locking_traits>
@ -97,7 +102,7 @@ public:
typedef T value_type; typedef T value_type;
typedef value_type* pointer; typedef value_type* pointer;
// ugh wish I knew a way that I could declare this just once /** Ugh wish I knew a way that I could declare this just once.*/
typedef AllocatorStrategyFixedBlock<sizeof(T), O::alignment, locking_traits> tParentStrategy; typedef AllocatorStrategyFixedBlock<sizeof(T), O::alignment, locking_traits> tParentStrategy;
AllocatorStrategyPool(const char* tag = nullptr, size_t poolSize = 100) AllocatorStrategyPool(const char* tag = nullptr, size_t poolSize = 100)
@ -107,9 +112,12 @@ public:
tParentStrategy::_pageSize = poolSize; tParentStrategy::_pageSize = poolSize;
} }
// @brief Allocate block of size T /**
// if size does not match sizeof(T) then the global allocator is called instead. * Allocate block of size T.
// @see CC_USE_ALLOCATOR_POOL *
* If size does not match sizeof(T) then the global allocator is called instead.
* @see CC_USE_ALLOCATOR_POOL
*/
CC_ALLOCATOR_INLINE void* allocate(size_t size) CC_ALLOCATOR_INLINE void* allocate(size_t size)
{ {
T* object; T* object;
@ -125,9 +133,12 @@ public:
return object; return object;
} }
// @brief Deallocate block of size T /**
// if size does not match sizeof(T) then the global allocator is called instead. * Deallocate block of size T.
// @see CC_USE_ALLOCATOR_POOL *
* If size does not match sizeof(T) then the global allocator is called instead.
* @see CC_USE_ALLOCATOR_POOL
*/
CC_ALLOCATOR_INLINE void deallocate(void* address, size_t size = 0) CC_ALLOCATOR_INLINE void deallocate(void* address, size_t size = 0)
{ {
if (address) if (address)
@ -157,4 +168,6 @@ public:
NS_CC_ALLOCATOR_END NS_CC_ALLOCATOR_END
NS_CC_END NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_STRATEGY_POOL_H #endif//CC_ALLOCATOR_STRATEGY_POOL_H

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2010 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -33,6 +33,15 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
/**
* @addtogroup base
* @{
*/
/**
* @class RandomHelper
* @brief A helper class for creating random number.
*/
class CC_DLL RandomHelper { class CC_DLL RandomHelper {
public: public:
template<typename T> template<typename T>
@ -53,8 +62,8 @@ private:
}; };
/** /**
* returns a random value between `min` and `max` * Returns a random value between `min` and `max`.
*/ */
template<typename T> template<typename T>
inline T random(T min, T max) { inline T random(T min, T max) {
return RandomHelper::random_int<T>(min, max); return RandomHelper::random_int<T>(min, max);
@ -76,7 +85,7 @@ inline double random(double min, double max) {
} }
/** /**
* Returns a random int between 0 and RAND_MAX * Returns a random int between 0 and RAND_MAX.
*/ */
inline int random() { inline int random() {
return cocos2d::random(0, RAND_MAX); return cocos2d::random(0, RAND_MAX);
@ -110,5 +119,8 @@ inline float rand_0_1() {
// return cocos2d::random(0.f, 1.f); // return cocos2d::random(0.f, 1.f);
}; };
// end group
/// @}
NS_CC_END NS_CC_END
#endif //__ccRandom_H_ #endif //__ccRandom_H_

View File

@ -2,7 +2,7 @@
Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc. Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -37,11 +37,17 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
/**
* @addtogroup base
* @{
*/
struct Color4B; struct Color4B;
struct Color4F; struct Color4F;
/** RGB color composed of bytes 3 bytes /**
@since v3.0 * RGB color composed of bytes 3 bytes.
* @since v3.0
*/ */
struct CC_DLL Color3B struct CC_DLL Color3B
{ {
@ -77,9 +83,10 @@ struct CC_DLL Color3B
static const Color3B GRAY; static const Color3B GRAY;
}; };
/** RGBA color composed of 4 bytes /**
@since v3.0 * RGBA color composed of 4 bytes.
*/ * @since v3.0
*/
struct CC_DLL Color4B struct CC_DLL Color4B
{ {
Color4B(); Color4B();
@ -111,9 +118,10 @@ struct CC_DLL Color4B
}; };
/** RGBA color composed of 4 floats /**
@since v3.0 * RGBA color composed of 4 floats.
*/ * @since v3.0
*/
struct CC_DLL Color4F struct CC_DLL Color4F
{ {
Color4F(); Color4F();
@ -181,8 +189,9 @@ struct CC_DLL Color4F
// GLfloat z; // GLfloat z;
// }; // };
/** A texcoord composed of 2 floats: u, y /** @struct Tex2F
@since v3.0 * A TEXCOORD composed of 2 floats: u, y
* @since v3.0
*/ */
struct CC_DLL Tex2F { struct CC_DLL Tex2F {
Tex2F(float _u, float _v): u(_u), v(_v) {} Tex2F(float _u, float _v): u(_u), v(_v) {}
@ -193,8 +202,9 @@ struct CC_DLL Tex2F {
GLfloat v; GLfloat v;
}; };
/** @struct PointSprite
//! Vec2 Sprite component * Vec2 Sprite component.
*/
struct CC_DLL PointSprite struct CC_DLL PointSprite
{ {
Vec2 pos; // 8 bytes Vec2 pos; // 8 bytes
@ -202,7 +212,9 @@ struct CC_DLL PointSprite
GLfloat size; // 4 bytes GLfloat size; // 4 bytes
}; };
//! A 2D Quad. 4 * 2 floats /** @struct Quad2
* A 2D Quad. 4 * 2 floats.
*/
struct CC_DLL Quad2 struct CC_DLL Quad2
{ {
Vec2 tl; Vec2 tl;
@ -211,8 +223,9 @@ struct CC_DLL Quad2
Vec2 br; Vec2 br;
}; };
/** @struct Quad3
//! A 3D Quad. 4 * 3 floats * A 3D Quad. 4 * 3 floats.
*/
struct CC_DLL Quad3 { struct CC_DLL Quad3 {
Vec3 bl; Vec3 bl;
Vec3 br; Vec3 br;
@ -220,7 +233,9 @@ struct CC_DLL Quad3 {
Vec3 tr; Vec3 tr;
}; };
//! a Vec2 with a vertex point, a tex coord point and a color 4B /** @struct V2F_C4B_T2F
* A Vec2 with a vertex point, a tex coord point and a color 4B.
*/
struct V2F_C4B_T2F struct V2F_C4B_T2F
{ {
//! vertices (2F) //! vertices (2F)
@ -231,7 +246,9 @@ struct V2F_C4B_T2F
Tex2F texCoords; Tex2F texCoords;
}; };
/** @struct V2F_C4B_PF
*
*/
struct V2F_C4B_PF struct V2F_C4B_PF
{ {
//! vertices (2F) //! vertices (2F)
@ -242,7 +259,9 @@ struct V2F_C4B_PF
float pointSize; float pointSize;
}; };
//! a Vec2 with a vertex point, a tex coord point and a color 4F /** @struct V2F_C4F_T2F
* A Vec2 with a vertex point, a tex coord point and a color 4F.
*/
struct CC_DLL V2F_C4F_T2F struct CC_DLL V2F_C4F_T2F
{ {
//! vertices (2F) //! vertices (2F)
@ -253,7 +272,9 @@ struct CC_DLL V2F_C4F_T2F
Tex2F texCoords; Tex2F texCoords;
}; };
//! a Vec2 with a vertex point, a tex coord point and a color 4B /** @struct V3F_C4B_T2F
* A Vec2 with a vertex point, a tex coord point and a color 4B.
*/
struct CC_DLL V3F_C4B_T2F struct CC_DLL V3F_C4B_T2F
{ {
//! vertices (3F) //! vertices (3F)
@ -266,7 +287,9 @@ struct CC_DLL V3F_C4B_T2F
Tex2F texCoords; // 8 bytes Tex2F texCoords; // 8 bytes
}; };
//! a Vec2 with a vertex point, a tex coord point /** @struct V3F_T2F
* A Vec2 with a vertex point, a tex coord point.
*/
struct CC_DLL V3F_T2F struct CC_DLL V3F_T2F
{ {
//! vertices (2F) //! vertices (2F)
@ -275,7 +298,9 @@ struct CC_DLL V3F_T2F
Tex2F texCoords; Tex2F texCoords;
}; };
//! A Triangle of V2F_C4B_T2F /** @struct V2F_C4B_T2F_Triangle
* A Triangle of V2F_C4B_T2F.
*/
struct CC_DLL V2F_C4B_T2F_Triangle struct CC_DLL V2F_C4B_T2F_Triangle
{ {
//! Vec2 A //! Vec2 A
@ -286,7 +311,9 @@ struct CC_DLL V2F_C4B_T2F_Triangle
V2F_C4B_T2F c; V2F_C4B_T2F c;
}; };
//! A Quad of V2F_C4B_T2F /** @struct V2F_C4B_T2F_Quad
* A Quad of V2F_C4B_T2F.
*/
struct CC_DLL V2F_C4B_T2F_Quad struct CC_DLL V2F_C4B_T2F_Quad
{ {
//! bottom left //! bottom left
@ -299,7 +326,9 @@ struct CC_DLL V2F_C4B_T2F_Quad
V2F_C4B_T2F tr; V2F_C4B_T2F tr;
}; };
//! 4 Vertex3FTex2FColor4B /** @struct V3F_C4B_T2F_Quad
* 4 Vertex3FTex2FColor4B.
*/
struct CC_DLL V3F_C4B_T2F_Quad struct CC_DLL V3F_C4B_T2F_Quad
{ {
//! top left //! top left
@ -312,7 +341,9 @@ struct CC_DLL V3F_C4B_T2F_Quad
V3F_C4B_T2F br; V3F_C4B_T2F br;
}; };
//! 4 Vertex2FTex2FColor4F Quad /** @struct V2F_C4F_T2F_Quad
* 4 Vertex2FTex2FColor4F Quad.
*/
struct CC_DLL V2F_C4F_T2F_Quad struct CC_DLL V2F_C4F_T2F_Quad
{ {
//! bottom left //! bottom left
@ -325,6 +356,9 @@ struct CC_DLL V2F_C4F_T2F_Quad
V2F_C4F_T2F tr; V2F_C4F_T2F tr;
}; };
/** @struct V3F_T2F_Quad
*
*/
struct CC_DLL V3F_T2F_Quad struct CC_DLL V3F_T2F_Quad
{ {
//! bottom left //! bottom left
@ -337,7 +371,9 @@ struct CC_DLL V3F_T2F_Quad
V3F_T2F tr; V3F_T2F tr;
}; };
//! Blend Function used for textures /** @struct BlendFunc
* Blend Function used for textures.
*/
struct CC_DLL BlendFunc struct CC_DLL BlendFunc
{ {
//! source blend function //! source blend function
@ -370,11 +406,11 @@ struct CC_DLL BlendFunc
} }
}; };
// Label::VAlignment /** @struct TextVAlignment
// Label::HAlignment * Vertical text alignment type.
*
// FIXME:: If any of these enums are edited and/or reordered, update Texture2D.m * @note If any of these enums are edited and/or reordered, update Texture2D.m.
//! Vertical text alignment type */
enum class CC_DLL TextVAlignment enum class CC_DLL TextVAlignment
{ {
TOP, TOP,
@ -382,8 +418,11 @@ enum class CC_DLL TextVAlignment
BOTTOM BOTTOM
}; };
// FIXME:: If any of these enums are edited and/or reordered, update Texture2D.m /** @struct TextHAlignment
//! Horizontal text alignment type * Horizontal text alignment type.
*
* @note If any of these enums are edited and/or reordered, update Texture2D.m.
*/
enum class CC_DLL TextHAlignment enum class CC_DLL TextHAlignment
{ {
LEFT, LEFT,
@ -391,9 +430,11 @@ enum class CC_DLL TextHAlignment
RIGHT RIGHT
}; };
// types for animation in particle systems // Types for animation in particle systems
// texture coordinates for a quad /** @struct T2F_Quad
* Texture coordinates for a quad.
*/
struct CC_DLL T2F_Quad struct CC_DLL T2F_Quad
{ {
//! bottom left //! bottom left
@ -406,7 +447,9 @@ struct CC_DLL T2F_Quad
Tex2F tr; Tex2F tr;
}; };
// struct that holds the size in pixels, texture coordinates and delays for animated ParticleSystemQuad /** @struct AnimationFrameData
* Struct that holds the size in pixels, texture coordinates and delays for animated ParticleSystemQuad.
*/
struct CC_DLL AnimationFrameData struct CC_DLL AnimationFrameData
{ {
T2F_Quad texCoords; T2F_Quad texCoords;
@ -418,8 +461,9 @@ struct CC_DLL AnimationFrameData
types used for defining fonts properties (i.e. font name, size, stroke or shadow) types used for defining fonts properties (i.e. font name, size, stroke or shadow)
*/ */
/** @struct FontShadow
// shadow attributes * Shadow attributes.
*/
struct CC_DLL FontShadow struct CC_DLL FontShadow
{ {
public: public:
@ -441,7 +485,9 @@ public:
float _shadowOpacity; float _shadowOpacity;
}; };
// stroke attributes /** @struct FontStroke
* Stroke attributes.
*/
struct CC_DLL FontStroke struct CC_DLL FontStroke
{ {
public: public:
@ -465,7 +511,9 @@ public:
}; };
// font attributes /** @struct FontDefinition
* Font attributes.
*/
struct CC_DLL FontDefinition struct CC_DLL FontDefinition
{ {
public: public:
@ -503,8 +551,8 @@ public:
}; };
/** /** @struct Acceleration
@brief The device accelerometer reports values for each axis in units of g-force * The device accelerometer reports values for each axis in units of g-force.
*/ */
class CC_DLL Acceleration class CC_DLL Acceleration
: public Ref : public Ref
@ -523,5 +571,6 @@ extern const std::string CC_DLL STD_STRING_EMPTY;
extern const ssize_t CC_DLL CC_INVALID_INDEX; extern const ssize_t CC_DLL CC_INVALID_INDEX;
NS_CC_END NS_CC_END
// end group
/// @}
#endif //__BASE_CCTYPES_H__ #endif //__BASE_CCTYPES_H__

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -34,21 +34,32 @@ NS_CC_BEGIN
struct FontDefinition; struct FontDefinition;
/**
* @addtogroup support
* @{
*/
/**
* @class Device
* @brief
*/
class CC_DLL Device class CC_DLL Device
{ {
public: public:
/** Defines the alignment of text. */
enum class TextAlign enum class TextAlign
{ {
CENTER = 0x33, ///< Horizontal center and vertical center. CENTER = 0x33, /** Horizontal center and vertical center. */
TOP = 0x13, ///< Horizontal center and vertical top. TOP = 0x13, /** Horizontal center and vertical top. */
TOP_RIGHT = 0x12, ///< Horizontal right and vertical top. TOP_RIGHT = 0x12, /** Horizontal right and vertical top. */
RIGHT = 0x32, ///< Horizontal right and vertical center. RIGHT = 0x32, /** Horizontal right and vertical center. */
BOTTOM_RIGHT = 0x22, ///< Horizontal right and vertical bottom. BOTTOM_RIGHT = 0x22, /** Horizontal right and vertical bottom. */
BOTTOM = 0x23, ///< Horizontal center and vertical bottom. BOTTOM = 0x23, /** Horizontal center and vertical bottom. */
BOTTOM_LEFT = 0x21, ///< Horizontal left and vertical bottom. BOTTOM_LEFT = 0x21, /** Horizontal left and vertical bottom. */
LEFT = 0x31, ///< Horizontal left and vertical center. LEFT = 0x31, /** Horizontal left and vertical center. */
TOP_LEFT = 0x11, ///< Horizontal left and vertical top. TOP_LEFT = 0x11, /** Horizontal left and vertical top. */
}; };
/** /**
* Gets the DPI of device * Gets the DPI of device
* @return The DPI of device. * @return The DPI of device.
@ -59,19 +70,30 @@ public:
* To enable or disable accelerometer. * To enable or disable accelerometer.
*/ */
static void setAccelerometerEnabled(bool isEnabled); static void setAccelerometerEnabled(bool isEnabled);
/** /**
* Sets the interval of accelerometer. * Sets the interval of accelerometer.
*/ */
static void setAccelerometerInterval(float interval); static void setAccelerometerInterval(float interval);
static Data getTextureDataForText(const char * text, const FontDefinition& textDefinition, TextAlign align, int &width, int &height, bool& hasPremultipliedAlpha); /**
* Controls whether the screen should remain on.
*
* @param keepScreenOn One flag indicating that the screen should remain on.
*/
static void setKeepScreenOn(bool keepScreenOn);
static void setKeepScreenOn(bool value); /**
* Gets texture data for text.
*/
static Data getTextureDataForText(const char * text, const FontDefinition& textDefinition, TextAlign align, int &width, int &height, bool& hasPremultipliedAlpha);
private: private:
CC_DISALLOW_IMPLICIT_CONSTRUCTORS(Device); CC_DISALLOW_IMPLICIT_CONSTRUCTORS(Device);
}; };
// end group
/// @}
NS_CC_END NS_CC_END

View File

@ -1,6 +1,8 @@
/* /****************************************************************************
Copyright (c) 2012 Zynga Inc.
Copyright (c) 2013-2015 Chukong Technologies Inc.
Copyright (c) 2012 - Zynga Inc. http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -19,13 +21,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/
*/
/*
Local Storage support for the JS Bindings for iOS.
Works on cocos2d-iphone and cocos2d-x.
*/
#ifndef __JSB_LOCALSTORAGE_H #ifndef __JSB_LOCALSTORAGE_H
#define __JSB_LOCALSTORAGE_H #define __JSB_LOCALSTORAGE_H
@ -33,19 +29,29 @@ THE SOFTWARE.
#include <string> #include <string>
#include "CCPlatformMacros.h" #include "CCPlatformMacros.h"
/** Initializes the database. If path is null, it will create an in-memory DB */ /**
* @addtogroup core
* @{
*/
/** Local Storage support for the JS Bindings.*/
/** Initializes the database. If path is null, it will create an in-memory DB. */
void CC_DLL localStorageInit( const std::string& fullpath = ""); void CC_DLL localStorageInit( const std::string& fullpath = "");
/** Frees the allocated resources */ /** Frees the allocated resources. */
void CC_DLL localStorageFree(); void CC_DLL localStorageFree();
/** sets an item in the LS */ /** Sets an item in the JS. */
void CC_DLL localStorageSetItem( const std::string& key, const std::string& value); void CC_DLL localStorageSetItem( const std::string& key, const std::string& value);
/** gets an item from the LS */ /** Gets an item from the JS. */
std::string CC_DLL localStorageGetItem( const std::string& key ); std::string CC_DLL localStorageGetItem( const std::string& key );
/** removes an item from the LS */ /** Removes an item from the JS. */
void CC_DLL localStorageRemoveItem( const std::string& key ); void CC_DLL localStorageRemoveItem( const std::string& key );
// end group
/// @}
#endif // __JSB_LOCALSTORAGE_H #endif // __JSB_LOCALSTORAGE_H

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -29,6 +29,11 @@
#include "ui/UIWidget.h" #include "ui/UIWidget.h"
/**
* @addtogroup ui
* @{
*/
NS_CC_BEGIN NS_CC_BEGIN
namespace experimental{ namespace experimental{
namespace ui{ namespace ui{
@ -54,33 +59,90 @@ namespace experimental{
CREATE_FUNC(VideoPlayer); CREATE_FUNC(VideoPlayer);
//Sets local file[support assets' file on android] as a video source for VideoPlayer /**
* Sets a file path as a video source for VideoPlayer.
*/
virtual void setFileName(const std::string& videoPath); virtual void setFileName(const std::string& videoPath);
virtual const std::string& getFileName() const { return _videoURL;} virtual const std::string& getFileName() const { return _videoURL;}
//Sets network link as a video source for VideoPlayer /**
* Sets a URL as a video source for VideoPlayer.
*/
virtual void setURL(const std::string& _videoURL); virtual void setURL(const std::string& _videoURL);
virtual const std::string& getURL() const { return _videoURL;} virtual const std::string& getURL() const { return _videoURL;}
/**
* Starts playback.
*/
virtual void play(); virtual void play();
/**
* Pauses playback.
*/
virtual void pause(); virtual void pause();
/**
* Resumes playback.
*/
virtual void resume(); virtual void resume();
/**
* Stops playback.
*/
virtual void stop(); virtual void stop();
/**
* Seeks to specified time position.
*
* @param sec The offset in seconds from the start to seek to.
*/
virtual void seekTo(float sec); virtual void seekTo(float sec);
/**
* Checks whether the VideoPlayer is playing.
*
* @return True if currently playing, false otherwise.
*/
virtual bool isPlaying() const; virtual bool isPlaying() const;
virtual void setVisible(bool visible) override; /**
* Causes the video player to keep aspect ratio or no when displaying the video.
*
* @param enable Specify true to keep aspect ratio or false to scale the video until
* both dimensions fit the visible bounds of the view exactly.
*/
virtual void setKeepAspectRatioEnabled(bool enable); virtual void setKeepAspectRatioEnabled(bool enable);
/**
* Indicates whether the video player keep aspect ratio when displaying the video.
*/
virtual bool isKeepAspectRatioEnabled()const { return _keepAspectRatioEnabled;} virtual bool isKeepAspectRatioEnabled()const { return _keepAspectRatioEnabled;}
virtual void setFullScreenEnabled(bool enabled); /**
* Causes the video player to enter or exit full-screen mode.
*
* @param fullscreen Specify true to enter full-screen mode or false to exit full-screen mode.
*/
virtual void setFullScreenEnabled(bool fullscreen);
/**
* Indicates whether the video player is in full-screen mode.
*
* @return True if the video player is in full-screen mode, false otherwise.
*/
virtual bool isFullScreenEnabled()const; virtual bool isFullScreenEnabled()const;
/**
* Register a callback to be invoked when the video state is updated.
*
* @param callback The callback that will be run.
*/
virtual void addEventListener(const VideoPlayer::ccVideoPlayerCallback& callback); virtual void addEventListener(const VideoPlayer::ccVideoPlayerCallback& callback);
virtual void onPlayEvent(int event); virtual void onPlayEvent(int event);
virtual void setVisible(bool visible) override;
virtual void draw(Renderer *renderer, const Mat4& transform, uint32_t flags) override; virtual void draw(Renderer *renderer, const Mat4& transform, uint32_t flags) override;
protected: protected:
@ -119,6 +181,7 @@ namespace experimental{
} }
NS_CC_END NS_CC_END
// end group
/// @}
#endif #endif
#endif #endif

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2014 Chukong Technologies Inc. Copyright (c) 2014-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -34,6 +34,11 @@
#include "ui/GUIExport.h" #include "ui/GUIExport.h"
#include "base/CCData.h" #include "base/CCData.h"
/**
* @addtogroup ui
* @{
*/
NS_CC_BEGIN NS_CC_BEGIN
namespace experimental{ namespace experimental{
namespace ui{ namespace ui{
@ -213,5 +218,6 @@ private:
}//namespace cocos2d }//namespace cocos2d
#endif #endif
// end group
/// @}
#endif //__COCOS2D_UI_WEBVIEW_H #endif //__COCOS2D_UI_WEBVIEW_H