Answers for "c++ drawing rectangle"

C++
0

c++ drawing rectangle

draw_rect(float x, float y, float half_size_x, float half_size_y, u32 color) {
	x *= rs.height * render_scale;
	y *= rs.height * render_scale;
	half_size_x *= rs.height * render_scale;
	half_size_y *= rs.height * render_scale;
	x += rs.width / 2.f;
	y += rs.height / 2.f;
	// Change to pixels
	int x0 = x - half_size_x;
	int x1 = x + half_size_x;
	int y0 = y - half_size_y;
	int y1 = y + half_size_y;
	draw_rect_in_pixels(x0, y0, x1, y1, color);
}
Posted by: Guest on July-09-2021

Browse Popular Code Answers by Language