Skip to content

Commit

Permalink
fix a scope issue where only the parent renderer reset function was c…
Browse files Browse the repository at this point in the history
…alled
  • Loading branch information
obiot committed Mar 3, 2023
1 parent 8453afc commit ae9bae2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/video/canvas/canvas_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ import * as event from "./../../system/event.js";
this.isContextValid = true;
event.emit(event.ONCONTEXT_RESTORED, this);
}, false );

// reset the renderer on game reset
event.on(event.GAME_RESET, () => {
this.reset();
});
}

/**
Expand Down
5 changes: 0 additions & 5 deletions src/video/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ import Point from "../geometries/point.js";

// default uvOffset
this.uvOffset = 0;

// reset the renderer on game reset
event.on(event.GAME_RESET, () => {
this.reset();
});
}

/**
Expand Down
6 changes: 5 additions & 1 deletion src/video/webgl/webgl_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { isPowerOfTwo } from "./../../math/math.js";
* @param {Compositor} [options.compositor] - A class that implements the compositor API for sprite rendering
*/
constructor(options) {

// parent contructor
super(options);

Expand Down Expand Up @@ -153,6 +152,11 @@ import { isPowerOfTwo } from "./../../math/math.js";
this.isContextValid = true;
event.emit(event.ONCONTEXT_RESTORED, this);
}, false );

// reset the renderer on game reset
event.on(event.GAME_RESET, () => {
this.reset();
});
}

/**
Expand Down

1 comment on commit ae9bae2

@obiot
Copy link
Member Author

@obiot obiot commented on ae9bae2 Mar 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow the changes linked to #1172

Please sign in to comment.