當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript pixi.js.Graphics類代碼示例

本文整理匯總了TypeScript中pixi.js.Graphics的典型用法代碼示例。如果您正苦於以下問題:TypeScript js.Graphics類的具體用法?TypeScript js.Graphics怎麽用?TypeScript js.Graphics使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了js.Graphics類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

	constructor(game: Game) {
		super(game);
		let test = new Graphics();
		test.lineStyle(4, 0x10fa01,1);
		test.drawCircle(10,10,50);
		this.container.addChild(test);
	}
開發者ID:fbessou,項目名稱:gooms-server,代碼行數:7,代碼來源:mainmenu.ts

示例2: preparePlayer

 private preparePlayer( config: PlayerConfig ) {
   const graphics = new PIXI.Graphics();
   const half_size = config.size / 2;
   graphics.beginFill(config.color, 1);
   graphics.drawRect(-half_size, -half_size, config.size, config.size);
   graphics.x = config.position[0];
   graphics.y = config.position[1];
   return { view: graphics, config };
 }
開發者ID:KuKKoMaH,項目名稱:tron-racing,代碼行數:9,代碼來源:Render.ts

示例3: fastFun

export function fastFun() {
    if (!Menu.fastBool) {
        if (Menu.editBool) {
            $("#editBulle").trigger("click");
        }
        Menu.disableButton($("#editBulle"));
        Menu.setBackground(Ressource.pathImgFast);
        $("#fastBulle").css({ "box-shadow": "lime 0px 0px 20px inset", "border-radius": "20px", "padding": "3px" })
        //$( "body" ).css({"border": "lime 1em dashed"})
        //renderer.transparent=true
        //console.log(renderer)
        var windowH = Rezo.windowH
        var windowW = Rezo.windowW
        sensorFast = new PIXI.Graphics();
        sensorFast.beginFill(0x00ff06, 0)
        sensorFast.drawRect(0, 0, windowW, windowH)
        sensorFast.hitArea = new PIXI.Rectangle(0, 0, windowW, windowH);
        sensorFast.interactive = true;
        var stage = Rezo.stage;
        stage.addChild(sensorFast)
        sensorFast.mousedown = sensorFast.touchstart = function (data) {
            data.data.originalEvent.preventDefault();
            this.data = data;
            console.log(this.data)
            var newPosition = this.data.data.getLocalPosition(this.parent);
            var newFastBulleText = prompt('Text nouvelle bulle')
            if (newFastBulleText) {
                updateWindowSize()
                var scaleScene = Rezo.scaleScene;
                var fastPoX = newPosition.x / scaleScene.scale.x - scaleScene.scene.x - (windowW / scaleScene.scale.x - windowW) / 2
                var fastPoY = newPosition.y / scaleScene.scale.x - scaleScene.scene.y - (windowH / scaleScene.scale.x - windowH) / 2
                Rezo.sceneBulle.addChild(new Bulle(fastPoX, fastPoY, newFastBulleText, Bulle.bulleColor));
                Link.linkBool = true
                Link.link3Bool = true
                Link.link2Bool = false

                Link.linkFun()
            }



        }
        Menu.fastBool = true
    } else {
        Menu.enableButton($("#editBulle"), Menu.editButton)
        Menu.setBackground();
        $("body").css({ "border": "0em" });
        $("#fastBulle").css({ "box-shadow": "none", "border-radius": "20px", "padding": "0px" });
        //console.log(renderer)
        Rezo.stage.removeChild(sensorFast);
        Link.linkBool = false;
        Link.link3Bool = false;
        Link.emptyLinkArray();
        //sceneBulle.mousedown = sceneBulle.touchstart = function () { };
        Menu.fastBool = false
    }
}
開發者ID:AntoineGermanique,項目名稱:REZO_TYPESCRIPT,代碼行數:57,代碼來源:fast.ts

示例4: setLocator

    private setLocator(): Graphics {
        const context = new Graphics;
        context
            .lineStyle(0.1, 0xFF0000, 1)
            .moveTo(this.x, this.y)
            .lineTo(1, this.y)

            .lineStyle(0.1, 0x0000FF, 1)
            .moveTo(this.x, this.y)
            .lineTo(this.x, 1);
        return context
    }
開發者ID:SonyStone,項目名稱:atanki-com,代碼行數:12,代碼來源:Locator.ts

示例5: constructor

	constructor (label: (string | (string | Item)[]), width: number, hint?: string, disabled: boolean = false) {
		super()

		const contentWidth = width // TODO MUST ACCOUNT FOR PADDING AND BORDER

		if (typeof label === 'string') {
			label = [label]
		}
		const textContainer = this.makeTextContainer(label, contentWidth)
		textContainer.x = (contentWidth / 2) - (textContainer.width / 2)
		textContainer.y = BORDER_WIDTH + PADDING

		const graphics: Graphics = new Graphics()
		if (disabled) {
			graphics.beginFill(DB16.LIGHT_GRAY)
		} else {
			graphics.beginFill(DB16.WHITE)
		}
		graphics.drawRect(
				BORDER_WIDTH,
				BORDER_WIDTH,
				width - 2 * BORDER_WIDTH,
				textContainer.height + 2 * PADDING,
		)

		const innerHeight = textContainer.height + 2 * PADDING
		graphics.lineStyle(BORDER_WIDTH, DB16.DARK_GRAY)
		// Top
		graphics.moveTo(BORDER_WIDTH, BORDER_WIDTH / 2)
		graphics.lineTo(width - BORDER_WIDTH, BORDER_WIDTH / 2)
		// Bottom
		graphics.moveTo(BORDER_WIDTH, innerHeight + BORDER_WIDTH + BORDER_WIDTH / 2)
		graphics.lineTo(width - BORDER_WIDTH, innerHeight + BORDER_WIDTH + BORDER_WIDTH / 2)
		// Left
		graphics.moveTo(BORDER_WIDTH / 2, BORDER_WIDTH)
		graphics.lineTo(BORDER_WIDTH / 2, innerHeight + BORDER_WIDTH)
		// Right
		graphics.moveTo(width - BORDER_WIDTH / 2, BORDER_WIDTH)
		graphics.lineTo(width - BORDER_WIDTH / 2, innerHeight + BORDER_WIDTH)

		this.addChild(graphics)
		this.addChild(textContainer)

		if (hint) {
			const hintText = new Text(hint, HINT_STYLE)
			hintText.x = textContainer.x - hintText.width - PADDING
			hintText.y = BORDER_WIDTH + (innerHeight / 2) - (hintText.height / 2)
			this.addChild(hintText)
		}
	}
開發者ID:bteixeira,項目名稱:phaser-tryouts,代碼行數:50,代碼來源:ui-button.ts


注:本文中的pixi.js.Graphics類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。