Comparing version
@@ -24,3 +24,3 @@ define(["require", "exports", "./config"], function (require, exports, config_1) { | ||
Handle.prototype.draw = function (image, x, y) { | ||
this.handle.drawImage(image, x, y); | ||
this.handle.drawImage(image.image, x, y); | ||
}; | ||
@@ -27,0 +27,0 @@ Handle.prototype.rotateImage = function (image, degrees) { |
@@ -6,6 +6,7 @@ export declare type GineAsset = ImageAsset | SpriteAsset; | ||
height: number; | ||
image: HTMLImageElement | null; | ||
draw(): void; | ||
update(): void; | ||
} | ||
export declare class Asset extends HTMLImageElement implements IGineAsset { | ||
export declare class Asset implements IGineAsset { | ||
type: string; | ||
@@ -12,0 +13,0 @@ width: number; |
@@ -15,11 +15,10 @@ var __extends = (this && this.__extends) || (function () { | ||
var assetFolder = 'assets'; | ||
var Asset = (function (_super) { | ||
__extends(Asset, _super); | ||
var Asset = (function () { | ||
function Asset(name, src) { | ||
var _this = _super.call(this) || this; | ||
_this.type = 'Asset'; | ||
_this.imageLoaded = false; | ||
_this.image = new Image(); | ||
_this.image.src = assetFolder + '/' + src; | ||
_this.image.onload = function () { | ||
var _this = this; | ||
this.type = 'Asset'; | ||
this.imageLoaded = false; | ||
this.image = new Image(); | ||
this.image.src = assetFolder + '/' + src; | ||
this.image.onload = function () { | ||
_this.imageLoaded = true; | ||
@@ -29,3 +28,2 @@ _this.width = _this.image.width; | ||
}; | ||
return _this; | ||
} | ||
@@ -35,3 +33,3 @@ Asset.prototype.draw = function () { }; | ||
return Asset; | ||
}(HTMLImageElement)); | ||
}()); | ||
exports.Asset = Asset; | ||
@@ -38,0 +36,0 @@ var ImageAsset = (function (_super) { |
{ | ||
"name": "gine", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Gine game engine.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -30,3 +30,3 @@ import {Canvas} from './canvas'; | ||
draw(image: Asset, x: number, y: number) { | ||
this.handle.drawImage(image, x, y) | ||
this.handle.drawImage(image.image, x, y) | ||
} | ||
@@ -33,0 +33,0 @@ |
@@ -8,2 +8,3 @@ // Went for Asset, cause Image is reserved. | ||
height: number | ||
image: HTMLImageElement | null | ||
@@ -15,3 +16,3 @@ draw(): void | ||
export class Asset extends HTMLImageElement implements IGineAsset { | ||
export class Asset implements IGineAsset { | ||
type: string = 'Asset' | ||
@@ -24,3 +25,2 @@ width: number | ||
constructor(name: string, src: string) { | ||
super() | ||
this.image = new Image() | ||
@@ -27,0 +27,0 @@ this.image.src = assetFolder+'/'+src |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
351361
-0.03%10229
-0.01%