Comments (5)
Hi, I figured it out: http://try.haxe.org/#e07B7
If there is a better method, I'm all ears, but this doesn't seem too bad.
from pixi-haxe.
Actually, that doesn't work.
In the proposed solution, I was using Type.getClass to get the class of the hitArea of an InteractiveTarget at runtime. Unfortunately, there is no type information for pixi classes at runtime so this will never work.
from pixi-haxe.
OK. Here is a hacky working solution. Since I am trying to specifically access the InteractiveTarget.hitArea member, this works.
Solution: http://try.haxe.org/#4f078
This shouldn't actually work but since pixi has a 'type' member in all of the Shape classes, I can take advantage of that. If there are any instances of using EitherType that don't have something like this, this method will likely fail. Because of this, I am going to leave the issue open as a better solution should be found.
EitherType seems to be ok for function parameters, but when using it for variables, it renders the variables almost unusable without hacks.
from pixi-haxe.
I'm closing this again. The above solution is not really as hacky as I originally thought. The pixi Shapes all have the 'type' member variable so that instanceof (Std.is in haxe) doesn't have to be used. While Std.is still works, casting the hitArea to a typedef with a 'type' member variable is an effective solution.
For anyone curious, here is a try.haxe that illustrates what does and doesn't work with EitherType: http://try.haxe.org/#B0783
from pixi-haxe.
Here ya go, mate :) #113
from pixi-haxe.
Related Issues (20)
- BlendMode / BlendModes HOT 2
- ScaleMode error HOT 1
- ScaleModes 2
- Perf Stat
- Particles aren't up to date HOT 5
- Erroneous specification for InteractionData::identifier ? HOT 1
- Eh,why don't have resouces in samples directory? HOT 1
- Settings Type Mismatch HOT 11
- No more Point::clone ? HOT 8
- Issue in Pixi Spine TextureRegion HOT 2
- Somber news HOT 9
- TextMetrics width/height properties HOT 1
- Type not found : pixi.plugins.app.Application HOT 2
- Compiling with Haxe 4 RC 3 show warnings HOT 1
- pixijs 5 HOT 20
- Release a new haxelib version before moving to Pixi 5? HOT 5
- pixi-projection plugin externs HOT 2
- Runtime errors for compiled examples HOT 1
- Loader deprecated
- Examples & Lib folder need to be updated for pixi 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixi-haxe.