2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

73 řádky
1.4 KiB

  1. #ifndef IZ_APP_H
  2. #define IZ_APP_H
  3. #include <SDL.h>
  4. #include <libwebsockets.h>
  5. #include "input/IZ_input.h"
  6. #include "output/IZ_video.h"
  7. #include "memory/IZ_pool.h"
  8. #include "net/svc/IZ_wsclient.h"
  9. typedef enum {
  10. IZ_APP_RUN_RESULT_OK,
  11. IZ_APP_RUN_SDL_INIT_ERROR,
  12. IZ_APP_RUN_VIDEO_INIT_ERROR,
  13. IZ_APP_RUN_INPUT_INIT_ERROR,
  14. IZ_APP_RUN_POOL_INIT_ERROR,
  15. IZ_APP_RUN_NETWORKING_ERROR,
  16. } IZ_AppRunResult;
  17. typedef struct {
  18. IZ_InputState input_state;
  19. IZ_VideoState video_state;
  20. IZ_Pool pool;
  21. IZ_WSClientState client;
  22. SDL_Thread* client_thread;
  23. u64 ticks;
  24. } IZ_App;
  25. typedef struct {
  26. u8 player_index: 3;
  27. u8 player_state: 5;
  28. u16 action_set;
  29. } IZ_AppPlayerActionSyncMessage;
  30. typedef struct {
  31. u8 player_index: 3;
  32. f32 x;
  33. f32 y;
  34. f32 right;
  35. f32 up;
  36. } IZ_AppPlayerState;
  37. typedef enum {
  38. IZ_MESSAGE_KIND_ACTION_SYNC = 0,
  39. IZ_MESSAGE_KIND_STATE_SYNC = 1,
  40. } IZ_MessageKind;
  41. typedef struct {
  42. u8 message_kind; // player
  43. u64 client_elapsed_time; // for synchronization
  44. } IZ_AppMessageHeader;
  45. typedef struct {
  46. u8 player_actions_count;
  47. IZ_AppPlayerActionSyncMessage player_actions[];
  48. } IZ_AppPlayerActionSection;
  49. typedef struct {
  50. IZ_AppMessageHeader header;
  51. IZ_AppPlayerActionSection player_actions;
  52. } IZ_AppActionSyncMessage;
  53. typedef struct {
  54. IZ_AppMessageHeader header;
  55. IZ_AppPlayerState player_state[IZ_PLAYERS];
  56. IZ_AppPlayerActionSection player_actions;
  57. } IZ_AppStateSyncMessage;
  58. IZ_ProcedureResult IZ_AppRun(IZ_App*, u8, const char**);
  59. #endif