It is currently March 28th, 2024, 6:09 pm

shape meter overlap detection [suggestion]

Report bugs with the Rainmeter application and suggest features.
Post Reply
User avatar
shantanuaryan67
Posts: 8
Joined: January 1st, 2016, 5:50 am
Location: vadodara, gujarat, india
Contact:

shape meter overlap detection [suggestion]

Post by shantanuaryan67 »

while i was browsing the 4.1 beta manual , i read about combining shapes. the intersect combine type only shows the common part (overlapping part) of the shapes. however i am in search of an action option that can detect if two shapes are overlapping or not and then execute something if it returns true
something like this:

Code: Select all

[MeterShapes]
Meter=Shape
Shape=Rectangle 4,4,110,110,55
Shape2=Rectangle 54,54,80,80,10
ifShape2OverlapsShape=!SetOption SomeStringMeter Text "New Text"
if the intersect combine type can already detect common parts then i dont think that detecting overlapss will be a big task
alternatively a Boolean might also work

Code: Select all

IfCondition=Shape∩Shape2
IfTrueAction=!SetOption SomeStringMeter Text "New Text"
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: shape meter overlap detection [suggestion]

Post by FreeRaider »

For now a solution can be a lua code:

ShapeOption.lua

Code: Select all

function Initalize()
	
		
end

function Update()
	
	MyMeter=SKIN:GetMeter('MeterShapes')
	
	ShapeOption = {}
	
	for i = 2, 20 do
	
		ShapeOption[i] = {}
	
	end
    
	
	for i = 2, 20 do
		
		ShapeOption[i] = MyMeter:GetOption('Shape'..i, '')
		
		
		
		if ShapeOption[i] ==  string.match(ShapeOption[i], '(Combine.*)')  then
			
			SKIN:Bang('!SetOption', 'MyStringMeter', 'Text', 'There is an overlapping')
			SKIN:Bang('[!UpdateMeter "MyStringMeter"]')
			SKIN:Bang('[!Redraw]')
		end
			
	end
	
	
end
and this example code:

test.ini

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[MeasureName]
Measure=Script
ScriptFile=ShapeOption.lua
UpdateDivider=-1

[MeterShapes]
Meter=Shape
Shape=Rectangle 4,4,110,110,55
Shape2=Rectangle 54,54,80,80,10
; Shape3=Combine Shape | Union Shape2

[MyStringMeter]
Meter=String
SolidColor=45,45,45,255
FontColor=255,255,255,255
FontFace=Courier New
FontSize=16
For testing you need comment / uncomment this ; Shape3=Combine Shape | Union Shape2.

P.S.: Comments start with a semi-colon ;
Post Reply