Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / (Gosu.record).draw_as_quad issue
- - By aktivb Date 2015-12-10 15:07 Edited 2015-12-10 19:47
The following code: http://dpaste.com/08BT5KR
yields, a tad unexpectedly, this: http://pasteboard.co/2LOGwr5r.png

I can post this as a github issue once I get confirmation that I'm not completely misunderstanding how this is supposed to work.

Gosu 0.10.4
Ruby 2.0.0
OSX 10.8.5

EDIT:

src/Graphics/Macro.cpp:
// Let's hope I never have to debug/understand this again! :D

Yeah, I can see why.

Here's something though, the corner ordering is off,
it's top_right, top_left, bottom_right, bottom_left:

Gosu.record(x,y) do
  draw_quad(..)
end.draw_as_quad(
  x2, y2, WHITE,
  x1, y1, WHITE,
  x3, y3, WHITE,
  x4, y4, WHITE)

seems to get it right, as far as I can tell
Parent - By jlnr (dev) Date 2015-12-19 13:21
Hey, thanks for reporting this issue...and for diving into the hell that is Macro.cpp :)

Gosu originally used "reading order" for coordinates everywhere: top left, top right, bottom left, bottom right. (I think this was a Direct3D thing, but I'm not sure.)
But everyone except me seems to prefer clockwise coordinates, so while Gosu uses "reading order" internally, it now accepts arguments in both(!) orders.

And here comes the bug: I forgot to translate clockwise coordinates into "reading order" in Macro::draw. I've pushed a commit and will release a new version of Gosu once I've verified that Rubygems 2.5.1 does not break my pre-compiled Windows gem anymore. In the meantime, you can just swap the parameters to Image#draw_as_quad and everything should work.
Up Topic Gosu / Gosu Exchange / (Gosu.record).draw_as_quad issue

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill