MultiPlayer.h 569 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdio.h>
  4. #include "game.h"
  5. #include "game_common.h"
  6. typedef struct {
  7. unsigned int screen_w;
  8. unsigned int screen_h;
  9. GameState state;
  10. GameShapes shapes;
  11. bool is_player_1;
  12. int sock;
  13. int conn;
  14. FILE *conn_s;
  15. } MultiPlayer;
  16. MultiPlayer MultiPlayer_alloc(
  17. const unsigned int screen_w,
  18. const unsigned int screen_h,
  19. const char *server_host,
  20. const uint16_t server_port
  21. );
  22. void MultiPlayer_free(MultiPlayer *const mp);
  23. void MultiPlayer_tick(MultiPlayer *const mp, const double delta);