У-у-у, скорость! Графон!

This commit is contained in:
igor 2017-12-28 18:55:47 +03:00
parent 0cd58a459d
commit dec28f4a61
3 changed files with 85 additions and 74 deletions

View File

@ -23,8 +23,8 @@ local colors = {
}
local baseResolution = {
width = 135,
height = 50,
width = 146,
height = 54,
}
local monitors = {}
@ -97,13 +97,13 @@ local function configurator()
for address in components.list("screen") do
if address ~= mainScreenAddress then
gpu.bind(address)
gpu.bind(address, false)
gpu.setBackground(0x0)
gpu.setForeground(0x0)
gpu.fill(1, 1, 160, 50, " ")
gpu.fill(1, 1, 160, 60, " ")
end
end
gpu.bind(mainScreenAddress)
gpu.bind(mainScreenAddress, false)
monitors = {}
local monitorCount = width * height
@ -112,14 +112,14 @@ local function configurator()
drawMonitors()
local e = {event.pull("touch")}
if e[2] ~= mainScreenAddress then
gpu.bind(e[2])
gpu.bind(e[2], false)
gpu.setResolution(baseResolution.width, baseResolution.height)
local color = color.HSBToHEX(counter / monitorCount * 360, 100, 100)
ecs.square(1,1,baseResolution.width, baseResolution.height,color)
gpu.setForeground(0xffffff - color)
ecs.centerText("xy", 0, "Монитор " .. xC .. "x" .. yC .. " откалиброван!")
gpu.bind(mainScreenAddress)
gpu.bind(mainScreenAddress, false)
monitors[xC] = monitors[xC] or {}
monitors[xC][yC] = {address = e[2]}
@ -144,15 +144,6 @@ local function configurator()
ecs.prepareToExit()
ecs.universalWindow("auto", "auto", 40, 0xeeeeee, true, {"EmptyLine"}, {"CenterText", 0x262626, "Калибровка успешно завершена!"}, {"EmptyLine"}, {"Button", {ecs.colors.orange, 0xffffff, "Отлично"}})
gpu.setBackground(0x000000)
for x = 1, #monitors do
for y = 1, #monitors[x] do
gpu.bind(monitors[x][y].address)
gpu.fill(1, 1, 160, 50, " ")
end
end
gpu.bind(mainScreenAddress)
ecs.prepareToExit()
end
@ -205,36 +196,33 @@ local function getMonitorAndCoordinates(x, y)
return xMonitor, yMonitor, xPos, yPos
end
function multiScreen.set(x, y, text)
local xMonitor, yMonitor, xPos, yPos = getMonitorAndCoordinates(x, y)
if monitors[xMonitor] and monitors[xMonitor][yMonitor] then
if currentAddress ~= monitors[xMonitor][yMonitor].address then
gpu.bind(monitors[xMonitor][yMonitor].address, false)
currentAddress = monitors[xMonitor][yMonitor].address
end
if gpu.getBackground() ~= currentBackground then gpu.setBackground(currentBackground) end
if gpu.getForeground() ~= currentForeground then gpu.setForeground(currentForeground) end
gpu.set(xPos, yPos, text)
end
end
function multiScreen.clear(color)
for x = 1, #monitors do
for y = 1, #monitors[x] do
gpu.bind(monitors[x][y].address, true)
gpu.bind(monitors[x][y].address, false)
gpu.setResolution(monitors.screenResolutionByWidth, monitors.screenResolutionByHeight)
gpu.setBackground(color)
gpu.fill(1, 1, 160, 50, " ")
gpu.fill(1, 1, 160, 60, " ")
end
end
gpu.bind(mainScreenAddress)
end
function multiScreen.set(x, y, text)
for i = 1, unicode.len(text) do
local xMonitor, yMonitor, xPos, yPos = getMonitorAndCoordinates(x + i - 1, y)
if monitors[xMonitor] and monitors[xMonitor][yMonitor] then
if currentAddress ~= monitors[xMonitor][yMonitor].address then
gpu.bind(monitors[xMonitor][yMonitor].address)
currentAddress = monitors[xMonitor][yMonitor].address
gpu.setResolution(monitors.screenResolutionByWidth, monitors.screenResolutionByHeight)
end
if gpu.getBackground() ~= currentBackground then gpu.setBackground(currentBackground) end
if gpu.getForeground() ~= currentForeground then gpu.setForeground(currentForeground) end
gpu.set(xPos, yPos, unicode.sub(text, i, i))
end
end
gpu.bind(mainScreenAddress, false)
end
--------------------------------------------------------------------------------------------------------------------------------------------
@ -279,7 +267,7 @@ local function drawBigImageFromOCIFRawFile(x, y, path)
end
file:close()
gpu.bind(mainScreenAddress)
gpu.bind(mainScreenAddress, false)
print("Отрисовка пикчи завершена")
end
@ -290,6 +278,7 @@ local args = {...}
if args[1] == "draw" and args[2] then
loadConfig()
print("Идет очистка мониторов...")
multiScreen.clear(0x000000)
if fs.exists(args[2]) then
drawBigImageFromOCIFRawFile(1, 1, args[2])

