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-2014 Chukong Technologies Inc.
Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
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
@ -42,14 +42,10 @@ NS_CC_BEGIN
class Label;
/**
* @addtogroup GUI
* @{
* @addtogroup label
* @addtogroup _2d
* @{
*/
/** @brief LabelTTF is a subclass of TextureNode that knows how to render text labels
*
* 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)))
#pragma GCC diagnostic warning "-Wdeprecated-declarations"

View File

@ -1,6 +1,6 @@
/****************************************************************************
Copyright (c) 2013 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
Copyright (c) 2013-2015 Chukong Technologies Inc.
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
@ -41,9 +41,9 @@
#endif // ERROR
/**
* @addtogroup Audio
* @{
*/
* @addtogroup core
* @{
*/
NS_CC_BEGIN
namespace experimental{
@ -335,7 +335,9 @@ protected:
}
NS_CC_END
// end audio group
// end group
/// @}
#endif // __AUDIO_ENGINE_H_
#endif

View File

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

View File

@ -1,6 +1,5 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
@ -42,6 +41,15 @@ THE SOFTWARE.
NS_CC_BEGIN
/////////////////////////////////////////////////////////////////////////////
/**
* @addtogroup base
* @{
*/
/**
* @class AsyncTaskPool
* @brief This class allows to perform background operations without having to manipulate threads.
*/
class CC_DLL AsyncTaskPool
{
public:
@ -54,28 +62,32 @@ public:
TASK_OTHER,
TASK_MAX_TYPE,
};
/**
* get instance
* Returns the shared instance of the async task pool.
*/
static AsyncTaskPool* getInstance();
/**
* destroy instance
* Destroys the async task pool.
*/
static void destoryInstance();
/**
* stop tasks
* @param type task type you want to stop
* Stop tasks.
*
* @param type Task type you want to stop.
*/
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 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 f task can be lambda function
* @param args task parameters
* @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 f task can be lambda function.
* @param args task parameters.
*/
template<class 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);
}
// end group
/// @}
NS_CC_END
#endif //__CCSYNC_TASK_POOL_H_

View File

