Jump to content

TypeScript PIXI Definition


Recommended Posts

Hey everyone :D

Mat, loving the effort you have made on PIXI. As an AS3 developer, I have been waiting for a while to try it.  I have no interest in working with Javascript directly, and so I have been hoping to go the TypeScript route. 

I am currently trying to create the definitions.  Thanks for the great documentation :D

Lets take something simple like the Point class. 


declare module PIXIexport class AlphaMaskFilter{....blah}export class Point    {        //properties        x: number;        y: number;        //constructor        constructor(x: number, y: number);        //methods        clone(): Point;    }

But what is holding me back is these other things:

The PolyK modules and the PIXI.PixiShader class. 

I have no idea how to implement these into the definition. 

I am not sure what it means when a class has a prefix.  Why does PIXI.PIXI.PixiShader exist and not just PIXI.PixiShader like all other PIXI module classes? My knowledge in JS is limited.

EDIT:  PIXI.PolyK.Triangulate


So in Javascript, is the method name "PolyK.Triangulate()".


Also, for the PolyK modules, should I put these in a different definition starting:

declare module PolyKexport class InteractionData {.... blah

If you understand what I am talking about, please respond :D

Link to comment
Share on other sites

So I know that PIXI is the module. 

The PolyK... object? Class? Is part of the PIXI module? How do you write a definition for that? Can it be as simple as adding the function call to the existing PIXI module?


declare module PIXIexport class Point{....export class InteractionData	{		//properties	    	global: Point;	    	originalEvent: any;	    	target: Sprite;				//constructor	   	constructor();	   	//methods	        getLocalPosition(displayObject:DisplayObject):Point;	}


I get confused behind the scenes. 

Link to comment
Share on other sites

  • 1 month later...



I want to get the PIXI definition out of my phaser definition file. 

Starting at line 74. 

If anyone can help me:

1) I still have no idea how events work. You can see that I extend EventTarget which is almost certainly wrong. 
2) I still cannot figure out the PIXI.polyK.InteractionData.  Like a module inside a namespace or what ever this is, but I have no idea how to define it. 

Link to comment
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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...