Changing Project Structure
This commit is contained in:
34
include/game.h
Normal file
34
include/game.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef GAME_H
|
||||
#define GAME_H 1
|
||||
|
||||
#include "network/networking.h"
|
||||
|
||||
|
||||
// Setup game board
|
||||
#define TOP_ROW 4
|
||||
#define BOT_ROW 21
|
||||
#define LEFT_COL 9
|
||||
#define RIGHT_COL 70
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int host;
|
||||
int playerNumber;
|
||||
char* domain;
|
||||
int port;
|
||||
|
||||
} GameData;
|
||||
|
||||
void SetupTermWin();
|
||||
void CloseTermWin();
|
||||
|
||||
void CreateGameServer(Server* serv,GameData*gd);
|
||||
void RunGameClient(Client* c);
|
||||
|
||||
void DrawWalls(GameData);
|
||||
void DrawHeader(GameData);
|
||||
|
||||
void MGameAlert(int y, int x, char* str);
|
||||
void GameAlert(char* str);
|
||||
|
||||
#endif
|
||||
26
include/network/networking.h
Normal file
26
include/network/networking.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef GAME_NETWORKING_H
|
||||
#define GAME_NETWORKING_H 1
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#define MAX_SERVER_CLIENTS 2
|
||||
|
||||
typedef struct {
|
||||
int server_fd;
|
||||
struct sockaddr_in address;
|
||||
int clients[2];
|
||||
int clientID;
|
||||
int client_count;
|
||||
} Server;
|
||||
|
||||
Server StartServer(int port);
|
||||
void RemoveClient(Server* s, int index);
|
||||
|
||||
typedef struct {
|
||||
int client_fd;
|
||||
struct sockaddr_in address;
|
||||
} Client;
|
||||
|
||||
Client StartClient(char* host, int port);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user