简体   繁体   English

如何在LibGDX中使用ShapeRenderer和ScrollPane?

[英]How use ShapeRenderer along with ScrollPane in LibGDX?

Am currently making a game in LibGDX for Android. 我目前正在Android的LibGDX中制作游戏。 So far I have a ScrollPane with a table inside that contains a list with custom rows [AS SHOWN IN THE ATTACHED IMAGE]. 到目前为止,我有一个ScrollPane ,其中包含一个包含自定义行的列表[如附图所示]。 I want each of those rows surrounded by a rectangle. 我希望每个行都被一个矩形包围。 Is it possible to achieve this? 是否有可能实现这一目标?

These are the rows of the list 这些是列表的行

在此输入图像描述

Since this has been viewed 100 times I might as well contribute even though it's almost 3 years old. 由于这已被观看了100次,所以即使它已经差不多3年了,我也可能做出贡献。

You can set debug on the child widget attached to the Scrollpane (which is probably a Table, so debugAll() or whatever you wish), which outlines the boundaries of the actors automatically. 您可以在附加到Scrollpane的子窗口小部件上设置调试(可能是Table,所以是debugAll()或任何您想要的),它会自动概述actor的边界。

This internally uses a Shaperenderer to do it from the Stage, and you can change the colour through the Table.debugTableColor, Table.debugCellColor, and Table.debugActorColor static fields. 这在内部使用Shaperenderer从舞台上执行,您可以通过Table.debugTableColor,Table.debugCellColor和Table.debugActorColor静态字段更改颜色。

Table.debugTableColor is for outlining the entire table, Table.debugCellColor is for each of the table's cells, and Table.debugActorColor is for the actors contained within each of the cells. Table.debugTableColor用于概述整个表,Table.debugCellColor用于表的每个单元格,Table.debugActorColor用于每个单元格中包含的actor。

But yeah, this should only be used for debugging the layout. 但是,这应该只用于调试布局。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM