Skip to content

Commit bb3bcfb

Browse files
committed
Merge branch 'master' of https://github.com/Pyroxenium/Basalt
2 parents 8689858 + bdc2415 commit bb3bcfb

26 files changed

+458
-373
lines changed

Basalt/main.lua

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ local getVariable = function(name)
7070
return variables[name]
7171
end
7272

73+
local getObjects = function()
74+
return moddedObjects
75+
end
76+
77+
local getObject = function(id)
78+
return getObjects()[id]
79+
end
80+
81+
local createObject = function(self, objectName, id)
82+
return getObject(objectName)(id, self)
83+
end
84+
7385
local bInstance = {
7486
getDynamicValueEventSetting = function()
7587
return basalt.dynamicValueEvents
@@ -127,14 +139,12 @@ local bInstance = {
127139
stop = stop,
128140
debug = basalt.debug,
129141
log = basalt.log,
142+
143+
getObjects = getObjects,
130144

131-
getObjects = function()
132-
return moddedObjects
133-
end,
145+
getObject = getObject,
134146

135-
getObject = function(id)
136-
return moddedObjects[id]
137-
end,
147+
createObject = createObject,
138148

139149
getDirectory = function()
140150
return projectDirectory

Basalt/objects/BaseFrame.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ return function(name, basalt)
4141
return self
4242
end,
4343

44+
getXOffset = function(self)
45+
return xOffset
46+
end,
47+
48+
setXOffset = function(self, newXOffset)
49+
return self:setOffset(newXOffset, nil)
50+
end,
51+
52+
getYOffset = function(self)
53+
return yOffset
54+
end,
55+
56+
setYOffset = function(self, newYOffset)
57+
return self:setOffset(nil, newYOffset)
58+
end,
59+
4460
setPalette = function(self, col, ...)
4561
if(self==basalt.getActiveFrame())then
4662
if(type(col)=="string")then

Basalt/objects/Button.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,32 @@ return function(name, basalt)
2323

2424
getBase = function(self)
2525
return base
26-
end,
26+
end,
27+
28+
getHorizontalAlign = function(self)
29+
return textHorizontalAlign
30+
end,
2731

2832
setHorizontalAlign = function(self, pos)
2933
textHorizontalAlign = pos
3034
self:updateDraw()
3135
return self
3236
end,
3337

38+
getVerticalAlign = function(self)
39+
return textVerticalAlign
40+
end,
41+
3442
setVerticalAlign = function(self, pos)
3543
textVerticalAlign = pos
3644
self:updateDraw()
3745
return self
3846
end,
3947

48+
getText = function(self)
49+
return text
50+
end,
51+
4052
setText = function(self, newText)
4153
text = newText
4254
self:updateDraw()

Basalt/objects/Checkbox.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,48 @@ return function(name, basalt)
3232
return self
3333
end,
3434

35+
setActiveSymbol = function(self, sym)
36+
return self:setSymbol(sym, nil)
37+
end,
38+
39+
setInactiveSymbol = function(self, inactive)
40+
return self:setSymbol(nil, inactive)
41+
end,
42+
3543
getSymbol = function(self)
3644
return symbol, inactiveSymbol
3745
end,
3846

47+
getActiveSymbol = function(self)
48+
return symbol
49+
end,
50+
51+
getInactiveSymbol = function(self)
52+
return inactiveSymbol
53+
end,
54+
3955
setText = function(self, _text)
4056
text = _text
4157
return self
4258
end,
4359

60+
getText = function(self)
61+
return text
62+
end,
63+
4464
setTextPosition = function(self, pos)
4565
textPos = pos or textPos
4666
return self
4767
end,
4868

69+
getTextPosition = function(self)
70+
return textPos
71+
end,
72+
4973
setChecked = base.setValue,
5074

75+
getChecked = base.getValue,
76+
5177
mouseHandler = function(self, button, x, y)
5278
if (base.mouseHandler(self, button, x, y)) then
5379
if(button == 1)then

Basalt/objects/Container.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,9 @@ return function(name, basalt)
384384
end
385385
end
386386

387-
for k,v in pairs(basalt.getObjects())do
388-
container["add"..k] = function(self, name)
389-
return addObject(self, v(name, basalt))
387+
for objectName, _ in pairs(basalt.getObjects()) do
388+
container["add" .. objectName] = function(self, id)
389+
return addObject(self, basalt:createObject(objectName, id))
390390
end
391391
end
392392

Basalt/objects/Dropdown.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,26 @@ return function(name, basalt)
8383
return self
8484
end,
8585

86+
setDropdownWidth = function(self, width)
87+
return self:setDropdownSize(width, dropdownH)
88+
end,
89+
90+
setDropdownHeight = function(self, height)
91+
return self:setDropdownSize(dropdownW, height)
92+
end,
93+
8694
getDropdownSize = function(self)
8795
return dropdownW, dropdownH
8896
end,
8997

98+
getDropdownWidth = function(self)
99+
return dropdownW
100+
end,
101+
102+
getDropdownHeight = function(self)
103+
return dropdownH
104+
end,
105+
90106
mouseHandler = function(self, button, x, y, isMon)
91107
if (isOpened) then
92108
local obx, oby = self:getAbsolutePosition()

Basalt/objects/Flexbox.lua

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ return function(name, basalt)
7676
return spacing
7777
end,
7878

79+
getFlexDirection = function(self)
80+
return flexDirection
81+
end,
82+
7983
setFlexDirection = function(self, direction)
8084
if direction == "row" or direction == "column" then
8185
flexDirection = direction
@@ -84,6 +88,10 @@ return function(name, basalt)
8488
return self
8589
end,
8690

91+
getJustifyContent = function(self)
92+
return justifyContent
93+
end,
94+
8795
setJustifyContent = function(self, alignment)
8896
if alignment == "flex-start" or alignment == "flex-end" or alignment == "center" or alignment == "space-between" or alignment == "space-around" then
8997
justifyContent = alignment
@@ -92,6 +100,10 @@ return function(name, basalt)
92100
return self
93101
end,
94102

103+
getAlignItems = function(self)
104+
return alignItems
105+
end,
106+
95107
setAlignItems = function(self, alignment)
96108
if alignment == "flex-start" or alignment == "flex-end" or alignment == "center" or alignment == "space-between" or alignment == "space-around" then
97109
alignItems = alignment
@@ -101,9 +113,9 @@ return function(name, basalt)
101113
end,
102114
}
103115

104-
for k,v in pairs(basalt.getObjects())do
105-
object["add"..k] = function(self, name)
106-
local obj = base["add"..k](self, name)
116+
for objectName, _ in pairs(basalt.getObjects()) do
117+
object["add" .. objectName] = function(self, id)
118+
local obj = base["add" .. objectName](self, id)
107119
applyLayout(base)
108120
return obj
109121
end

Basalt/objects/Frame.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ return function(name, basalt)
3838
return self
3939
end,
4040

41+
getXOffset = function(self)
42+
return xOffset
43+
end,
44+
45+
setXOffset = function(self, newXOffset)
46+
return self:setOffset(newXOffset, nil)
47+
end,
48+
49+
getYOffset = function(self)
50+
return yOffset
51+
end,
52+
53+
setYOffset = function(self, newYOffset)
54+
return self:setOffset(nil, newYOffset)
55+
end,
56+
4157
setParent = function(self, p, ...)
4258
base.setParent(self, p, ...)
4359
parent = p

Basalt/objects/Graph.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@ return function(name, basalt)
3232
return self
3333
end,
3434

35+
setGraphSymbolColor = function(self, symbolColor)
36+
return self:setGraphSymbolColor(nil, symbolColor)
37+
end,
38+
3539
getGraphSymbol = function(self)
3640
return graphSymbol, graphSymbolCol
3741
end,
3842

43+
getGraphSymbolColor = function(self)
44+
return graphSymbolCol
45+
end,
46+
3947
addDataPoint = function(self, value)
4048
if value >= minValue and value <= maxValue then
4149
table.insert(graphData, value)
@@ -75,6 +83,10 @@ return function(name, basalt)
7583
return self
7684
end,
7785

86+
getGraphType = function(self)
87+
return graphType
88+
end,
89+
7890
setMaxEntries = function(self, value)
7991
maxEntries = value
8092
self:updateDraw()

Basalt/objects/Image.lua

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ return function(name, basalt)
7373
return self
7474
end,
7575

76+
setXOffset = function(self, _x)
77+
return self:setOffset(self, _x, nil)
78+
end,
79+
80+
setYOffset = function(self, _y)
81+
return self:setOffset(self, nil, _y)
82+
end,
83+
7684
setSize = function(self, _x, _y)
7785
base:setSize(_x, _y)
7886
autoSize = false
@@ -83,6 +91,14 @@ return function(name, basalt)
8391
return xOffset, yOffset
8492
end,
8593

94+
getXOffset = function(self)
95+
return xOffset
96+
end,
97+
98+
getYOffset = function(self)
99+
return yOffset
100+
end,
101+
86102
selectFrame = function(self, id)
87103
if(bimgLibrary.getFrameObject(id)==nil)then
88104
bimgLibrary.addFrame(id)
@@ -142,6 +158,10 @@ return function(name, basalt)
142158
return self
143159
end,
144160

161+
setPath = function(self, path)
162+
return self:loadImage(path)
163+
end,
164+
145165
setImage = function(self, t)
146166
if(type(t)=="table")then
147167
bimgLibrary = bimg(t)
@@ -176,6 +196,14 @@ return function(name, basalt)
176196
return self
177197
end,
178198

199+
getUsePalette = function(self)
200+
return usePalette
201+
end,
202+
203+
setUsePalette = function(self, use)
204+
return self:usePalette(use)
205+
end,
206+
179207
play = function(self, inf)
180208
if(bimgLibrary.getMetadata("animated"))then
181209
local t = bimgLibrary.getMetadata("duration") or bimgLibrary.getMetadata("secondsPerFrame") or 0.2
@@ -186,6 +214,10 @@ return function(name, basalt)
186214
return self
187215
end,
188216

217+
setPlay = function(self, inf)
218+
return self:play(inf)
219+
end,
220+
189221
stop = function(self)
190222
os.cancelTimer(animTimer)
191223
animTimer = nil

0 commit comments

Comments
 (0)