diff --git a/client/src/main/resources/img/icon.png b/client/src/main/resources/img/icon.png new file mode 100644 index 0000000..b21f0b7 Binary files /dev/null and b/client/src/main/resources/img/icon.png differ diff --git a/client/src/main/resources/ships/corvette.json b/client/src/main/resources/ships/corvette.json new file mode 100644 index 0000000..bc181c8 --- /dev/null +++ b/client/src/main/resources/ships/corvette.json @@ -0,0 +1,62 @@ +{ + "name": "Corvette", + "components": [ + { + "type": "panel", + "name": "Main Fuselage", + "mass": 5000, + "points": [ + {"x": 0.3, "y": 0.6}, + {"x": 0.2, "y": 0.1}, + {"x": 0.1, "y": 0.5}, + {"x": 0.2, "y": 0.8}, + {"x": 0.8, "y": 0.8}, + {"x": 0.9, "y": 0.5}, + {"x": 0.8, "y": 0.1}, + {"x": 0.7, "y": 0.6} + ] + }, + { + "type": "panel", + "name": "Front Cargo Bay", + "mass": 1000, + "points": [ + {"x": 0.4, "y": 0.2}, + {"x": 0.35, "y": 0.6}, + {"x": 0.65, "y": 0.6}, + {"x": 0.6, "y": 0.2} + ] + }, + { + "type": "cockpit", + "mass": 800, + "points": [ + {"x": 0.5, "y": 0.0}, + {"x": 0.4, "y": 0.2}, + {"x": 0.6, "y": 0.2} + ] + }, + { + "type": "gun", + "name": "Port-Side Machine Gun", + "mass": 500, + "location": {"x": 0.15, "y": 0.35}, + "rotation": 0, + "minRotation": -160, + "maxRotation": 5, + "barrelWidth": 0.02, + "barrelLength": 0.2 + }, + { + "type": "gun", + "name": "Starboard-Side Machine Gun", + "mass": 500, + "location": {"x": 0.85, "y": 0.35}, + "rotation": 0, + "minRotation": -5, + "maxRotation": 160, + "barrelWidth": 0.02, + "barrelLength": 0.2 + } + ] +} \ No newline at end of file diff --git a/server/pom.xml b/server/pom.xml index 047266c..085e189 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -23,5 +23,18 @@ core ${project.parent.version} + + + org.eclipse.jetty + jetty-servlet + 11.0.8 + + + + org.slf4j + slf4j-jdk14 + 2.0.0-alpha7 + runtime + \ No newline at end of file diff --git a/server/src/main/java/nl/andrewl/starship_arena/server/StarshipArenaServer.java b/server/src/main/java/nl/andrewl/starship_arena/server/StarshipArenaServer.java index aa4adc6..1779b65 100644 --- a/server/src/main/java/nl/andrewl/starship_arena/server/StarshipArenaServer.java +++ b/server/src/main/java/nl/andrewl/starship_arena/server/StarshipArenaServer.java @@ -1,7 +1,23 @@ package nl.andrewl.starship_arena.server; -public class StarshipArenaServer { - public static void main(String[] args) { +import nl.andrewl.starship_arena.server.servlet.ArenasServlet; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +public class StarshipArenaServer { + public static void main(String[] args) throws Exception { + Server jettyServer = new Server(8080); + Connector connector = new ServerConnector(jettyServer); + jettyServer.addConnector(connector); + + ServletContextHandler servletContext = new ServletContextHandler(); + servletContext.setContextPath("/"); + servletContext.addServlet(new ServletHolder(new ArenasServlet()), "/arenas"); + + jettyServer.setHandler(servletContext); + jettyServer.start(); } } diff --git a/server/src/main/java/nl/andrewl/starship_arena/server/servlet/ArenasServlet.java b/server/src/main/java/nl/andrewl/starship_arena/server/servlet/ArenasServlet.java new file mode 100644 index 0000000..5fdb694 --- /dev/null +++ b/server/src/main/java/nl/andrewl/starship_arena/server/servlet/ArenasServlet.java @@ -0,0 +1,16 @@ +package nl.andrewl.starship_arena.server.servlet; + +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +import java.io.IOException; + +public class ArenasServlet extends HttpServlet { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + super.doGet(req, resp); + // TODO: Return the list of available arenas. + } +}