简体   繁体   English

libGDX中的多个阶段将演员隐藏在后台

[英]Multiple stages in libGDX hides actors on back stage

Using libGDX, I have two stages. 使用libGDX,我有两个阶段。 One has a tiled map and a bunch of actors/sprites moving around. 一个有平铺的地图,还有一群演员/精灵在四处移动。 On top of that, I have a HUD stage, which has the score and other things. 最重要的是,我有一个HUD舞台,其中包含乐谱和其他内容。

I can see the tiled map, but the sprites aren't visible. 我可以看到平铺的地图,但子画面不可见。 If I don't draw the HUD stage, then I can see the sprites 如果我不绘制HUD舞台,那么我可以看到精灵

The HUD is just some text in a table, so it is largely transparent. HUD只是表中的一些文本,因此在很大程度上是透明的。

This code: 这段代码:

Sub Main_Draw(SpriteBatch As lgSpriteBatch, ParentAlpha As Float)
    Draws the maze
    SpriteBatch.DisableBlending
    SpriteBatch.SetColorRGBA(1, 1, 1, 1)
    Maze.Draw(Stage.Camera)
    SpriteBatch.EnableBlending
    HUDStage.Draw
End Sub

I went so far as to remove any reference to the HUD stage, except the initialization of the stage itself, with the same result. 我什至删除了对HUD阶段的任何引用,除了阶段本身的初始化以外,结果相同。

This is probably because libgdx recently had an API change. 这可能是因为libgdx最近更改了API。 Now, 现在,

void draw(Batch batch, float parentAlpha)

is called by stage's root group instead of 由阶段的根组而不是

void draw(SpriteBatch batch, float parentAlpha)

Since your method does not override parent's method, it is not being called. 由于您的方法不会覆盖父级的方法,因此不会被调用。

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

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