Какая-то хуйня

This commit is contained in:
Igor Timofeev 2018-10-28 04:35:44 +03:00
parent 53cf767531
commit 8bb7240194
4 changed files with 11 additions and 10 deletions

View File

@ -331,8 +331,9 @@ local function drawCross(x, y)
drawInvertedText(x, y + 1, "")
end
local oldUptime
OCGLView.draw = function(object)
mainContainer.oldClock = os.clock()
oldUptime = computer.uptime()
if world then renderWorld() end
scene:render()
if mainContainer.toolbar.zBufferSwitch.state then
@ -472,7 +473,7 @@ end
local FPSCounter = GUI.object(2, 2, 8, 3)
FPSCounter.draw = function(FPSCounter)
renderer.renderFPSCounter(FPSCounter.x, FPSCounter.y, tostring(math.ceil(1 / (os.clock() - mainContainer.oldClock) / 10)), 0xFFFF00)
renderer.renderFPSCounter(FPSCounter.x, FPSCounter.y, tostring(math.ceil(1 / (computer.uptime() - oldUptime))), 0xFFFF00)
end
mainContainer:addChild(FPSCounter)

View File

@ -33,7 +33,7 @@ end
-------------------------------------------------------------------------------------
buffer.clear(backgroundColor)
buffer.draw(true)
buffer.drawChanges(true)
while true do
local eventType = event.pull(0.0001)
@ -54,9 +54,9 @@ while true do
buffer.clear(backgroundColor)
for i = 1, lineCount - 1 do
buffer.semiPixelLine(t[i].x, t[i].y, t[i + 1].x, t[i + 1].y, lineColor)
buffer.drawSemiPixelLine(t[i].x, t[i].y, t[i + 1].x, t[i + 1].y, lineColor)
end
buffer.semiPixelLine(t[1].x, t[1].y, t[lineCount].x, t[lineCount].y, lineColor)
buffer.draw()
buffer.drawSemiPixelLine(t[1].x, t[1].y, t[lineCount].x, t[lineCount].y, lineColor)
buffer.drawChanges()
end

View File

@ -814,7 +814,7 @@ local colors = {
}
buffer.clear()
buffer.draw(true)
buffer.drawChanges(true)
local sizeX,sizeY = 80, 50
while true do
@ -822,10 +822,10 @@ while true do
for y=1, sizeY do
for x=1, sizeX do
local pos = (y <= sizeX and x <= sizeX) and string.sub(nyans[frame][y], x, x) or ","
buffer.square(x * 2 - 1, y, 2, 1, colors[pos], 0x0, " ")
buffer.drawRectangle(x * 2 - 1, y, 2, 1, colors[pos], 0x0, " ")
end
end
buffer.draw()
buffer.drawChanges()
local eventType = event.pull(0)
if eventType == "touch" or eventType == "key_down" then
return

View File

@ -5,7 +5,7 @@ local fs = require("filesystem")
----------------------------------------------------------------------------------------------------
local function encode(data)
data = data:gsub("([^%w%-%_%.%~])", function(char)
data = data:gsub("([^%-%_%.%~])", function(char)
return string.format("%%%02X", string.byte(char))
end)