Sign in to follow this  
Vurda69

PIXI plugin and debug

Recommended Posts

Activating the pixi plugin I have problems displaying the bodies in debug.
In practice, the box should be designed in a webgl context and not 2d

I hope for a change in future versions

example : (debug.js - line 242)

 _drawBody: function(body) {
        if (!body.world || !body.shape) return;
        
           var context = game.renderer.context;
           var shape = body.shape;
        
           if (game.renderer.canvas.getContext('webgl') === null){ //
           // 2d
                
            var x = 0;
            var y = 0;
            if (this._camera) {
                x = -this._camera.position.x;
                y = -this._camera.position.y;
            }
            context.setTransform(1, 0, 0, 1, x, y);
            context.globalAlpha = game.Debug.bodyAlpha;
            context.fillStyle = game.Debug.bodyColor;
            context.strokeStyle = game.Debug.bodyLineColor;
            context.lineWidth = game.Debug.bodyLineWidth;
    
            if (shape.width && shape.height) {
                context.beginPath();
                context.rect(
                    (body.position.x - shape.width / 2) * game.scale,
                    (body.position.y - shape.height / 2) * game.scale,
                    shape.width * game.scale,
                    shape.height * game.scale
                );
                context.fill();
                context.stroke();
            }
            else if (shape.radius) {
                context.beginPath();
                context.arc(
                    body.position.x * game.scale,
                    body.position.y * game.scale,
                    shape.radius * game.scale,
                    0,
                    Math.PI * 2
                );
                context.fill();
                context.stroke();
            }
            
        } else { //
        
           // webgl (pixi plugin)

           // ??????
         
        }
    
    },

 

Share this post


Link to post
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.