Because lack of example, I don’t know how to create a background map with a slider that can switch the vertical or horizontal position of the map
Could anyone tell me how to do it? many thanks
[java]package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector4f;
import com.jme3.system.AppSettings;
import tonegod.gui.controls.lists.Slider;
import tonegod.gui.controls.windows.Window;
import tonegod.gui.core.Screen;
public class Main extends SimpleApplication {
@Override
public void simpleInitApp() {
flyCam.setDragToRotate(true);
Screen screen = new Screen(this);
Window window = new Window(screen, "win", new Vector2f(15, 15), new Vector2f(2560, 2400),
new Vector4f(14, 14, 14, 14),
"Images/background.jpg");
guiNode.addControl(screen);
Slider slider1 = new Slider(
screen,
"SomeID",
new Vector2f(0, 0), new Vector2f(screen.getWidth(), 15),
Slider.Orientation.HORIZONTAL,
true) {
@Override
public void onChange(int selectedIndex, Object value) {
float percent = (((float) (Integer) value) / 100);
}
};
screen.addElement(slider1);
screen.addElement(window);
}
public static void main(String[] args) {
AppSettings settings = new AppSettings(true);
Main app = new Main();
app.setDisplayStatView(false);
app.setShowSettings(false);
app.setDisplayFps(false);
app.setSettings(settings);
app.start();
}
}[/java]