reworked time played in total
reworked time played in total, now better way wich helps with future features and improvements, cleaned up
|
@ -30,21 +30,22 @@
|
||||||
</HBox>
|
</HBox>
|
||||||
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="aboutBtn" onAction="#aboutBtnAction" prefHeight="38.0" prefWidth="150.0" text="About" textAlignment="CENTER">
|
<JFXButton fx:id="aboutBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="150.0" onAction="#aboutBtnAction" prefHeight="38.0" prefWidth="150.0" text="About" textAlignment="LEFT">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="settingsBtn" onAction="#settingsBtnAction" prefHeight="38.0" prefWidth="150.0" text="Settings" textAlignment="CENTER">
|
<JFXButton fx:id="settingsBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="150.0" onAction="#settingsBtnAction" prefHeight="38.0" prefWidth="150.0" text="Settings" textAlignment="LEFT">
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="14.0" />
|
|
||||||
</font></JFXButton>
|
|
||||||
<JFXButton fx:id="addBtn" onAction="#addBtnAction" prefHeight="38.0" prefWidth="150.0" text="Add new Game" textAlignment="CENTER">
|
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="reloadRomsBtn" onAction="#reloadRomsBtnAction" prefHeight="38.0" prefWidth="150.0" text="reload roms">
|
<JFXButton fx:id="addBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="150.0" onAction="#addBtnAction" prefHeight="38.0" prefWidth="150.0" text="Add new Game" textAlignment="LEFT">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="14.0" />
|
||||||
|
</font>
|
||||||
|
</JFXButton>
|
||||||
|
<JFXButton fx:id="reloadRomsBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="150.0" onAction="#reloadRomsBtnAction" prefHeight="38.0" prefWidth="150.0" text="reload roms" textAlignment="LEFT">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -79,8 +80,8 @@
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="timePlayedBtn" buttonType="RAISED" layoutX="341.0" layoutY="588.0" onAction="#timePlayedBtnAction" prefHeight="32.0" prefWidth="100.0" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="516.5" AnchorPane.topAnchor="558.0">
|
<JFXButton fx:id="timePlayedBtn" buttonType="RAISED" maxHeight="32.0" minWidth="100.0" onAction="#timePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="516.5" AnchorPane.topAnchor="558.0">
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" onAction="#lastTimePlayedBtnAction" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
|
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" minWidth="100.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|
After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 233 B |
After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 232 B |
After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 326 B |
|
@ -30,21 +30,22 @@
|
||||||
</HBox>
|
</HBox>
|
||||||
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="aboutBtn" onAction="#aboutBtnAction" prefHeight="38.0" prefWidth="150.0" text="About" textAlignment="CENTER">
|
<JFXButton fx:id="aboutBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="150.0" onAction="#aboutBtnAction" prefHeight="38.0" prefWidth="150.0" text="About" textAlignment="LEFT">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="settingsBtn" onAction="#settingsBtnAction" prefHeight="38.0" prefWidth="150.0" text="Settings" textAlignment="CENTER">
|
<JFXButton fx:id="settingsBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="150.0" onAction="#settingsBtnAction" prefHeight="38.0" prefWidth="150.0" text="Settings" textAlignment="LEFT">
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="14.0" />
|
|
||||||
</font></JFXButton>
|
|
||||||
<JFXButton fx:id="addBtn" onAction="#addBtnAction" prefHeight="38.0" prefWidth="150.0" text="Add new Game" textAlignment="CENTER">
|
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="reloadRomsBtn" onAction="#reloadRomsBtnAction" prefHeight="38.0" prefWidth="150.0" text="reload roms">
|
<JFXButton fx:id="addBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="150.0" onAction="#addBtnAction" prefHeight="38.0" prefWidth="150.0" text="Add new Game" textAlignment="LEFT">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="14.0" />
|
||||||
|
</font>
|
||||||
|
</JFXButton>
|
||||||
|
<JFXButton fx:id="reloadRomsBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="150.0" onAction="#reloadRomsBtnAction" prefHeight="38.0" prefWidth="150.0" text="reload roms" textAlignment="LEFT">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -79,8 +80,8 @@
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="timePlayedBtn" buttonType="RAISED" layoutX="341.0" layoutY="588.0" onAction="#timePlayedBtnAction" prefHeight="32.0" prefWidth="100.0" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="516.5" AnchorPane.topAnchor="558.0">
|
<JFXButton fx:id="timePlayedBtn" buttonType="RAISED" maxHeight="32.0" minWidth="100.0" onAction="#timePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="516.5" AnchorPane.topAnchor="558.0">
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" onAction="#lastTimePlayedBtnAction" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
|
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" minWidth="100.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" visible="false" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="516.5" AnchorPane.topAnchor="558.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
@ -24,7 +25,6 @@ import com.jfoenix.controls.JFXHamburger;
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.JFXTextField;
|
||||||
import com.jfoenix.controls.JFXToggleButton;
|
import com.jfoenix.controls.JFXToggleButton;
|
||||||
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
|
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
|
||||||
|
|
||||||
import javafx.animation.FadeTransition;
|
import javafx.animation.FadeTransition;
|
||||||
import javafx.animation.ParallelTransition;
|
import javafx.animation.ParallelTransition;
|
||||||
import javafx.animation.TranslateTransition;
|
import javafx.animation.TranslateTransition;
|
||||||
|
@ -78,7 +78,7 @@ public class MainWindowController {
|
||||||
private JFXButton playBtn;
|
private JFXButton playBtn;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton timePlayedBtn;
|
JFXButton timePlayedBtn;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton lastTimePlayedBtn;
|
private JFXButton lastTimePlayedBtn;
|
||||||
|
@ -113,7 +113,9 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
private HBox topHBox;
|
private HBox topHBox;
|
||||||
|
|
||||||
private Main main;
|
Main main;
|
||||||
|
dbController dbController;
|
||||||
|
playGame playGame;
|
||||||
private boolean menuTrue = false;
|
private boolean menuTrue = false;
|
||||||
private boolean settingsTrue = false;
|
private boolean settingsTrue = false;
|
||||||
private boolean playTrue = false;
|
private boolean playTrue = false;
|
||||||
|
@ -146,22 +148,29 @@ public class MainWindowController {
|
||||||
private MenuItem addDLC = new MenuItem("add DLC");
|
private MenuItem addDLC = new MenuItem("add DLC");
|
||||||
private ContextMenu gameContextMenu = new ContextMenu(edit, remove, update, addDLC);
|
private ContextMenu gameContextMenu = new ContextMenu(edit, remove, update, addDLC);
|
||||||
private MouseEvent selectedEvent;
|
private MouseEvent selectedEvent;
|
||||||
|
|
||||||
private Label lastGameLabel = new Label();
|
private Label lastGameLabel = new Label();
|
||||||
|
|
||||||
dbController dbController;
|
private ImageView add_circle_black = new ImageView(new Image("recources/icons/ic_add_circle_black_24dp_1x.png"));
|
||||||
|
private ImageView info_black = new ImageView(new Image("recources/icons/ic_info_black_24dp_1x.png"));
|
||||||
|
private ImageView settings_black = new ImageView(new Image("recources/icons/ic_settings_black_24dp_1x.png"));
|
||||||
|
private ImageView cached_black = new ImageView(new Image("recources/icons/ic_cached_black_24dp_1x.png"));
|
||||||
|
|
||||||
|
private ImageView add_circle_white = new ImageView(new Image("recources/icons/ic_add_circle_white_24dp_1x.png"));
|
||||||
|
private ImageView info_white = new ImageView(new Image("recources/icons/ic_info_white_24dp_1x.png"));
|
||||||
|
private ImageView settings_white = new ImageView(new Image("recources/icons/ic_settings_white_24dp_1x.png"));
|
||||||
|
private ImageView cached_white = new ImageView(new Image("recources/icons/ic_cached_white_24dp_1x.png"));
|
||||||
|
|
||||||
public void setMain(Main main) {
|
public void setMain(Main main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
dbController = new dbController(this);
|
dbController = new dbController(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initUI(){
|
void initUI(){
|
||||||
cemuTextField.setText(cemuPath);
|
cemuTextField.setText(cemuPath);
|
||||||
romTextField.setText(romPath);
|
romTextField.setText(romPath);
|
||||||
colorPicker.setValue(Color.valueOf(getColor()));
|
colorPicker.setValue(Color.valueOf(getColor()));
|
||||||
fullscreenToggleBtn.setSelected(isFullscreen());
|
fullscreenToggleBtn.setSelected(isFullscreen());
|
||||||
edit.setDisable(true);
|
edit.setDisable(true);
|
||||||
applyColor();
|
applyColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,6 +229,7 @@ public class MainWindowController {
|
||||||
alert.setTitle("remove");
|
alert.setTitle("remove");
|
||||||
alert.setHeaderText("cemu_UI");
|
alert.setHeaderText("cemu_UI");
|
||||||
alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type");
|
alert.setContentText("please select a game, \""+selectedGameTitleID+"\" is not a valid type");
|
||||||
|
|
||||||
alert.initOwner(main.primaryStage);
|
alert.initOwner(main.primaryStage);
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}
|
}
|
||||||
|
@ -433,34 +443,9 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
void playBtnAction(ActionEvent event) throws InterruptedException, IOException{
|
void playBtnAction(ActionEvent event) throws InterruptedException, IOException{
|
||||||
dbController.setLastPlayed(selectedGameTitleID);
|
dbController.setLastPlayed(selectedGameTitleID);
|
||||||
long startTime;
|
playGame = new playGame(this,dbController);
|
||||||
long endTime;
|
|
||||||
int timePlayedNow;
|
|
||||||
int timePlayed;
|
|
||||||
Process p;
|
|
||||||
|
|
||||||
main.primaryStage.setIconified(true);
|
playGame.start();
|
||||||
startTime = System.currentTimeMillis();
|
|
||||||
try{
|
|
||||||
|
|
||||||
if(fullscreen){
|
|
||||||
p = Runtime.getRuntime().exec(getCemuPath()+"\\Cemu.exe -f -g \""+gameExecutePath+"\"");
|
|
||||||
}else{
|
|
||||||
p = Runtime.getRuntime().exec(getCemuPath()+"\\Cemu.exe -g \""+gameExecutePath+"\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
p.waitFor();
|
|
||||||
endTime = System.currentTimeMillis();
|
|
||||||
timePlayedNow = (int) Math.floor(((endTime - startTime)/1000/60));
|
|
||||||
timePlayed = Integer.parseInt(dbController.getTimePlayed(selectedGameTitleID))+timePlayedNow;
|
|
||||||
|
|
||||||
dbController.setTimePlayed(Integer.toString(timePlayed), selectedGameTitleID);
|
|
||||||
timePlayedBtn.setText(dbController.getTimePlayed(selectedGameTitleID)+ " min");
|
|
||||||
main.primaryStage.setIconified(false);
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -696,7 +681,13 @@ public class MainWindowController {
|
||||||
}else{
|
}else{
|
||||||
lastTimePlayedBtn.setText("Last played, "+dbController.getLastPlayed(titleID));
|
lastTimePlayedBtn.setText("Last played, "+dbController.getLastPlayed(titleID));
|
||||||
}
|
}
|
||||||
|
if(Integer.parseInt(dbController.getTimePlayed(titleID)) > 60){
|
||||||
|
int hoursPlayed = (int) Math.floor(Integer.parseInt(dbController.getTimePlayed(titleID))/60);
|
||||||
|
int minutesPlayed = Integer.parseInt(dbController.getTimePlayed(titleID))-60*hoursPlayed;
|
||||||
|
timePlayedBtn.setText(hoursPlayed+"h "+minutesPlayed+"min");
|
||||||
|
}else{
|
||||||
timePlayedBtn.setText(dbController.getTimePlayed(titleID)+ " min");
|
timePlayedBtn.setText(dbController.getTimePlayed(titleID)+ " min");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(playTrue == false){
|
if(playTrue == false){
|
||||||
|
@ -725,32 +716,51 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyColor(){
|
private void applyColor(){
|
||||||
String style = "-fx-background-color: #"+getColor()+";";
|
String boxStyle = "-fx-background-color: #"+getColor()+";";
|
||||||
String btnStyleBlack = "-fx-button-type: RAISED; -fx-background-color: #"+getColor()+"; -fx-text-fill: BLACK;";
|
String btnStyleBlack = "-fx-button-type: RAISED; -fx-background-color: #"+getColor()+"; -fx-text-fill: BLACK;";
|
||||||
String timeBtnStyle = "-fx-button-type: RAISED; -fx-background-color: #ffffff; -fx-text-fill: BLACK;";
|
String btnStyleWhite = "-fx-button-type: RAISED; -fx-background-color: #"+getColor()+"; -fx-text-fill: WHITE;";
|
||||||
|
BigInteger icolor = new BigInteger(getColor(),16);
|
||||||
|
BigInteger ccolor = new BigInteger("78909cff",16);
|
||||||
getColor();
|
getColor();
|
||||||
|
|
||||||
sideMenuVBox.setStyle(style);
|
sideMenuVBox.setStyle(boxStyle);
|
||||||
topHBox.setStyle(style);
|
topHBox.setStyle(boxStyle);
|
||||||
cemuTextField.setFocusColor(Color.valueOf(getColor()));
|
cemuTextField.setFocusColor(Color.valueOf(getColor()));
|
||||||
romTextField.setFocusColor(Color.valueOf(getColor()));
|
romTextField.setFocusColor(Color.valueOf(getColor()));
|
||||||
|
|
||||||
aboutBtn.setStyle("-fx-text-fill: BLACK;");
|
if(icolor.compareTo(ccolor) == -1){
|
||||||
settingsBtn.setStyle("-fx-text-fill: BLACK;");
|
aboutBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
addBtn.setStyle("-fx-text-fill: BLACK;");
|
settingsBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
reloadRomsBtn.setStyle("-fx-text-fill: BLACK;");
|
addBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
playBtn.setStyle("-fx-text-fill: BLACK;");
|
reloadRomsBtn.setStyle("-fx-text-fill: WHITE;");
|
||||||
cemuTFBtn.setStyle(btnStyleBlack);
|
playBtn.setStyle("-fx-text-fill: WHITE; -fx-font-family: Roboto Medium;");
|
||||||
romTFBtn.setStyle(btnStyleBlack);
|
cemuTFBtn.setStyle(btnStyleWhite);
|
||||||
playBtn.setStyle(btnStyleBlack);
|
romTFBtn.setStyle(btnStyleWhite);
|
||||||
|
playBtn.setStyle(btnStyleWhite);
|
||||||
|
|
||||||
|
aboutBtn.setGraphic(info_white);
|
||||||
|
settingsBtn.setGraphic(settings_white);
|
||||||
|
addBtn.setGraphic(add_circle_white);
|
||||||
|
reloadRomsBtn.setGraphic(cached_white);
|
||||||
|
}else{
|
||||||
|
aboutBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
|
settingsBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
|
addBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
|
reloadRomsBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
|
playBtn.setStyle("-fx-text-fill: BLACK; -fx-font-family: Roboto Medium;");
|
||||||
|
cemuTFBtn.setStyle(btnStyleBlack);
|
||||||
|
romTFBtn.setStyle(btnStyleBlack);
|
||||||
|
playBtn.setStyle(btnStyleBlack);
|
||||||
|
|
||||||
|
aboutBtn.setGraphic(info_black);
|
||||||
|
settingsBtn.setGraphic(settings_black);
|
||||||
|
addBtn.setGraphic(add_circle_black);
|
||||||
|
reloadRomsBtn.setGraphic(cached_black);
|
||||||
|
}
|
||||||
|
|
||||||
for(int i=0; i<gameCover.size(); i++){
|
for(int i=0; i<gameCover.size(); i++){
|
||||||
gameCover.get(i).setRipplerFill(Paint.valueOf(getColor()));
|
gameCover.get(i).setRipplerFill(Paint.valueOf(getColor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTimePlayedBtn.setStyle(timeBtnStyle);
|
|
||||||
timePlayedBtn.setStyle(timeBtnStyle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveSettings(){
|
void saveSettings(){
|
||||||
|
@ -939,4 +949,20 @@ public class MainWindowController {
|
||||||
this.fullscreen = fullscreen;
|
this.fullscreen = fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGameExecutePath() {
|
||||||
|
return gameExecutePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGameExecutePath(String gameExecutePath) {
|
||||||
|
this.gameExecutePath = gameExecutePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSelectedGameTitleID() {
|
||||||
|
return selectedGameTitleID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedGameTitleID(String selectedGameTitleID) {
|
||||||
|
this.selectedGameTitleID = selectedGameTitleID;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package application;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
|
||||||
|
public class playGame extends Thread{
|
||||||
|
|
||||||
|
MainWindowController mainWindowController;
|
||||||
|
dbController dbController;
|
||||||
|
|
||||||
|
public playGame(MainWindowController m, dbController db){
|
||||||
|
mainWindowController = m;
|
||||||
|
dbController = db;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run(){
|
||||||
|
String selectedGameTitleID = mainWindowController.getSelectedGameTitleID();
|
||||||
|
long startTime;
|
||||||
|
long endTime;
|
||||||
|
int timePlayedNow;
|
||||||
|
int timePlayed;
|
||||||
|
Process p;
|
||||||
|
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
mainWindowController.main.primaryStage.setIconified(true);
|
||||||
|
});
|
||||||
|
startTime = System.currentTimeMillis();
|
||||||
|
try{
|
||||||
|
if(mainWindowController.isFullscreen()){
|
||||||
|
p = Runtime.getRuntime().exec(mainWindowController.getCemuPath()+"\\Cemu.exe -f -g \""+mainWindowController.getGameExecutePath()+"\"");
|
||||||
|
}else{
|
||||||
|
p = Runtime.getRuntime().exec(mainWindowController.getCemuPath()+"\\Cemu.exe -g \""+mainWindowController.getGameExecutePath()+"\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
p.waitFor();
|
||||||
|
endTime = System.currentTimeMillis();
|
||||||
|
timePlayedNow = (int) Math.floor(((endTime - startTime)/1000/60));
|
||||||
|
timePlayed = Integer.parseInt(dbController.getTimePlayed(selectedGameTitleID))+timePlayedNow;
|
||||||
|
|
||||||
|
dbController.setTimePlayed(Integer.toString(timePlayed), selectedGameTitleID);
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
mainWindowController.timePlayedBtn.setText(dbController.getTimePlayed(selectedGameTitleID)+ " min");
|
||||||
|
mainWindowController.main.primaryStage.setIconified(false);
|
||||||
|
});
|
||||||
|
}catch (IOException | InterruptedException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 233 B |
After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 232 B |
After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 326 B |