目前是否有任何引擎可以将 JavaScript 编译为具有图形支持的独立应用程序?

发布于 2024-10-06 08:10:35 字数 226 浏览 4 评论 0原文

我见过像 Mozilla Rhino 这样的东西,或者内部使用 V8。然而,我真正寻找的是一个解决方案,我基本上可以为 PC 编写独立的 Canvas 应用程序。钛合金还可以,但我不喜欢最终的结果。基本上我正在寻找使用 JS 编写具有图形支持的 PC 客户端应用程序的能力,并将其编译成应用程序。我不希望所有资源完全开放,任何人都可以拿走/更改并重新发布为自己的资源。总体来说,如果我愿意的话,我可以选择通过游戏获利。目前有类似的事情吗?

Ive seen things like Mozilla Rhino, or using V8 internally. What I am really looking for however is a solution where I can basically write standalone Canvas apps for the PC. Titanium was ok, but I didn't like the end result. Basically Im looking for the ability to write PC client apps with graphics support using JS, that compile into an application. I don't want something where all resources are totally open for anyone just to take/change and re release as their own. Big picture is to have the option to monetize a game if I chose to. Is there currently anything like that out there?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

一生独一 2024-10-13 08:10:35

Adobe AIR 2.5 支持canvas 标签。它使用 Webkit,但不支持当前 Webkit 浏览器所具备的功能。例如视频/音频标签、svg。这是一个不错的列表 AIR 中构建的 Webkit 支持/不支持的功能。

Adobe AIR 2.5 has support for the canvas tag. It uses Webkit, however it doesn't support somethings current Webkit browsers have. Such as video/audio tag, svg. Here is a decent list of supported/unsupported features of the Webkit build in AIR.

揪着可爱 2024-10-13 08:10:35

这是一个相当老的问题,但我想对我发现的内容给出更新的答案。您可以使用 QT 来完成此操作。您在窗口中包含一个 webkit 小部件,并通过嵌入到应用程序中的资源文件加载 js/html/图像。

http://www.somethinghitme.com/2012/ 03/29/turning-canvas-games-into-executables/

我喜欢这个无线解决方案,因为您的所有资产都可以包含和隐藏。

This is a rather old question, but I wanted to give an updated answer to what I found. You can use QT to do exactly this. You include a webkit widget in the window, and load your js/html/images via resource files which are embedded into the application.

http://www.somethinghitme.com/2012/03/29/turning-canvas-games-into-executables/

I like this solution over the Air solution, because all of your assets can be contained and hidden.

随梦而飞# 2024-10-13 08:10:35

我之前的答案的更好方法是使用 nodeWebkit

与之前使用 QT 的方法相比,以下优点如下。

  • 不需要像 QT 那样的单独 IDE
  • 不需要像 QT 那样的样板代码
  • 非常容易将所有依赖项和资源打包到单个可执行文件中
  • 使用 V8 并定期更新以保持最新状态,与 QT 的实现不同

对于画布,我已将其用于游戏 < a href="http://grapplehero.com" rel="nofollow">格斗英雄,Rezoner 已将其用于他的游戏qbqbqb。还有更多在野外使用它的例子。这是迄今为止最好的解决方案。

A better approach to my previous answer is to use nodeWebkit.

Here are the following benefits over the previous method which used QT.

  • Requires no seperate IDE like QT
  • Requires no boilerplate code at all like QT
  • Very easy to pack up all dependencies and resources into a single executable
  • Uses V8 and is updated regularly to stay current unlike QT's implementation

For canvas specifically I have used it for the game grapple hero and Rezoner has used it for his game qbqbqb. There are many more examples of its use in the wild. It is as of today the best solution.

薆情海 2024-10-13 08:10:35

我会尝试 XULRunner。每当我不想编写整个应用程序时,我都会使用它,而且它工作得很好。 XUL 是一种类似 XML 的标记语言,用于布局。下面是一些示例代码:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window id="vbox example" title="Example 3...."
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <vbox>
    <button id="yes" label="Yes"/>
    <button id="no" label="No"/>
    <button id="maybe" label="Maybe"/>
  </vbox>
</window>

CSS 用于设计应用程序的样式,JavaScript 用于后端。它非常容易编码,整个应用程序就像一个独立的网站。我用它编写了一些下载管理器,但您只需进行最少的修改即可将 HTML 直接迁移到代码中。

要构建应用程序,您只需将布局和功能文件放入一个文件夹中,可以选择从中创建一个 JAR,然后将其复制到 XULRunner 目录中。您只需运行可执行文件,就可以了。最重要的是,相同的代码可以在 Windows、Mac OS 和 Linux 上运行。

祝你好运!

(这是 XULRunner 的最佳参考,因为它是 Mozilla 的宝贝:https://developer.mozilla.org/en/ xulrunner


等等,你是在谈论 iPhone 吗?您应该标记一下,如果您是... XULRunner 适用于除 iOS 之外的所有平台。这难道不让你爱上苹果吗?

I would try XULRunner. I use it whenever I don't feel like coding a whole application, and it works quite well. XUL is an XML-like markup language which is used for layout. Here's some example code:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window id="vbox example" title="Example 3...."
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <vbox>
    <button id="yes" label="Yes"/>
    <button id="no" label="No"/>
    <button id="maybe" label="Maybe"/>
  </vbox>
</window>

CSS is used for styling the application, and JavaScript for the backend. It's quite easy to code with, and the whole application is like a standalone website. I coded a few download managers with it, but you can just migrate your HTML <canvas> straight into the code with minimal modifications.

To build an application, you just place the layout and functionality files into a folder, optionally make a JAR out of it, and just copy it into the XULRunner directory. You just run the executable, and it's good to go. Best of all, the same code works in Windows, Mac OS, and Linux.

Good luck!

(Here's the best reference for XULRunner, since it's Mozilla's baby: https://developer.mozilla.org/en/xulrunner)


Wait, are you talking about the iPhone? You should have tagged that if you are... XULRunner is only available for every platform except iOS. Doesn't that make you love Apple?

橘寄 2024-10-13 08:10:35

jslibs 是一个独立的 JavaScript 运行时(基于 Firefox JavaScript 引擎),支持 OpenGL(以及很多其他第三方库)。

jslibs is a standalone JavaScript runtime (based on Firefox JavaScript engine) that support OpenGL (and a lot of other 3rd party libraries).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文