These are chat archives for pixijs/pixi.js

2nd
Nov 2016
Rick Richardson
@rrichardson
Nov 02 2016 14:52
Hey all. I'm trying to create something akin to a drawing app, where one would continuously draw lines. I found : http://www.html5gamedevs.com/topic/16387-how-to-smooth-a-line-drawn-using-mouse-events/ and I'm trying to update it to pixijs 4, but I can't get interactivity to work.
there is a background rectangle which I tried to make interactive = true, then set on('mousedown', myfunc)
but I still can't get anything to register mousedown events (or any events at all)
any hints would be appreciated
Dave Moore
@themoonrat
Nov 02 2016 18:16
Either use latest dev version, or use pointerdown instead
Rick Richardson
@rrichardson
Nov 02 2016 18:17
@themoonrat - thanks, master branch?
Dave Moore
@themoonrat
Nov 02 2016 18:18
dev branch
Rick Richardson
@rrichardson
Nov 02 2016 18:18
k
For links to latest dev build, minified and not :)
Rick Richardson
@rrichardson
Nov 02 2016 18:31
wrangling kubernetes at the moment.. I'll give it a try soon
Rick Richardson
@rrichardson
Nov 02 2016 21:45
sweet!
I am registering mousedown
still no actual lines being drawn.. but its a start
JR Heard
@jrheard
Nov 02 2016 23:17
hi! i'm sure i'm doing something silly here.
i have a simple game, which i'm rendering using pixi.
i've been using the canvas renderer, but am interested in switching to the webgl one.
currently, i have one PIXI.Container and one PIXI.Graphics, and the container has one child which is that single Graphics,
and in order to draw shapes on the screen (everything in my game is a rectangle), i use theGraphics.drawRect(), and everything is fine.
where it gets weird is when i want to move one of these rectangles around. what i'm currently doing is reaching into the theGraphics.graphicsData list to find the rectangle i drew, and then setting theRectangle.shape.x = foo and theRectangle.shape.y = bar.
this works in the canvas renderer, but does not appear to work in the webgl renderer. am i doing something wrong? is there a better way to move rectangles around? or am i misinterpreting this situation entirely?
the code is in clojurescript, so i'm not sure how helpful it is to you guys, but i'm linking it just in case :) https://github.com/jrheard/voke/blob/master/src/voke/pixi.cljs
the relevant functions are rectangle and update-entity-position!
(root cause of the question: i just changed the game so that the "camera" "tracks" the player, and immediately ran into pixijs/pixi.js#2524 [my walls now appear to have tiny visible gaps between them]; that github issue says that the main way to fix this problem is to switch to the webgl renderer, so that's my motivation here)
JR Heard
@jrheard
Nov 02 2016 23:23
i could make each entity (each wall, each monster, each projectile, etc) in the game a Container, and move those around by manipulating theContainer.position.x and theContainer.position.y, which seems much better supported - but i've seen englercj say "Try to draw all the boxes with 1 Graphics object, that way they are batched together in webgl and draw very quickly", which seems to mean that this many-containers idea is a bad one. but again i'm a pixi noob and it seems very likely that i'm misinterpreting one or more pieces of this tool :)
JR Heard
@jrheard
Nov 02 2016 23:32
(i'm using nothing but colored rectangles - i have no sprites. is this unusual/bad? i'm just making a simple game for fun, i only plan to draw rectangles, i do not plan on using any images at all)
JR Heard
@jrheard
Nov 02 2016 23:51
(game at jrheard.com/voke, wasd + arrow keys to control)