GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2021-02-03 03:42:59

Jacko
Member
Registered: 2021-02-03
Posts: 1

Draw point of specified size

should be self-explanatory, point size expands from center

Expand/// @func   draw_point_size(x,y,size)
///
/// @desc   Draws a point of the specified size
///
/// @arg    {real}    x,y         position
/// @arg    {real}    width         width of point in pixels, real
///
/// GMLscripts.com/license
{
	var _x, _y, size
	_x = argument0;
	_y = argument1;
	size = argument2;

	draw_rectangle(_x-(size/2),_y-(size/2),_x+(size/2),_y+(size/2),false);
	return 0;
}

Offline

#2 2021-02-16 09:39:20

gnysek
Member
Registered: 2011-12-29
Posts: 36

Re: Draw point of specified size

Issue with this is that depending of GPU (Intel/GeForce/AMD) rectangle might be offset by 1px, and when you use odd number, you have no idea on which pixel it will be rounded in this case. So, the result might be even ~2px wrong.

Offline

#3 2021-05-25 14:43:56

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Draw point of specified size

That's an interesting observation. Also, calling this a point, which strictly speaking has no length, area, or volume, is a bit weird. But I can see the practical utility of it. I'll need to think about this.

Apologies for the late reply.


Abusing forum power since 1986.

Offline

Board footer

Powered by FluxBB