找到你要的答案

Q:Is HTML rendering possible in libgdx (or, what is the best practice to create a help screen)?

Q:HTML在libGDX可能渲染(或创建一个帮助屏幕的最佳做法是什么)?

I want to create a help screen for my game. This screen contains text and pictures that describe the game.

One option is to create a stage and add a table to it that will define the position of the different labels and images. However, this option seems to be "unnatural", limited when it comes to format options, and a potential headache when it comes to code maintenance.

The content of the screen is static which makes it a good candidate for an HTML document. My idea is to create the help screen document in HTML and then have it rendered inside my help screen. My question is, is this possible in libgdx? If not, what other way would I have to implement this?

我想为我的游戏创建一个帮助屏幕。这个屏幕包含描述游戏的文本和图片。

一种选择是创建一个舞台,并添加一个表,它将定义不同的标签和图像的位置。然而,这个选项似乎是“不自然的”,有限的,当涉及到格式选项,以及一个潜在的头痛时,涉及到代码维护。

屏幕的内容是静态的,是一个很好的候选人,一个HTML文档。我的想法是在HTML创建帮助屏幕文件然后将它呈现在我的帮助屏幕。我的问题是,这可能在libGDX?如果没有,我还有什么其他的方法来实现这个?

answer1: 回答1:

As it is not possible to embed a browser in your LibGDX app (as nicely explained here), you could either link to an external website in the device's browser or use the libgdx-stagebuilder to build up the Scene2D stage using XML. Or you just stick to the normal LibGDX way. Unfortunately, I don't see any other option than those.

因为它不可能嵌入浏览器在你的应用程序(如好libGDX这里解释),你可以连接到设备上的浏览器外部网站或使用libGDX stagebuilder建立scene2d阶段使用XML。或者你只是坚持正常libGDX方式。不幸的是,我没有看到任何其他选择比那些。

answer2: 回答2:

I don't think this is supported in libGDX as of yet, but it should be possible using platform specific code. How you do it will vary from platform to platform, so I can't tell you exactly what to look up, but android has something called webview you might want to look at.

我不认为这是支持libGDX作为然而,但它应该有可能使用特定于平台的代码。你怎么会从不同的平台,所以我不怎么抬头告诉你,但有一种叫做Android的WebView也许你想看看。

libgdx