merge Implement mapdrawing into master #3
26
.github/workflows/gradle.yml
vendored
Normal file
26
.github/workflows/gradle.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# This workflow will build a Java project with Gradle
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
||||
|
||||
name: Java CI with Gradle
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
@@ -1,5 +1,9 @@
|
||||
package netwerkprog.game.client;
|
||||
|
||||
import netwerkprog.game.util.application.Controller;
|
||||
import netwerkprog.game.util.data.Data;
|
||||
import netwerkprog.game.util.data.DataParser;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -7,21 +11,25 @@ import java.net.Socket;
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Client extends Thread{
|
||||
public class Client extends Controller {
|
||||
private int port;
|
||||
private String hostname;
|
||||
private DataParser parser;
|
||||
private boolean isConnected = true;
|
||||
|
||||
|
||||
|
||||
public Client(String hostname) {
|
||||
this.port = Data.port();
|
||||
this.hostname = hostname;
|
||||
this.parser = new DataParser();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.connect();
|
||||
}
|
||||
|
||||
public Client(String hostname, int port) {
|
||||
this.port = port;
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
System.out.println("[CLIENT] connecting to server on port " + port);
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
@@ -66,10 +74,12 @@ public class Client extends Thread{
|
||||
while (isConnected) {
|
||||
try {
|
||||
received = in.readUTF();
|
||||
System.out.println(received);
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println("exception caught - " + e.getMessage());;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package netwerkprog.game;
|
||||
package netwerkprog.game.client;
|
||||
|
||||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Files;
|
||||
@@ -12,18 +12,17 @@ import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
import netwerkprog.game.client.Client;
|
||||
import netwerkprog.game.client.game.map.Map;
|
||||
import netwerkprog.game.client.game.map.MapRenderer;
|
||||
import netwerkprog.game.client.map.GameInputProcessor;
|
||||
import netwerkprog.game.client.map.Map;
|
||||
import netwerkprog.game.client.map.MapRenderer;
|
||||
import netwerkprog.game.server.Server;
|
||||
import netwerkprog.game.util.FrameRate;
|
||||
import netwerkprog.game.util.graphics.FrameRate;
|
||||
|
||||
public class MainGame extends ApplicationAdapter {
|
||||
SpriteBatch batch;
|
||||
float screenWidth;
|
||||
float screenHeight;
|
||||
private FrameRate frameRate;
|
||||
private Client client;
|
||||
private Thread client;
|
||||
private OrthographicCamera camera;
|
||||
private GameInputProcessor gameInputProcessor;
|
||||
|
||||
@@ -79,10 +78,13 @@ public class MainGame extends ApplicationAdapter {
|
||||
music.setVolume(.1f);
|
||||
music.play();
|
||||
music.setLooping(true);
|
||||
|
||||
connectToServer();
|
||||
}
|
||||
|
||||
|
||||
private void connectToServer() {
|
||||
client = new Client("localhost", Server.PORT);
|
||||
client = new Thread(new Client("localhost"));
|
||||
try {
|
||||
client.start();
|
||||
} catch (Exception e) {
|
||||
@@ -1,14 +0,0 @@
|
||||
package netwerkprog.game.client.controllers;
|
||||
|
||||
import netwerkprog.game.util.Controller;
|
||||
|
||||
public class GraphicsController extends Controller {
|
||||
public GraphicsController() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package netwerkprog.game.client.controllers;
|
||||
|
||||
import netwerkprog.game.util.Controller;
|
||||
|
||||
public class LogicController extends Controller {
|
||||
|
||||
public LogicController() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package netwerkprog.game.client.controllers;
|
||||
|
||||
import netwerkprog.game.util.Controller;
|
||||
|
||||
public class SessionController extends Controller {
|
||||
public SessionController() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
15
core/src/netwerkprog/game/client/game/Game.java
Normal file
15
core/src/netwerkprog/game/client/game/Game.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package netwerkprog.game.client.game;
|
||||
|
||||
import netwerkprog.game.util.application.Controller;
|
||||
|
||||
public class Game extends Controller {
|
||||
|
||||
|
||||
public Game() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
14
core/src/netwerkprog/game/client/game/Graphics.java
Normal file
14
core/src/netwerkprog/game/client/game/Graphics.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package netwerkprog.game.client.game;
|
||||
|
||||
import netwerkprog.game.util.application.Controller;
|
||||
|
||||
public class Graphics extends Controller {
|
||||
public Graphics() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters;
|
||||
|
||||
public class DevTest1 {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters;
|
||||
|
||||
public class DevTest2 {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters.abilities;
|
||||
|
||||
public class BodySwap {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters.abilities;
|
||||
|
||||
public class Implant {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters.abilities;
|
||||
|
||||
public class MindControl {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters.abilities;
|
||||
|
||||
public class OverrideOrders {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters.abilities;
|
||||
|
||||
public class Scrambler {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters.abilities;
|
||||
|
||||
public class ServerHardening {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters.abilities;
|
||||
|
||||
public class Spyware {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.client.game.characters.abilities;
|
||||
|
||||
public class SystemicInfection {
|
||||
}
|
||||
15
core/src/netwerkprog/game/client/game/logic/Logic.java
Normal file
15
core/src/netwerkprog/game/client/game/logic/Logic.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package netwerkprog.game.client.game.logic;
|
||||
|
||||
import netwerkprog.game.util.application.Controller;
|
||||
|
||||
public class Logic extends Controller {
|
||||
|
||||
public Logic() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package netwerkprog.game.client.map;
|
||||
package netwerkprog.game.client.game.map;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package netwerkprog.game.client.map;
|
||||
package netwerkprog.game.client.game.map;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import netwerkprog.game.util.graphics.Renderable;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import netwerkprog.game.util.Renderable;
|
||||
|
||||
public class MapRenderer implements Renderable {
|
||||
private final OrthographicCamera camera;
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.InputProcessor;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import netwerkprog.game.MainGame;
|
||||
import netwerkprog.game.client.MainGame;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -8,7 +8,6 @@ public class Server {
|
||||
private SessionController sessionController;
|
||||
private Thread sessionThread;
|
||||
private HashMap<String, Thread> gameThreads;
|
||||
public static final int PORT = 8000;
|
||||
|
||||
public void start() {
|
||||
this.sessionController = new SessionController();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package netwerkprog.game.server;
|
||||
|
||||
import netwerkprog.game.server.controllers.SessionController;
|
||||
import netwerkprog.game.util.data.Data;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -50,12 +51,14 @@ public class ServerClient implements Runnable {
|
||||
while (isConnected) {
|
||||
try {
|
||||
String received = this.in.readUTF();
|
||||
if (received.equals("\\quit")) {
|
||||
isConnected = false;
|
||||
Data data = server.parseData(received);
|
||||
if (data.toString().equals("\\quit")) {
|
||||
this.isConnected = false;
|
||||
this.server.removeClient(this);
|
||||
} else {
|
||||
this.server.sendToEveryoneExcept(this.name,"<" + this.name + "> : " + received);
|
||||
this.out.writeUTF(data.toString());
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println("[SERVERCLIENT] caught exception - " + e.getMessage());
|
||||
System.out.println("[SERVERCLIENT] terminating failing connection...");
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package netwerkprog.game.server.controllers;
|
||||
|
||||
import netwerkprog.game.server.Server;
|
||||
import netwerkprog.game.server.ServerClient;
|
||||
import netwerkprog.game.util.Controller;
|
||||
import netwerkprog.game.util.data.Data;
|
||||
import netwerkprog.game.util.data.DataParser;
|
||||
import netwerkprog.game.util.application.Controller;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -11,63 +12,99 @@ import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The sessionController manages any connections from new clients and assigns individual threads to said clients.
|
||||
*/
|
||||
public class SessionController extends Controller {
|
||||
private ServerSocket serverSocket;
|
||||
private ArrayList<ServerClient> clients = new ArrayList<>();
|
||||
private HashMap<String, Thread> clientThreads = new HashMap<>();
|
||||
private final DataParser parser;
|
||||
private final ArrayList<ServerClient> clients = new ArrayList<>();
|
||||
private final HashMap<String, Thread> clientThreads = new HashMap<>();
|
||||
private boolean listening;
|
||||
|
||||
public SessionController() {
|
||||
|
||||
this.parser = new DataParser();
|
||||
this.listening = true;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
try {
|
||||
this.serverSocket = new ServerSocket(Server.PORT);
|
||||
System.out.println("[SERVER] listening on port " + Server.PORT);
|
||||
Socket socket = serverSocket.accept();
|
||||
/**
|
||||
* Thread run method.
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
this.listening = true;
|
||||
while (listening) {
|
||||
listen();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens for any new clients.
|
||||
*/
|
||||
public void listen() {
|
||||
try {
|
||||
this.serverSocket = new ServerSocket(Data.port());
|
||||
System.out.println("[SERVER] listening on port " + Data.port());
|
||||
registerClient(serverSocket.accept());
|
||||
this.serverSocket.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a client to the server.
|
||||
* @param socket The socket used for the client connections.
|
||||
*/
|
||||
public void registerClient(Socket socket) {
|
||||
try {
|
||||
System.out.println("[SERVER] got new client on " + socket.getInetAddress().getHostAddress());
|
||||
DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream());
|
||||
DataInputStream inputStream = new DataInputStream(socket.getInputStream());
|
||||
|
||||
outputStream.writeUTF("Enter nickname: ");
|
||||
String nickname = inputStream.readUTF();
|
||||
outputStream.writeUTF("Enter username: ");
|
||||
String username = inputStream.readUTF();
|
||||
|
||||
System.out.println("[SERVER] got nickname " + nickname);
|
||||
ServerClient serverClient = new ServerClient(nickname, socket, this);
|
||||
System.out.println("[SERVER] got username " + username);
|
||||
ServerClient serverClient = new ServerClient(username, socket, this);
|
||||
|
||||
Thread t = new Thread(serverClient);
|
||||
t.start();
|
||||
|
||||
clientThreads.put(nickname, t);
|
||||
this.clientThreads.put(username,t);
|
||||
this.clients.add(serverClient);
|
||||
|
||||
sendMessage(nickname, "--- Welcome! ---\nPeople online : " + clients.size());
|
||||
|
||||
clients.forEach(yeet -> sendToEveryoneExcept(nickname, nickname + " joined the server! [" + socket.getInetAddress().getHostAddress() + "]"));
|
||||
|
||||
|
||||
this.serverSocket.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void sendToEveryone(String text) {
|
||||
/**
|
||||
* Parses the request to the requested Data.
|
||||
* @param request The request to parse.
|
||||
* @return Parsed Data.
|
||||
*/
|
||||
public Data parseData(String request) {
|
||||
return this.parser.parse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a server message to all connected clients.
|
||||
* @param text message.
|
||||
*/
|
||||
public void serverMessage(String text) {
|
||||
for (ServerClient serverClient : clients) {
|
||||
serverClient.writeUTF(text);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendToEveryoneExcept(String name, String text) {
|
||||
for (ServerClient serverClient : clients) {
|
||||
if (!serverClient.getName().equals(name))
|
||||
serverClient.writeUTF(text);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(String name, String text) {
|
||||
/**
|
||||
* Sends a message to a specific user.
|
||||
* @param name user.
|
||||
* @param text message.
|
||||
*/
|
||||
public void personalMessage(String name, String text) {
|
||||
for (ServerClient serverClient : clients) {
|
||||
if (serverClient.getName().equals(name)) {
|
||||
serverClient.writeUTF(text);
|
||||
@@ -76,6 +113,10 @@ public class SessionController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a client from the server.
|
||||
* @param serverClient The client to remove.
|
||||
*/
|
||||
public void removeClient(ServerClient serverClient) {
|
||||
this.clients.remove(serverClient);
|
||||
try {
|
||||
@@ -84,21 +125,27 @@ public class SessionController extends Controller {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.clientThreads.remove(serverClient.getName());
|
||||
this.sendToEveryone(serverClient.getName() + " left!");
|
||||
this.serverMessage(serverClient.getName() + " left!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean running = true;
|
||||
while (running) {
|
||||
System.out.println("Session thread active.");
|
||||
connect();
|
||||
/**
|
||||
* Gets a list of all connected users.
|
||||
* @return Set of all connected users.
|
||||
*/
|
||||
public Set<String> getUsernames() {
|
||||
return this.clientThreads.keySet();
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
/**
|
||||
* Shuts down the sessionController.
|
||||
*/
|
||||
public void shutdown() {
|
||||
this.listening = false;
|
||||
try {
|
||||
serverSocket.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("[SERVER] networking shutdown ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package netwerkprog.game.util;
|
||||
|
||||
public interface Renderable extends Updatable {
|
||||
void render();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package netwerkprog.game.util;
|
||||
package netwerkprog.game.util.application;
|
||||
|
||||
public abstract class Controller implements Runnable {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package netwerkprog.game.util;
|
||||
package netwerkprog.game.util.application;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package netwerkprog.game.util;
|
||||
package netwerkprog.game.util.application;
|
||||
|
||||
public class Timer implements Updatable {
|
||||
private double wait;
|
||||
@@ -1,4 +1,4 @@
|
||||
package netwerkprog.game.util;
|
||||
package netwerkprog.game.util.application;
|
||||
|
||||
public interface Updatable {
|
||||
void update(double deltaTime);
|
||||
@@ -1,4 +1,4 @@
|
||||
package netwerkprog.game.util;
|
||||
package netwerkprog.game.util.data;
|
||||
|
||||
public interface Callback {
|
||||
void onDataReceived();
|
||||
7
core/src/netwerkprog/game/util/data/Data.java
Normal file
7
core/src/netwerkprog/game/util/data/Data.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package netwerkprog.game.util.data;
|
||||
|
||||
public class Data {
|
||||
public static int port() {
|
||||
return 8000;
|
||||
}
|
||||
}
|
||||
10
core/src/netwerkprog/game/util/data/DataParser.java
Normal file
10
core/src/netwerkprog/game/util/data/DataParser.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package netwerkprog.game.util.data;
|
||||
|
||||
public class DataParser {
|
||||
public DataParser() {
|
||||
}
|
||||
|
||||
public Data parse(String request) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
4
core/src/netwerkprog/game/util/data/Event.java
Normal file
4
core/src/netwerkprog/game/util/data/Event.java
Normal file
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.util.data;
|
||||
|
||||
public class Event {
|
||||
}
|
||||
14
core/src/netwerkprog/game/util/game/Ability.java
Normal file
14
core/src/netwerkprog/game/util/game/Ability.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package netwerkprog.game.util.game;
|
||||
|
||||
public abstract class Ability {
|
||||
protected String name;
|
||||
|
||||
public Ability(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public abstract String getCommand();
|
||||
|
||||
|
||||
}
|
||||
30
core/src/netwerkprog/game/util/game/Character.java
Normal file
30
core/src/netwerkprog/game/util/game/Character.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package netwerkprog.game.util.game;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
public abstract class Character {
|
||||
protected String name;
|
||||
protected Faction faction;
|
||||
protected HashSet<Ability> abilities;
|
||||
protected boolean override;
|
||||
|
||||
public Character(String name, Faction faction, Ability... abilities) {
|
||||
this.name = name;
|
||||
this.faction = faction;
|
||||
this.abilities = new HashSet<>(Arrays.asList(abilities));
|
||||
this.override = false;
|
||||
}
|
||||
|
||||
public void addAbilities(Ability ability) {
|
||||
this.abilities.add(ability);
|
||||
}
|
||||
|
||||
public void removeAbility(Ability ability) {
|
||||
this.abilities.remove(ability);
|
||||
}
|
||||
|
||||
public void changeControl() {
|
||||
this.override = !this.override;
|
||||
}
|
||||
}
|
||||
4
core/src/netwerkprog/game/util/game/Faction.java
Normal file
4
core/src/netwerkprog/game/util/game/Faction.java
Normal file
@@ -0,0 +1,4 @@
|
||||
package netwerkprog.game.util.game;
|
||||
|
||||
public enum Faction {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package netwerkprog.game.util;
|
||||
package netwerkprog.game.util.graphics;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
7
core/src/netwerkprog/game/util/graphics/Renderable.java
Normal file
7
core/src/netwerkprog/game/util/graphics/Renderable.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package netwerkprog.game.util.graphics;
|
||||
|
||||
import netwerkprog.game.util.application.Updatable;
|
||||
|
||||
public interface Renderable extends Updatable {
|
||||
void render();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import netwerkprog.game.client.map.Map;
|
||||
import netwerkprog.game.client.game.map.Map;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
30
core/src/test/java/RestartSessionControllerTest.java
Normal file
30
core/src/test/java/RestartSessionControllerTest.java
Normal file
@@ -0,0 +1,30 @@
|
||||
import netwerkprog.game.server.controllers.SessionController;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RestartSessionControllerTest {
|
||||
|
||||
@Test
|
||||
public void restartSessionController() {
|
||||
SessionController sessionController;
|
||||
Thread sessionThread;
|
||||
|
||||
sessionController = new SessionController();
|
||||
sessionThread = new Thread(sessionController);
|
||||
|
||||
sessionThread.start();
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
sessionController.shutdown();
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(sessionThread.getState());
|
||||
sessionThread = new Thread(sessionController);
|
||||
sessionThread.start();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package netwerkprog.game.desktop;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import netwerkprog.game.MainGame;
|
||||
import netwerkprog.game.util.GameApplicationConfiguration;
|
||||
import netwerkprog.game.client.MainGame;
|
||||
import netwerkprog.game.util.application.GameApplicationConfiguration;
|
||||
|
||||
public class DesktopLauncher {
|
||||
public static void main (String[] arg) {
|
||||
|
||||
Reference in New Issue
Block a user