@ -1,6 +1,5 @@
/****************************************************************************
Copyright (c) 2014 cocos2d-x.org
Copyright (c) 2014 Chukong Technologies Inc.
Copyright (c) 2014-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
@ -38,6 +37,11 @@ class EventListenerController;
class EventController;
class EventDispatcher;
/**
* @addtogroup base
* @{
*/
/**
* @class Controller
* @brief A Controller object represents a connected physical game controller.
@ -209,6 +213,8 @@ private:
friend class EventListenerController;
};
// end group
/// @}
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
@ -40,33 +40,48 @@
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>
class Map
{
public:
// ------------------------------------------
// Iterators
// ------------------------------------------
#if USE_STD_UNORDERED_MAP
typedef std::unordered_map<K, V> RefMap;
#else
typedef std::map<K, V> RefMap;
#endif
// ------------------------------------------
// Iterators
// ------------------------------------------
/** Iterator, can be used to loop the Map. */
typedef typename RefMap::iterator iterator;
/** Const iterator, can be used to loop the Map. */
typedef typename RefMap::const_iterator const_iterator;
/** Return iterator to beginning. */
iterator begin() { return _data.begin(); }
/** Return const_iterator to beginning. */
const_iterator begin() const { return _data.begin(); }
/** Return iterator to end.*/
iterator end() { return _data.end(); }
/** Return const_iterator to end.*/
const_iterator end() const { return _data.end(); }
/** Return const_iterator to beginning.*/
const_iterator cbegin() const { return _data.cbegin(); }
/** Return const_iterator to end.*/
const_iterator cend() const { return _data.cend(); }
/** Default constructor */
@ -77,7 +92,7 @@ public:
CCLOGINFO("In the default constructor of Map!");
}
/** Contructor with capacity */
/** Constructor with capacity. */
explicit Map<K, V>(ssize_t capacity)
: _data()
{
@ -86,7 +101,7 @@ public:
_data.reserve(capacity);
}
/** Copy constructor */
/** Copy constructor. */
Map<K, V>(const Map<K, V>& other)
{
static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for cocos2d::Map<K, V>!");
@ -95,7 +110,7 @@ public:
addRefForAllObjects();
}
/** Move constructor */
/** Move constructor. */
Map<K, V>(Map<K, V>&& other)
{
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);
}
/** Destructor
/**
* Destructor.
* It will release all objects in map.
*/
~Map<K, V>()
@ -112,7 +128,7 @@ public:
clear();
}
/** Sets capacity of the map */
/** Sets capacity of the map. */
void reserve(ssize_t capacity)
{
#if USE_STD_UNORDERED_MAP
@ -156,7 +172,8 @@ public:
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.
* To clear the content of an array object, member function unordered_map::clear exists.
*/
@ -165,7 +182,7 @@ public:
return _data.empty();
}
/** Returns all keys in the map */
/** Returns all keys in the map. */
std::vector<K> keys() const
{
std::vector<K> keys;
@ -182,7 +199,7 @@ public:
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;
@ -205,7 +222,9 @@ public:
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.
* @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).
@ -226,12 +245,13 @@ public:
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).
*
* @param key Key to be searched for.
* 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).
*
*/
const_iterator find(const K& key) const
{
@ -243,7 +263,9 @@ public:
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.
* @param key The key to be inserted.
* @param object The object to be inserted.
@ -256,7 +278,9 @@ public:
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>.
* Member type const_iterator is a forward iterator type.
*/
@ -267,7 +291,9 @@ public:
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.
* 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).
@ -285,7 +311,9 @@ public:
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.
*/
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,
* leaving it with a size of 0.
*/
@ -309,7 +338,8 @@ public:
_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.
*/
V getRandomObject() const
@ -349,7 +379,7 @@ public:
// return _data.at(key);
// }
/** Copy assignment operator */
/** Copy assignment operator. */
Map<K, V>& operator= ( const Map<K, V>& other )
{
if (this != &other) {
@ -361,7 +391,7 @@ public:
return *this;
}
/** Move assignment operator */
/** Move assignment operator. */
Map<K, V>& operator= ( Map<K, V>&& other )
{
if (this != &other) {
@ -386,7 +416,7 @@ protected:
RefMap _data;
};
// end of data_structure group
// end group
/// @}
NS_CC_END

View File

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

View File

@ -1,6 +1,6 @@
/****************************************************************************
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
@ -37,122 +37,124 @@ THE SOFTWARE.
#include "platform/CCStdC.h"
#endif
/**
* @addtogroup base
* @{
*/
namespace cocos2d
{
#ifndef _unz64_H
typedef struct unz_file_info_s unz_file_info;
#endif
/* XXX: pragma pack ??? */
/** @struct CCZHeader
/** XXX: pragma pack ???
* @struct CCZHeader
*/
struct CCZHeader {
unsigned char sig[4]; // signature. Should be 'CCZ!' 4 bytes
unsigned short compression_type; // should 0
unsigned short version; // should be 2 (although version type==1 is also supported)
unsigned int reserved; // Reserved for users.
unsigned int len; // size of the uncompressed file
unsigned char sig[4]; /** Signature. Should be 'CCZ!' 4 bytes. */
unsigned short compression_type; /** Should be 0. */
unsigned short version; /** Should be 2 (although version type==1 is also supported). */
unsigned int reserved; /** Reserved for users. */
unsigned int len; /** Size of the uncompressed file. */
};
enum {
CCZ_COMPRESSION_ZLIB, // zlib format.
CCZ_COMPRESSION_BZIP2, // bzip2 format (not supported yet)
CCZ_COMPRESSION_GZIP, // gzip format (not supported yet)
CCZ_COMPRESSION_NONE, // plain (not supported yet)
CCZ_COMPRESSION_ZLIB, /** zlib format. */
CCZ_COMPRESSION_BZIP2, /** bzip2 format (not supported yet). */
CCZ_COMPRESSION_GZIP, /** gzip format (not supported yet). */
CCZ_COMPRESSION_NONE, /** plain (not supported yet). */
};
class CC_DLL ZipUtils
{
public:
/**
* Inflates either zlib or gzip deflated memory. The inflated memory is
* expected to be freed by the caller.
* Inflates either zlib or gzip deflated memory. The inflated memory is 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.
* @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); }
static ssize_t inflateMemory(unsigned char *in, ssize_t inLength, unsigned char **out);
/**
* Inflates either zlib or gzip deflated memory. The inflated memory is
* expected to be freed by the caller.
* Inflates either zlib or gzip deflated memory. The inflated memory is 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
*
@since v1.0.0
* @return The length of the deflated buffer.
* @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); }
static ssize_t inflateMemoryWithHint(unsigned char *in, ssize_t inLength, unsigned char **out, ssize_t outLengthHint);
/** inflates a GZip file into memory
*
* @returns the length of the deflated buffer
/**
* Inflates a GZip file into memory.
*
* @return The length of the deflated buffer.
* @since v0.99.5
*/
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);
/** test a file is a GZip format file or not
*
* @returns true is a GZip format file. false is not
/**
* Test a file is a GZip format file or not.
*
* @return True is a GZip format file. false is not.
* @since v3.0
*/
CC_DEPRECATED_ATTRIBUTE static bool ccIsGZipFile(const char *filename) { return isGZipFile(filename); }
static bool isGZipFile(const char *filename);
/** test the buffer is GZip format or not
*
* @returns true is GZip format. false is not
/**
* Test the buffer is GZip format or not.
*
* @return True is GZip format. false is not.
* @since v3.0
*/
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);
/** inflates a CCZ file into memory
*
* @returns the length of the deflated buffer
/**
* Inflates a CCZ file into memory.
*
* @return The length of the deflated buffer.
* @since v0.99.5
*/
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);
/** inflates a buffer with CCZ format into memory
*
* @returns the length of the deflated buffer
/**
* Inflates a buffer with CCZ format into memory.
*
* @return The length of the deflated buffer.
* @since v3.0
*/
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);
/** test a file is a CCZ format file or not
*
* @returns true is a CCZ format file. false is not
/**
* Test a file is a CCZ format file or not.
*
* @return True is a CCZ format file. false is not.
* @since v3.0
*/
CC_DEPRECATED_ATTRIBUTE static bool ccIsCCZFile(const char *filename) { return isCCZFile(filename); }
static bool isCCZFile(const char *filename);
/** test the buffer is CCZ format or not
*
* @returns true is CCZ format. false is not
/**
* Test the buffer is CCZ format or not.
*
* @return True is CCZ format. false is not.
* @since v3.0
*/
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);
/** 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
* 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(3, 0xdddddddd);
*
* Splitting the key into 4 parts and calling the function
* from 4 different source files increases the difficulty to
* reverse engineer the encryption key. Be aware that encrpytion
* is *never* 100% secure and the key code can be cracked by
* knowledgable persons.
* Splitting the key into 4 parts and calling the function from 4 different source
* files increases the difficulty to reverse engineer the encryption key.
* Be aware that encrpytion is *never* 100% secure and the key code
* can be cracked by knowledgable persons.
*
* IMPORTANT: Be sure to call setPvrEncryptionKey or
* 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.
*
* @param index part of the key [0..3]
* @param value value of the key part
* @param index Part of the key [0..3].
* @param value Value of the key part.
*/
CC_DEPRECATED_ATTRIBUTE static void ccSetPvrEncryptionKeyPart(int index, unsigned int value) { setPvrEncryptionKeyPart(index, 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
* 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);
*
* Note that using this function makes it easier to reverse engineer and
* discover the complete key because the key parts are present in one
* function call.
* Note that using this function makes it easier to reverse engineer and discover
* the complete key because the key parts are present in one function call.
*
* IMPORTANT: Be sure to call setPvrEncryptionKey or
* setPvrEncryptionKeyPart with all of the key parts *before* loading
* the spritesheet or decryption will fail and the spritesheet
* will fail to load.
* IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart
* with all of the key parts *before* loading the spritesheet or decryption
* will fail and the sprite sheet will fail to load.
*
* @param keyPart1 the key value part 1.
* @param keyPart2 the key value part 2.
* @param keyPart3 the key value part 3.
* @param keyPart4 the key value part 4.
* @param keyPart1 The key value part 1.
* @param keyPart2 The key value part 2.
* @param keyPart3 The key value part 3.
* @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); }
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;
};
} // end of namespace cocos2d
// end group
/// @}
#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)
http://www.cocos2d-x.org
@ -27,11 +23,17 @@
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_BASE_H
#define CC_ALLOCATOR_BASE_H
/// @cond
#include <string>
#include "platform/CCPlatformMacros.h"
#include "base/allocator/CCAllocatorMacros.h"
NS_CC_BEGIN
NS_CC_ALLOCATOR_BEGIN
@ -110,4 +112,6 @@ public:
NS_CC_ALLOCATOR_END
NS_CC_END
/// @endcond
#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)
http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_DIAGNOSTICS_H
#define CC_ALLOCATOR_DIAGNOSTICS_H
/// @cond
#include <unordered_set>
#include "base/allocator/CCAllocatorMacros.h"
@ -58,4 +58,6 @@ protected:
NS_CC_ALLOCATOR_END
NS_CC_END
/// @endcond
#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)
http://www.cocos2d-x.org
@ -27,16 +23,22 @@
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_GLOBAL_H
#define CC_ALLOCATOR_GLOBAL_H
/// @cond
#include "base/allocator/CCAllocatorMacros.h"
#include "base/allocator/CCAllocatorStrategyDefault.h"
NS_CC_BEGIN
NS_CC_ALLOCATOR_BEGIN
// @brief Make visible at the global scope.
/** Make visible at the global scope.*/
extern CC_ALLOCATOR_GLOBAL ccAllocatorGlobal;
NS_CC_ALLOCATOR_END
NS_CC_END
/// @endcond
#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)
http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_MACROS_H
#define CC_ALLOCATOR_MACROS_H
/// @cond
#include "base/ccConfig.h"
#include "platform/CCPlatformMacros.h"
@ -127,4 +127,6 @@
} \
}
/// @endcond
#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)
http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_MUTEX_H
#define CC_ALLOCATOR_MUTEX_H
/// @cond
#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
@ -121,4 +121,6 @@ struct lockless_semantics
NS_CC_ALLOCATOR_END
NS_CC_END
/// @endcond
#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)
http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_STRATEGY_DEFAULT_H
#define CC_ALLOCATOR_STRATEGY_DEFAULT_H
/// @cond
#include "base/allocator/CCAllocatorMacros.h"
#include "base/allocator/CCAllocatorBase.h"
@ -55,4 +55,6 @@ public:
NS_CC_ALLOCATOR_END
NS_CC_END
/// @endcond
#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)
http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_STRATEGY_FIXED_BLOCK_H
#define CC_ALLOCATOR_STRATEGY_FIXED_BLOCK_H
/// @cond
/****************************************************************************
WARNING!
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_END
/// @endcond
#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)
http://www.cocos2d-x.org
@ -27,6 +23,10 @@
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_STRATEGY_GLOBAL_SMALL_BLOCK_H
#define CC_ALLOCATOR_STRATEGY_GLOBAL_SMALL_BLOCK_H
/// @cond
/****************************************************************************
WARNING!
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_END
/// @endcond
#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)
http://www.cocos2d-x.org
@ -26,6 +22,11 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef CC_ALLOCATOR_STRATEGY_POOL_H
#define CC_ALLOCATOR_STRATEGY_POOL_H
/// @cond
#include <vector>
#include <typeinfo>
#include <sstream>
@ -39,12 +40,16 @@
NS_CC_BEGIN
NS_CC_ALLOCATOR_BEGIN
// @brief ObjectTraits describes an allocatable object
// Templated class that represents a default allocatable object.
// Provide custom implementations to change the constructor/destructor behavior,
// or to change the default alignment of the object in memory.
// @param T Type of object
// @param _alignment Alignment of object T
/**
* ObjectTraits describes an allocatable object.
*
* Template class that represents a default allocatable object.
* Provide custom implementations to change the constructor/destructor behavior,
* 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)>
class ObjectTraits
{
@ -57,36 +62,36 @@ public:
virtual ~ObjectTraits()
{}
// @brief constructor implementation for type T
/** Constructor implementation for type T.*/
void construct(T* address)
{
::new(address) T();
}
// @brief destructor implementation for type T
/** Destructor implementation for type T.*/
void destroy(T* address)
{
address->~T();
}
// @brief returns the name of this object type T
/** Returns the name of this object type T.*/
const char* name() const
{
return typeid(T).name();
}
};
// @brief
// Fixed sized pool allocator strategy for objects of type T
// Optionally takes a page size which determines how many objects
// are added when the allocator needs more storage.
// ObjectTraits allows you to control the alignment, construction
// and destruction of an object in the pool.
// @param T Type of object.
// @param _page_size Number of objects of T in each page.
// @param O ObjectTraits for type T
// @see CC_USE_ALLOCATOR_POOL
/**
* Fixed sized pool allocator strategy for objects of type T.
*
* Optionally takes a page size which determines how many objects are added when the allocator needs more storage.
* ObjectTraits allows you to control the alignment, construction and destruction of an object in the pool.
*
* @param T Type of object.
* @param _page_size Number of objects of T in each page.
* @param O ObjectTraits for type T
* @see CC_USE_ALLOCATOR_POOL
*/
template <typename T, typename O = ObjectTraits<T>, typename locking_traits = lockless_semantics>
class AllocatorStrategyPool
: public AllocatorStrategyFixedBlock<sizeof(T), O::alignment, locking_traits>
@ -97,7 +102,7 @@ public:
typedef T value_type;
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;
AllocatorStrategyPool(const char* tag = nullptr, size_t poolSize = 100)
@ -107,9 +112,12 @@ public:
tParentStrategy::_pageSize = poolSize;
}
// @brief Allocate block of size T
// if size does not match sizeof(T) then the global allocator is called instead.
// @see CC_USE_ALLOCATOR_POOL
/**
* Allocate block of size T.
*
* 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)
{
T* object;
@ -125,9 +133,12 @@ public:
return object;
}
// @brief Deallocate block of size T
// if size does not match sizeof(T) then the global allocator is called instead.
// @see CC_USE_ALLOCATOR_POOL
/**
* Deallocate block of size T.
*
* 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)
{
if (address)
@ -157,4 +168,6 @@ public:
NS_CC_ALLOCATOR_END
NS_CC_END
/// @endcond
#endif//CC_ALLOCATOR_STRATEGY_POOL_H

View File

@ -1,6 +1,6 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
@ -33,6 +33,15 @@ THE SOFTWARE.
NS_CC_BEGIN
/**
* @addtogroup base
* @{
*/
/**
* @class RandomHelper
* @brief A helper class for creating random number.
*/
class CC_DLL RandomHelper {
public:
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>
inline T random(T min, T 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() {
return cocos2d::random(0, RAND_MAX);
@ -110,5 +119,8 @@ inline float rand_0_1() {
// return cocos2d::random(0.f, 1.f);
};
// end group
/// @}
NS_CC_END
#endif //__ccRandom_H_

View File

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

View File

@ -1,6 +1,6 @@
/****************************************************************************
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
@ -34,21 +34,32 @@ NS_CC_BEGIN
struct FontDefinition;
/**
* @addtogroup support
* @{
*/
/**
* @class Device
* @brief
*/
class CC_DLL Device
{
public:
/** Defines the alignment of text. */
enum class TextAlign
{
CENTER = 0x33, ///< Horizontal center and vertical center.
TOP = 0x13, ///< Horizontal center and vertical top.
TOP_RIGHT = 0x12, ///< Horizontal right and vertical top.
RIGHT = 0x32, ///< Horizontal right and vertical center.
BOTTOM_RIGHT = 0x22, ///< Horizontal right and vertical bottom.
BOTTOM = 0x23, ///< Horizontal center and vertical bottom.
BOTTOM_LEFT = 0x21, ///< Horizontal left and vertical bottom.
LEFT = 0x31, ///< Horizontal left and vertical center.
TOP_LEFT = 0x11, ///< Horizontal left and vertical top.
CENTER = 0x33, /** Horizontal center and vertical center. */
TOP = 0x13, /** Horizontal center and vertical top. */
TOP_RIGHT = 0x12, /** Horizontal right and vertical top. */
RIGHT = 0x32, /** Horizontal right and vertical center. */
BOTTOM_RIGHT = 0x22, /** Horizontal right and vertical bottom. */
BOTTOM = 0x23, /** Horizontal center and vertical bottom. */
BOTTOM_LEFT = 0x21, /** Horizontal left and vertical bottom. */
LEFT = 0x31, /** Horizontal left and vertical center. */
TOP_LEFT = 0x11, /** Horizontal left and vertical top. */
};
/**
* Gets the DPI of device
* @return The DPI of device.
@ -59,19 +70,30 @@ public:
* To enable or disable accelerometer.
*/
static void setAccelerometerEnabled(bool isEnabled);
/**
* Sets the interval of accelerometer.
*/
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:
CC_DISALLOW_IMPLICIT_CONSTRUCTORS(Device);
};
// end group
/// @}
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
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,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Local Storage support for the JS Bindings for iOS.
Works on cocos2d-iphone and cocos2d-x.
*/
****************************************************************************/
#ifndef __JSB_LOCALSTORAGE_H
#define __JSB_LOCALSTORAGE_H
@ -33,19 +29,29 @@ THE SOFTWARE.
#include <string>
#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 = "");
/** Frees the allocated resources */
/** Frees the allocated resources. */
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);
/** gets an item from the LS */
/** Gets an item from the JS. */
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 );
// end group
/// @}
#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
@ -29,6 +29,11 @@
#include "ui/UIWidget.h"
/**
* @addtogroup ui
* @{
*/
NS_CC_BEGIN
namespace experimental{
namespace ui{
@ -54,33 +59,90 @@ namespace experimental{
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 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 const std::string& getURL() const { return _videoURL;}
/**
* Starts playback.
*/
virtual void play();
/**
* Pauses playback.
*/
virtual void pause();
/**
* Resumes playback.
*/
virtual void resume();
/**
* Stops playback.
*/
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);
/**
* Checks whether the VideoPlayer is playing.
*
* @return True if currently playing, false otherwise.
*/
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);
/**
* Indicates whether the video player keep aspect ratio when displaying the video.
*/
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;
/**
* 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 onPlayEvent(int event);
virtual void setVisible(bool visible) override;
virtual void draw(Renderer *renderer, const Mat4& transform, uint32_t flags) override;
protected:
@ -119,6 +181,7 @@ namespace experimental{
}
NS_CC_END
// end group
/// @}
#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
@ -34,6 +34,11 @@
#include "ui/GUIExport.h"
#include "base/CCData.h"
/**
* @addtogroup ui
* @{
*/
NS_CC_BEGIN
namespace experimental{
namespace ui{
@ -213,5 +218,6 @@ private:
}//namespace cocos2d
#endif
// end group
/// @}
#endif //__COCOS2D_UI_WEBVIEW_H