From 832e52c0603c7f33c9fdadb21e8b0f38e309d955 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Sat, 18 Jul 2026 10:11:34 +0300 Subject: [PATCH] =?UTF-8?q?feat(view):=20=D0=92=20=D1=84=D1=83=D0=BD=D0=BA?= =?UTF-8?q?=D1=86=D0=B8=D1=8E=20createGameView=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D1=80=20container=20=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B2=20=D1=8D=D1=82?= =?UTF-8?q?=D0=BE=D1=82=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=B9=D0=BD=D0=B5?= =?UTF-8?q?=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/view.js b/src/view.js index fbb25b1..0c86337 100644 --- a/src/view.js +++ b/src/view.js @@ -1,4 +1,4 @@ -import { Graphics } from 'pixi.js'; +import { Container, Graphics } from 'pixi.js'; import { Ball } from './entities/ball/ball'; import { Brick } from './entities/brick/brick'; import { Paddle } from './entities/paddle/paddle'; @@ -29,16 +29,25 @@ function createBrickView(brick) { } /** - * Создает визуальное отображение всех сущностей в игре с помощью Pixi.js + * Создает визуальное отображение всех сущностей в игре с помощью Pixi.js и добавляет в контейнер * @param {Game} game экземпляр класса игра + * @param {Container} container контейнер Pixi.js */ -export function createGameView(game) { +export function createGameView(game, container) { try { const ball = createBallView(game.ball); + container.addChild(ball); const paddle = createPaddleView(game.paddle); + container.addChild(paddle); - const bricks = game.bricks.map((row) => row.map((brick) => createBrickView(brick))); + const bricks = game.bricks.map((row) => + row.map((brick) => { + const brickView = createBrickView(brick); + container.addChild(brickView); + return brickView; + }), + ); return { ball,