cocos2d-x
3.3
|
Console is helper class that lets the developer control the game from TCP connection. More...
#include <CCConsole.h>
Classes | |
struct | Command |
Public Member Functions | |
Console () | |
Constructor. More... | |
virtual | ~Console () |
Destructor. More... | |
bool | listenOnTCP (int port) |
starts listening to specifed TCP port More... | |
bool | listenOnFileDescriptor (int fd) |
starts listening to specifed file descriptor More... | |
void | stop () |
stops the Console. More... | |
void | addCommand (const Command &cmd) |
add custom command More... | |
void | log (const char *buf) |
log something in the console More... | |
Public Member Functions inherited from Ref | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
Ref * | autorelease () |
Releases the ownership sometime soon automatically. More... | |
unsigned int | getReferenceCount () const |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
NA NA More... | |
Protected Member Functions | |
void | loop () |
ssize_t | readline (int fd, char *buf, size_t maxlen) |
ssize_t | readBytes (int fd, char *buffer, size_t maxlen, bool *more) |
bool | parseCommand (int fd) |
void | addClient () |
void | commandHelp (int fd, const std::string &args) |
void | commandExit (int fd, const std::string &args) |
void | commandSceneGraph (int fd, const std::string &args) |
void | commandFileUtils (int fd, const std::string &args) |
void | commandConfig (int fd, const std::string &args) |
void | commandTextures (int fd, const std::string &args) |
void | commandResolution (int fd, const std::string &args) |
void | commandProjection (int fd, const std::string &args) |
void | commandDirector (int fd, const std::string &args) |
void | commandTouch (int fd, const std::string &args) |
void | commandUpload (int fd) |
Protected Member Functions inherited from Ref | |
Ref () | |
Constructor. More... | |
Protected Attributes | |
int | _listenfd |
int | _maxfd |
std::vector< int > | _fds |
std::thread | _thread |
fd_set | _read_set |
bool | _running |
bool | _endThread |
std::string | _writablePath |
std::map< std::string, Command > | _commands |
bool | _sendDebugStrings |
std::mutex | _DebugStringsMutex |
std::vector< std::string > | _DebugStrings |
intptr_t | _touchId |
Protected Attributes inherited from Ref | |
unsigned int | _referenceCount |
count of references More... | |
Console is helper class that lets the developer control the game from TCP connection.
Console will spawn a new thread that will listen to a specified TCP port. Console has a basic token parser. Each token is associated with an std::function<void(int)>. If the std::function<> needs to use the cocos2d API, it needs to call
``` scheduler->performFunctionInCocosThread( ... ); ```
Console | ( | ) |
Constructor.
|
virtual |
Destructor.
|
protected |
void addCommand | ( | const Command & | cmd | ) |
add custom command
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool listenOnFileDescriptor | ( | int | fd | ) |
starts listening to specifed file descriptor
bool listenOnTCP | ( | int | port | ) |
starts listening to specifed TCP port
void log | ( | const char * | buf | ) |
log something in the console
|
protected |
|
protected |
|
protected |
|
protected |
void stop | ( | ) |
stops the Console.
'stop' will be called at destruction time as well
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |