cocos2d-x  3.0Beta0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Console Class Reference

Console is helper class that lets the developer control the game from TCP connection. More...

#include <CCConsole.h>

Inheritance diagram for Console:
Object

Classes

struct  Command
 

Public Member Functions

bool listenOnTCP (int port)
 starts listening to specifed TCP port More...
 
var listenOnTCP ( var port)
 starts listening to specifed TCP port More...
 
local listenOnTCP ( local port)
 starts listening to specifed TCP port More...
 
bool listenOnFileDescriptor (int fd)
 starts listening to specifed file descriptor More...
 
var listenOnFileDescriptor ( var fd)
 starts listening to specifed file descriptor More...
 
local listenOnFileDescriptor ( local fd)
 starts listening to specifed file descriptor More...
 
void cancel ()
 cancels the Console. More...
 
var cancel ()
 cancels the Console. More...
 
local cancel ()
 cancels the Console. More...
 
void setUserCommands (Command *commands, int numberOfCommands)
 sets user tokens More...
 
var setUserCommands ( var commands, var numberOfCommands)
 sets user tokens More...
 
local setUserCommands ( local commands, local numberOfCommands)
 sets user tokens More...
 
- Public Member Functions inherited from Object
 Object ()
 Constructor. More...
 
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
local retainCount ()
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)
virtual void update (float dt)

Static Public Member Functions

static Consolecreate ()
 creates a new instnace of the Console More...
 

Protected Member Functions

 Console ()
 Console ()
 Console ()
virtual ~Console ()
local ~Console ()
void loop ()
var loop ()
local loop ()
ssize_t readline (int fd)
var readline ( var fd)
local readline ( local fd)
bool parseCommand (int fd)
var parseCommand ( var fd)
local parseCommand ( local fd)
void sendPrompt (int fd)
var sendPrompt ( var fd)
local sendPrompt ( local fd)
void addClient ()
void commandHelp (int fd, const char *command)
var commandHelp ( var fd, var command)
local commandHelp ( local fd, local command)
void commandExit (int fd, const char *command)
local commandExit ( local fd, local command)
void commandSceneGraph (int fd, const char *command)
var commandSceneGraph ( var fd, var command)
local commandSceneGraph ( local fd, local command)

Protected Attributes

int _listenfd
int _maxfd
var _maxfd
local _maxfd
std::vector< int > _fds
var _fds
local _fds
std::thread _thread
var _thread
local _thread
fd_set _read_set
var _read_set
local _read_set
bool _running
var _running
local _running
bool _endThread
var _endThread
local _endThread
char _buffer [512]
var _buffer ()
local _buffer ()
struct Command _commands [15]
var _commands ()
local _commands ()
int _maxCommands
var _maxCommands
local _maxCommands
struct Command_userCommands
var _userCommands
local _userCommands
int _maxUserCommands
var _maxUserCommands
local _maxUserCommands
- Protected Attributes inherited from Object
unsigned int _reference
 count of references More...
 
var _reference
 count of references More...
 
local _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 
var _autoReleaseCount
 count of autorelease More...
 
local _autoReleaseCount
 count of autorelease More...
 

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 
var _luaID
 Lua reference id. More...
 
local _luaID
 Lua reference id. More...
 

Detailed Description

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( ... ); ```

Constructor & Destructor Documentation

Console ( )
protected
var Console ( )
protected
local Console ( )
protected
virtual ~Console ( )
protectedvirtual
var ~Console ( )
protectedvirtual
local ~Console ( )
protectedvirtual

Member Function Documentation

void addClient ( )
protected
var addClient ( )
protected
local addClient ( )
protected
void cancel ( )

cancels the Console.

Cancel will be called at destruction time as well

var cancel ( )

cancels the Console.

Cancel will be called at destruction time as well

local cancel ( )

cancels the Console.

Cancel will be called at destruction time as well

void commandExit ( int  fd,
const char *  command 
)
protected
var commandExit ( var  fd,
var  command 
)
protected
local commandExit ( local  fd,
local  command 
)
protected
void commandHelp ( int  fd,
const char *  command 
)
protected
var commandHelp ( var  fd,
var  command 
)
protected
local commandHelp ( local  fd,
local  command 
)
protected
void commandSceneGraph ( int  fd,
const char *  command 
)
protected
var commandSceneGraph ( var  fd,
var  command 
)
protected
local commandSceneGraph ( local  fd,
local  command 
)
protected
static Console* create ( )
static

creates a new instnace of the Console

bool listenOnFileDescriptor ( int  fd)

starts listening to specifed file descriptor

var listenOnFileDescriptor ( var  fd)

starts listening to specifed file descriptor

local listenOnFileDescriptor ( local  fd)

starts listening to specifed file descriptor

bool listenOnTCP ( int  port)

starts listening to specifed TCP port

var listenOnTCP ( var  port)

starts listening to specifed TCP port

local listenOnTCP ( local  port)

starts listening to specifed TCP port

void loop ( )
protected
var loop ( )
protected
local loop ( )
protected
bool parseCommand ( int  fd)
protected
var parseCommand ( var  fd)
protected
local parseCommand ( local  fd)
protected
ssize_t readline ( int  fd)
protected
var readline ( var  fd)
protected
local readline ( local  fd)
protected
void sendPrompt ( int  fd)
protected
var sendPrompt ( var  fd)
protected
local sendPrompt ( local  fd)
protected
void setUserCommands ( Command commands,
int  numberOfCommands 
)

sets user tokens

var setUserCommands ( var  commands,
var  numberOfCommands 
)

sets user tokens

local setUserCommands ( local  commands,
local  numberOfCommands 
)

sets user tokens

Member Data Documentation

char _buffer[512]
protected
char _buffer[512]
protected
char _buffer[512]
protected
struct Command _commands[15]
protected
struct Command _commands[15]
protected
struct Command _commands[15]
protected
bool _endThread
protected
var _endThread
protected
local _endThread
protected
std::vector<int> _fds
protected
var _fds
protected
local _fds
protected
int _listenfd
protected
var _listenfd
protected
local _listenfd
protected
int _maxCommands
protected
var _maxCommands
protected
local _maxCommands
protected
int _maxfd
protected
var _maxfd
protected
local _maxfd
protected
int _maxUserCommands
protected
var _maxUserCommands
protected
local _maxUserCommands
protected
fd_set _read_set
protected
var _read_set
protected
local _read_set
protected
bool _running
protected
var _running
protected
local _running
protected
std::thread _thread
protected
var _thread
protected
local _thread
protected
struct Command* _userCommands
protected
var _userCommands
protected
local _userCommands
protected

The documentation for this class was generated from the following file: