lewisje / renderengine

Automatically exported from code.google.com/p/renderengine
MIT License
0 stars 0 forks source link

ScrollingBackground.setupWorld() calls this.drawImage() with the wrong argument list #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I could only make scrolling backgrounds work when I changed this method in 
context.scrollingbackground.js

  setupWorld: function(time) {
     this.base(time);

     // Render the slice of the level image first
     this.drawImage(this.getViewport(), this.level.getSourceImage(), this.visRect);
  },

to:

  setupWorld: function(time) {
     this.base(time);

     // Render the slice of the level image first
     this.drawImage(null, this.getViewport(), this.level.getSourceImage(), this.visRect);
  },

Original issue reported on code.google.com by maryrose...@gmail.com on 31 May 2010 at 7:04

GoogleCodeExporter commented 8 years ago

Original comment by bfatt...@gmail.com on 10 Jun 2010 at 9:05

GoogleCodeExporter commented 8 years ago
When the htmlelement context was removed, we removed the need for the reference 
in the code to the host object for which the image was being drawn.  Later the 
code was refactored and the reference was moved to the end, as can be seen in 
the definition of the function in context.render2d.js:

  /**
    * Draw an image on the context.
    *
    * @param rect {Rectangle2D} The rectangle that specifies the position and
    *             dimensions of the image rectangle.
    * @param image {Object} The image to draw onto the context
    * @param [srcRect] {Rectangle2D} <i>[optional]</i> The source rectangle within the image, if
    *                <tt>null</tt> the entire image is used
    * @param [ref] {HostObject} A reference host object
    */
   drawImage: function(rect, image, srcRect /*, ref */) {
   },

As such, the way you have it would be from an older version of the engine 
source.  I recommend that you either update the engine so the reference can be 
the last argument, or keep it your way and don't update the engine at this time.

Original comment by bfatt...@gmail.com on 15 Jul 2010 at 3:49