Jump to content
Fórum Script Brasil
  • 0

Converter código javascript para Delphi


Alan Castelan

Question

Tenho este código em javascript e estou tentando passar ele para o delphi alguém pode me ajudar??

o código no java e este

Packer = function(w, h) {

this.root = { x: 0, y: 0, w: w, h: h };

};

Packer.prototype = {

fit: function(blocks) {

var n, node, block;

for (n = 0; n < blocks.length; n++) {

block = blocks[n];

if (node = this.findNode(this.root, block.w, block.h))

block.fit = this.splitNode(node, block.w, block.h);

}

},

findNode: function(root, w, h) {

if (root.used)

return this.findNode(root.right, w, h) || this.findNode(root.down, w, h);

else if ((w <= root.w) && (h <= root.h))

return root;

else

return null;

},

splitNode: function(node, w, h) {

node.used = true;

node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h };

node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h };

return node;

}

}

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

ok... distração minha

não sei se voce vai achar alguma para isso

mas me lembrei desse link ... um conversor de java para delphi ( quem sabe resolve )

http://www.borlandforum.com/impboard/attach/0000097226/java2delphi.20070629.zip

nesse link tem um exemplo de conversão

http://www.delphipages.com/forum/archive/index.php/t-197212.html

abraço

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...