DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

b085f64e90c589d33cad94609fa192e7cdfff345 — Jonni Liljamo 1 year, 9 months ago eb36e21
feat(client): connect to server (temporarily hard coded url)
1 files changed, 19 insertions(+), 0 deletions(-)

M client/src/main.rs
M client/src/main.rs => client/src/main.rs +19 -0
@@ 20,6 20,12 @@ use iyes_loopless::prelude::*;

use belly::prelude::{BellyPlugin, StyleSheet};

use naia_bevy_client::{
    Client as NaiaClient, ClientConfig as NaiaClientConfig, Plugin as NaiaClientPlugin,
};

use laurelin_shared::server::protocol::protocol;

mod api;
mod cfg;
mod constants;


@@ 104,9 110,22 @@ fn main() {
    app.insert_resource(runtime::menu::RTDMenu::default())
        .insert_resource(runtime::game::RTDGame::default());

    // Networking
    app.add_plugin(NaiaClientPlugin::new(
        NaiaClientConfig::default(),
        protocol(),
    ))
    .add_startup_system(init_networking);

    app.run();
}

fn init_networking(mut commands: Commands, mut client: NaiaClient) {
    info!("Laurelin client connecting");

    client.connect("http://127.0.0.1:14191");
}

fn setup(mut commands: Commands) {
    // Spawn a camera
    commands.spawn(Camera3dBundle::default());