-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainApplication.java
42 lines (33 loc) · 1.2 KB
/
MainApplication.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.orangomango.railway;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.image.Image;
import javafx.stage.Screen;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import com.orangomango.railway.ui.HomeScreen;
import dev.webfx.platform.resource.Resource;
public class MainApplication extends Application{
private static final int WIDTH = 1150;
private static final int HEIGHT = 750;
private static final double SCALE = 1;
private static final int FPS = 40;
public static Stage stage;
private static final Media BACKGROUND_MUSIC = new Media(Resource.toUrl("/audio/background.mp3", MainApplication.class));
@Override
public void start(Stage stage){
MainApplication.stage = stage;
stage.setTitle("RAIL-the-WAY v2.0");
MediaPlayer music = new MediaPlayer(BACKGROUND_MUSIC);
music.setCycleCount(MediaPlayer.INDEFINITE);
music.play();
HomeScreen gs = new HomeScreen(WIDTH, HEIGHT, FPS, SCALE);
stage.setScene(gs.getScene());
stage.setResizable(false);
stage.getIcons().add(new Image(Resource.toUrl("/images/icon.png", MainApplication.class)));
stage.show();
}
public static void main(String[] args){
launch(args);
}
}