2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 lines
1.0 KiB

  1. #ifndef IZ_APP_NET_H
  2. #define IZ_APP_NET_H
  3. #include "IZ_subsystem.h"
  4. typedef enum {
  5. IZ_MESSAGE_KIND_ACTION_SYNC = 0,
  6. IZ_MESSAGE_KIND_STATE_SYNC = 1,
  7. } IZ_AppMessageKind;
  8. typedef struct {
  9. u8 index: 3;
  10. u8 state: 5;
  11. u16 value;
  12. } IZ_AppPlayerActionSyncMessage;
  13. typedef struct {
  14. u8 player_index: 3;
  15. f32 x;
  16. f32 y;
  17. f32 right;
  18. f32 up;
  19. } IZ_AppPlayerState;
  20. typedef struct {
  21. u8 message_kind; // player
  22. u64 client_elapsed_time; // for synchronization
  23. } IZ_AppMessageHeader;
  24. typedef struct {
  25. u8 player_actions_count;
  26. IZ_AppPlayerActionSyncMessage player[];
  27. } IZ_AppPlayerActionSection;
  28. typedef struct {
  29. IZ_AppMessageHeader header;
  30. IZ_AppPlayerActionSection action;
  31. } IZ_AppActionSyncMessage;
  32. typedef struct {
  33. IZ_AppMessageHeader header;
  34. IZ_AppPlayerState player_state[IZ_PLAYERS];
  35. IZ_AppPlayerActionSection player_actions;
  36. } IZ_AppStateSyncMessage;
  37. struct IZ_App;
  38. void IZ_AppBindConnection(struct IZ_App*, struct lws*);
  39. void IZ_AppHandleOutboundNetworking(struct IZ_App*);
  40. IZ_ProcedureResult IZ_AppRunNetworkingThread(struct IZ_App*);
  41. #endif