core/menusystem: port everything to new widget var names
This commit is contained in:
parent
9d413db186
commit
05c8691c56
4 changed files with 94 additions and 94 deletions
|
@ -17,7 +17,7 @@ function FlowBox:new(x,y,w,h,slots_hor,slots_vert)
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:update(dt)
|
function FlowBox:update(dt)
|
||||||
local col, line = self:getCoord(self.selected)
|
local col, line = self:getCoord(self.widget.selected)
|
||||||
local begincol, beginline = self:getCoord(self.begin)
|
local begincol, beginline = self:getCoord(self.begin)
|
||||||
|
|
||||||
if line < beginline then
|
if line < beginline then
|
||||||
|
@ -44,8 +44,8 @@ function FlowBox:getCoord(id_selected)
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:moveCursor(new_col, new_line)
|
function FlowBox:moveCursor(new_col, new_line)
|
||||||
local col, line = self:getCoord(self.selected)
|
local col, line = self:getCoord(self.widget.selected)
|
||||||
local lastcol, lastline = self:getCoord(#self.listWidget)
|
local lastcol, lastline = self:getCoord(#self.widget.list)
|
||||||
|
|
||||||
|
|
||||||
if new_line < 0 then
|
if new_line < 0 then
|
||||||
|
@ -78,11 +78,11 @@ function FlowBox:moveCursor(new_col, new_line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.selected = (new_line * self.slots_hor) + new_col + 1
|
self.widget.selected = (new_line * self.slots_hor) + new_col + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:keyreleased(key, code)
|
function FlowBox:keyreleased(key, code)
|
||||||
local col, line = self:getCoord(self.selected)
|
local col, line = self:getCoord(self.widget.selected)
|
||||||
if key == 'left' then
|
if key == 'left' then
|
||||||
self:moveCursor(col - 1, line)
|
self:moveCursor(col - 1, line)
|
||||||
end
|
end
|
||||||
|
@ -100,55 +100,55 @@ function FlowBox:keyreleased(key, code)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == "A" then
|
if key == "A" then
|
||||||
self.listWidget[self.selected]:action()
|
self.widget.list[self.widget.selected]:action()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:mousemoved(x, y)
|
function FlowBox:mousemoved(x, y)
|
||||||
local col, line = self:getCoord(self.selected)
|
local col, line = self:getCoord(self.widget.selected)
|
||||||
local begincol, beginline = self:getCoord(self.begin)
|
local begincol, beginline = self:getCoord(self.begin)
|
||||||
local newcol, newline
|
local newcol, newline
|
||||||
|
|
||||||
newline = beginline + math.floor(y / self.widgetsH)
|
newline = beginline + math.floor(y / self.widgetsH)
|
||||||
newcol = math.floor(x / self.widgetsW)
|
newcol = math.floor(x / self.widgetsW)
|
||||||
self.selected = (newline * self.slots_hor) + newcol + 1
|
self.widget.selected = (newline * self.slots_hor) + newcol + 1
|
||||||
|
|
||||||
if self.selected < 1 then
|
if self.widget.selected < 1 then
|
||||||
self.selected = 1
|
self.widget.selected = 1
|
||||||
end
|
end
|
||||||
if self.selected > #self.listWidget then
|
if self.widget.selected > #self.widget.list then
|
||||||
self.selected = #self.listWidget
|
self.widget.selected = #self.widget.list
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:mousepressed(x, y, button, isTouch)
|
function FlowBox:mousepressed(x, y, button, isTouch)
|
||||||
local col, line = self:getCoord(self.selected)
|
local col, line = self:getCoord(self.widget.selected)
|
||||||
local begincol, beginline = self:getCoord(self.begin)
|
local begincol, beginline = self:getCoord(self.begin)
|
||||||
local newline, newcol
|
local newline, newcol
|
||||||
|
|
||||||
newline = beginline + math.floor(y / self.widgetsH)
|
newline = beginline + math.floor(y / self.widgetsH)
|
||||||
newcol = math.floor(x / self.widgetsW)
|
newcol = math.floor(x / self.widgetsW)
|
||||||
self.selected = (newline * self.slots_hor) + newcol + 1
|
self.widget.selected = (newline * self.slots_hor) + newcol + 1
|
||||||
|
|
||||||
if self.selected < 1 then
|
if self.widget.selected < 1 then
|
||||||
self.selected = 1
|
self.widget.selected = 1
|
||||||
end
|
end
|
||||||
if self.selected > #self.listWidget then
|
if self.widget.selected > #self.widget.list then
|
||||||
self.selected = #self.listWidget
|
self.widget.selected = #self.widget.list
|
||||||
end
|
end
|
||||||
|
|
||||||
if #self.listWidget > 0 then
|
if #self.widget.list > 0 then
|
||||||
self.listWidget[self.selected]:action()
|
self.widget.list[self.widget.selected]:action()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:draw()
|
function FlowBox:draw()
|
||||||
local widgety = self.y
|
local widgety = self.y
|
||||||
local widgetx = self.x
|
local widgetx = self.x
|
||||||
for i,v in ipairs(self.listWidget) do
|
for i,v in ipairs(self.widget.list) do
|
||||||
if (i >= self.begin) and (i < self.begin + self.slots) then
|
if (i >= self.begin) and (i < self.begin + self.slots) then
|
||||||
v:draw(widgetx, widgety, self.widgetsW, self.widgetsH)
|
v:draw(widgetx, widgety, self.widgetsW, self.widgetsH)
|
||||||
if self.selected == i and self.focus == true then
|
if self.widget.selected == i and self.focus == true then
|
||||||
v:drawSelected(widgetx, widgety, self.widgetsW, self.widgetsH)
|
v:drawSelected(widgetx, widgety, self.widgetsW, self.widgetsH)
|
||||||
else
|
else
|
||||||
v:draw(widgetx, widgety, self.widgetsW, self.widgetsH)
|
v:draw(widgetx, widgety, self.widgetsW, self.widgetsH)
|
||||||
|
|
|
@ -37,14 +37,14 @@ function GridBox:update(dt)
|
||||||
if self.listSlot[slotID].isSlave > 0 then
|
if self.listSlot[slotID].isSlave > 0 then
|
||||||
slotID = self.listSlot[slotID].isSlave
|
slotID = self.listSlot[slotID].isSlave
|
||||||
end
|
end
|
||||||
self.selected = self.listSlot[slotID].widgetID
|
self.widget.selected = self.listSlot[slotID].widgetID
|
||||||
self.cursor.x, self.cursor.y = self:getCoord(slotID)
|
self.cursor.x, self.cursor.y = self:getCoord(slotID)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GridBox:regenSlots()
|
function GridBox:regenSlots()
|
||||||
local widgetID = 1
|
local widgetID = 1
|
||||||
for i,v in ipairs(self.listSlot) do
|
for i,v in ipairs(self.listSlot) do
|
||||||
if v.isSlave == 0 and (widgetID <= #self.listWidget) then
|
if v.isSlave == 0 and (widgetID <= #self.widget.list) then
|
||||||
self.listSlot[i].widgetID = widgetID
|
self.listSlot[i].widgetID = widgetID
|
||||||
widgetID = widgetID + 1
|
widgetID = widgetID + 1
|
||||||
end
|
end
|
||||||
|
@ -118,8 +118,8 @@ function GridBox:moveCursor(newcol, newline)
|
||||||
previousSlot = self:getSlotbyCoord(col, line)
|
previousSlot = self:getSlotbyCoord(col, line)
|
||||||
newSlot = self:getSlotbyCoord(self.cursor.x, self.cursor.y)
|
newSlot = self:getSlotbyCoord(self.cursor.x, self.cursor.y)
|
||||||
|
|
||||||
if (self.listSlot[newSlot].isSlave > 0) or (self.listSlot[newSlot].widgetID > #self.listWidget) then
|
if (self.listSlot[newSlot].isSlave > 0) or (self.listSlot[newSlot].widgetID > #self.widget.list) then
|
||||||
if (self.listSlot[newSlot].isSlave == previousSlot) or (self.listSlot[newSlot].widgetID > #self.listWidget) then
|
if (self.listSlot[newSlot].isSlave == previousSlot) or (self.listSlot[newSlot].widgetID > #self.widget.list) then
|
||||||
self:moveCursor(self.cursor.x + relcol, self.cursor.y + relline)
|
self:moveCursor(self.cursor.x + relcol, self.cursor.y + relline)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -127,7 +127,7 @@ function GridBox:moveCursor(newcol, newline)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GridBox:keyreleased(key, code)
|
function GridBox:keyreleased(key, code)
|
||||||
slotID = self:getSlot(self.selected)
|
slotID = self:getSlot(self.widget.selected)
|
||||||
local col, line = self.cursor.x, self.cursor.y
|
local col, line = self.cursor.x, self.cursor.y
|
||||||
if key == 'left' then
|
if key == 'left' then
|
||||||
--self:moveCol(-1)
|
--self:moveCol(-1)
|
||||||
|
@ -147,13 +147,13 @@ function GridBox:keyreleased(key, code)
|
||||||
self:moveCursor(col, line + 1)
|
self:moveCursor(col, line + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == "A" and self.selected <= #self.listWidget then
|
if key == "A" and self.widget.selected <= #self.widget.list then
|
||||||
self.listWidget[self.selected]:action()
|
self.widget.list[self.widget.selected]:action()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GridBox:mousemoved(x, y)
|
function GridBox:mousemoved(x, y)
|
||||||
local col, line = self:getCoord(self.selected)
|
local col, line = self:getCoord(self.widget.selected)
|
||||||
local begincol, beginline = self:getCoord(self.begin)
|
local begincol, beginline = self:getCoord(self.begin)
|
||||||
local newcol, newline
|
local newcol, newline
|
||||||
local newselect, slotID
|
local newselect, slotID
|
||||||
|
@ -163,17 +163,17 @@ function GridBox:mousemoved(x, y)
|
||||||
self.cursor.x = newcol
|
self.cursor.x = newcol
|
||||||
self.cursor.y = newline
|
self.cursor.y = newline
|
||||||
|
|
||||||
if self.selected < 1 then
|
if self.widget.selected < 1 then
|
||||||
self.selected = 1
|
self.widget.selected = 1
|
||||||
end
|
end
|
||||||
if self.selected > #self.listWidget then
|
if self.widget.selected > #self.widget.list then
|
||||||
self.selected = #self.listWidget
|
self.widget.selected = #self.widget.list
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function GridBox:mousepressed(x, y, button, isTouch)
|
function GridBox:mousepressed(x, y, button, isTouch)
|
||||||
local col, line = self:getCoord(self.selected)
|
local col, line = self:getCoord(self.widget.selected)
|
||||||
local begincol, beginline = self:getCoord(self.begin)
|
local begincol, beginline = self:getCoord(self.begin)
|
||||||
local newcol, newline
|
local newcol, newline
|
||||||
local newselect, slotID
|
local newselect, slotID
|
||||||
|
@ -188,10 +188,10 @@ function GridBox:mousepressed(x, y, button, isTouch)
|
||||||
slotID = newselect
|
slotID = newselect
|
||||||
end
|
end
|
||||||
|
|
||||||
self.selected = self.listSlot[slotID].widgetID
|
self.widget.selected = self.listSlot[slotID].widgetID
|
||||||
|
|
||||||
if #self.listWidget > 0 and self.selected > 1 and self.selected <= #self.listWidget then
|
if #self.widget.list > 0 and self.widget.selected > 1 and self.widget.selected <= #self.widget.list then
|
||||||
self.listWidget[self.selected]:action()
|
self.widget.list[self.widget.selected]:action()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -201,12 +201,12 @@ function GridBox:draw()
|
||||||
|
|
||||||
self:regenSlots() -- On reget les slots au cas où :p
|
self:regenSlots() -- On reget les slots au cas où :p
|
||||||
for i,v in ipairs(self.listSlot) do
|
for i,v in ipairs(self.listSlot) do
|
||||||
if (v.isSlave == 0) and (v.widgetID <= #self.listWidget) then
|
if (v.isSlave == 0) and (v.widgetID <= #self.widget.list) then
|
||||||
--self.listWidget[v.widgetID]:draw(widgetx, widgety, self.widgetsW * v.sizeW, self.widgetsH * v.sizeH)
|
--self.widget.list[v.widgetID]:draw(widgetx, widgety, self.widgetsW * v.sizeW, self.widgetsH * v.sizeH)
|
||||||
if self.selected == v.widgetID and self.focus == true then
|
if self.widget.selected == v.widgetID and self.focus == true then
|
||||||
self.listWidget[v.widgetID]:drawSelected(widgetx, widgety, self.widgetsW * v.sizeW, self.widgetsH * v.sizeH)
|
self.widget.list[v.widgetID]:drawSelected(widgetx, widgety, self.widgetsW * v.sizeW, self.widgetsH * v.sizeH)
|
||||||
else
|
else
|
||||||
self.listWidget[v.widgetID]:draw(widgetx, widgety, self.widgetsW * v.sizeW, self.widgetsH * v.sizeH)
|
self.widget.list[v.widgetID]:draw(widgetx, widgety, self.widgetsW * v.sizeW, self.widgetsH * v.sizeH)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (v.isSlave > 0) and false then
|
if (v.isSlave > 0) and false then
|
||||||
|
|
|
@ -13,11 +13,11 @@ function ListBox:new(x,y,w,h,slots)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ListBox:update(dt)
|
function ListBox:update(dt)
|
||||||
if self.selected < self.begin then
|
if self.widget.selected < self.begin then
|
||||||
self.begin = self.selected
|
self.begin = self.widget.selected
|
||||||
end
|
end
|
||||||
if self.selected > self.begin + self.slots - 1 then
|
if self.widget.selected > self.begin + self.slots - 1 then
|
||||||
self.begin = self.selected - self.slots + 1
|
self.begin = self.widget.selected - self.slots + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.begin < 1 then
|
if self.begin < 1 then
|
||||||
|
@ -28,48 +28,48 @@ end
|
||||||
function ListBox:keyreleased(key, code)
|
function ListBox:keyreleased(key, code)
|
||||||
|
|
||||||
if key == 'up' then
|
if key == 'up' then
|
||||||
self:moveCursor(self.selected - 1)
|
self:moveCursor(self.widget.selected - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == 'down' then
|
if key == 'down' then
|
||||||
self:moveCursor(self.selected + 1)
|
self:moveCursor(self.widget.selected + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == "A" then
|
if key == "A" then
|
||||||
self.listWidget[self.selected]:action()
|
self.widget.list[self.widget.selected]:action()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ListBox:mousemoved(x, y)
|
function ListBox:mousemoved(x, y)
|
||||||
self.selected = self.begin + math.floor(y / self.widgetsH)
|
self.widget.selected = self.begin + math.floor(y / self.widgetsH)
|
||||||
if self.selected < 1 then
|
if self.widget.selected < 1 then
|
||||||
self.selected = 1
|
self.widget.selected = 1
|
||||||
end
|
end
|
||||||
if self.selected > #self.listWidget then
|
if self.widget.selected > #self.widget.list then
|
||||||
self.selected = #self.listWidget
|
self.widget.selected = #self.widget.list
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ListBox:mousepressed(x, y, button, isTouch)
|
function ListBox:mousepressed(x, y, button, isTouch)
|
||||||
self.selected = self.begin + math.floor(y / self.widgetsH)
|
self.widget.selected = self.begin + math.floor(y / self.widgetsH)
|
||||||
if self.selected < 1 then
|
if self.widget.selected < 1 then
|
||||||
self.selected = 1
|
self.widget.selected = 1
|
||||||
end
|
end
|
||||||
if self.selected > #self.listWidget then
|
if self.widget.selected > #self.widget.list then
|
||||||
self.selected = #self.listWidget
|
self.widget.selected = #self.widget.list
|
||||||
end
|
end
|
||||||
if #self.listWidget > 0 then
|
if #self.widget.list > 0 then
|
||||||
self.listWidget[self.selected]:action()
|
self.widget.list[self.widget.selected]:action()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ListBox:draw()
|
function ListBox:draw()
|
||||||
local widgety = self.y
|
local widgety = self.y
|
||||||
for i,v in ipairs(self.listWidget) do
|
for i,v in ipairs(self.widget.list) do
|
||||||
if (i >= self.begin) and (i < self.begin + self.slots) then
|
if (i >= self.begin) and (i < self.begin + self.slots) then
|
||||||
v:draw(self.x, widgety, self.w, self.widgetsH)
|
v:draw(self.x, widgety, self.w, self.widgetsH)
|
||||||
if self.selected == i and self.focus == true then
|
if self.widget.selected == i and self.focus == true then
|
||||||
v:drawSelected(self.x, widgety, self.w, self.widgetsH)
|
v:drawSelected(self.x, widgety, self.w, self.widgetsH)
|
||||||
else
|
else
|
||||||
v:draw(self.x, widgety, self.w, self.widgetsH)
|
v:draw(self.x, widgety, self.w, self.widgetsH)
|
||||||
|
|
|
@ -43,12 +43,12 @@ end
|
||||||
|
|
||||||
function TextMenu:update(dt)
|
function TextMenu:update(dt)
|
||||||
self:getBoundingBox()
|
self:getBoundingBox()
|
||||||
if self.selected ~= 0 then
|
if self.widget.selected ~= 0 then
|
||||||
if self.selected < self.begin then
|
if self.widget.selected < self.begin then
|
||||||
self.begin = self.selected
|
self.begin = self.widget.selected
|
||||||
end
|
end
|
||||||
if self.selected > self.begin + self.slots - 1 then
|
if self.widget.selected > self.begin + self.slots - 1 then
|
||||||
self.begin = self.selected - self.slots + 1
|
self.begin = self.widget.selected - self.slots + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ end
|
||||||
function TextMenu:setWidthAuto()
|
function TextMenu:setWidthAuto()
|
||||||
local width = self.w
|
local width = self.w
|
||||||
|
|
||||||
for i,v in ipairs(self.listWidget) do
|
for i,v in ipairs(self.widget.list) do
|
||||||
local stringWidth = self.font:getWidth(v.beginlabel .. v.label .. v.endlabel)
|
local stringWidth = self.font:getWidth(v.beginlabel .. v.label .. v.endlabel)
|
||||||
width = math.max(stringWidth, width)
|
width = math.max(stringWidth, width)
|
||||||
end
|
end
|
||||||
|
@ -82,16 +82,16 @@ end
|
||||||
function TextMenu:keyreleased(key, code)
|
function TextMenu:keyreleased(key, code)
|
||||||
|
|
||||||
if key == 'up' then
|
if key == 'up' then
|
||||||
self:moveCursor(self.selected - 1)
|
self:moveCursor(self.widget.selected - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == 'down' then
|
if key == 'down' then
|
||||||
self:moveCursor(self.selected + 1)
|
self:moveCursor(self.widget.selected + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == "A" then
|
if key == "A" then
|
||||||
if (self.selected > 0) and (self.selected <= #self.listWidget) then
|
if (self.widget.selected > 0) and (self.widget.selected <= #self.widget.list) then
|
||||||
self.listWidget[self.selected]:action()
|
self.widget.list[self.widget.selected]:action()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,33 +102,33 @@ function TextMenu:keyreleased(key, code)
|
||||||
end
|
end
|
||||||
|
|
||||||
function TextMenu:mousemoved(x, y)
|
function TextMenu:mousemoved(x, y)
|
||||||
local selectedPrevous = self.selected
|
local selectedPrevous = self.widget.selected
|
||||||
self.selected = self.begin + math.floor(y / self.widgetsH)
|
self.widget.selected = self.begin + math.floor(y / self.widgetsH)
|
||||||
if self.selected < 1 then
|
if self.widget.selected < 1 then
|
||||||
self.selected = 1
|
self.widget.selected = 1
|
||||||
end
|
end
|
||||||
if self.selected > #self.listWidget then
|
if self.widget.selected > #self.widget.list then
|
||||||
self.selected = #self.listWidget
|
self.widget.selected = #self.widget.list
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.selected ~= selectedPrevious then
|
if self.widget.selected ~= selectedPrevious then
|
||||||
self.canvas.needRedraw = true
|
self.canvas.needRedraw = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TextMenu:mousepressed(x, y, button, isTouch)
|
function TextMenu:mousepressed(x, y, button, isTouch)
|
||||||
self.selected = self.begin + math.floor(y / self.widgetsH)
|
self.widget.selected = self.begin + math.floor(y / self.widgetsH)
|
||||||
if self.selected < 1 then
|
if self.widget.selected < 1 then
|
||||||
self.selected = 1
|
self.widget.selected = 1
|
||||||
end
|
end
|
||||||
if self.selected > #self.listWidget then
|
if self.widget.selected > #self.widget.list then
|
||||||
self.selected = #self.listWidget
|
self.widget.selected = #self.widget.list
|
||||||
end
|
end
|
||||||
if #self.listWidget > 0 then
|
if #self.widget.list > 0 then
|
||||||
self.listWidget[self.selected]:action()
|
self.widget.list[self.widget.selected]:action()
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.selected ~= selectedPrevious then
|
if self.widget.selected ~= selectedPrevious then
|
||||||
self.canvas.needRedraw = true
|
self.canvas.needRedraw = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -146,7 +146,7 @@ function TextMenu:drawCanvas()
|
||||||
local x = 0
|
local x = 0
|
||||||
|
|
||||||
self.font:set()
|
self.font:set()
|
||||||
for i, v in ipairs(self.listWidget) do
|
for i, v in ipairs(self.widget.list) do
|
||||||
if (i >= self.begin) and (i < self.begin + self.slots) then
|
if (i >= self.begin) and (i < self.begin + self.slots) then
|
||||||
self:drawWidget(i, widgety)
|
self:drawWidget(i, widgety)
|
||||||
|
|
||||||
|
@ -159,14 +159,14 @@ function TextMenu:drawCanvas()
|
||||||
end
|
end
|
||||||
|
|
||||||
function TextMenu:drawWidget(widgetID, y)
|
function TextMenu:drawWidget(widgetID, y)
|
||||||
local widget = self.listWidget[widgetID]
|
local widget = self.widget.list[widgetID]
|
||||||
print(widget)
|
print(widget)
|
||||||
if widget.canvas.needRedraw == true then
|
if widget.canvas.needRedraw == true then
|
||||||
self:drawWidgetCanvas(widget)
|
self:drawWidgetCanvas(widget)
|
||||||
widget.canvas.needRedraw = false
|
widget.canvas.needRedraw = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.selected == widgetID and self.focus == true then
|
if self.widget.selected == widgetID and self.focus == true then
|
||||||
love.graphics.setColor(1, 1, 0, 1)
|
love.graphics.setColor(1, 1, 0, 1)
|
||||||
else
|
else
|
||||||
love.graphics.setColor(1, 1, 1, 1)
|
love.graphics.setColor(1, 1, 1, 1)
|
||||||
|
@ -194,7 +194,7 @@ end
|
||||||
|
|
||||||
function Menu:moveView(begin, absolute)
|
function Menu:moveView(begin, absolute)
|
||||||
--local absolute = absolute or true
|
--local absolute = absolute or true
|
||||||
self.selected = 0
|
self.widget.selected = 0
|
||||||
|
|
||||||
if (absolute) then
|
if (absolute) then
|
||||||
self.begin = begin
|
self.begin = begin
|
||||||
|
@ -215,7 +215,7 @@ function Menu:isViewAtBeggining()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Menu:isViewAtEnd()
|
function Menu:isViewAtEnd()
|
||||||
return ((self.begin + self.slots) > (#self.listWidget))
|
return ((self.begin + self.slots) > (#self.widget.list))
|
||||||
end
|
end
|
||||||
|
|
||||||
return TextMenu
|
return TextMenu
|
||||||
|
|
Loading…
Reference in a new issue