rlease 0.3.3 #7
@ -1023,14 +1023,8 @@ public class MainWindowController {
|
|||||||
* @param titleID : game ID
|
* @param titleID : game ID
|
||||||
*/
|
*/
|
||||||
public void addGame(String title, String coverPath, String romPath, String titleID){
|
public void addGame(String title, String coverPath, String romPath, String titleID){
|
||||||
Image coverImage = new Image(new File(coverPath).toURI().toString());
|
UIROMDataType uiROMElement = new UIROMDataType(title, coverPath, gameContextMenu);
|
||||||
UIROMDataType uiROMElement = new UIROMDataType();
|
|
||||||
|
|
||||||
generatePosition();
|
|
||||||
|
|
||||||
uiROMElement.getLabel().setText(title);
|
|
||||||
uiROMElement.getImageView().setImage(coverImage);
|
|
||||||
uiROMElement.getButton().setContextMenu(gameContextMenu);
|
|
||||||
uiROMElement.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
|
uiROMElement.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(MouseEvent event) {
|
public void handle(MouseEvent event) {
|
||||||
@ -1131,18 +1125,18 @@ public class MainWindowController {
|
|||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove all games from gamesAnchorPane and add them afterwards
|
// remove all games from gamesAnchorPane and add them afterwards
|
||||||
public void refreshUIData() {
|
public void refreshUIData() {
|
||||||
//remove all games form gamesAnchorPane
|
// remove all games form gamesAnchorPane
|
||||||
gamesAnchorPane.getChildren().clear();
|
gamesAnchorPane.getChildren().clear();
|
||||||
|
|
||||||
//reset position
|
// reset position
|
||||||
xPos = -200;
|
xPos = -200;
|
||||||
yPos = 17;
|
yPos = 17;
|
||||||
xNextElement = 0;
|
xNextElement = 0;
|
||||||
|
|
||||||
//add all games to gamesAnchorPane (UI)
|
// add all games to gamesAnchorPane (UI)
|
||||||
for(UIROMDataType game : games) {
|
for (UIROMDataType game : games) {
|
||||||
generatePosition();
|
generatePosition();
|
||||||
|
|
||||||
game.setLayoutX(xPos);
|
game.setLayoutX(xPos);
|
||||||
@ -1353,7 +1347,6 @@ public class MainWindowController {
|
|||||||
*/
|
*/
|
||||||
private void generatePosition() {
|
private void generatePosition() {
|
||||||
int xMaxElements = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217);
|
int xMaxElements = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217);
|
||||||
System.out.println(xMaxElements);
|
|
||||||
|
|
||||||
if(xNextElement >= xMaxElements){
|
if(xNextElement >= xMaxElements){
|
||||||
oldXNextElement = xNextElement;
|
oldXNextElement = xNextElement;
|
||||||
|
@ -20,10 +20,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.cemu_UI.datatypes;
|
package com.cemu_UI.datatypes;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
@ -37,6 +41,14 @@ public class UIROMDataType extends VBox {
|
|||||||
private JFXButton button = new JFXButton();
|
private JFXButton button = new JFXButton();
|
||||||
private ImageView imageView = new ImageView();
|
private ImageView imageView = new ImageView();
|
||||||
|
|
||||||
|
public UIROMDataType(String text, String coverPath, ContextMenu contextMenu) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
label.setText(text);
|
||||||
|
imageView.setImage(new Image(new File(coverPath).toURI().toString()));
|
||||||
|
button.setContextMenu(contextMenu);
|
||||||
|
}
|
||||||
|
|
||||||
public UIROMDataType() {
|
public UIROMDataType() {
|
||||||
super.getChildren().addAll(label, button);
|
super.getChildren().addAll(label, button);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user