View File

@ -63,11 +63,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="Main.java" pinned="false" current-in-tab="true">
<file leaf-file-name="Main.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342">
<caret line="69" column="88" lean-forward="true" selection-start-line="69" selection-start-column="88" selection-end-line="69" selection-end-column="88" />
<state relative-caret-position="184">
<caret line="115" column="35" lean-forward="true" selection-start-line="115" selection-start-column="35" selection-end-line="115" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#4174#4175#0" expanded="true" />
@ -87,6 +87,29 @@
</provider>
</entry>
</file>
<file leaf-file-name="OCIFStringButton.css" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/sample/Styles/OCIFStringButton.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="21" column="0" lean-forward="true" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="OCIF.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="410">
<caret line="48" column="25" lean-forward="true" selection-start-line="48" selection-start-column="25" selection-end-line="48" selection-end-column="25" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514453485000" expanded="true" signature="4152:5205" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -98,7 +121,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>jg</find>
<find>vagina</find>
<find>gridPane</find>
<find>getWi</find>
@ -119,8 +141,6 @@
<find>play</find>
<find>playAnimation(</find>
<find>initiali</find>
<find>currentImagePath</find>
<find>loadImage</find>
<find>loadIm</find>
<find>encodingMethods</find>
<find>combo</find>
@ -128,6 +148,9 @@
<find>enable bra</find>
<find>scene</find>
<find>integerToByteArray</find>
<find>currentImagePath</find>
<find>new Image</find>
<find>loadImage</find>
</findStrings>
<replaceStrings>
<replace>sample</replace>
@ -157,8 +180,8 @@
<option value="$PROJECT_DIR$/src/sample/Styles/button.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/textField.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/OCIFStringTextField.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/OCIFStringButton.css" />
<option value="$PROJECT_DIR$/src/sample/Main.java" />
<option value="$PROJECT_DIR$/src/sample/Styles/OCIFStringButton.css" />
</list>
</option>
</component>
@ -507,16 +530,16 @@
<option name="totallyTimeSpent" value="1302000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1920" height="973" extended-state="6" />
<frame x="0" y="23" width="1920" height="980" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18125" sideWeight="0.6703755" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15572916" sideWeight="0.6703755" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3296582" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19755827" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19603524" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@ -564,13 +587,6 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/sample/Palette.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="16" lean-forward="false" selection-start-line="6" selection-start-column="16" selection-end-line="6" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1635">
@ -878,17 +894,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2085">
<caret line="139" column="38" lean-forward="true" selection-start-line="139" selection-start-column="38" selection-end-line="139" selection-end-column="38" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514453485000" expanded="true" signature="4152:5205" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Pixel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
@ -956,17 +961,15 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/OCIFStringButton.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="21" column="0" lean-forward="true" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
</state>
<entry file="file://$PROJECT_DIR$/src/sample/Resources/StringResultButton.psd">
<provider selected="true" editor-type-id="images">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342">
<caret line="69" column="88" lean-forward="true" selection-start-line="69" selection-start-column="88" selection-end-line="69" selection-end-column="88" />
<state relative-caret-position="184">
<caret line="115" column="35" lean-forward="true" selection-start-line="115" selection-start-column="35" selection-end-line="115" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#4174#4175#0" expanded="true" />
@ -985,6 +988,25 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/OCIFStringButton.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="21" column="0" lean-forward="true" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="410">
<caret line="48" column="25" lean-forward="true" selection-start-line="48" selection-start-column="25" selection-end-line="48" selection-end-column="25" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514453485000" expanded="true" signature="4152:5205" ph="..." />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>