Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
075903f9a9 | ||
|
|
d6931412c8 | ||
|
|
73b43358ff | ||
|
|
df7be99fdd | ||
|
|
6f0ddd6bf6 | ||
|
|
a821abed1f | ||
|
|
50dce1c1e7 | ||
|
|
94fccf9211 | ||
|
|
a4d0492d17 | ||
|
|
5ebb5fe436 | ||
|
|
bb921c57cd | ||
|
|
2b85ab9746 | ||
|
|
29ebd7d4d7 | ||
|
|
8ab7bc4bde | ||
|
|
1b8f62ce41 | ||
|
|
61e38d89e8 | ||
|
|
a0db5ecb61 | ||
|
|
3ef7aa91bf | ||
|
|
09e8589938 | ||
|
|
e9aba2498b | ||
|
|
20ceb6b56f | ||
|
|
6d2956f3bf | ||
|
|
91e42e096c | ||
|
|
5f00dfe401 | ||
|
|
2c4c059a70 | ||
|
|
923b570d48 | ||
|
|
5499057e7e | ||
|
|
d6091b312c | ||
|
|
f19c0ebb49 | ||
|
|
01b83822b1 | ||
|
|
c81f24cca2 | ||
|
|
ed894cb390 | ||
|
|
355db9a82c | ||
|
|
8112378c70 | ||
|
|
a181496052 | ||
|
|
636ed0001f | ||
|
|
0e3da7eda5 | ||
|
|
3cf5adaef1 |
@@ -92,6 +92,7 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getDeepObject(name)
|
local function getDeepObject(name)
|
||||||
local o = getObject(name)
|
local o = getObject(name)
|
||||||
if(o~=nil)then return o end
|
if(o~=nil)then return o end
|
||||||
@@ -825,9 +826,7 @@ return function(name, parent, pTerm, basalt)
|
|||||||
if (events["other_event"][index] ~= nil) then
|
if (events["other_event"][index] ~= nil) then
|
||||||
for _, value in rpairs(events["other_event"][index]) do
|
for _, value in rpairs(events["other_event"][index]) do
|
||||||
if (value.eventHandler ~= nil) then
|
if (value.eventHandler ~= nil) then
|
||||||
if (value:eventHandler(event, ...)) then
|
value:eventHandler(event, ...)
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -836,6 +835,7 @@ return function(name, parent, pTerm, basalt)
|
|||||||
if(autoSize)and not(isMonitor)then
|
if(autoSize)and not(isMonitor)then
|
||||||
if(self.parent==nil)then
|
if(self.parent==nil)then
|
||||||
if(event=="term_resize")then
|
if(event=="term_resize")then
|
||||||
|
self:sendEvent("basalt_resize", self, event, ...)
|
||||||
self:setSize(termObject.getSize())
|
self:setSize(termObject.getSize())
|
||||||
autoSize = true
|
autoSize = true
|
||||||
end
|
end
|
||||||
@@ -885,20 +885,20 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
mouseHandler = function(self, button, x, y, _, side)
|
mouseHandler = function(self, button, x, y, touch, side)
|
||||||
if(isGroupedMonitor)then
|
if(isGroupedMonitor)then
|
||||||
if(termObject.calculateClick~=nil)then
|
if(termObject.calculateClick~=nil)then
|
||||||
x, y = termObject.calculateClick(side, x, y)
|
x, y = termObject.calculateClick(side, x, y)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(base.mouseHandler(self, button, x, y))then
|
if(base.mouseHandler(self, button, x, y, touch))then
|
||||||
if(events["mouse_click"]~=nil)then
|
if(events["mouse_click"]~=nil)then
|
||||||
self:setCursor(false)
|
self:setCursor(false)
|
||||||
for _, index in ipairs(eventZIndex["mouse_click"]) do
|
for _, index in ipairs(eventZIndex["mouse_click"]) do
|
||||||
if (events["mouse_click"][index] ~= nil) then
|
if (events["mouse_click"][index] ~= nil) then
|
||||||
for _, value in rpairs(events["mouse_click"][index]) do
|
for _, value in rpairs(events["mouse_click"][index]) do
|
||||||
if (value.mouseHandler ~= nil) then
|
if (value.mouseHandler ~= nil) then
|
||||||
if (value:mouseHandler(button, x, y)) then
|
if (value:mouseHandler(button, x, y, touch)) then
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -108,11 +108,25 @@ return function(name)
|
|||||||
|
|
||||||
setValuesByXMLData = function(self, data)
|
setValuesByXMLData = function(self, data)
|
||||||
local baseFrame = self:getBaseFrame()
|
local baseFrame = self:getBaseFrame()
|
||||||
if(xmlValue("x", data)~=nil)then self:setPosition(xmlValue("x", data), self:getY()) end
|
local tex, mode, infPlay
|
||||||
if(xmlValue("y", data)~=nil)then self:setPosition(self:getX(), xmlValue("y", data)) end
|
if(xmlValue("texture", data)~=nil)then tex = xmlValue("texture", data) end
|
||||||
if(xmlValue("width", data)~=nil)then self:setSize(xmlValue("width", data), self.height) end
|
if(xmlValue("mode", data)~=nil)then mode = xmlValue("mode", data) end
|
||||||
if(xmlValue("height", data)~=nil)then self:setSize(self.width, xmlValue("height", data)) end
|
if(xmlValue("texturePlay", data)~=nil)then infPlay = xmlValue("texturePlay", data) end
|
||||||
|
local x, y
|
||||||
|
if(xmlValue("x", data)~=nil)then x = xmlValue("x", data) end
|
||||||
|
if(xmlValue("y", data)~=nil)then y = xmlValue("y", data) end
|
||||||
|
if(x~=nil)or(y~=nil)then
|
||||||
|
self:setPosition(x, y)
|
||||||
|
end
|
||||||
|
local w, h
|
||||||
|
if(xmlValue("width", data)~=nil)then w = xmlValue("width", data) end
|
||||||
|
if(xmlValue("height", data)~=nil)then h = xmlValue("height", data) end
|
||||||
|
if(w~=nil)or(h~=nil)then
|
||||||
|
self:setSize(w, h)
|
||||||
|
end
|
||||||
if(xmlValue("bg", data)~=nil)then self:setBackground(colors[xmlValue("bg", data)]) end
|
if(xmlValue("bg", data)~=nil)then self:setBackground(colors[xmlValue("bg", data)]) end
|
||||||
|
if(xmlValue("bgSymbol", data)~=nil)then self:setBackground(self.bgColor, xmlValue("bgSymbol", data)) end
|
||||||
|
if(xmlValue("bgSymbolColor", data)~=nil)then self:setBackground(self.bgColor, self.bgSymbol, colors[xmlValue("bgSymbolColor", data)]) end
|
||||||
if(xmlValue("fg", data)~=nil)then self:setForeground(colors[xmlValue("fg", data)]) end
|
if(xmlValue("fg", data)~=nil)then self:setForeground(colors[xmlValue("fg", data)]) end
|
||||||
if(xmlValue("value", data)~=nil)then self:setValue(colors[xmlValue("value", data)]) end
|
if(xmlValue("value", data)~=nil)then self:setValue(colors[xmlValue("value", data)]) end
|
||||||
if(xmlValue("visible", data)~=nil)then if(xmlValue("visible", data))then self:show() else self:hide() end end
|
if(xmlValue("visible", data)~=nil)then if(xmlValue("visible", data))then self:show() else self:hide() end end
|
||||||
@@ -121,10 +135,10 @@ return function(name)
|
|||||||
if(xmlValue("anchor", data)~=nil)then self:setAnchor(xmlValue("anchor", data)) end
|
if(xmlValue("anchor", data)~=nil)then self:setAnchor(xmlValue("anchor", data)) end
|
||||||
if(xmlValue("shadowColor", data)~=nil)then self:setShadow(colors[xmlValue("shadowColor", data)]) end
|
if(xmlValue("shadowColor", data)~=nil)then self:setShadow(colors[xmlValue("shadowColor", data)]) end
|
||||||
if(xmlValue("border", data)~=nil)then self:setBorder(colors[xmlValue("border", data)]) end
|
if(xmlValue("border", data)~=nil)then self:setBorder(colors[xmlValue("border", data)]) end
|
||||||
if(xmlValue("borderLeft", data)~=nil)then borderColors["left"] = xmlValue("borderLeft", data) end
|
if(xmlValue("borderLeft", data)~=nil)then borderColors["left"] = colors[xmlValue("borderLeft", data)] end
|
||||||
if(xmlValue("borderTop", data)~=nil)then borderColors["top"] = xmlValue("borderTop", data) end
|
if(xmlValue("borderTop", data)~=nil)then borderColors["top"] = colors[xmlValue("borderTop", data)] end
|
||||||
if(xmlValue("borderRight", data)~=nil)then borderColors["right"] = xmlValue("borderRight", data) end
|
if(xmlValue("borderRight", data)~=nil)then borderColors["right"] = colors[xmlValue("borderRight", data)] end
|
||||||
if(xmlValue("borderBottom", data)~=nil)then borderColors["bottom"] = xmlValue("borderBottom", data) end
|
if(xmlValue("borderBottom", data)~=nil)then borderColors["bottom"] = colors[xmlValue("borderBottom", data)] end
|
||||||
if(xmlValue("borderColor", data)~=nil)then self:setBorder(colors[xmlValue("borderColor", data)]) end
|
if(xmlValue("borderColor", data)~=nil)then self:setBorder(colors[xmlValue("borderColor", data)]) end
|
||||||
if(xmlValue("ignoreOffset", data)~=nil)then if(xmlValue("ignoreOffset", data))then self:ignoreOffset(true) end end
|
if(xmlValue("ignoreOffset", data)~=nil)then if(xmlValue("ignoreOffset", data))then self:ignoreOffset(true) end end
|
||||||
if(xmlValue("onClick", data)~=nil)then self:generateXMLEventFunction(self.onClick, xmlValue("onClick", data)) end
|
if(xmlValue("onClick", data)~=nil)then self:generateXMLEventFunction(self.onClick, xmlValue("onClick", data)) end
|
||||||
@@ -141,6 +155,9 @@ return function(name)
|
|||||||
if(xmlValue("onEvent", data)~=nil)then self:generateXMLEventFunction(self.onEvent, xmlValue("onEvent", data)) end
|
if(xmlValue("onEvent", data)~=nil)then self:generateXMLEventFunction(self.onEvent, xmlValue("onEvent", data)) end
|
||||||
if(xmlValue("onGetFocus", data)~=nil)then self:generateXMLEventFunction(self.onGetFocus, xmlValue("onGetFocus", data)) end
|
if(xmlValue("onGetFocus", data)~=nil)then self:generateXMLEventFunction(self.onGetFocus, xmlValue("onGetFocus", data)) end
|
||||||
if(xmlValue("onLoseFocus", data)~=nil)then self:generateXMLEventFunction(self.onLoseFocus, xmlValue("onLoseFocus", data)) end
|
if(xmlValue("onLoseFocus", data)~=nil)then self:generateXMLEventFunction(self.onLoseFocus, xmlValue("onLoseFocus", data)) end
|
||||||
|
if(tex~=nil)then
|
||||||
|
self:setTexture(tex, mode, infPlay)
|
||||||
|
end
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local curDir = fs.getDir(table.pack(...)[2]) or ""
|
local curDir = fs.getDir(table.pack(...)[2]) or ""
|
||||||
|
|
||||||
|
local defaultPath = package.path
|
||||||
if not(packed)then
|
if not(packed)then
|
||||||
local defaultPath = package.path
|
|
||||||
local format = "path;/path/?.lua;/path/?/init.lua;"
|
local format = "path;/path/?.lua;/path/?/init.lua;"
|
||||||
|
|
||||||
local main = format:gsub("path", curDir)
|
local main = format:gsub("path", curDir)
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
local sub,floor = string.sub,math.floor
|
local sub,floor,rep = string.sub,math.floor,string.rep
|
||||||
|
|
||||||
local function loadNFPAsBimg(path)
|
local function loadNFPAsBimg(path)
|
||||||
return {[1]={{}, {}, paintutils.loadImage(path)}}, "bimg"
|
local bimg = {{}}
|
||||||
|
local nfp = fs.open(path, "r")
|
||||||
|
if(nfp~=nil)then
|
||||||
|
for line in nfp.readLine do
|
||||||
|
table.insert(bimg[1], {rep(" ",#line), rep(" ",#line), line})
|
||||||
|
end
|
||||||
|
nfp.close()
|
||||||
|
return bimg
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function loadNFP(path)
|
local function loadNFP(path)
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ function process:new(path, window, newEnv, ...)
|
|||||||
local env = setmetatable(newEnv, {__index=_ENV})
|
local env = setmetatable(newEnv, {__index=_ENV})
|
||||||
env.shell = shell
|
env.shell = shell
|
||||||
env.basaltProgram=true
|
env.basaltProgram=true
|
||||||
env.arg = {[0]=path, table.unpack(args)}
|
|
||||||
env.require, env.package = newPackage(env, fs.getDir(pPath))
|
env.require, env.package = newPackage(env, fs.getDir(pPath))
|
||||||
if(fs.exists(pPath))then
|
if(fs.exists(pPath))then
|
||||||
local file = fs.open(pPath, "r")
|
local file = fs.open(pPath, "r")
|
||||||
@@ -25,7 +24,7 @@ function process:new(path, window, newEnv, ...)
|
|||||||
file.close()
|
file.close()
|
||||||
local program = load(content, path, "bt", env)
|
local program = load(content, path, "bt", env)
|
||||||
if(program~=nil)then
|
if(program~=nil)then
|
||||||
return program()
|
return program(table.unpack(args))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
local sub = string.sub
|
local sub,find,reverse = string.sub,string.find,string.reverse
|
||||||
|
|
||||||
local splitString = function(str, sep)
|
local function splitString(str, delimiter)
|
||||||
if sep == nil then
|
local result = {}
|
||||||
sep = "%s"
|
if str == "" or delimiter == "" then
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
local start = 1
|
||||||
|
local delim_start, delim_end = find(str, delimiter, start)
|
||||||
|
while delim_start do
|
||||||
|
table.insert(result, sub(str, start, delim_start - 1))
|
||||||
|
start = delim_end + 1
|
||||||
|
delim_start, delim_end = find(str, delimiter, start)
|
||||||
end
|
end
|
||||||
local t={}
|
table.insert(result, sub(str, start))
|
||||||
for v in string.gmatch(str, "([^"..sep.."]+)") do
|
return result
|
||||||
table.insert(t, v)
|
|
||||||
end
|
|
||||||
return t
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local relations = {[0] = {8, 4, 3, 6, 5}, {4, 14, 8, 7}, {6, 10, 8, 7}, {9, 11, 8, 0}, {1, 14, 8, 0}, {13, 12, 8, 0}, {2, 10, 8, 0}, {15, 8, 10, 11, 12, 14},
|
local relations = {[0] = {8, 4, 3, 6, 5}, {4, 14, 8, 7}, {6, 10, 8, 7}, {9, 11, 8, 0}, {1, 14, 8, 0}, {13, 12, 8, 0}, {2, 10, 8, 0}, {15, 8, 10, 11, 12, 14},
|
||||||
@@ -81,7 +86,7 @@ end
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
getTextHorizontalAlign = function(text, width, textAlign, replaceChar)
|
getTextHorizontalAlign = function(text, width, textAlign, replaceChar)
|
||||||
text = string.sub(text, 1, width)
|
text = sub(text, 1, width)
|
||||||
local offset = width - string.len(text)
|
local offset = width - string.len(text)
|
||||||
if (textAlign == "right") then
|
if (textAlign == "right") then
|
||||||
text = string.rep(replaceChar or " ", offset) .. text
|
text = string.rep(replaceChar or " ", offset) .. text
|
||||||
@@ -132,22 +137,25 @@ splitString = splitString,
|
|||||||
|
|
||||||
createText = function(str, width)
|
createText = function(str, width)
|
||||||
local uniqueLines = splitString(str, "\n")
|
local uniqueLines = splitString(str, "\n")
|
||||||
local lines = {}
|
local result = {}
|
||||||
for k,v in pairs(uniqueLines)do
|
for k,v in pairs(uniqueLines)do
|
||||||
local line = ""
|
if(#v==0)then table.insert(result, "") end
|
||||||
local words = splitString(v, " ")
|
while #v > width do
|
||||||
for a,b in pairs(words)do
|
local last_space = find(reverse(sub(v, 1, width)), " ")
|
||||||
if(#line+#b <= width)then
|
if not last_space then
|
||||||
line = line=="" and b or line.." "..b
|
last_space = width
|
||||||
if(a==#words)then table.insert(lines, line) end
|
|
||||||
else
|
else
|
||||||
table.insert(lines, line)
|
last_space = width - last_space + 1
|
||||||
line = b:sub(1,width)
|
|
||||||
if(a==#words)then table.insert(lines, line) end
|
|
||||||
end
|
end
|
||||||
|
local line = sub(v, 1, last_space)
|
||||||
|
table.insert(result, line)
|
||||||
|
v = sub(v, last_space + 1)
|
||||||
|
end
|
||||||
|
if #v > 0 then
|
||||||
|
table.insert(result, v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return lines
|
return result
|
||||||
end,
|
end,
|
||||||
|
|
||||||
getValueFromXML = function(name, tab)
|
getValueFromXML = function(name, tab)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ return function(...)
|
|||||||
local co = coroutine.create(f)
|
local co = coroutine.create(f)
|
||||||
local ok, result = coroutine.resume(co, ...)
|
local ok, result = coroutine.resume(co, ...)
|
||||||
if(ok)then
|
if(ok)then
|
||||||
table.insert(schedules, co)
|
table.insert(schedules, {co, result})
|
||||||
else
|
else
|
||||||
basaltError(result)
|
basaltError(result)
|
||||||
end
|
end
|
||||||
@@ -154,15 +154,26 @@ local bInstance = {
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
local function handleSchedules(event, p1, p2, p3, p4)
|
local function handleSchedules(event, ...)
|
||||||
if(#schedules>0)then
|
if(#schedules>0)then
|
||||||
local finished = {}
|
local finished = {}
|
||||||
for n=1,#schedules do
|
for n=1,#schedules do
|
||||||
if(schedules[n]~=nil)then
|
if(schedules[n]~=nil)then
|
||||||
if (coroutine.status(schedules[n]) == "suspended")then
|
if (coroutine.status(schedules[n][1]) == "suspended")then
|
||||||
local ok, result = coroutine.resume(schedules[n], event, p1, p2, p3, p4)
|
if(schedules[n][2]~=nil)then
|
||||||
if not(ok)then
|
if(schedules[n][2]==event)then
|
||||||
basaltError(result)
|
local ok, result = coroutine.resume(schedules[n][1], event, ...)
|
||||||
|
schedules[n][2] = result
|
||||||
|
if not(ok)then
|
||||||
|
basaltError(result)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local ok, result = coroutine.resume(schedules[n][1], event, ...)
|
||||||
|
schedules[n][2] = result
|
||||||
|
if not(ok)then
|
||||||
|
basaltError(result)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
table.insert(finished, n)
|
table.insert(finished, n)
|
||||||
@@ -240,21 +251,23 @@ local function basaltUpdateEvent(event, ...)
|
|||||||
local mouseEvent = mouseEvents[event]
|
local mouseEvent = mouseEvents[event]
|
||||||
if(mouseEvent~=nil)then
|
if(mouseEvent~=nil)then
|
||||||
mouseEvent(mainFrame, ...)
|
mouseEvent(mainFrame, ...)
|
||||||
|
handleSchedules(event, ...)
|
||||||
drawFrames()
|
drawFrames()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(event == "monitor_touch") then
|
if(event == "monitor_touch") then
|
||||||
if(monFrames[p1]~=nil)then
|
if(monFrames[a[1]]~=nil)then
|
||||||
monFrames[p1]:mouseHandler(1, a[2], a[3], true)
|
monFrames[a[1]]:mouseHandler(1, a[2], a[3], true)
|
||||||
activeFrame = monFrames[p1]
|
activeFrame = monFrames[a[1]]
|
||||||
end
|
end
|
||||||
if(count(monGroups)>0)then
|
if(count(monGroups)>0)then
|
||||||
for k,v in pairs(monGroups)do
|
for k,v in pairs(monGroups)do
|
||||||
v[1]:mouseHandler(1, a[2], a[3], true, a[1])
|
v[1]:mouseHandler(1, a[2], a[3], true, a[1])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
handleSchedules(event, ...)
|
||||||
drawFrames()
|
drawFrames()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -273,6 +286,7 @@ local function basaltUpdateEvent(event, ...)
|
|||||||
activeKey[a[1]] = false
|
activeKey[a[1]] = false
|
||||||
end
|
end
|
||||||
keyEvent(activeFrame, ...)
|
keyEvent(activeFrame, ...)
|
||||||
|
handleSchedules(event, ...)
|
||||||
drawFrames()
|
drawFrames()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -422,6 +436,10 @@ basalt = {
|
|||||||
projectDirectory = dir
|
projectDirectory = dir
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
forceRenderUpdate = function()
|
||||||
|
drawFrames()
|
||||||
|
end,
|
||||||
|
|
||||||
debug = function(...)
|
debug = function(...)
|
||||||
local args = { ... }
|
local args = { ... }
|
||||||
if(mainFrame==nil)then print(...) return end
|
if(mainFrame==nil)then print(...) return end
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ return function(name)
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
setText = function(self, text)
|
setText = function(self, text)
|
||||||
base:setValue(text)
|
base:setValue(tostring(text))
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ return function(name)
|
|||||||
return dropdownW, dropdownH
|
return dropdownW, dropdownH
|
||||||
end,
|
end,
|
||||||
|
|
||||||
mouseHandler = function(self, button, x, y)
|
mouseHandler = function(self, button, x, y, touch)
|
||||||
if (isOpened) then
|
if (isOpened) then
|
||||||
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
|
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
|
||||||
if(button==1)then
|
if(button==1)then
|
||||||
@@ -135,6 +135,9 @@ return function(name)
|
|||||||
self:setValue(list[n + yOffset])
|
self:setValue(list[n + yOffset])
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
local val = self:getEventSystem():sendEvent("mouse_click", self, "mouse_click", dir, x, y)
|
local val = self:getEventSystem():sendEvent("mouse_click", self, "mouse_click", dir, x, y)
|
||||||
|
if(touch)then
|
||||||
|
self:mouseUpHandler(button, x, y)
|
||||||
|
end
|
||||||
if(val==false)then return val end
|
if(val==false)then return val end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,17 +23,17 @@ return function(name)
|
|||||||
local p = {}
|
local p = {}
|
||||||
for k,v in pairs(colors)do
|
for k,v in pairs(colors)do
|
||||||
if(type(v)=="number")then
|
if(type(v)=="number")then
|
||||||
p[k] = {term.nativePaletteColor(v)}
|
p[v] = {term.nativePaletteColor(v)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(originalImage.palette~=nil)then
|
if(originalImage.palette~=nil)then
|
||||||
for k,v in pairs(originalImage.palette)do
|
for k,v in pairs(originalImage.palette)do
|
||||||
p[k] = tonumber(v)
|
p[2^k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(originalImage[id]~=nil)and(originalImage[id].palette~=nil)then
|
if(originalImage[id]~=nil)and(originalImage[id].palette~=nil)then
|
||||||
for k,v in pairs(originalImage[id].palette)do
|
for k,v in pairs(originalImage[id].palette)do
|
||||||
p[k] = tonumber(v)
|
p[2^k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return p
|
return p
|
||||||
|
|||||||
@@ -706,49 +706,54 @@ return function(name, parent)
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
customEventHandler = function(self, event, ...)
|
||||||
|
base.customEventHandler(self, event, ...)
|
||||||
|
if (curProcess == nil) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if(event=="basalt_resize")then
|
||||||
|
local w, h = pWindow.getSize()
|
||||||
|
local pW, pH = self:getSize()
|
||||||
|
if(w~=pW)or(h~=pH)then
|
||||||
|
pWindow.basalt_resize(pW, pH)
|
||||||
|
if not (curProcess:isDead()) then
|
||||||
|
resumeProcess(self, "term_resize")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
pWindow.basalt_reposition(self:getAnchorPosition())
|
||||||
|
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
eventHandler = function(self, event, p1, p2, p3, p4)
|
eventHandler = function(self, event, p1, p2, p3, p4)
|
||||||
if(base.eventHandler(self, event, p1, p2, p3, p4))then
|
base.eventHandler(self, event, p1, p2, p3, p4)
|
||||||
if (curProcess == nil) then
|
if (curProcess == nil) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if(event=="dynamicValueEvent")then
|
if not (curProcess:isDead()) then
|
||||||
local w, h = pWindow.getSize()
|
if not (paused) then
|
||||||
local pW, pH = self:getSize()
|
if(event ~= "terminate") then
|
||||||
if(w~=pW)or(h~=pH)then
|
resumeProcess(self, event, p1, p2, p3, p4)
|
||||||
pWindow.basalt_resize(pW, pH)
|
|
||||||
if not (curProcess:isDead()) then
|
|
||||||
resumeProcess(self, "term_resize")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
pWindow.basalt_reposition(self:getAnchorPosition())
|
if (self:isFocused()) then
|
||||||
|
local obx, oby = self:getAnchorPosition()
|
||||||
end
|
local xCur, yCur = pWindow.getCursorPos()
|
||||||
if not (curProcess:isDead()) then
|
if (self.parent ~= nil) then
|
||||||
if not (paused) then
|
local w,h = self:getSize()
|
||||||
if(event ~= "terminate") then
|
if (obx + xCur - 1 >= 1 and obx + xCur - 1 <= obx + w - 1 and yCur + oby - 1 >= 1 and yCur + oby - 1 <= oby + h - 1) then
|
||||||
resumeProcess(self, event, p1, p2, p3, p4)
|
self.parent:setCursor(pWindow.getCursorBlink(), obx + xCur - 1, yCur + oby - 1, pWindow.getTextColor())
|
||||||
end
|
|
||||||
if (self:isFocused()) then
|
|
||||||
local obx, oby = self:getAnchorPosition()
|
|
||||||
local xCur, yCur = pWindow.getCursorPos()
|
|
||||||
if (self.parent ~= nil) then
|
|
||||||
local w,h = self:getSize()
|
|
||||||
if (obx + xCur - 1 >= 1 and obx + xCur - 1 <= obx + w - 1 and yCur + oby - 1 >= 1 and yCur + oby - 1 <= oby + h - 1) then
|
|
||||||
self.parent:setCursor(pWindow.getCursorBlink(), obx + xCur - 1, yCur + oby - 1, pWindow.getTextColor())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if (event == "terminate") then
|
|
||||||
resumeProcess(self, event)
|
|
||||||
self.parent:setCursor(false)
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
table.insert(queuedEvent, { event = event, args = { p1, p2, p3, p4 } })
|
if (event == "terminate") then
|
||||||
|
resumeProcess(self, event)
|
||||||
|
self.parent:setCursor(false)
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
table.insert(queuedEvent, { event = event, args = { p1, p2, p3, p4 } })
|
||||||
end
|
end
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ return function(name)
|
|||||||
local objectType = "Textfield"
|
local objectType = "Textfield"
|
||||||
local hIndex, wIndex, textX, textY = 1, 1, 1, 1
|
local hIndex, wIndex, textX, textY = 1, 1, 1, 1
|
||||||
|
|
||||||
local lines = { " " }
|
local lines = { "" }
|
||||||
local bgLines = { "" }
|
local bgLines = { "" }
|
||||||
local fgLines = { "" }
|
local fgLines = { "" }
|
||||||
local keyWords = { }
|
local keyWords = { }
|
||||||
@@ -216,7 +216,7 @@ return function(name)
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
clear = function(self)
|
clear = function(self)
|
||||||
lines = {" "}
|
lines = {""}
|
||||||
bgLines = {""}
|
bgLines = {""}
|
||||||
fgLines = {""}
|
fgLines = {""}
|
||||||
startSelX,endSelX,startSelY,endSelY = nil,nil,nil,nil
|
startSelX,endSelX,startSelY,endSelY = nil,nil,nil,nil
|
||||||
@@ -299,7 +299,7 @@ return function(name)
|
|||||||
table.remove(bgLines, index or #bgLines)
|
table.remove(bgLines, index or #bgLines)
|
||||||
table.remove(fgLines, index or #fgLines)
|
table.remove(fgLines, index or #fgLines)
|
||||||
else
|
else
|
||||||
lines = {" "}
|
lines = {""}
|
||||||
bgLines = {""}
|
bgLines = {""}
|
||||||
fgLines = {""}
|
fgLines = {""}
|
||||||
end
|
end
|
||||||
@@ -666,26 +666,31 @@ return function(name)
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
eventHandler = function(self, event, paste, p2, p3, p4)
|
eventHandler = function(self, event, paste, p2, p3, p4)
|
||||||
if(base.eventHandler(self, event, paste, p2, p3, p4))then
|
base.eventHandler(self, event, paste, p2, p3, p4)
|
||||||
if(event=="paste")then
|
if(event=="paste")then
|
||||||
if(self:isFocused())then
|
if(self:isFocused())then
|
||||||
local w, h = self:getSize()
|
local w, h = self:getSize()
|
||||||
lines[textY] = lines[textY]:sub(1, textX - 1) .. paste .. lines[textY]:sub(textX, lines[textY]:len())
|
lines[textY] = lines[textY]:sub(1, textX - 1) .. paste .. lines[textY]:sub(textX, lines[textY]:len())
|
||||||
fgLines[textY] = fgLines[textY]:sub(1, textX - 1) .. tHex[self.fgColor]:rep(paste:len()) .. fgLines[textY]:sub(textX, fgLines[textY]:len())
|
fgLines[textY] = fgLines[textY]:sub(1, textX - 1) .. tHex[self.fgColor]:rep(paste:len()) .. fgLines[textY]:sub(textX, fgLines[textY]:len())
|
||||||
bgLines[textY] = bgLines[textY]:sub(1, textX - 1) .. tHex[self.bgColor]:rep(paste:len()) .. bgLines[textY]:sub(textX, bgLines[textY]:len())
|
bgLines[textY] = bgLines[textY]:sub(1, textX - 1) .. tHex[self.bgColor]:rep(paste:len()) .. bgLines[textY]:sub(textX, bgLines[textY]:len())
|
||||||
textX = textX + paste:len()
|
textX = textX + paste:len()
|
||||||
if (textX >= w + wIndex) then
|
if (textX >= w + wIndex) then
|
||||||
wIndex = (textX+1)-w
|
wIndex = (textX+1)-w
|
||||||
end
|
|
||||||
local anchx, anchy = self:getAnchorPosition()
|
|
||||||
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
|
|
||||||
updateColors(self)
|
|
||||||
self:updateDraw()
|
|
||||||
end
|
end
|
||||||
|
local anchx, anchy = self:getAnchorPosition()
|
||||||
|
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
|
||||||
|
updateColors(self)
|
||||||
|
self:updateDraw()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
setSelectionColor = function(self, bg, fg)
|
||||||
|
selectionBG = bg or selectionBG
|
||||||
|
selectionFG = fg or selectionFG
|
||||||
|
return self
|
||||||
|
end,
|
||||||
|
|
||||||
draw = function(self)
|
draw = function(self)
|
||||||
if (base.draw(self)) then
|
if (base.draw(self)) then
|
||||||
if (self.parent ~= nil) then
|
if (self.parent ~= nil) then
|
||||||
@@ -714,6 +719,7 @@ return function(name)
|
|||||||
self.parent:setBG(obx, oby + n - 1, bg)
|
self.parent:setBG(obx, oby + n - 1, bg)
|
||||||
self.parent:setFG(obx, oby + n - 1, fg)
|
self.parent:setFG(obx, oby + n - 1, fg)
|
||||||
end
|
end
|
||||||
|
--[[
|
||||||
if(startSelX~=nil)and(endSelX~=nil)and(startSelY~=nil)and(endSelY~=nil)then
|
if(startSelX~=nil)and(endSelX~=nil)and(startSelY~=nil)and(endSelY~=nil)then
|
||||||
local sx,ex,sy,ey = getSelectionCoordinates(self)
|
local sx,ex,sy,ey = getSelectionCoordinates(self)
|
||||||
for n=sy,ey do
|
for n=sy,ey do
|
||||||
@@ -731,7 +737,7 @@ return function(name)
|
|||||||
self.parent:setBG(obx + xOffset, oby + n - 1, rep(tHex[selectionBG], line))
|
self.parent:setBG(obx + xOffset, oby + n - 1, rep(tHex[selectionBG], line))
|
||||||
self.parent:setFG(obx + xOffset, oby + n - 1, rep(tHex[selectionFG], line))
|
self.parent:setFG(obx + xOffset, oby + n - 1, rep(tHex[selectionFG], line))
|
||||||
end
|
end
|
||||||
end
|
end]]
|
||||||
if(self:isFocused())then
|
if(self:isFocused())then
|
||||||
local anchx, anchy = self:getAnchorPosition()
|
local anchx, anchy = self:getAnchorPosition()
|
||||||
--self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
|
--self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# How-To
|
||||||
|
|
||||||
After downloading the project you can finally start creating your own program and use basalt. The first thing you want to use in your program is always:
|
After downloading the project you can finally start creating your own program and use basalt. The first thing you want to use in your program is always:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
@@ -24,7 +26,7 @@ local basalt = require("basalt") --> Load the basalt framework into the variable
|
|||||||
--> Now we want to create a base frame, we call the variable "main" - by default everything you create is visible. (you don't need to use :show())
|
--> Now we want to create a base frame, we call the variable "main" - by default everything you create is visible. (you don't need to use :show())
|
||||||
local main = basalt.createFrame()
|
local main = basalt.createFrame()
|
||||||
|
|
||||||
local button = mainFrame:addButton() --> Here we add our first button
|
local button = main:addButton() --> Here we add our first button
|
||||||
button:setPosition(4, 4) -- of course we want to change the default position of our button
|
button:setPosition(4, 4) -- of course we want to change the default position of our button
|
||||||
button:setSize(16, 3) -- and the default size.
|
button:setSize(16, 3) -- and the default size.
|
||||||
button:setText("Click me!") --> This method displays what the text of our button should look like
|
button:setText("Click me!") --> This method displays what the text of our button should look like
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ function installer.generateWebVersion(file, version)
|
|||||||
if(request~=nil)then
|
if(request~=nil)then
|
||||||
if(fs.exists(file))then
|
if(fs.exists(file))then
|
||||||
fs.delete(file)
|
fs.delete(file)
|
||||||
|
end
|
||||||
local f = fs.open(file, "w")
|
local f = fs.open(file, "w")
|
||||||
local link = "https://basalt.madefor.cc/versions/"..version
|
local link = "https://basalt.madefor.cc/versions/"..version
|
||||||
local content = 'local request = http.get("'..link..'", _G._GIT_API_KEY and {Authorization = "token ".._G._GIT_API_KEY})\n'
|
local content = 'local request = http.get("'..link..'", _G._GIT_API_KEY and {Authorization = "token ".._G._GIT_API_KEY})\n'
|
||||||
@@ -257,7 +258,6 @@ end
|
|||||||
f.write(content)
|
f.write(content)
|
||||||
f.close()
|
f.close()
|
||||||
printStatus("Web version successfully downloaded!")
|
printStatus("Web version successfully downloaded!")
|
||||||
end
|
|
||||||
else
|
else
|
||||||
error("Version doesn't exist!")
|
error("Version doesn't exist!")
|
||||||
end
|
end
|
||||||
@@ -367,7 +367,7 @@ if(#args>0)then
|
|||||||
installer.downloadProject(args[2] or "basalt", args[3] or "master", args[4]~=nil and installer.createIgnoreList(args[4]) or nil)
|
installer.downloadProject(args[2] or "basalt", args[3] or "master", args[4]~=nil and installer.createIgnoreList(args[4]) or nil)
|
||||||
elseif(string.lower(args[1])=="web")then
|
elseif(string.lower(args[1])=="web")then
|
||||||
installer.generateWebVersion(args[3] or "basaltWeb.lua", args[2] or "latest.lua")
|
installer.generateWebVersion(args[3] or "basaltWeb.lua", args[2] or "latest.lua")
|
||||||
elseif(string.lower(args[1])=="file")then
|
elseif(string.lower(args[1])=="file")or(string.lower(args[1])=="release")then
|
||||||
installer.download("https://basalt.madefor.cc/versions/"..args[2] or "latest.lua", args[3] or "basalt.lua")
|
installer.download("https://basalt.madefor.cc/versions/"..args[2] or "latest.lua", args[3] or "basalt.lua")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
## setTheme
|
## setTheme
|
||||||
Sets the default theme of that frame children objects always try to get the theme of its parent frame, if it does not exist it goes to its parent parent frame, and so on until it reaches the basalt managers theme - which is sotred in theme.lua (Please checkout [theme](https://github.com/Pyroxenium/Basalt/blob/master/Basalt/theme.lua) for how it could look like.
|
|
||||||
|
Sets the default theme, of that frame children objects always try to get the theme of its parent frame, if it does not exist it goes to its parent parent frame, and so on until it reaches the basalt manager's theme - which is stored in theme.lua (Please checkout [theme](https://github.com/Pyroxenium/Basalt/blob/master/Basalt/theme.lua) for how it could look like.
|
||||||
|
|
||||||
#### Parameters:
|
#### Parameters:
|
||||||
|
|
||||||
1. `table` theme layout look into [theme](https://github.com/Pyroxenium/Basalt/blob/master/Basalt/theme.lua) for a example
|
1. `table` theme layout look into [theme](https://github.com/Pyroxenium/Basalt/blob/master/Basalt/theme.lua) for a example
|
||||||
|
|
||||||
#### Returns:
|
#### Returns:
|
||||||
|
|
||||||
1. `frame` The frame being used
|
1. `frame` The frame being used
|
||||||
|
|
||||||
#### Usage:
|
#### Usage:
|
||||||
* Creates a new base frame and adds a new theme which only changes the default color of buttons.
|
|
||||||
|
- Creates a new base frame and adds a new theme which only changes the default color of buttons.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local myFrame = basalt.createFrame():setTheme({
|
local myFrame = basalt.createFrame():setTheme({
|
||||||
ButtonBG = colors.yellow,
|
ButtonBG = colors.yellow,
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
The image object is for adding more advanced backgrounds.
|
The image object is for adding more advanced backgrounds to your interface. It supports the loading of .nfp and .bimg images.
|
||||||
It also provides a :shrink() function, where you can shrink the images to smaller ones. This functionallity is fully provided by the blittle library created by Bomb Bloke. I did not ask for permission to add it into the framework. If the creator wants me to remove the blittle part, just text me on discord!
|
|
||||||
|
|
||||||
The image object is still not done. in the future i will provide more image formats.
|
|
||||||
|
|
||||||
[Object](objects/Object.md) methods also apply for images.
|
[Object](objects/Object.md) methods also apply for images.
|
||||||
|
|
||||||
| | |
|
| | |
|
||||||
|---|---|
|
|---|---|
|
||||||
|[loadImage](objects/Image/loadImage.md)|Adds a new object
|
|[loadImage](objects/Image/loadImage.md)|Loads an image from the specified file path
|
||||||
|[shrink](objects/Image/shrink.md)|Sets the top bar text and colors - deprecated
|
|[setImage](objects/Image/setImage.md)|Set's a new image
|
||||||
|
|[usePalette](objects/Image/usePalette.md)|Changes the used palette to the image prefered palette
|
||||||
|
|[play](objects/Image/play.md)|Plays an animated image
|
||||||
|
|[selectFrame](objects/Image/selectFrame.md)|Selects a specific frame in an animated image
|
||||||
|
|[getMetadata](objects/Image/getMetadata.md)|Returns the metadata of the image
|
||||||
|
|[getImageSize](objects/Image/getImageSize.md)|Returns the width and height of the image
|
||||||
|
|[resizeImage](objects/Image/resizeImage.md)|Resizes the image to the specified dimensions
|
||||||
|
|
||||||
|
# About Bimg
|
||||||
|
|
||||||
|
Bimg is a custom image format that can be used in place of .nfp, it is a table which can store multiple frames and metadata. The frames can store text, background and foreground, which makes it possible to create any image you'd like. The image format is made by people from the Minecraft Computercraft Mods - Discord. Here's a Github page which explains how the Bimg format works: [bimg](https://github.com/SkyTheCodeMaster/bimg)
|
||||||
|
|||||||
6
docs/objects/Image/getImageSize.md
Normal file
6
docs/objects/Image/getImageSize.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
## getImageSize
|
||||||
|
Returns the current image size
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
1. `number` width
|
||||||
|
2. `number` height
|
||||||
9
docs/objects/Image/getMetadata.md
Normal file
9
docs/objects/Image/getMetadata.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
## getMetadata
|
||||||
|
Returns the metadata set in the image
|
||||||
|
|
||||||
|
#### Parameter:
|
||||||
|
|
||||||
|
1. `string` the metadata key (for example: title, description, author, creator, data, width, height,...)
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
1. `any` metadata value
|
||||||
@@ -1,18 +1,23 @@
|
|||||||
## loadImage
|
## loadImage
|
||||||
loads a default .nfp file into the object.
|
This method is used to load an image file into the image object.
|
||||||
|
|
||||||
#### Parameters:
|
#### Parameters:
|
||||||
1. `string` the absolute file path
|
|
||||||
|
1. `path` the absolute file path
|
||||||
|
|
||||||
#### Returns:
|
#### Returns:
|
||||||
|
|
||||||
1. `object` The object in use
|
1. `object` The object in use
|
||||||
|
|
||||||
#### Usage:
|
#### Usage:
|
||||||
|
|
||||||
* Creates a default image and loads a test.nfp file
|
* Creates a default image and loads a test.nfp file
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local mainFrame = basalt.createFrame()
|
local mainFrame = basalt.createFrame()
|
||||||
local aImage = mainFrame:addImage():loadImage("test.nfp")
|
local aImage = mainFrame:addImage():loadImage("test.nfp")
|
||||||
```
|
```
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<image path="test.nfp" />
|
<image path="test.nfp" />
|
||||||
```
|
```
|
||||||
10
docs/objects/Image/play.md
Normal file
10
docs/objects/Image/play.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
## play
|
||||||
|
Plays a bimg animation. This can only work if the bimg has more than 1 frame.
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
1. `boolean` If the image animation should play
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
|
||||||
|
1. `object` The object in use
|
||||||
19
docs/objects/Image/resizeImage.md
Normal file
19
docs/objects/Image/resizeImage.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
## resizeImage
|
||||||
|
This method is used to resize a bimg image. It takes two parameters: the new width, and the new height. It is important to note that resizing images can result in a loss of quality, as the original pixel data is being transformed and resampled to fit the new dimensions. This is especially noticeable when increasing the size of an image, as new pixels must be generated to fill in the gaps. As a result, it is generally recommended to use the original image at its full size whenever possible, rather than resizing it.
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
1. `number` the new width
|
||||||
|
2. `number` the new height
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
1. `object` The object in use
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
* Creates a new image object, loads the image and changes it's size.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local mainFrame = basalt.createFrame()
|
||||||
|
local aImage = mainFrame:addImage():loadImage("test.bimg"):resizeImage(40, 20)
|
||||||
|
```
|
||||||
19
docs/objects/Image/selectFrame.md
Normal file
19
docs/objects/Image/selectFrame.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
## selectFrame
|
||||||
|
The selectFrame method allows you to change the current frame of an image object. It takes a single parameter, the index of the frame you want to display.
|
||||||
|
|
||||||
|
#### Parameters:
|
||||||
|
|
||||||
|
1. `number` the frame index
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
|
||||||
|
1. `object` The object in use
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
* Creates a default image and loads a test.nfp file
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local mainFrame = basalt.createFrame()
|
||||||
|
local aImage = mainFrame:addImage():loadImage("test.bimg"):selectFrame(2)
|
||||||
|
```
|
||||||
23
docs/objects/Image/setImage.md
Normal file
23
docs/objects/Image/setImage.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
## setImage
|
||||||
|
Sets a new image
|
||||||
|
|
||||||
|
#### Parameter:
|
||||||
|
|
||||||
|
1. `table` A table in bimg or nfp format.
|
||||||
|
1. `string` The format in which the image should be loaded (nfp or bimg)
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
* Creates a default image and loads a test.nfp file
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local mainFrame = basalt.createFrame()
|
||||||
|
|
||||||
|
local bimg = {
|
||||||
|
[1] = {
|
||||||
|
{"Hello", "fffff", "33333"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local aImage = mainFrame:addImage():setImage(bimg)
|
||||||
|
```
|
||||||
11
docs/objects/Image/usePalette.md
Normal file
11
docs/objects/Image/usePalette.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
## usePalette
|
||||||
|
|
||||||
|
Changes the palette colors of the image, if the bimg image has palette metadata.
|
||||||
|
|
||||||
|
#### Parameter:
|
||||||
|
|
||||||
|
1. `boolean` if the image should change the palette
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
|
||||||
|
1. `object` The object in use
|
||||||
3066
docs/versions/basalt-1.6.4.lua
Normal file
3066
docs/versions/basalt-1.6.4.lua
Normal file
File diff suppressed because one or more lines are too long
3083
docs/versions/basalt.lua
Normal file
3083
docs/versions/basalt.lua
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user