15887

Creating NPAPI plugin in Delphi and accessing exported APIs using javascript

I have found a useful billards physics library in Borland delphi for my hobby project. The code is object oriented(in Object pascal). I want to visualize it using webGL (javascript) in chrome browser.

The idea is, I should have one call to make from the javascript which will access the interface from delphi lib and give me the new position, rotation and scale values in respective array.

For this I want to develop an NPAPI lib Scriptable plugin in Delphi(Meaning NO UI only lib of APIs).

1)I want to export those necessary physics APIs from the Delphi via this NPAPI plugin and access them in my html page using JavaScript. I am targeting chrome. 2) Any simple "hello world" tutorial or article related to this will be highly helpful.

3)Any help on using Firebreath to achieve the same is most preferable. How to use Delphi with Firebreath?

Answer1:

    <li>

    use a good HTML / JavaScript editor (for example the NetBeans IDE) create a basic HTML page which contains the "hard-coded" JavaScript to display the initial scene, and a HTML form to accept user input

    </li> <li>

    use Indy or Synapse to create a HTTP server (in Delphi), wich serves this HTML page and when the user submits form input, parse the form parameters and pass them to the billiard simulation, which should emit a list of graphic commands as a result - and convert these to WebGL (this is the hard part) statements

    </li> <li>

    from the HTTP server, send a response (HTML document) back to the client, with the JavaScript / WebGL statements embedded, so that the client will see the animation and the new playfield state

    </li> <li>

    repeat until end of game

    </li> </ul>

    Answer2:

    Create a COM DLL and install it on the client's machine. Then Javascript can use its ActiveXObject class to access the COM object (or, under IE, you can use the <object> HTML tag). Make sure your COM object implements the IDispatch interface, as Javascript needs to use late binding since it is an interpretted environment and not compiled.

Recommend

  • Ruby Mechanize not returning Javascript built page correctly
  • Avoid Multiple Next () Statement in Python Generator
  • How to get, in php, the entire html of a page loaded in part from jquery
  • Anyone using webtest without ant?
  • SSL Certificate Context - How to get it using NPAPI
  • What cross-browser technology do you use in your web applications to manipulate on client machines?
  • How to embed flash in Mono?
  • “Drawing” an arc in discrete x-y steps
  • How can I fast-forward a branch without checking it out
  • Can a MEF application built on .NET 4 import types built against .NET 3.5?
  • Java Netbeans Error Cannot find symbol, symbol: class out, location: class System, expected, illega
  • Build entire solution for .NET 4 and .NET 4.5 and copy files to specific folders
  • how to force the use of cmov in gcc and VS
  • Deploying pre-encrypted configuration files to a production environment
  • Instanciate service on startup in Angular2
  • Get rendered html code in Backing Component from Composite Component
  • record audio in HTML / js without Flash?
  • get passwords from chrome
  • C# 4 and CLR Compatibility
  • Implement JwtBearer Authentication in NSwag SwaggerUi
  • Access user's phone number on iOS 7
  • Using JRuby with Rails 3.2
  • Unable to install Git-core+svn by MacPorts
  • Django simple Captcha “No module named fields” error
  • Could not find rake using whenever rails
  • Chrome doesn't support silverlight anymore? How to solve this?
  • HTML download movie download link
  • Updating server-side rendering client-side
  • htaccess rewriting URLs with multiple forward slashes
  • Display Images one by one with next and previous functionality
  • Web-crawler for facebook in python
  • How to get icons for entities from eclipse?
  • A cron job substitute?
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • How to set the response of a form post action to a iframe source?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • JaxB to read class hierarchy
  • Observable and ngFor in Angular 2