为什么我的按钮被红色边框包围,这个边框从哪里来?
Why is my button surrounded by a red border from where comes this border?
我在主菜单上使用由 texturepacker.jar
创建的按钮作为 button.pack 文件和 PNG
,我的 PNG 按钮中的问题没有红色边框但是当我 运行 程序我看到按钮被 1 像素的红色边框包围,我似乎无法找到它的来源!
这是 运行 时间的按钮:
这是生成按钮的代码:
@Override
public void render(float delta) {
Gdx.gl.glClearColor(3, 2, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act(delta);
stage.draw();
}
@Override
public void show() {
stage = new Stage();
atlas = new TextureAtlas("gui/button.pack");
skin = new Skin(atlas);
table = new Table(skin);
table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
black = new BitmapFont(Gdx.files.internal("font/black.fnt"), false);
TextButtonStyle textButtonStyle = new TextButtonStyle();
textButtonStyle.up = skin.getDrawable("button_up");
textButtonStyle.down = skin.getDrawable("button_pressed");
textButtonStyle.pressedOffsetX = 1;
textButtonStyle.pressedOffsetY = -1;
textButtonStyle.font = black;
buttonExit = new TextButton("EXIT", textButtonStyle);
buttonExit.pad(20);
table.add(buttonExit);
table.debug();
stage.addActor(table);
}
任何有关如何删除此红色边框的帮助?
由于table.debug();
,边界在那里。删除它,红色边框应该消失。
scene2d 调试功能应该有助于展示 Table 如何布局单元格和演员。它还可以帮助处理事件以显示鼠标悬停或单击事件的任意参与者的边界。
过去需要有一个单独的 drawDebug()
调用,但这已经改变,现在在启用调试时集成到 stage.draw();
中。
我在主菜单上使用由 texturepacker.jar
创建的按钮作为 button.pack 文件和 PNG
,我的 PNG 按钮中的问题没有红色边框但是当我 运行 程序我看到按钮被 1 像素的红色边框包围,我似乎无法找到它的来源!
这是 运行 时间的按钮:
这是生成按钮的代码:
@Override
public void render(float delta) {
Gdx.gl.glClearColor(3, 2, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act(delta);
stage.draw();
}
@Override
public void show() {
stage = new Stage();
atlas = new TextureAtlas("gui/button.pack");
skin = new Skin(atlas);
table = new Table(skin);
table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
black = new BitmapFont(Gdx.files.internal("font/black.fnt"), false);
TextButtonStyle textButtonStyle = new TextButtonStyle();
textButtonStyle.up = skin.getDrawable("button_up");
textButtonStyle.down = skin.getDrawable("button_pressed");
textButtonStyle.pressedOffsetX = 1;
textButtonStyle.pressedOffsetY = -1;
textButtonStyle.font = black;
buttonExit = new TextButton("EXIT", textButtonStyle);
buttonExit.pad(20);
table.add(buttonExit);
table.debug();
stage.addActor(table);
}
任何有关如何删除此红色边框的帮助?
由于table.debug();
,边界在那里。删除它,红色边框应该消失。
scene2d 调试功能应该有助于展示 Table 如何布局单元格和演员。它还可以帮助处理事件以显示鼠标悬停或单击事件的任意参与者的边界。
过去需要有一个单独的 drawDebug()
调用,但这已经改变,现在在启用调试时集成到 stage.draw();
中。