parent
5a7cdfd3da
commit
f8a86c508d
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import com.jfoenix.controls.JFXButton?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.effect.Shadow?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.shape.Line?>
|
||||
<?import javafx.scene.shape.Rectangle?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<AnchorPane fx:id="levelRoot" id="1" fx:controller="controller.GamePlayController" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1300.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1" >
|
||||
<children>
|
||||
<AnchorPane minHeight="400.0" minWidth="400.0" prefHeight="608.0" prefWidth="348.0" layoutX="960.0">
|
||||
<children>
|
||||
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#323436" height="900.0" layoutY="0.0" stroke="BLACK" strokeType="INSIDE" width="340" />
|
||||
<ImageView fitHeight="128.0" fitWidth="93.0" layoutX="50.0" layoutY="33.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../image/personnage/Perso1.2.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<Label layoutX="144.0" layoutY="59.0" prefHeight="41.0" prefWidth="124.0" text="Pseudonyme" textFill="WHITE">
|
||||
<font>
|
||||
<Font name="Segoe UI Black" size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Rectangle arcHeight="5.0" arcWidth="5.0" height="331.0" layoutX="50.0" layoutY="166.0" opacity="0.3" stroke="BLACK" strokeDashOffset="10.0" strokeLineCap="ROUND" strokeLineJoin="ROUND" strokeMiterLimit="100.0" strokeType="INSIDE" strokeWidth="5.0" width="201.0" />
|
||||
<Line endX="100.0" layoutX="139.0" layoutY="222.0" startX="-77.0" stroke="#f2f0f0" />
|
||||
<Label alignment="CENTER" layoutX="88.0" layoutY="173.0" prefHeight="41.0" prefWidth="124.0" text="Action" textFill="WHITE">
|
||||
<font>
|
||||
<Font name="Segoe UI" size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<JFXButton fx:id="buttonDe" onAction="#lancerDe" layoutX="95.0" layoutY="530.0" prefHeight="30.0" prefWidth="119.0" ripplerFill="#e1e1e1" style="-fx-background-color: #EB9C0A;" text="Lancer le dé" textAlignment="CENTER" textFill="WHITE">
|
||||
<font>
|
||||
<Font name="Segoe UI" size="15.0" />
|
||||
</font>
|
||||
<effect>
|
||||
<Shadow />
|
||||
</effect>
|
||||
</JFXButton>
|
||||
<ImageView fx:id="de" fitWidth="75" fitHeight="75" layoutX="100" layoutY="580.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../image/dé/icon.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</AnchorPane>
|
@ -0,0 +1,36 @@
|
||||
package model;
|
||||
|
||||
public class GameLoop {
|
||||
private Thread timer;
|
||||
|
||||
public void start() {
|
||||
timer = new Thread("timer") {
|
||||
public void run() {
|
||||
final double FPS = 60;
|
||||
final double DELAY = 1000000000 / FPS;
|
||||
long lastTime = System.nanoTime();
|
||||
long timer = 0;
|
||||
double delta = 0;
|
||||
long currentTime;
|
||||
int frames = 0;
|
||||
while (true) {
|
||||
currentTime = System.nanoTime();
|
||||
delta += (currentTime - lastTime) / DELAY;
|
||||
timer += currentTime - lastTime;
|
||||
lastTime = currentTime;
|
||||
if (delta >= 1) {
|
||||
//update(); // fonction qui sera update
|
||||
|
||||
frames++;
|
||||
delta--;
|
||||
}
|
||||
if (timer >= 1000000000) {
|
||||
timer = 0;
|
||||
System.out.println("FPS: " + frames);
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package model;
|
||||
|
||||
public class Time {
|
||||
private Thread timer;
|
||||
|
||||
public void start() {
|
||||
timer = new Thread("timer") {
|
||||
public void run() {
|
||||
final double FPS = 60;
|
||||
final double DELAY = 1000000000 / FPS;
|
||||
long lastTime = System.nanoTime();
|
||||
long timer = 0;
|
||||
double delta = 0;
|
||||
long currentTime;
|
||||
int frames = 0;
|
||||
while (true) {
|
||||
currentTime = System.nanoTime();
|
||||
delta += (currentTime - lastTime) / DELAY;
|
||||
timer += currentTime - lastTime;
|
||||
lastTime = currentTime;
|
||||
if (delta >= 1) {
|
||||
//update(); // fonction qui sera update
|
||||
frames++;
|
||||
delta--;
|
||||
}
|
||||
if (timer >= 1000000000) {
|
||||
timer = 0;
|
||||
System.out.println("FPS: " + frames);
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue