mirror of
https://github.com/LDDestroier/CC/
synced 2025-01-19 05:32:51 +00:00
Slightly improved renderer
This commit is contained in:
parent
1cc951abaa
commit
fdad83c5c7
30
pain.lua
30
pain.lua
@ -3000,16 +3000,22 @@ local listAllMonitors = function()
|
||||
end
|
||||
|
||||
local getInput = function() --gotta catch them all
|
||||
|
||||
local doot = function()
|
||||
local button, x, y, oldmx, oldmy, origx, origy
|
||||
local isDragging = false
|
||||
local proceed = false
|
||||
local evt, oldx, oldy = {}
|
||||
local button, points, key, dir
|
||||
renderBar(barmsg)
|
||||
while true do
|
||||
doRender = false
|
||||
local oldx,oldy = paint.scrollX,paint.scrollY
|
||||
local evt = {getEvents("mouse_scroll","mouse_click", "mouse_drag","mouse_up","key","key_up",true)}
|
||||
evt = {getEvents("mouse_scroll","mouse_click", "mouse_drag","mouse_up","key","key_up",true)}
|
||||
|
||||
--doRender = false
|
||||
oldx, oldy = paint.scrollX,paint.scrollY
|
||||
|
||||
if (evt[1] == "mouse_scroll") and (not viewing) then
|
||||
local dir = evt[2]
|
||||
dir = evt[2]
|
||||
if dir == 1 then
|
||||
if keysDown[keys.leftShift] or keysDown[keys.rightShift] then
|
||||
paint.t = paint.t * 2
|
||||
@ -3066,7 +3072,7 @@ local getInput = function() --gotta catch them all
|
||||
dragPoses[1] = {x=x,y=y}
|
||||
end
|
||||
dragPoses[2] = {x=x,y=y}
|
||||
local points = getDotsInLine(dragPoses[1].x,dragPoses[1].y,dragPoses[2].x,dragPoses[2].y)
|
||||
points = getDotsInLine(dragPoses[1].x,dragPoses[1].y,dragPoses[2].x,dragPoses[2].y)
|
||||
renderAllPAIN()
|
||||
for a = 1, #points do
|
||||
term.setCursorPos(points[a].x, points[a].y)
|
||||
@ -3074,7 +3080,7 @@ local getInput = function() --gotta catch them all
|
||||
end
|
||||
elseif (not dontDragThisTime) then
|
||||
if evt[1] == "mouse_drag" then
|
||||
local points = getDotsInLine(linePoses[1].x,linePoses[1].y,linePoses[2].x,linePoses[2].y)
|
||||
points = getDotsInLine(linePoses[1].x,linePoses[1].y,linePoses[2].x,linePoses[2].y)
|
||||
for a = 1, #points do
|
||||
putDotDown({x=points[a].x, y=points[a].y})
|
||||
end
|
||||
@ -3100,12 +3106,12 @@ local getInput = function() --gotta catch them all
|
||||
end
|
||||
elseif (evt[1] == "mouse_up") and (not viewing) and (not plc.isCurrentlyFilling) then
|
||||
origx,origy = 0,0
|
||||
local button = evt[2]
|
||||
button = evt[2]
|
||||
miceDown[button] = false
|
||||
oldmx,oldmy = nil,nil
|
||||
lastMX, lastMY = nil,nil
|
||||
if isDragging then
|
||||
local points = getDotsInLine(dragPoses[1].x,dragPoses[1].y,dragPoses[2].x,dragPoses[2].y)
|
||||
points = getDotsInLine(dragPoses[1].x,dragPoses[1].y,dragPoses[2].x,dragPoses[2].y)
|
||||
for a = 1, #points do
|
||||
putDotDown({x=points[a].x, y=points[a].y})
|
||||
end
|
||||
@ -3115,7 +3121,7 @@ local getInput = function() --gotta catch them all
|
||||
saveToUndoBuffer()
|
||||
isDragging = false
|
||||
elseif evt[1] == "key" then
|
||||
local key = evt[2]
|
||||
key = evt[2]
|
||||
if (isDragging or not keysDown[keys.leftShift]) and (keysDown[keys.tab]) then
|
||||
if key == keys.right and (not keysDown[keys.right]) then
|
||||
paint.scrollX = paint.scrollX + 1
|
||||
@ -3457,11 +3463,17 @@ local getInput = function() --gotta catch them all
|
||||
if (oldx~=paint.scrollX) or (oldy~=paint.scrollY) then
|
||||
doRender = true
|
||||
end
|
||||
end
|
||||
end
|
||||
parallel.waitForAny(doot, function()
|
||||
while true do
|
||||
sleep(0.05)
|
||||
if doRender then
|
||||
renderAllPAIN()
|
||||
doRender = false
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
runPainEditor = function(...) --needs to be cleaned up
|
||||
|
Loading…
Reference in New Issue
Block a user