Skip to content

Commit

Permalink
Add suport for pixi v5
Browse files Browse the repository at this point in the history
  • Loading branch information
getkey committed Apr 1, 2019
1 parent ba8ac1e commit a2e2488
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules/
yarn-error.log
5 changes: 3 additions & 2 deletions README.md
@@ -1,7 +1,8 @@
# gstatsjs

This is a fork of [eXponenta's gstatsjs](https://github.com/eXponenta/gstatsjs) that can be imported as a ES6 module. Additionally, it can be installed from [NPM](https://www.npmjs.com/package/gstats).
No other modifications have been made (and none are planned). More informations [here](https://github.com/eXponenta/gstatsjs/pull/2).
This is a fork of [eXponenta's gstatsjs](https://github.com/eXponenta/gstatsjs) that can be imported as a ES6 module. Additionally, it can be installed from [NPM](https://www.npmjs.com/package/gstats). More informations [here](https://github.com/eXponenta/gstatsjs/pull/2).

It also drops support of Pixi v4 in favor of v5.

```sh
npm install gstats # for npm users
Expand Down
6 changes: 4 additions & 2 deletions dist/PIXIHooks.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/PIXIHooks.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/PhaserHooks.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/PhaserHooks.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "gstats",
"version": "0.0.1",
"version": "0.1.0",
"description": "Show DrawCalls, FPS, Texture Count on PIXI, Phaser projects",
"module": "dist/main.js",
"scripts": {
Expand All @@ -17,7 +17,7 @@
],
"author": "eXponenta",
"license": "ISC",
"devDependencies": {
"@types/pixi.js": "^4.7.0"
"peerDependencies": {
"pixi.js": "^5.0.0-rc.3"
}
}
6 changes: 4 additions & 2 deletions src/PIXIHooks.ts
@@ -1,3 +1,5 @@
// @ts-ignore (it's a peer dependency)
import { Renderer } from 'pixi.js';
import BaseHooks from './BaseHooks';

export default class PIXIHooks extends BaseHooks {
Expand All @@ -10,11 +12,11 @@ export default class PIXIHooks extends BaseHooks {
return;
}

if(app.renderer instanceof PIXI.WebGLRenderer){
if(app.renderer instanceof Renderer){

this.attach(app.renderer.gl);

var start_textures = app.renderer.textureManager._managedTextures;
var start_textures = app.renderer.texture._managedTextures;

if(start_textures && this.texturehook){
console.log("[PIXI Hooks] Collect used textures:", start_textures.length);
Expand Down
4 changes: 3 additions & 1 deletion src/PhaserHooks.ts
@@ -1,3 +1,5 @@
// @ts-ignore (it's a peer dependency)
import { Renderer } from 'pixi.js';
import BaseHooks from './BaseHooks';

export default class PhaserHooks extends BaseHooks {
Expand Down Expand Up @@ -27,7 +29,7 @@ export default class PhaserHooks extends BaseHooks {

} else {

if(game.renderer instanceof PIXI.WebGLRenderer){
if(game.renderer instanceof Renderer){

this.attach(game.renderer.gl);

Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit a2e2488

Please sign in to comment.