在Delphi中创建NPAPI插件并使用javascript访问导出的API [英] Creating NPAPI plugin in Delphi and accessing exported APIs using javascript

查看:1549
本文介绍了在Delphi中创建NPAPI插件并使用javascript访问导出的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经找到一个有用的Billards物理库在Borland delphi为我的爱好项目。代码是面向对象的(在Object pascal中)。我想在Chrome浏览器中使用webGL(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.

这个想法是,我应该从javascript中调用一个将从delphi访问接口的调用lib并给我在相应的数组中的新的位置,旋转和缩放值。

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.

为此我想开发一个NPAPI lib Scriptable插件在Delphi的API)。

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

1)我想通过这个NPAPI插件从Delphi导出这些必要的物理API,并使用JavaScript在我的html页面中访问它们。我定位了chrome。
2)任何简单的hello world教程或与此相关的文章都将非常有帮助。

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)使用Firebreath实现相同的任何帮助最优选。
如何使用Delphi与Firebreath?

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

推荐答案


  • 使用好的HTML / JavaScript编辑器(例如NetBeans IDE)创建一个基本HTML页面,其中包含用于显示初始场景的硬编码JavaScript和用于接受用户输入的HTML表单

    • 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

      使用Indy或Synapse创建一个HTTP服务器(在Delphi中),它将为此HTML页面提供服务,当用户提交表单输入时,解析表单参数并将其传递给台球模拟,的图形命令 - 并将它们从HTTP服务器转换为WebGL(这是硬部分)语句

      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

      ,发送响应回到客户端,嵌入JavaScript / WebGL语句,以便客户端将看到动画和新的球场状态

      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

      重复直到游戏结束

      这篇关于在Delphi中创建NPAPI插件并使用javascript访问导出的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