c_api_game_session.h - Engine C API Reference

c_api_game_session.h
  1. #pragma once
  2. #include "c_api_types.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. struct GameSessionCApi_BoolPeerWrapper {
  7. int bool_value;
  8. PeerId peer;
  9. };
  10. struct GameSessionCApi
  11. {
  12. int (*in_session_self) (GameSessionPtr);
  13. int (*in_session) (GameSessionPtr, PeerId);
  14. PeerId (*host) (GameSessionPtr);
  15. void (*make_host) (GameSessionPtr);
  16. void (*shutdown_host) (GameSessionPtr);
  17. int (*host_error_occured) (GameSessionPtr);
  18. void (*migrate_host) (GameSessionPtr);
  19. void (*disconnect_from_host) (GameSessionPtr);
  20. void (*add_peer) (GameSessionPtr, uint64_t);
  21. PeerId (*peer) (GameSessionPtr, unsigned index);
  22. unsigned (*num_peers) (GameSessionPtr);
  23. int (*peer_is_synchronizing) (GameSessionPtr, unsigned index);
  24. UnitSynchronizerPtr (*unit_synchronizer) (GameSessionPtr);
  25. GameObjectId (*create_game_object_with_default_values) (GameSessionPtr, unsigned unit_type_id32);
  26. GameObjectId (*create_game_object) (GameSessionPtr, unsigned unit_type_id32, struct GameObjectField* field_array, unsigned num_elements);
  27. void (*destroy_game_object) (GameSessionPtr, GameObjectId);
  28. int (*game_object_exists) (GameSessionPtr, GameObjectId);
  29. void (*remove_peer) (GameSessionPtr, PeerId, game_object_callback_function game_object_destroyed);
  30. void (*leave) (GameSessionPtr);
  31. struct GameSessionCApi_BoolPeerWrapper (*broken_connection) (GameSessionPtr);
  32. struct GameSessionCApi_BoolPeerWrapper (*wants_to_leave) (GameSessionPtr);
  33. void (*migrate_game_object) (GameSessionPtr, GameObjectId, PeerId new_owner, struct RPCCallback*);
  34. unsigned (*num_game_objects) (GameSessionPtr);
  35. GameObjectId (*game_object_id_from_index) (GameSessionPtr, unsigned);
  36. PeerId (*game_object_owner) (GameSessionPtr, GameObjectId);
  37. int (*game_object_owner_is_self) (GameSessionPtr, GameObjectId);
  38. void (*set_game_object_fields) (GameSessionPtr, GameObjectId, struct GameObjectField* field_array, unsigned num_elements);
  39. struct GameObjectField (*game_object_field) (GameSessionPtr, GameObjectId, unsigned field_name_id32);
  40. };
  41. #ifdef __cplusplus
  42. }
  43. #endif