Giter VIP home page Giter VIP logo

Comments (4)

AlmasB avatar AlmasB commented on June 18, 2024

Hi, thanks for this. Please can you include the image, fxml file and the minimal code that reproduces this issue so we can test and fix it as appropriate.

from fxgl.

wendyunfa avatar wendyunfa commented on June 18, 2024

Thank you for your reply.
Simply add the following code to the initUI method that extends the overrides of the GameApplication class to reproduce

    protected void initUI() {
        UI ui = getAssetLoader().loadUI("fxml/CitySubScene.fxml", () -> {});
        getGameScene().addUI(ui);
    }

Resource path of fxml assets/ui/fxml/CitySubScene.fxml

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.StackPane?>

<Pane xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1">
   <StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0">
      <children>
          <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0">
            <children>
               <ImageView fitHeight="416.0" fitWidth="298.0" layoutX="61.0" layoutY="63.0">
                  <image>
                     <Image url="@CityDataWindow.png" />
                  </image>
               </ImageView>
            </children>
         </AnchorPane>
      </children>
   </StackPane>
</Pane>

Resource path of IMageassets/ui/fxml/CityDataWindow.png
CityDataWindow

from fxgl.

AlmasB avatar AlmasB commented on June 18, 2024

@wendyunfa thanks for the clear examples, this should now be fixed by the attached commit.

Let me know if it works.

To get the latest build, you can use this:

<dependencies>
    <dependency>
        <groupId>com.github.almasb</groupId>
        <artifactId>fxgl</artifactId>
        <version>21+dev-SNAPSHOT</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>oss.sonatype.org-snapshot</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>

from fxgl.

wendyunfa avatar wendyunfa commented on June 18, 2024

Thank you very much. After testing, this problem has been fixed.

from fxgl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.