app tweaks

This commit is contained in:
kepler155c@gmail.com
2019-04-13 21:38:57 -04:00
parent d45249e022
commit 4733116476
2 changed files with 60 additions and 4 deletions

49
neural/autorun/splash.lua Normal file
View File

@@ -0,0 +1,49 @@
local opus = {
'fffff00',
'ffff07000',
'ff00770b00 4444',
'ff077777444444444',
'f07777744444444444',
'f0000777444444444',
'070000111744444',
'777770000',
'7777000000',
'70700000000',
'077000000000',
}
local hex = {
['0'] = 0xF0F0F04F,
['1'] = 0xF2B2334F,
['2'] = 0xE57FD84F,
['3'] = 0x99B2F24F,
['4'] = 0xDEDE6C4F,
['5'] = 0x7FCC194F,
['6'] = 0xF2B2CC4F,
['7'] = 0x4C4C4C4F,
['8'] = 0x9999994F,
['9'] = 0x4C99B24F,
['a'] = 0xB266E54F,
['b'] = 0x3366CC4F,
['c'] = 0x7F664C4F,
['d'] = 0x57A64E4F,
['e'] = 0xCC4C4C4F,
-- ['f'] = 0x191919FF, -- transparent
}
local canvas = device['plethora:glasses'] and device['plethora:glasses'].canvas()
if canvas then
canvas.clear() -- assuming we are the first to use the canvas
local w, h = canvas.getSize()
canvas.group = canvas.addGroup({ w - 30, h - 30 })
local function drawLine(k, line)
for i = 1, #line do
local pix = hex[line:sub(i, i)]
if pix then
canvas.group.addRectangle(i*1.5, k*2.25, 1.5, 2.25, pix)
end
end
end
for k,line in ipairs(opus) do
drawLine(k, line)
end
end

View File

@@ -1,4 +1,4 @@
-- original concept: osmarks https://pastebin.com/ZP9Q1HCT
-- original concept: osmarks https://pastebin.com/xEDKdM85
local Sound = require('sound')
local Util = require('util')
@@ -25,11 +25,18 @@ end
local canvas = modules.canvas and modules.canvas()
local function dist(x, y, z)
return math.sqrt(
math.pow(x, 2) +
math.pow(y, 2) +
math.pow(z, 2))
end
local function display(meta)
if canvas then
if not canvas.group then
canvas.group = canvas.addGroup({ 4, 90 })
canvas.group.addRectangle(0, 0, 60, 30, 0x00000033)
canvas.group.addRectangle(0, 0, 70, 30, 0x00000033)
canvas.pitch = canvas.group.addText({ 4, 5 }, '') -- , 0x202020FF)
canvas.pitch.setShadow(true)
canvas.pitch.setScale(.75)
@@ -54,10 +61,10 @@ local function display(meta)
canvas.meter.setPosition(0, 90 - y)
canvas.meter.setSize(5, size)
canvas.meter.setColor(color)
canvas.pitch.setText(string.format('Pitch: %s\nMotion Y: %s\nSpeed: %s',
canvas.pitch.setText(string.format('Pitch: %s\nMotion Y: %s\nSpeed: %s m/s',
math.floor(-meta.pitch),
Util.round(meta.motionY, 2),
Util.round(math.abs(meta.motionX) + math.abs(meta.motionY) + math.abs(meta.motionZ), 2)))
Util.round(dist(meta.motionX, meta.motionY, meta.motionZ) * 20, 2)))
end
end