Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Recordad cambiar los nombres de "Eliaseeg" por el suyo.
- -- Si queréis dibujar una línea abajo del else de la función eventMouse colocar "dibujarLinea", te debería quedar así: dibujarLinea(data[name].primerCheck,{x=xCursor,y=yCursor},1).
- -- Si queréis dibujar un círculo colocar "dibujarCirculo", que quedaría así: dibujarCirculo(data[name].primerCheck,{x=xCursor,y=yCursor},1)
- data={}
- data["Eliaseeg"]={
- primerCheck=nil
- };
- system.bindMouse("Eliaseeg",true)
- id=1
- function dibujarLinea(punto1,punto2,res)
- a=(punto1.y-punto2.y)/(punto1.x-punto2.x)
- b=punto1.y-a*punto1.x
- if(punto1.x>punto2.x) then punto1,punto2=punto2,punto1 end
- for i=punto1.x,punto2.x,res do
- ui.addTextArea(id,"",nil,i,a*i+b, 1, 1, "0x2E9AFE", "0x2E9AFE")
- id=id+1
- end
- end
- function dibujarCirculo(point1,point2)
- r=math.sqrt(math.pow((point1.x-point2.x),2)+math.pow((point1.y-point2.y),2))
- res=1-r*math.pow(10,-2)
- if(res<0.1)then res =0.1 end
- for i=0,2*math.pi,res do
- ui.addTextArea(id,"",nil,point1.x+r*math.cos(i),point1.y+r*math.sin(i), 1, 1, "0x2E9AFE", "0x2E9AFE")
- id=id+1
- end
- end
- function eventMouse(name,xCursor,yCursor)
- if(not data[name].primerCheck)then
- data[name].primerCheck={x=xCursor,y=yCursor}
- else
- dibujarLinea(data[name].primerCheck,{x=xCursor,y=yCursor},1)
- data[name].primerCheck = nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement