Loktar
Loktar

Reputation: 35309

Are there currently any engines for compiling JavaScript to an standalone app with graphics support?

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?

Upvotes: 1

Views: 1138

Answers (5)

Loktar
Loktar

Reputation: 35309

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.

Upvotes: 1

Loktar
Loktar

Reputation: 35309

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.

Upvotes: 1

Franck Freiburger
Franck Freiburger

Reputation: 28448

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

Upvotes: 0

subhaze
subhaze

Reputation: 8855

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.

Upvotes: 1

Blender
Blender

Reputation: 298196

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?

Upvotes: 0

Related Questions