adding multiplayer
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include "../game_source/entities/Player.h"
|
||||
#include "../game_source/entities/Player_e.h"
|
||||
#include "../game_source/entities/Player_c.h"
|
||||
#include "../game_source/entities/Centery.h"
|
||||
#include <sys/random.h>
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
@@ -78,13 +80,36 @@ int client_init(void* cli) {
|
||||
|
||||
CreateWorld(&c->world, clock());
|
||||
InitWorld(&c->world);
|
||||
entity* cen = CreatePlayer("testing", c, &c->world);
|
||||
cen->position.x = 3;
|
||||
cen->position.y = 3;
|
||||
AddEntity(&c->world, cen);
|
||||
player_data p = {
|
||||
.holding = 0,
|
||||
.class = 0,
|
||||
.health = 20,
|
||||
.ac = 4,
|
||||
.str = 0,
|
||||
.wis = 0,
|
||||
.intel = 0,
|
||||
.dex = 0,
|
||||
.name = "testing",
|
||||
.c = (color){100,100,100},
|
||||
};
|
||||
entity* pc = CreatePlayerCharecter(p,c, &c->world);
|
||||
entity* pe = CreatePlayerEntity(p,0, &c->world);
|
||||
//pc->position.x = 3;
|
||||
//pc->position.y = 3;
|
||||
pe->position.x = 3;
|
||||
pe->position.y = 3;
|
||||
//AddEntity(&c->world, pc);
|
||||
AddEntity(&c->world, pe);
|
||||
GenerateWorld(&c->world);
|
||||
CammeraInit(&c->cam, 150,50,0,0,&c->world, &c->w);
|
||||
clock_gettime(CLOCK_MONOTONIC,&c->last_time);
|
||||
memset(&c->server, 0, sizeof(game_server));
|
||||
if(Connect(&c->server) < 0) {
|
||||
printf("Could not connect to server\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
pe->server = c->server.game_info.socket;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -104,6 +129,8 @@ int client_update(ssh_terminal_data* td, void* cli) {
|
||||
|
||||
tart_jump(&w, (tart_vec2){w.windowSize.x, w.windowSize.y-1});
|
||||
tart_insert_cell(&w, 5, 'a');
|
||||
tart_jump(&w, (tart_vec2){0,0});
|
||||
tart_printf(&w, 5, T"Entities %d\n", c->world.ent_list->count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <tart.h>
|
||||
#include "../game_source/cammera.h"
|
||||
#include "../game_source/world.h"
|
||||
#include "../server_source/game_client.h"
|
||||
|
||||
typedef struct {
|
||||
tart_window w;
|
||||
@@ -32,6 +33,8 @@ typedef struct {
|
||||
struct ssh_server_callbacks_struct server_cb;
|
||||
struct ssh_channel_callbacks_struct channel_cb;
|
||||
struct timespec last_time;
|
||||
game_server server;
|
||||
|
||||
|
||||
|
||||
} client;
|
||||
|
||||
Reference in New Issue
Block a user