piston icon indicating copy to clipboard operation
piston copied to clipboard

Why is transform required for drawing text at position?

Open benstigsen opened this issue 6 years ago • 1 comments

For something like rectangle it's:

rectangle(
	[1.0, 0.0, 0.0, 1.0], // RGBA
	[0.0, 0.0, 100.0, 100.0], // [x, y, w, h]
	context.transform, graphics
);

But for text it's:

let transform = context.transform.trans(10.0, 100.0);

text::Text::new_color([0.0, 0.0, 0.0, 1.0], 32).draw(
	"Hello world!",
	&mut font,
	&context.draw_state,
	transform, graphics
).unwrap();

Why does text require transform, and not just x and y coordinates?

benstigsen avatar Sep 26 '19 11:09 benstigsen

I opened https://github.com/PistonDevelopers/graphics/issues/1137

bvssvni avatar Aug 08 '20 08:08 bvssvni