-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
39 lines (32 loc) · 970 Bytes
/
Main.java
File metadata and controls
39 lines (32 loc) · 970 Bytes
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
package platformer;
import javafx.animation.AnimationTimer;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.input.KeyEvent;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.event.EventType;
public class Main extends Application {
private Canvas canvas;
private GraphicsContext context;
private static int WINDOW_WIDTH = 800;
private static int WINDOW_HEIGHT = 600;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
canvas = new Canvas(WINDOW_WIDTH, WINDOW_HEIGHT);
context = canvas.getGraphicsContext2D();
Scene scene = new Scene(new Group(canvas));
stage.setWidth(WINDOW_WIDTH);
stage.setHeight(WINDOW_HEIGHT);
stage.setScene(scene);
stage.setResizable(false);
stage.show();
}
}