Created new lobby menu. Working on animated background for menu.
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
package visualiser.Controllers;
|
||||
|
||||
import javafx.animation.Animation;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Rectangle2D;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.util.Duration;
|
||||
import mock.app.Event;
|
||||
import org.xml.sax.SAXException;
|
||||
import mock.exceptions.EventConstructionException;
|
||||
@@ -10,6 +16,7 @@ import shared.exceptions.InvalidBoatDataException;
|
||||
import shared.exceptions.InvalidRaceDataException;
|
||||
import shared.exceptions.InvalidRegattaDataException;
|
||||
import shared.exceptions.XMLReaderException;
|
||||
import visualiser.model.SpriteAnimation;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
@@ -25,12 +32,22 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class HostController extends Controller {
|
||||
|
||||
private static final int COLUMNS = 4;
|
||||
private static final int COUNT = 10;
|
||||
private static final int OFFSET_X = 18;
|
||||
private static final int OFFSET_Y = 25;
|
||||
private static final int WIDTH = 374;
|
||||
private static final int HEIGHT = 243;
|
||||
|
||||
|
||||
// @FXML
|
||||
// TextField gameNameField;
|
||||
//
|
||||
// @FXML
|
||||
// TextField hostNameField;
|
||||
|
||||
@FXML
|
||||
TextField gameNameField;
|
||||
|
||||
@FXML
|
||||
TextField hostNameField;
|
||||
private ImageView imageView;
|
||||
|
||||
@FXML
|
||||
AnchorPane hostWrapper;
|
||||
@@ -81,12 +98,20 @@ public class HostController extends Controller {
|
||||
* Hosts a game.
|
||||
*/
|
||||
public void hostGame(){
|
||||
|
||||
Platform.runLater(() -> {
|
||||
imageView.setImage(new Image("https://media.tenor.com/images/3059eba221c9537eff1cf84ff4eabffc/tenor.gif"));
|
||||
imageView.setViewport(new Rectangle2D(OFFSET_X, OFFSET_Y, WIDTH, HEIGHT));
|
||||
final Animation animation = new SpriteAnimation(imageView, Duration.millis(250), COUNT, COLUMNS, OFFSET_X, OFFSET_Y, WIDTH, HEIGHT);
|
||||
animation.setCycleCount(Animation.INDEFINITE);
|
||||
animation.play();
|
||||
});
|
||||
hostWrapper.setVisible(true);
|
||||
}
|
||||
|
||||
public void menuBtnPressed(){
|
||||
hostWrapper.setVisible(false);
|
||||
parent.enterTitle();
|
||||
}
|
||||
// public void menuBtnPressed(){
|
||||
// hostWrapper.setVisible(false);
|
||||
// parent.enterTitle();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user