/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (almaslvl@gmail.com).
 * See LICENSE for details.
 */
package sandbox;

import com.almasb.fxgl.app.GameApplication;
import com.almasb.fxgl.app.GameSettings;
import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.texture.ImagesKt;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

/**
 * This is a sample class for testing image rescaling.
 */
public class ImageSample extends GameApplication {
    @Override
    protected void initSettings(GameSettings settings) {
        settings.setWidth(800);
        settings.setHeight(800);
        settings.setTitle("ImageSample");
    }

    @Override
    protected void initGame() {
        // Image obtained from internet.
        Image background = new Image("https://www.empiraft.com/zh_cn/new/images/background.png");
        Image backgroundResized = ImagesKt.resize(background, 400, 200);
        FXGL.addUINode(new ImageView( backgroundResized ), 400, 0);

        // Image obtained from internet.
        Image original = new Image("https://www.empiraft.com/zh_cn/new/images/icon-game.png");
        // Demo to resize image, note: original image from url ("https://www.empiraft.com/zh_cn/new/images/icon-game.png") is 64px * 64px
        for (int i = 16; i > 0; i--) {
            Image processed = ImagesKt.resize(original, 16 * i, 16 * i);
            FXGL.addUINode(new ImageView( processed ), 5 * i  * i, 0.3 * i * i * i);
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}

@@ -235,41 +235,8 @@
 gs;%0A
-import com.almasb.fxgl.dsl.FXGL;%0A
 impo
@@ -343,16 +343,59 @@
 eView;%0A%0A
+import static com.almasb.fxgl.dsl.FXGL.*;%0A%0A
 /**%0A * T
@@ -735,49 +735,8 @@
 ) %7B%0A
-        // Image obtained from internet.%0A
     
@@ -762,61 +762,15 @@
 d = 
-new I
+i
 mage(%22
-https://www.empiraft.com/zh_cn/new/images/
 back
@@ -854,9 +854,9 @@
 00, 
-2
+3
 00);
@@ -856,37 +856,32 @@
 , 300);%0A        
-FXGL.
 addUINode(new Im
@@ -888,17 +888,16 @@
 ageView(
- 
 backgrou
@@ -909,18 +909,9 @@
 ized
- ), 400, 0
+)
 );%0A%0A
@@ -925,270 +925,58 @@
  // 
-Image obtained from internet.%0A        Image original = new Image(%22https://www.empiraft.com/zh_cn/new/images/icon-game.png%22);%0A        // Demo to resize image, note: original image from url (%22https://www.empiraft.com/zh_cn/new/images/icon-game.png%22) is 64px * 64px
+64x64%0A        Image original = image(%22brick.png%22);
 %0A   
@@ -1096,21 +1096,16 @@
         
-FXGL.
 addUINod
@@ -1120,17 +1120,16 @@
 ageView(
- 
 processe
@@ -1129,17 +1129,16 @@
 rocessed
- 
 ), 5 * i

use local images