Skip to content

Commit

Permalink
added window to enter ip to connect to, and fixed gradle jar main class
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj42 committed Mar 27, 2018
1 parent dc76043 commit f7dc75c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
7 changes: 4 additions & 3 deletions core/client/src/miniventure/game/client/ClientWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ public void update(float delta) {
public boolean worldLoaded() { return getLevelCount() > 0; }

@Override
public void createWorld(int width, int height) { createWorld(width, height, true); }
public void createWorld(int width, int height, boolean startServer) {
public void createWorld(int width, int height) { createWorld(width, height, true, ""); }
public void createWorld(String ipAddress) { createWorld(0, 0, false, ipAddress); }
private void createWorld(int width, int height, boolean startServer, String ipAddress) {
LoadingScreen loadingScreen = new LoadingScreen();
ClientCore.setScreen(loadingScreen);

Expand All @@ -106,7 +107,7 @@ public void createWorld(int width, int height, boolean startServer) {
if(startServer) // start server, then connect
serverStarter.startServer(width, height, connect);
else // server should already be running; just connect
connect.act();
client.connectToServer(loadingScreen, ipAddress);

}).start();
}
Expand Down
5 changes: 4 additions & 1 deletion core/client/src/miniventure/game/screen/MainMenu.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package miniventure.game.screen;

import javax.swing.JOptionPane;

import miniventure.game.GameCore;
import miniventure.game.client.ClientWorld;

Expand Down Expand Up @@ -41,7 +43,8 @@ public void clicked(InputEvent e, float x, float y) {
joinBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y) {
world.createWorld(0, 0, false);
String ipAddress = JOptionPane.showInputDialog("Enter the IP Address you want to connect to.");
world.createWorld(ipAddress);
}
});

Expand Down
2 changes: 1 addition & 1 deletion desktop/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/" ]

project.ext.mainClassName = "miniventure.game.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../core/assets");
project.ext.assetsDir = new File("../core/game/assets");

task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
Expand Down
2 changes: 1 addition & 1 deletion desktop/src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Manifest-Version: 1.0
Main-Class: miniventure.desktop.DesktopLauncher
Main-Class: miniventure.game.desktop.DesktopLauncher

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package miniventure.desktop;
package miniventure.game.desktop;

import miniventure.game.GameCore;
import miniventure.game.client.ClientCore;
Expand Down

0 comments on commit f7dc75c

Please sign in to comment.