Package multididdy_controller

Source Code of multididdy_controller.Controller

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package multididdy_controller;

import java.util.logging.Level;
import java.util.logging.Logger;
import multididdy_debug.Debug;
import multididdy_model.Client;
import multididdy_model.Model;
import multididdy_view.View;
import multididdy_model.Server;
import multididdy_model.UpdateProtocol;
import multididdy_model.UpdateType;
import multididdy_tools.ConfigReader;
import multididdy_view.InputListener;
import org.newdawn.slick.Input;

/**
*
* @author chris
*/
public class Controller  implements InputListener{
    public View view;
    public Model model;
    public Server myServer;
    public Client myClient;
   
    public Controller(){
       
        model = new Model();
        /*
        ConfigReader cr = new ConfigReader("./data/weapons/RocketLauncher/weapon.ini");
       
        Debug.p(""+cr.getInt("speed"));
        Debug.p(""+cr.getBool("explosion"));
        Debug.p(""+cr.getDouble("doubleval"));
        Debug.p(""+cr.getString("name"));
        Debug.p(""+cr.getValues("animationFrames"));
        */
        myServer = new Server();
        myServer.start();

        for(int i=0;i<100000;++i) {
            Debug.p(""+i,0);
        }
        Debug.p("",0);
       
        myClient = new Client();
        myClient.start();
       
       
                for(int i=0;i<100000;++i) {
            Debug.p(""+i,0);
        }
        Debug.p("",0);
       
        myClient = new Client();
        myClient.start();
       
       
       
        UpdateProtocol up = new UpdateProtocol();
        up.setType(UpdateType.CLIENT_CONNECTED);
        up.setMessage("Harald Hirschhausen");
       
        //myClient.sendMessage(up);
       
        for(int i=0;i<100000;++i) {
            Debug.p(""+i,0);
        }
        Debug.p("",0);
       
        myServer.sendMessageToAll(up);
       
       
        myClient.sendMessage(up);
       
       
        view= new View();
        view.addInputListener(this);
    }
   
    @Override
    public void handleInput(Input input) {
       
        if(input.isKeyPressed(input.KEY_ESCAPE)){
            view.gui.guiContext.exit();
       
        }
       
    
           
    }
}
TOP

Related Classes of multididdy_controller.Controller

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.