Unigine::Cigi::CigiClientInterface Class
Header: | #include <CigiClientInterface.h> |
This class represents the CIGI Client interface.
CIGI plugin must be loaded.
CigiClientInterface Class
Members
init( int version, const char * host, int send, int recv, int size = 1432 )
Initializes the CIGI Client using the given parameters.Arguments
- int version - CIGI protocol version. One of the CIGI_VERSION_* values.
- const char * host - CIGI Host address.
- int send - TCP port number to be used for sending packets to the CIGI Host.
- int recv - TCP port number to be used for receiving packets from the CIGI Host.
- int size - Packet size. The default value is 1432.
int isInitialized( )
Returns a value indicating if the CIGI Client was initialized successfully.Return value
1 if the CIGI Client was initialized successfully; otherwise, 0.IView * getView( int view_id )
Returns the interface of the specified view.The specified view will be created, if it doesn't exist yet.
Arguments
- int view_id - ID of the view.
Return value
Pointer to the view interface.IViewGroup * getViewGroup( int group_id )
Returns the interface of the specified view group.The specified view group will be created, if it doesn't exist yet.
Arguments
- int group_id - ID of the view group.
Return value
Pointer to the view group interface.IEntity * getEntity( int entity_id )
Returns the interface of the specified entity.The specified entity will be created, if it doesn't exist yet.
Arguments
- int entity_id - ID of the entity.
Return value
Pointer to the entity interface.void loadEntityTypes( const char * file_name )
Loads entity definitions from the specified .xml file.Arguments
- const char * file_name - Path to the .xml file with entity definitions. By default entity definitions will be loaded from the "entity_types.xml" file.
int findEntityType( const char * type_name )
Returns the entity type ID by its name.Entity type IDs are defined in the entity definition file.
Arguments
- const char * type_name - Entity type name.
Return value
Entity type ID.int findComponentID( int entity_type, const char * name )
Returns the ID of the component with the given name, which belongs to the specified entity type.Arguments
- int entity_type - Entity type ID.
- const char * name - Component name.
Return value
Component ID.void setIGMode( int mode )
Sets the current IG mode.Arguments
- int mode - IG mode. One of the CIGI_MODE_* values.
int getIGMode( )
Returns the current IG mode.Return value
IG mode. One of the CIGI_MODE_* values.void setIGStatus( int status )
Sets the current IG status.Arguments
- int status - IG status. The following values are supported:
- 0 - normal
- 1-255 - an error has occurred
int getIGStatus( )
Returns the current IG status.Return value
IG status. The following values are supported:- 0 - normal
- 1-255 - an error has occurred
void setDatabase( int db )
Sets the database to be used.Arguments
- int db - ID of the database to be used.
int getDatabase( )
Returns the database currently used.Return value
ID of the database currently used.int getInterpolation( )
Returns a value indicating if interpolation and extrapolation are enabled.Return value
1 if interpolation and extrapolation are enabled; otherwise, 0.int getIGFrame( )
Returns the number of the current frame for the IG.Return value
Current IG frame number.int getHostFrame( )
Returns the number of the current frame for the Host.Return value
Current Host frame number.double getHostTime( )
Returns the current Host time (with latency corrections).Return value
Current Host time, in seconds.double getLastReceivedHostTime( )
Returns the last received Host time.Return value
Last received Host time, in seconds.int isPacketsReceived( )
Returns a value indicating if packets where received from the Host after the last update().Return value
1 if packets were received from the Host after the last update(); otherwise, 0.void setPlayer( int view_id )
Sets the view with the given ID as a current one.Arguments
- int view_id - ID of the view to be set.
void useSynckerViewAsViewID( int enabled )
Enables or disables an option to use of Syncker View IDs as View IDs for CIGI.This method is to be called on Syncker Master only.
Arguments
- int enabled - 1 to use Syncker View IDs as View IDs for CIGI; 0 - to use own View IDs.
int isSynckerViewUsedAsViewID( )
Returns a value indicating if Syncker View IDs are used as View IDs for CIGI.Return value
1 if Syncker View IDs are used as View IDs for CIGI; otherwise, 0.void setConnectCallback( Unigine::CallbackBase * func )
Sets a callback function to be fired when the Host has connected.Arguments
- Unigine::CallbackBase * func - Callback pointer.
Unigine::CallbackBase * getConnectCallback( )
Returns a callback to be fired when the Host has connected.Return value
Callback pointer.void setReceivePacketCallback( int cigi_opcode, Unigine::CallbackBase * func )
Sets a callback function to be fired when a packet of the specified type has been received from the Host.Arguments
- int cigi_opcode - CIGI data packet opcode. One of the CIGI_OPCODE_* values.
- Unigine::CallbackBase * func - Callback pointer.
Unigine::CallbackBase * getReceivePacketCallback( int cigi_opcode )
Returns a callback to be fired when a packet of the specified type has been received from the Host.Arguments
- int cigi_opcode - CIGI data packet opcode. One of the CIGI_OPCODE_* values.
Return value
Callback pointer.void setCreateComponentCallback( int component_class, int entity_type, int component_id, Unigine::CallbackBase * func )
Sets a callback function to be fired on creation of the specified type of component with the specified ID and the specified entity type.Arguments
- int component_class - CIGI component class. One of the CIGI_COMPONENT_* values.
- int entity_type - Entity type ID.This value is used only when the component type is set to CIGI_COMPONENT_ENTITY.
- int component_id - Component ID.
- Unigine::CallbackBase * func - Callback pointer.
Unigine::CallbackBase * getCreateComponentCallback( int component_class, int entity_type, int component_id )
Returns a callback to be fired on creation of the specified type of component with the specified ID and the specified entity type.Arguments
- int component_class - CIGI component class. One of the CIGI_COMPONENT_* values.
- int entity_type - Entity type ID.This value is used only when the component type is set to CIGI_COMPONENT_ENTITY.
- int component_id - Component ID.
Return value
Callback pointer.void setDestroyComponentCallback( int component_class, int entity_type, int component_id, Unigine::CallbackBase * func )
Sets a callback function to be fired on deletion of the specified type of component with the specified ID and the specified entity type.Arguments
- int component_class - CIGI component class. One of the CIGI_COMPONENT_* values.
- int entity_type - Entity type ID.This value is used only when the component type is set to CIGI_COMPONENT_ENTITY.
- int component_id - Component ID.
- Unigine::CallbackBase * func - Callback pointer.
Unigine::CallbackBase * getDestroyComponentCallback( int component_class, int entity_type, int component_id )
Returns a callback to be fired on deletion of the specified type of component with the specified ID and the specified entity type.Arguments
- int component_class - CIGI component class. One of the CIGI_COMPONENT_* values.
- int entity_type - Entity type ID.This value is used only when the component type is set to CIGI_COMPONENT_ENTITY.
- int component_id - Component ID.
Return value
Callback pointer.int getNumHostPackets( )
Returns the total number of packets received from the Host.Return value
Total number of packets received from the Host.ICigiHostPacket * getHostPacket( int num )
Returns the specified CIGI Host packet.Arguments
- int num - ID of the Host packet.
Return value
CIGI Host packet.void addIGPacket( ICigiIGPacket * packet )
Sends the specified IG packet to the Host.Arguments
- ICigiIGPacket * packet - IG Packet to be sent to the Host.
int showDebug( )
Returns a value indicating if the debug information is to be displayed.Return value
1 if the debug information is to be displayed; otherwise, 0.Last update:
27.12.2018
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter