Added launcher base javafx code.

This commit is contained in:
Andrew Lalis 2022-07-15 13:00:14 +02:00
parent 55628434a9
commit c2958e403b
7 changed files with 130 additions and 0 deletions

4
launcher/README.md Normal file
View File

@ -0,0 +1,4 @@
# AoS2 Launcher
The launcher is a standalone application that can be installed on a client's computer, to make starting the client program easier. Since the client boots up and directly connects to a server via command-line arguments, everything before that is managed by the launcher, like finding a server, choosing a nickname, etc.
This is a JavaFX application.

53
launcher/pom.xml Normal file
View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nl.andrewl</groupId>
<artifactId>aos2-launcher</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
<javafx.version>18.0.1</javafx.version>
<javafx.maven.plugin.version>0.0.8</javafx.maven.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.maven.plugin.version}</version>
<configuration>
<mainClass>nl.andrewl.aos2_launcher.Launcher</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
module aos2_launcher {
requires javafx.base;
requires javafx.controls;
requires javafx.graphics;
requires javafx.fxml;
exports nl.andrewl.aos2_launcher to javafx.graphics;
opens nl.andrewl.aos2_launcher to javafx.fxml;
}

View File

@ -0,0 +1,29 @@
package nl.andrewl.aos2_launcher;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
/**
* The main starting point for the launcher app.
*/
public class Launcher extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader loader = new FXMLLoader(Launcher.class.getResource("/main_view.fxml"));
Parent rootNode = loader.load();
Scene scene = new Scene(rootNode);
scene.getStylesheets().add(Launcher.class.getResource("/styles.css").toExternalForm());
stage.setScene(scene);
stage.setTitle("Ace of Shades 2 - Launcher");
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View File

@ -0,0 +1,11 @@
package nl.andrewl.aos2_launcher;
import javafx.fxml.FXML;
import javafx.scene.layout.TilePane;
public class MainViewController {
@FXML
public TilePane profilesTilePane;
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/16"
maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0"
fx:controller="nl.andrewl.aos2_launcher.MainViewController"
>
<MenuBar>
<Menu mnemonicParsing="false" text="File">
<MenuItem mnemonicParsing="false" text="Exit"/>
</Menu>
<Menu mnemonicParsing="false" text="Profiles">
<MenuItem mnemonicParsing="false" text="New Profile"/>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<MenuItem mnemonicParsing="false" text="About"/>
</Menu>
</MenuBar>
<ScrollPane VBox.vgrow="ALWAYS">
<TilePane fx:id="profilesTilePane"/>
</ScrollPane>
</VBox>

View File