**Quote: **"Could you provide an example? "

Sure. Here's your code snippet with my function added. There's a slight difference between ours right at the edge of the boundary lines, but I believe that's due to precision of floats over integers.

// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "AngleInrangeDemo" )
SetWindowSize( 720, 405, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 720, 405 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 1 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
// set print properties
SetPrintSize( 26 )
SetPrintColor( 255, 255, 0 )
cx = GetVirtualWidth() * 0.5
cy = GetVirtualHeight() * 0.5
rad = GetVirtualHeight() * 0.4
angle = 0.0
ccw# = 10.0
cw# = 10.0
do
DrawEllipse( cx, cy, rad, rad, MakeColor( 20, 20, 20 ), MakeColor( 20, 20, 20 ), 0 )
inc angle
if angle > 360.0 then dec angle, 360.0
DrawTestAngleLine( cx, cy, rad, angle )
_tempAng# = ATanFull( GetPointerX() - cx, GetPointerY() - cy )
DrawCircleShard( cx, cy, rad, _tempAng#, ccw#, cw# )
print("[Phaelax] in range: " + boolean_str(getAngularDifference(angle, _tempAng#) < 15))
//~ PrintC( "FPS: " ) : Print( Str( ScreenFPS(), 0 ) )
PrintC( "Is White Line Angle in range?: " ) : Print( boolean_str( inrangeAngle( angle, _tempAng#, ccw#, cw# ) ) )
Sync()
loop
function getAngularDifference(a as integer, b as integer)
d = abs(a - b)
if d > 180 then d = 360 - d
endfunction d
/*
Tests whether an angle is within a range.
-----------------------------------------
_testAng -- = The angle to test.
_rangeAng = The angle upon which the range is calculated.
_ccw ------ = The distance counter clockwise from the range angle.
_cw = The distance clockwise from the range angle.
*/
function inrangeAngle( _testAng#, _rangeAng#, _ccw#, _cw# )
_oob = 0
_min# = _rangeAng# - _ccw#
if _min# < 0.0
inc _min#, 360.0
_oob = 1
endif
_max# = _rangeAng# + _cw#
if _max# > 360.0
dec _max#, 360.0
_oob = 1
endif
if _oob = 1
if _testAng# > _min# then exitfunction 1
if _testAng# < _max# then exitfunction 1
else
if _testAng# > _min# and _testAng# < _max# then exitfunction 1
endif
endfunction 0
function DrawTestAngleLine( _x#, _y#, _radius#, _ang# )
_coutX# = PlaceByAngX( _x#, _ang#, _radius# )
_coutY# = PlaceByAngY( _y#, _ang#, _radius# )
DrawLine( _x#, _y#, _coutX#, _coutY#, 255, 255, 255 )
endfunction
function DrawCircleShard( _x#, _y#, _radius#, _ang#, _ccw#, _cw# )
_len# = 4.0
// Draw grey line
_coutX# = PlaceByAngX( _x#, _ang#, _radius# )
_coutY# = PlaceByAngY( _y#, _ang#, _radius# )
DrawLine( _x#, _y#, _coutX#, _coutY#, 63, 63, 63 )
// Draw red lines
for i = 1 to _ccw# - 1
_x1# = PlaceByAngX( _x#, _ang# - i, _radius# )
_y1# = PlaceByAngY( _y#, _ang# - i, _radius# )
if i = 1 then DrawLine( _x1#, _y1#, _coutX#, _coutY#, 200, 40, 40 )
_x2# = PlaceByAngX( _x#, _ang# - (i + 1), _radius# )
_y2# = PlaceByAngY( _y#, _ang# - (i + 1), _radius# )
` DrawLine( _x1#, _y1#, _x2#, _y2#, 200, 40, 40 )
next i
_x1# = PlaceByAngX( _x#, _ang# - _ccw#, _radius# - _len# )
_y1# = PlaceByAngY( _y#, _ang# - _ccw#, _radius# - _len# )
_x2# = PlaceByAngX( _x#, _ang# - _ccw#, _radius# + _len# )
_y2# = PlaceByAngY( _y#, _ang# - _ccw#, _radius# + _len# )
DrawLine( _x1#, _y1#, _x2#, _y2#, 200, 40, 40 )
// Draw blue lines
for i = 1 to _cw# - 1
_x1# = PlaceByAngX( _x#, _ang# + i, _radius# )
_y1# = PlaceByAngY( _y#, _ang# + i, _radius# )
if i = 1 then DrawLine( _x1#, _y1#, _coutX#, _coutY#, 20, 80, 200 )
_x2# = PlaceByAngX( _x#, _ang# + (i + 1), _radius# )
_y2# = PlaceByAngY( _y#, _ang# + (i + 1), _radius# )
DrawLine( _x1#, _y1#, _x2#, _y2#, 20, 80, 200 )
next i
_x1# = PlaceByAngX( _x#, _ang# + _cw#, _radius# - _len# )
_y1# = PlaceByAngY( _y#, _ang# + _cw#, _radius# - _len# )
_x2# = PlaceByAngX( _x#, _ang# + _cw#, _radius# + _len# )
_y2# = PlaceByAngY( _y#, _ang# + _cw#, _radius# + _len# )
DrawLine( _x1#, _y1#, _x2#, _y2#, 20, 80, 200 )
endfunction
function PlaceByAngX( _x#, _angle#, _distance# )
ret# = cos( _angle# - 90.0 )
endfunction _x# + ret# * _distance#
function PlaceByAngY( _y#, _angle#, _distance# )
_ret# = sin( _angle# - 90.0 )
endfunction _y# + _ret# * _distance#
function boolean_str( _val )
if _val then exitfunction "true"
endfunction "false"