diff --git a/bin/application/Main.class b/bin/application/Main.class
index 08fc9de..50f8bf3 100644
Binary files a/bin/application/Main.class and b/bin/application/Main.class differ
diff --git a/bin/application/MainWindow.fxml b/bin/application/MainWindow.fxml
index c745c9e..9ee6dfe 100644
--- a/bin/application/MainWindow.fxml
+++ b/bin/application/MainWindow.fxml
@@ -16,7 +16,7 @@
-
+
@@ -105,13 +105,13 @@
-
+
-
+
-
+
diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class
index 650d653..b8e120c 100644
Binary files a/bin/application/MainWindowController$1.class and b/bin/application/MainWindowController$1.class differ
diff --git a/bin/application/MainWindowController$10.class b/bin/application/MainWindowController$10.class
index 19e4c25..cc71ebf 100644
Binary files a/bin/application/MainWindowController$10.class and b/bin/application/MainWindowController$10.class differ
diff --git a/bin/application/MainWindowController$11.class b/bin/application/MainWindowController$11.class
index 01b571b..4fb6065 100644
Binary files a/bin/application/MainWindowController$11.class and b/bin/application/MainWindowController$11.class differ
diff --git a/bin/application/MainWindowController$12.class b/bin/application/MainWindowController$12.class
index 48751b4..9ec88a0 100644
Binary files a/bin/application/MainWindowController$12.class and b/bin/application/MainWindowController$12.class differ
diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class
index 8eee081..1211ea3 100644
Binary files a/bin/application/MainWindowController$2.class and b/bin/application/MainWindowController$2.class differ
diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class
index ecc531c..b41d036 100644
Binary files a/bin/application/MainWindowController$3.class and b/bin/application/MainWindowController$3.class differ
diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class
index 3d27cb5..2b6f23c 100644
Binary files a/bin/application/MainWindowController$4.class and b/bin/application/MainWindowController$4.class differ
diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class
index 24e3ed6..414288e 100644
Binary files a/bin/application/MainWindowController$5.class and b/bin/application/MainWindowController$5.class differ
diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class
index ac200b5..6a9343b 100644
Binary files a/bin/application/MainWindowController$6.class and b/bin/application/MainWindowController$6.class differ
diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class
index 9d192a7..c108923 100644
Binary files a/bin/application/MainWindowController$7.class and b/bin/application/MainWindowController$7.class differ
diff --git a/bin/application/MainWindowController$8.class b/bin/application/MainWindowController$8.class
index a432aa6..a870744 100644
Binary files a/bin/application/MainWindowController$8.class and b/bin/application/MainWindowController$8.class differ
diff --git a/bin/application/MainWindowController$9.class b/bin/application/MainWindowController$9.class
index 2956aba..df25d1f 100644
Binary files a/bin/application/MainWindowController$9.class and b/bin/application/MainWindowController$9.class differ
diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class
index 51479fd..0227133 100644
Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ
diff --git a/src/application/Main.java b/src/application/Main.java
index c6bffa5..7e05425 100644
--- a/src/application/Main.java
+++ b/src/application/Main.java
@@ -20,10 +20,11 @@ import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.Optional;
-
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javafx.application.Application;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
import javafx.fxml.FXMLLoader;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
@@ -56,6 +57,7 @@ public class Main extends Application {
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
cloudController = new CloudController(this);
+ initActions();
mainWindow();
}
@@ -63,7 +65,7 @@ public class Main extends Application {
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
pane = loader.load();
- primaryStage.setResizable(false);
+// primaryStage.setResizable(false);
primaryStage.setTitle("cemu_UI");
// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon
@@ -114,7 +116,7 @@ public class Main extends Application {
mainWindowController.setxPosHelper(0);
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
- System.exit(0); //finishes itselfdownloading games.db...
+ System.exit(0); //finishes itself
}
if(pictureCache.exists() != true){
@@ -187,6 +189,19 @@ public class Main extends Application {
}
}
+ private void initActions() {
+ final ChangeListener listener = new ChangeListener() {
+ @Override
+ public void changed(ObservableValue extends Number> observable, Number oldValue, final Number newValue) {
+ mainWindowController.refreshUIData();
+ mainWindowController.refreshplayBtnPosition();
+ }
+ };
+
+ //add listener to primaryStage
+ primaryStage.widthProperty().addListener(listener);
+ }
+
public static void main(String[] args) {
//delete old log file and create new
if(System.getProperty("os.name").equals("Linux")){
diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml
index c745c9e..9ee6dfe 100644
--- a/src/application/MainWindow.fxml
+++ b/src/application/MainWindow.fxml
@@ -16,7 +16,7 @@
-
+
@@ -105,13 +105,13 @@
-
+
-
+
-
+
diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java
index 55d9677..6a814d6 100644
--- a/src/application/MainWindowController.java
+++ b/src/application/MainWindowController.java
@@ -34,7 +34,6 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Optional;
import java.util.Properties;
-
import javax.imageio.ImageIO;
import javax.swing.ProgressMonitor;
import javax.swing.ProgressMonitorInputStream;
@@ -162,6 +161,9 @@ public class MainWindowController {
@FXML
private AnchorPane gamesAnchorPane;
+ @FXML
+ private AnchorPane mainAnchorPane;
+
@FXML
private ScrollPane scrollPaneMain;
@@ -219,7 +221,7 @@ public class MainWindowController {
private String selectedGameTitle;
private String id;
private String version = "0.1.7";
- private String buildNumber = "039";
+ private String buildNumber = "041";
private String versionName = "Throwback Galaxy";
private int xPos = -200;
private int yPos = 17;
@@ -300,7 +302,7 @@ public class MainWindowController {
* initialize all actions not initialized by a own method
*/
void initActions() {
- LOGGER.info("initializing Actions... ");
+ LOGGER.info("initializing Actions ...");
HamburgerBackArrowBasicTransition burgerTask = new HamburgerBackArrowBasicTransition(menuHam);
menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
@@ -373,28 +375,14 @@ public class MainWindowController {
Optional result = alert.showAndWait();
if (result.get() == ButtonType.OK){
try {
- //remove all elements from gamesAnchorPane
- for(int i=0; i< games.size(); i++){
- gamesAnchorPane.getChildren().remove(games.get(i).getVBox());
- }
- //remove game from database
+ //remove game from database
games.remove(selectedUIDataIndex);
dbController.removeRom(selectedGameTitleID);
- //remove all games form gamesAnchorPane (UI)
- gamesAnchorPane.getChildren().removeAll(gamesAnchorPane.getChildren());
- //reset position
- xPos = -200;
- yPos = 17;
- xPosHelper = 0;
- //add all games to gamesAnchorPane (UI)
- for(int i=0; i< games.size(); i++){
- generatePosition();
- games.get(i).getVBox().setLayoutX(getxPos());
- games.get(i).getVBox().setLayoutY(getyPos());
- gamesAnchorPane.getChildren().add(games.get(i).getVBox());
- }
+
+ //refresh all games at gamesAnchorPane (UI)
+ refreshUIData();
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.error("error!",e);
}
}
}
@@ -958,7 +946,7 @@ public class MainWindowController {
}
/**
- * add game to the program and initialize all needed actions (start, time stamps, titleID)
+ * add game to games(ArrayList) and initialize all needed actions (start, time stamps, titleID)
* @param title : game title
* @param coverPath : path to cover (cache)
* @param romPath : path to rom file (.rpx)
@@ -990,7 +978,6 @@ public class MainWindowController {
@Override
public void handle(MouseEvent event) {
LOGGER.info("selected: "+title+"; ID: "+titleID);
-
//getting the selected game index by comparing event.getSource() with games.get(i).getButton()
for(int i=0; i 60){
- int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(titleID))/60);
- int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(titleID))-60*hoursPlayed;
- totalPlaytimeBtn.setText(hoursPlayed+"h "+minutesPlayed+"min");
- }else{
- totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID)+ " min");
- }
+ }
+
+ //setting total playtime, if total playtime > 60 minutes, formate is "x hours x minutes" (xh x min), else only minutes are showed
+ if(Integer.parseInt(dbController.getTotalPlaytime(titleID)) > 60){
+ int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTotalPlaytime(titleID))/60);
+ int minutesPlayed = Integer.parseInt(dbController.getTotalPlaytime(titleID))-60*hoursPlayed;
+ totalPlaytimeBtn.setText(hoursPlayed+" h "+minutesPlayed+" min");
+ }else{
+ totalPlaytimeBtn.setText(dbController.getTotalPlaytime(titleID)+ " min");
}
if (!playTrue) {
@@ -1046,13 +1035,38 @@ public class MainWindowController {
games.add(new UIROMDataType(VBox, gameTitleLabel, gameBtn, titleID, romPath));
}
- //add all games to the UI (only called on startup)
- void addUIData(){
+ //add all games saved in games(ArrayList) to the gamesAnchorPane
+ void addUIData() {
for(int i=0; i