Go to the source code of this file.
Data Structures | |
struct | vp_terrain_cell_t |
Macros | |
#define | VPSDK_API extern |
#define | VPSDK_VERSION 2 |
#define | VP_PACK_TERRAIN_ATTRIBUTES(tex, rotation, visible) |
#define | VP_UNPACK_TERRAIN_VISIBILITY(x) ((x & 0x8000) >> 15) |
#define | VP_UNPACK_TERRAIN_ROTATION(x) ((x & 0x6000) >> 13) |
#define | VP_UNPACK_TERRAIN_TEXTURE(x) (x & 0x0FFF) |
Typedefs | |
typedef enum vp_event_t | vp_event_t |
Events can be registered using vp_event_set. | |
typedef enum vp_callback_t | vp_callback_t |
typedef enum vp_int_attribute_t | vp_int_attribute_t |
typedef enum vp_float_attribute_t | vp_float_attribute_t |
typedef enum vp_string_attribute_t | vp_string_attribute_t |
typedef enum vp_data_attribute_t | vp_data_attribute_t |
typedef enum vp_proxy_type_t | vp_proxy_type_t |
Proxy types. | |
typedef enum vp_url_target_t | vp_url_target_t |
typedef void * | vp_instance_t |
typedef vp_instance_t | VPInstance |
typedef void(* | VPEventHandler )(VPInstance) |
typedef void(* | VPCallbackHandler )(VPInstance, int, int) |
typedef struct vp_terrain_cell_t | vp_terrain_cell_t |
Functions | |
VPSDK_API int | vp_init (int version) |
Initialize the Virtual Paradise SDK API. | |
VPSDK_API VPInstance | vp_create (void) |
Create a new instance. | |
VPSDK_API int | vp_destroy (VPInstance instance) |
Destroy a Virtual Paradise SDK instance. | |
VPSDK_API int | vp_connect_universe (VPInstance instance, const char *host, int port) |
Connect to a universe server. | |
VPSDK_API int | vp_login (VPInstance instance, const char *username, const char *password, const char *botname) |
Login to the universe server. | |
VPSDK_API int | vp_wait (VPInstance instance, int milliseconds) |
Process incoming and outgoing data. | |
VPSDK_API int | vp_enter (VPInstance instance, const char *worldname) |
Enter a world, the current world will be left. | |
VPSDK_API int | vp_leave (VPInstance instance) |
Leave the current world. | |
VPSDK_API int | vp_say (VPInstance instance, const char *message) |
Send a simple message to everyone in the current world. | |
VPSDK_API int | vp_console_message (VPInstance instance, int session, const char *name, const char *message, int effects, unsigned char red, unsigned char green, unsigned char blue) |
Send a console message. | |
VPSDK_API int | vp_event_set (VPInstance instance, vp_event_t eventname, VPEventHandler event) |
Register an event handler. | |
VPSDK_API int | vp_callback_set (VPInstance instance, vp_callback_t callbackname, VPCallbackHandler callback) |
Register a callback function. | |
VPSDK_API void * | vp_user_data (VPInstance instance) |
Retrieve the pointer to user-defined data for this instance. | |
VPSDK_API void | vp_user_data_set (VPInstance instance, void *data) |
Sets a pointer to user-defined data for this instance. | |
VPSDK_API int | vp_state_change (VPInstance instance) |
Update avatar. | |
VPSDK_API int | vp_int (VPInstance instance, vp_int_attribute_t name) |
VPSDK_API float | vp_float (VPInstance instance, vp_float_attribute_t name) |
VPSDK_API const char * | vp_string (VPInstance instance, vp_string_attribute_t name) |
VPSDK_API const char * | vp_data (VPInstance instance, vp_data_attribute_t name, int *length) |
VPSDK_API int | vp_int_get (VPInstance instance, vp_int_attribute_t name, int *value) |
VPSDK_API int | vp_float_get (VPInstance instance, vp_float_attribute_t name, float *value) |
VPSDK_API int | vp_string_get (VPInstance instance, vp_string_attribute_t name, char **value) |
VPSDK_API int | vp_int_set (VPInstance instance, vp_int_attribute_t name, int value) |
VPSDK_API int | vp_float_set (VPInstance instance, vp_float_attribute_t name, float value) |
VPSDK_API void | vp_string_set (VPInstance instance, vp_string_attribute_t name, const char *str) |
VPSDK_API int | vp_data_set (VPInstance instance, vp_data_attribute_t name, int length, char *data) |
VPSDK_API int | vp_query_cell (VPInstance instance, int x, int z) |
Query the objects in a single cell Each object will be sent in a VP_EVENT_OBJECT event. | |
VPSDK_API int | vp_object_add (VPInstance instance) |
Builds a new object. | |
VPSDK_API int | vp_object_bump_begin (vp_instance_t instance, int object_id, int session_to) |
Send a object contact begin event to other users in the world. | |
VPSDK_API int | vp_object_bump_end (vp_instance_t instance, int object_id, int session_to) |
Send a object contact end event to other users in the world. | |
VPSDK_API int | vp_object_change (VPInstance instance) |
Changes an existing object. | |
VPSDK_API int | vp_object_click (VPInstance instance, int object_id, int session_to, float hit_x, float hit_y, float hit_z) |
Sends an object click event to other users in the world. | |
VPSDK_API int | vp_object_delete (VPInstance instance, int object_id) |
Delete an object. | |
VPSDK_API int | vp_object_get (VPInstance instance, int object_id) |
Request the attributes of a single object. | |
VPSDK_API int | vp_world_list (VPInstance instance, int time) |
Request the world list. | |
VPSDK_API int | vp_user_attributes_by_id (VPInstance instance, int user_id) |
Request user attributes by user ID. | |
VPSDK_API int | vp_user_attributes_by_name (VPInstance instance, const char *name) |
Get user attributes by user name. | |
VPSDK_API int | vp_friends_get (VPInstance instance) |
VPSDK_API int | vp_friend_add_by_name (VPInstance instance, const char *name) |
VPSDK_API int | vp_friend_delete (VPInstance instance, int friend_id) |
VPSDK_API int | vp_terrain_query (VPInstance instance, int tile_x, int tile_z, int revision[][4]) |
Query a terrain tile. | |
VPSDK_API int | vp_terrain_node_set (VPInstance instance, int tile_x, int tile_z, int node_x, int node_z, struct vp_terrain_cell_t *cells) |
Replace terrain node data. | |
VPSDK_API int | vp_avatar_click (VPInstance instance, int avatar_session) |
Send an avatar click event to other users in the world. | |
VPSDK_API int | vp_teleport_avatar (VPInstance instance, int target_session, const char *world, float x, float y, float z, float yaw, float pitch) |
Request that another avatar teleports to a new location. | |
VPSDK_API int | vp_url_send (VPInstance instance, int session_id, const char *url, vp_url_target_t url_target) |
Send a URL to a user. | |
#define VP_PACK_TERRAIN_ATTRIBUTES | ( | tex, | |
rotation, | |||
visible | |||
) |
#define VP_UNPACK_TERRAIN_ROTATION | ( | x | ) | ((x & 0x6000) >> 13) |
#define VP_UNPACK_TERRAIN_TEXTURE | ( | x | ) | (x & 0x0FFF) |
#define VP_UNPACK_TERRAIN_VISIBILITY | ( | x | ) | ((x & 0x8000) >> 15) |
#define VPSDK_API extern |
#define VPSDK_VERSION 2 |
typedef enum vp_callback_t vp_callback_t |
typedef enum vp_data_attribute_t vp_data_attribute_t |
typedef enum vp_event_t vp_event_t |
Events can be registered using vp_event_set.
typedef enum vp_float_attribute_t vp_float_attribute_t |
typedef void* vp_instance_t |
typedef enum vp_int_attribute_t vp_int_attribute_t |
typedef enum vp_proxy_type_t vp_proxy_type_t |
Proxy types.
typedef enum vp_string_attribute_t vp_string_attribute_t |
typedef struct vp_terrain_cell_t vp_terrain_cell_t |
typedef enum vp_url_target_t vp_url_target_t |
typedef void(* VPCallbackHandler)(VPInstance, int, int) |
typedef void(* VPEventHandler)(VPInstance) |
typedef vp_instance_t VPInstance |
enum vp_callback_t |
VP_CALLBACK_OBJECT_ADD |
The attribute VP_OBJECT_ID is set to the object ID of the new object. |
VP_CALLBACK_OBJECT_CHANGE |
VP_OBJECT_ID attribute is set to the changed object ID |
VP_CALLBACK_OBJECT_DELETE |
VP_OBJECT_ID attribute is set to the deleted object ID |
VP_CALLBACK_GET_FRIENDS | |
VP_CALLBACK_FRIEND_ADD | |
VP_CALLBACK_FRIEND_DELETE | |
VP_CALLBACK_TERRAIN_QUERY | |
VP_CALLBACK_TERRAIN_NODE_SET | |
VP_CALLBACK_OBJECT_GET |
Reason codes: Attributes: |
VP_HIGHEST_CALLBACK |
enum vp_chat_type |
enum vp_data_attribute_t |
enum vp_event_t |
Events can be registered using vp_event_set.
VP_EVENT_CHAT |
Called when a user in the same world the instance is in sends a message. Attributes:
|
VP_EVENT_AVATAR_ADD |
Called when a user enters the world Attributes: |
VP_EVENT_AVATAR_CHANGE |
Called when a users' avatar changes shape or position Attributes: |
VP_EVENT_AVATAR_DELETE |
Called when a user leaves the world. Attributes: |
VP_EVENT_OBJECT |
Called when a new object is created or sent as a result to a query. The following attributes are set when the event is called: |
VP_EVENT_OBJECT_CHANGE |
Called when an object is changed by another user. The following attributes are set when the event is called: |
VP_EVENT_OBJECT_DELETE |
Called when an object is deleted another user. The VP_OBJECT_ID attribute is set when the event is called. Attributes: |
VP_EVENT_OBJECT_CLICK |
Called when an object is clicked by another user. The following attributes are set when the event is called: |
VP_EVENT_WORLD_LIST |
Attributes: Called when a world changes state or when the world list is requested using vp_world_list. |
VP_EVENT_WORLD_SETTING |
Attributes: |
VP_EVENT_WORLD_SETTINGS_CHANGED |
Attributes: Called when the server is done sending world settings. |
VP_EVENT_FRIEND | |
VP_EVENT_WORLD_DISCONNECT |
Attributes: |
VP_EVENT_UNIVERSE_DISCONNECT |
Attributes: |
VP_EVENT_USER_ATTRIBUTES |
Attributes: |
VP_EVENT_CELL_END |
Attributes: |
VP_EVENT_TERRAIN_NODE |
Attributes: |
VP_EVENT_AVATAR_CLICK |
Attributes: |
VP_EVENT_TELEPORT |
Attributes:
|
VP_EVENT_URL |
Attributes:
|
VP_EVENT_OBJECT_BUMP_BEGIN |
Attributes:
|
VP_EVENT_OBJECT_BUMP_END |
Attributes:
|
VP_HIGHEST_EVENT |
enum vp_float_attribute_t |
VP_AVATAR_X | |
VP_AVATAR_Y | |
VP_AVATAR_Z | |
VP_AVATAR_YAW | |
VP_AVATAR_PITCH | |
VP_MY_X | |
VP_MY_Y | |
VP_MY_Z | |
VP_MY_YAW | |
VP_MY_PITCH | |
VP_OBJECT_X | |
VP_OBJECT_Y | |
VP_OBJECT_Z | |
VP_OBJECT_ROTATION_X | |
VP_OBJECT_ROTATION_Y | |
VP_OBJECT_ROTATION_Z | |
VP_OBJECT_YAW |
Only works correctly when VP_OBJECT_ROTATION_ANGLE is set to infinity. |
VP_OBJECT_PITCH |
Only works correctly when VP_OBJECT_ROTATION_ANGLE is set to infinity. |
VP_OBJECT_ROLL |
Only works correctly when VP_OBJECT_ROTATION_ANGLE is set to infinity. |
VP_OBJECT_ROTATION_ANGLE | |
VP_TELEPORT_X | |
VP_TELEPORT_Y | |
VP_TELEPORT_Z | |
VP_TELEPORT_YAW | |
VP_TELEPORT_PITCH | |
VP_CLICK_HIT_X | |
VP_CLICK_HIT_Y | |
VP_CLICK_HIT_Z | |
VP_HIGHEST_FLOAT |
enum vp_int_attribute_t |
enum vp_proxy_type_t |
enum vp_text_effect |
enum vp_url_target_t |
VPSDK_API int vp_avatar_click | ( | VPInstance | instance, |
int | avatar_session | ||
) |
Send an avatar click event to other users in the world.
Uses the following attributes:
avatar_session | The session id of the clicked avatar |
VPSDK_API int vp_callback_set | ( | VPInstance | instance, |
vp_callback_t | callbackname, | ||
VPCallbackHandler | callback | ||
) |
Register a callback function.
VPSDK_API int vp_connect_universe | ( | VPInstance | instance, |
const char * | host, | ||
int | port | ||
) |
Connect to a universe server.
instance | |
host | Host address of server to connect to. |
port | TCP port of remote server. |
VPSDK_API int vp_console_message | ( | VPInstance | instance, |
int | session, | ||
const char * | name, | ||
const char * | message, | ||
int | effects, | ||
unsigned char | red, | ||
unsigned char | green, | ||
unsigned char | blue | ||
) |
Send a console message.
session | The session ID to send the message to. Zero to send to everyone |
name | The name to use for the chat message. Empty string to hide name. |
message | Chat message contents |
effects | Text effects (combination of #VPTextEffect flags) |
red | Red component of the text color(0-255) |
green | Green component of the text color(0-255) |
blue | Blue component of the text color(0-255) |
VPSDK_API VPInstance vp_create | ( | void | ) |
Create a new instance.
VPSDK_API const char* vp_data | ( | VPInstance | instance, |
vp_data_attribute_t | name, | ||
int * | length | ||
) |
VPSDK_API int vp_data_set | ( | VPInstance | instance, |
vp_data_attribute_t | name, | ||
int | length, | ||
char * | data | ||
) |
VPSDK_API int vp_destroy | ( | VPInstance | instance | ) |
Destroy a Virtual Paradise SDK instance.
VPSDK_API int vp_enter | ( | VPInstance | instance, |
const char * | worldname | ||
) |
Enter a world, the current world will be left.
VPSDK_API int vp_event_set | ( | VPInstance | instance, |
vp_event_t | eventname, | ||
VPEventHandler | event | ||
) |
Register an event handler.
VPSDK_API float vp_float | ( | VPInstance | instance, |
vp_float_attribute_t | name | ||
) |
VPSDK_API int vp_float_get | ( | VPInstance | instance, |
vp_float_attribute_t | name, | ||
float * | value | ||
) |
VPSDK_API int vp_float_set | ( | VPInstance | instance, |
vp_float_attribute_t | name, | ||
float | value | ||
) |
VPSDK_API int vp_friend_add_by_name | ( | VPInstance | instance, |
const char * | name | ||
) |
VPSDK_API int vp_friend_delete | ( | VPInstance | instance, |
int | friend_id | ||
) |
VPSDK_API int vp_friends_get | ( | VPInstance | instance | ) |
VPSDK_API int vp_init | ( | int | version = VPSDK_VERSION | ) |
Initialize the Virtual Paradise SDK API.
This function should be called before calling any other VPSDK functions.
version |
VPSDK_API int vp_int | ( | VPInstance | instance, |
vp_int_attribute_t | name | ||
) |
VPSDK_API int vp_int_get | ( | VPInstance | instance, |
vp_int_attribute_t | name, | ||
int * | value | ||
) |
VPSDK_API int vp_int_set | ( | VPInstance | instance, |
vp_int_attribute_t | name, | ||
int | value | ||
) |
VPSDK_API int vp_leave | ( | VPInstance | instance | ) |
Leave the current world.
VPSDK_API int vp_login | ( | VPInstance | instance, |
const char * | username, | ||
const char * | password, | ||
const char * | botname | ||
) |
Login to the universe server.
instance | |
username | |
password | |
botname |
VPSDK_API int vp_object_add | ( | VPInstance | instance | ) |
VPSDK_API int vp_object_bump_begin | ( | vp_instance_t | instance, |
int | object_id, | ||
int | session_to | ||
) |
Send a object contact begin event to other users in the world.
object_id | |
session_to | Session ID to send a bump event to, or 0 to send to everyone |
VPSDK_API int vp_object_bump_end | ( | vp_instance_t | instance, |
int | object_id, | ||
int | session_to | ||
) |
Send a object contact end event to other users in the world.
object_id | |
session_to | Session ID to send a bump event to, or 0 to send to everyone |
VPSDK_API int vp_object_change | ( | VPInstance | instance | ) |
Changes an existing object.
Uses attributes:
VPSDK_API int vp_object_click | ( | VPInstance | instance, |
int | object_id, | ||
int | session_to, | ||
float | hit_x, | ||
float | hit_y, | ||
float | hit_z | ||
) |
Sends an object click event to other users in the world.
object_id | Object ID of the clicked object |
session_to | Target session, or 0 to send to everyone |
hit_x,hit_y,hit_z | Position where the object was hit |
VPSDK_API int vp_object_delete | ( | VPInstance | instance, |
int | object_id | ||
) |
Delete an object.
object_id | ID of the object to be deleted |
VPSDK_API int vp_object_get | ( | VPInstance | instance, |
int | object_id | ||
) |
Request the attributes of a single object.
The result will be returned in the VP_CALLBACK_OBJECT_GET callback.
VPSDK_API int vp_query_cell | ( | VPInstance | instance, |
int | x, | ||
int | z | ||
) |
Query the objects in a single cell Each object will be sent in a VP_EVENT_OBJECT event.
After all the objects for the cell have been sent, a VP_EVENT_CELL_END event will be raised.
VPSDK_API int vp_say | ( | VPInstance | instance, |
const char * | message | ||
) |
Send a simple message to everyone in the current world.
message | The message to send. |
VPSDK_API int vp_state_change | ( | VPInstance | instance | ) |
Update avatar.
Attributes:
VPSDK_API const char* vp_string | ( | VPInstance | instance, |
vp_string_attribute_t | name | ||
) |
VPSDK_API int vp_string_get | ( | VPInstance | instance, |
vp_string_attribute_t | name, | ||
char ** | value | ||
) |
VPSDK_API void vp_string_set | ( | VPInstance | instance, |
vp_string_attribute_t | name, | ||
const char * | str | ||
) |
VPSDK_API int vp_teleport_avatar | ( | VPInstance | instance, |
int | target_session, | ||
const char * | world, | ||
float | x, | ||
float | y, | ||
float | z, | ||
float | yaw, | ||
float | pitch | ||
) |
Request that another avatar teleports to a new location.
target_session | session ID of the avatar to teleport |
world | destination world, empty string to teleport avatar in current world |
x,y,z | avatar position |
yaw,pitch | avatar rotation |
VPSDK_API int vp_terrain_node_set | ( | VPInstance | instance, |
int | tile_x, | ||
int | tile_z, | ||
int | node_x, | ||
int | node_z, | ||
struct vp_terrain_cell_t * | cells | ||
) |
Replace terrain node data.
tile_x | |
tile_z | |
node_x | |
node_z | |
cells | Pointer to 64 cells (8x8: cells[z*8+x]) |
VPSDK_API int vp_terrain_query | ( | VPInstance | instance, |
int | tile_x, | ||
int | tile_z, | ||
int | revision[][4] | ||
) |
Query a terrain tile.
tile_x | |
tile_z | |
revision | 16 node revision numbers (4x4: revision[z][x]) |
VPSDK_API int vp_url_send | ( | VPInstance | instance, |
int | session_id, | ||
const char * | url, | ||
vp_url_target_t | url_target | ||
) |
Send a URL to a user.
session_id | target session id |
url | the URL to send to the target session ID |
url_target | Where to open the URL, see vp_url_target_t |
VPSDK_API int vp_user_attributes_by_id | ( | VPInstance | instance, |
int | user_id | ||
) |
Request user attributes by user ID.
The user attributes will be returned in the VP_EVENT_USER_ATTRIBUTES event.
VPSDK_API int vp_user_attributes_by_name | ( | VPInstance | instance, |
const char * | name | ||
) |
VPSDK_API void* vp_user_data | ( | VPInstance | instance | ) |
Retrieve the pointer to user-defined data for this instance.
VPSDK_API void vp_user_data_set | ( | VPInstance | instance, |
void * | data | ||
) |
Sets a pointer to user-defined data for this instance.
This pointer is not accessed in any way, allocating and freeing it is the responsibility of the application programmer.
data | The pointer to your user-defined data. |
VPSDK_API int vp_wait | ( | VPInstance | instance, |
int | milliseconds | ||
) |
Process incoming and outgoing data.
Waits for connection to be ready for sending or receiving. This function needs to be called for events to fire.
milliseconds | The maximum time to wait in milliseconds. |
VPSDK_API int vp_world_list | ( | VPInstance | instance, |
int | time | ||
) |
Request the world list.
The worlds will be listed in the VP_EVENT_WORLD_LIST event. See vp_event_set().
time | Time since your last update. This is not used yet, the whole list will be requested. |