PistonDevelopers/piston

Why is transform required for drawing text at position?

benstigsen opened this issue · 3 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?