Search the Community
Showing results for tags 'graphics()'.
-
Hello. I currently have a strange problem when drawing lines or a rectangle on a existing container. Containers Layout: ---------------------------------- - World : Container -> SceneManager -> GetActiveScene(): Container When the world get's created i get the ActiveScene from the scene manager. But when the graphics object is rendered it has a differant size then its container where it is placed in. Code Snippet: NewScene(sceneOptions: ISceneOptions): boolean { //this.ActiveScene.removeAllListeners(); //this.ActiveScene.destroy(); this.ActiveScene = new Scene(0xe3d8c3); this.ActiveScene.y = 110; this.ActiveScene.width = 900; this.ActiveScene.height = 400; var graphics = new Graphics(); graphics.beginFill(0xffffff); // draw a rectangle graphics.drawRect(0, 0, 900, this.ActiveScene.height - 25); //this.ActiveScene.addChild(Overlay.Instance.Overlay); this.logger.log('New Scene created!'); this.ActiveScene.addChild(graphics); return true; } Hope anyone can help.
- 3 replies
-
- container
- graphics()
-
(and 2 more)
Tagged with:
-
let bigRect = new PIXI.Graphics(); bigRect.beginFill('0x00FF00'); bigRect.drawRect(0, 0, 200, 150); bigRect.endFill(); let smallRect = new PIXI.Graphics(); smallRect.beginFill('0xFFFF00'); smallRect.drawRect(0, 0, 190, 140); smallRect.endFill(); let smallRect_x = bigRect.x + (bigRect.width - smallRect.width)/2; let smallRect_y = bigRect.y + (bigRect.height - smallRect.height)/2; smallRect.position.set(smallRect_x, smallRect_y); app.stage.addChild(bigRect); bigRect.addChild(smallRect); bigRect.position.set(100, 100); I want to center smallRect inside bigRect. Why is it working in the code above when positions are set to (0, 0) initially, but wouldn't work if I had any position other than (0, 0) for the bigRect. It's not a problem to set the initial positions to (0, 0) and than change them, I just want to understand how it's working underneath.
-
I was about to file a bug report on gitHub and saw a notice that the repo is for Phaser 3 related issues only. So, is the Phaser 2 repo closed? The bug relates to the beginFill(...) and arc(..., true) methods see below. Perhaps this has been fixed in v3? Here is the issue... let myGraphic = game.add.graphics(game.world.centerX, game.world.centerY); myGraphic.beginFill(0xFF3300, 0.5); myGraphic.arc(0, 0, 135, game.math.degToRad(0), game.math.degToRad(90), true); let myGraphic = game.add.graphics(game.world.centerX, game.world.centerY); myGraphic.beginFill(0xFF3300, 0.5); myGraphic.arc(0, 0, 135, game.math.degToRad(0), game.math.degToRad(90), true); The issue may be reproduced with the above code using the bool direction parameter set to true [anticlockwise] together with beginFill(...). Rather starting the arc at due east 0º, the fill is begun from about 7º. Oddly if rendered using lineStyle(...) only and without beginFill(...) it draws correctly, beginning at 0º The same issue may be seen in the example at: https://phaser.io/examples/v2/display/arc -u