舞台之外libgdx位置窗口

舞台之外libgdx位置窗口

本文介绍了舞台之外libgdx位置窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用MoveToAction(或方法),用于定位scene2d窗口舞台之外。我希望菜单和退出滑动。结果
我的舞台,我的皮肤都存储在我的世界一流的。

I am wondering how to use MoveToAction (or any method) for positioning a scene2d Window outside of the stage. I want the menu to slide in and out.
My Stage and my Skin are stored in my world class.

这些方法做工精细现在,而不是在所有动画吧:

These methods work fine for now, while not at all animating it:

Window window = new Window("NoteBook", world.skin);
    ...

public void closeBook() {
    window.remove();
}

public void openBook() {
    world.stage.addActor(window);
}

这是我在尝试更新这些功能,让动画。在这里,窗户被初始化期间一度已经添加到舞台上,所以这些方法只能处理动画。

This is how I am trying to update these functions to allow animation. Here the windows are already added to the stage once during init, so these methods handle only the animation.

public void closeBook() {
    MoveToAction action = new MoveToAction();
    action.setPosition(-200, -200);         // somewhere off screen
    action.setDuration(0.5f);
    window.addAction(action);
}

public void openBook() {
    MoveToAction action = new MoveToAction();
    action.setPosition(0, 0);           // original location
    action.setDuration(0.5f);
    window.addAction(action);
}

此似乎部分地工作,因为它确实动画窗口的移动,但它停止在屏幕的边缘,不会打破过去它。
我试着调整我的舞台的视口的尺寸,但它仍然总是在边缘停止。

This seems to partially work, in that it does animate the window's movement, but it stops at the edge of the screen and won't break past it.I've tried adjusting my stage's viewport dimensions but it still always stops at the edge.

所以,问题是,我怎么外面的舞台位置的scene2d窗口(或貌似之外)?

So the question is, how do I position a scene2d Window outside (or seemingly outside) of the stage?

推荐答案

试试这个:

window.setKeepWithinStage(假);

这应该允许在窗口外移动的舞台。

Which should allow the window to move outside of the stage.

这篇关于舞台之外libgdx位置窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 18:09