Removed the built in updator script
This commit is contained in:
parent
fe759d7b28
commit
5aa5a6a989
|
|
@ -1,6 +1,15 @@
|
|||
package projectzombie.display;
|
||||
|
||||
import static org.lwjgl.opengl.GL33.*;
|
||||
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
|
||||
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
|
||||
import static org.lwjgl.opengl.GL11.GL_MODELVIEW;
|
||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.glBlendFunc;
|
||||
import static org.lwjgl.opengl.GL11.glClear;
|
||||
import static org.lwjgl.opengl.GL11.glLoadMatrixf;
|
||||
import static org.lwjgl.opengl.GL11.glMatrixMode;
|
||||
import static org.lwjgl.opengl.GL11.glViewport;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.opengl.GL;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,17 @@
|
|||
package projectzombie.input;
|
||||
|
||||
import static projectzombie.input.GameInput.*;
|
||||
import static projectzombie.input.GameInput.activateItem_last;
|
||||
import static projectzombie.input.GameInput.activateTile_last;
|
||||
import static projectzombie.input.GameInput.activate_last;
|
||||
import static projectzombie.input.GameInput.backButton_last;
|
||||
import static projectzombie.input.GameInput.dropItem_last;
|
||||
import static projectzombie.input.GameInput.fireGun;
|
||||
import static projectzombie.input.GameInput.hotbar_l;
|
||||
import static projectzombie.input.GameInput.hotbar_r;
|
||||
import static projectzombie.input.GameInput.moveDown;
|
||||
import static projectzombie.input.GameInput.moveUp;
|
||||
import static projectzombie.input.GameInput.move_last;
|
||||
import static projectzombie.input.GameInput.startButton_last;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
|
@ -11,7 +22,6 @@ import org.lwjgl.glfw.GLFWJoystickCallbackI;
|
|||
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.DisplayWindow;
|
||||
import projectzombie.input.types.Input;
|
||||
|
||||
public class JoystickCallback implements GLFWJoystickCallbackI, IMainloopTask
|
||||
|
|
|
|||
|
|
@ -1,7 +1,27 @@
|
|||
package projectzombie.input;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
import static projectzombie.input.GameInput.*;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_1;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_2;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_3;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_4;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_5;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_6;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_A;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_D;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_E;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_F11;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_Q;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_S;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_W;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_RELEASE;
|
||||
import static projectzombie.input.GameInput.backButton_last;
|
||||
import static projectzombie.input.GameInput.fireGun;
|
||||
import static projectzombie.input.GameInput.moveDown;
|
||||
import static projectzombie.input.GameInput.moveLeft;
|
||||
import static projectzombie.input.GameInput.moveRight;
|
||||
import static projectzombie.input.GameInput.moveUp;
|
||||
import static projectzombie.input.GameInput.move_last;
|
||||
|
||||
import org.lwjgl.glfw.GLFWKeyCallbackI;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package projectzombie.menu.gui.components;
|
||||
|
||||
import projectzombie.Main;
|
||||
import projectzombie.menu.Menu;
|
||||
import projectzombie.menu.MenuGamePause;
|
||||
import projectzombie.menu.MenuMain;
|
||||
import projectzombie.menu.MenuSettings;
|
||||
import projectzombie.menu.gui.ButtonGroup;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package projectzombie.resources;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
|
@ -14,51 +11,6 @@ public class Resource
|
|||
String path;
|
||||
byte[] data;
|
||||
|
||||
/*private InputStream fileURLStream(String path, int tries)
|
||||
{
|
||||
System.err.println("Getting \""+fileURL(path)+"\". Try "+ tries);
|
||||
|
||||
try {
|
||||
return new URL(fileURL(path)).openStream();
|
||||
}
|
||||
|
||||
catch(MalformedURLException e) {
|
||||
System.err.println("Malformed URL");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
|
||||
catch(IOException e)
|
||||
{
|
||||
if(tries == 10) {
|
||||
e.printStackTrace();
|
||||
System.err.println("Exceeded max tries");
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
|
||||
else {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e1) {
|
||||
System.err.println("Terminated by user");
|
||||
System.exit(1);
|
||||
}
|
||||
return this.fileURLStream(path, tries+1);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*private InputStream fileURLStream(String path) {
|
||||
return this.fileURLStream(path, 0);
|
||||
}*/
|
||||
|
||||
private String fileURL(String path) {
|
||||
return "https://www.onewaycoding.com/files/game_resources/ShooterGame/"+path;
|
||||
}
|
||||
|
||||
private String filePath(String path) {
|
||||
return "resources/"+path;
|
||||
}
|
||||
|
|
@ -71,54 +23,22 @@ public class Resource
|
|||
|
||||
public void load()
|
||||
{
|
||||
// Does the resource not exist
|
||||
File file = new File(filePath(path));
|
||||
if(!file.exists())
|
||||
try
|
||||
{
|
||||
// Create the parent directories
|
||||
file.getParentFile().mkdirs();
|
||||
// Open the file stored on the hard drive
|
||||
InputStream file_stream = new FileInputStream(filePath(path));
|
||||
|
||||
try
|
||||
{
|
||||
// Download the file and open the file output stream
|
||||
OutputStream file_stream = new FileOutputStream(filePath(path));
|
||||
|
||||
// Get the resource data from the server
|
||||
data = ResourceDownload.downloadURL(fileURL(path));
|
||||
|
||||
// Save all the data downloaded to a file
|
||||
file_stream.write(data);
|
||||
file_stream.close();
|
||||
}
|
||||
|
||||
catch(IOException e)
|
||||
{
|
||||
// Print the stacktrace and exit
|
||||
System.err.println("Error downloading file");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
data = new byte[file_stream.available()];
|
||||
file_stream.read(data);
|
||||
file_stream.close();
|
||||
}
|
||||
|
||||
else
|
||||
catch(IOException e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Open the file stored on the hard drive
|
||||
InputStream file_stream = new FileInputStream(filePath(path));
|
||||
|
||||
data = new byte[file_stream.available()];
|
||||
file_stream.read(data);
|
||||
file_stream.close();
|
||||
}
|
||||
|
||||
catch(IOException e)
|
||||
{
|
||||
// Print the stacktrace and exit
|
||||
System.err.println("Error opening file");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
// Print the stacktrace and exit
|
||||
System.err.println("Error opening file at "+path+"!");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
package projectzombie.resources;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class ResourceDownload
|
||||
{
|
||||
public static byte[] downloadURL(String path) throws IOException
|
||||
{
|
||||
// Get the url and the connection
|
||||
URL url = new URL(path);
|
||||
URLConnection con = url.openConnection();
|
||||
|
||||
// Get the file size
|
||||
int fileSize = con.getContentLength();
|
||||
byte[] data = new byte[fileSize];
|
||||
|
||||
// Get the input stream
|
||||
InputStream stream = con.getInputStream();
|
||||
|
||||
// Get 1 kb packets from the server
|
||||
for(int i = 0; i < fileSize; i ++)
|
||||
{
|
||||
// Load the stream contents to the buffer
|
||||
byte buffer[] = new byte[1];
|
||||
stream.read(buffer);
|
||||
|
||||
// Send a status update
|
||||
DecimalFormat decim = new DecimalFormat("#.##");
|
||||
if(i % 1048576 == 0) System.out.println(decim.format(i / 1048576) + " MB / " +
|
||||
decim.format(fileSize / 1048576) + " MB - " +
|
||||
decim.format((double)i / (double)fileSize) + "%");
|
||||
|
||||
// Store the bytes downloaded to the data variable
|
||||
for(int b=0;b<buffer.length;b++) {
|
||||
if(i+b < fileSize) {
|
||||
data[i+b] = buffer[b];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close the connection
|
||||
stream.close();
|
||||
|
||||
// Send back the data array
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
package projectzombie.settings;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import bdf.classes.BdfClassManager;
|
||||
import bdf.classes.IBdfClassManager;
|
||||
import bdf.file.BdfFileManager;
|
||||
|
|
|
|||
Loading…
Reference in New Issue