sum edits bruh
This commit is contained in:
@@ -72,4 +72,4 @@ If you have any issues or questions about JUI, feel free to contact me on Discor
|
||||
|
||||
|
||||
### Credits:
|
||||
This project utilizes the YACI library. https://github.com/jpatte/yaci.lua
|
||||
This project utilizes the YACI library. https://github.com/jpatte/yaci.lua
|
@@ -23,8 +23,19 @@ function InputForm:init()
|
||||
self.cursor = "|"
|
||||
self.cursorPos = 0
|
||||
self.shift = false
|
||||
self.grabFocusOnReturn = false
|
||||
end
|
||||
|
||||
function InputForm:setGrabFocusOnReturn(val)
|
||||
self.grabFocusOnReturn = val
|
||||
end
|
||||
|
||||
function InputForm:setClearOnReturn(val)
|
||||
self.clearOnReturn = val
|
||||
end
|
||||
|
||||
|
||||
|
||||
function InputForm:reset()
|
||||
self.cursorPos = 0
|
||||
self.time = 0.0
|
||||
@@ -50,9 +61,12 @@ function InputForm:keypressed(key)
|
||||
--print(self.internalText)
|
||||
self.inputEvent:call(self.internalText)
|
||||
self:dropFocus(true)
|
||||
if self.clearOnReturnKey then
|
||||
if self.clearOnReturn then
|
||||
self:reset()
|
||||
end
|
||||
if self.grabFocusOnReturn then
|
||||
self:grabFocus()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,7 +131,7 @@ function InputForm:render()
|
||||
self.super:render()
|
||||
|
||||
|
||||
self:renderChildren()
|
||||
self:renderChildren(dt)
|
||||
end
|
||||
|
||||
return InputForm
|
33
lib/classes/RichTextLabel.lua
Normal file
33
lib/classes/RichTextLabel.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
local UIRect = require("lib.classes.UIRect")
|
||||
|
||||
local RichTextLabel = UIRect:subclass("RichTextLabel")
|
||||
|
||||
function RichTextLabel:init()
|
||||
self.super:init()
|
||||
|
||||
self.font = love.graphics.newFont(12)
|
||||
self.fontFace = nil
|
||||
|
||||
self.textTable = love.graphics.newText()
|
||||
end
|
||||
|
||||
function RichTextLabel:internalRefreshText()
|
||||
|
||||
end
|
||||
|
||||
function RichTextLabel:update(dt)
|
||||
self.super:update(dt)
|
||||
|
||||
|
||||
self:renderChildren()
|
||||
end
|
||||
|
||||
function RichTextLabel:render()
|
||||
self.super:render()
|
||||
|
||||
|
||||
self:renderChildren()
|
||||
end
|
||||
|
||||
|
||||
return RichTextLabel
|
@@ -1,7 +1,7 @@
|
||||
local newclass = require("lib.YACI")
|
||||
local Dimension = require("lib.datatypes.Dimension")
|
||||
local Vector2D = require("lib.datatypes.Vector2D")
|
||||
|
||||
local Event = require("lib.classes.Event")
|
||||
--[[
|
||||
UIBase class
|
||||
|
||||
@@ -47,7 +47,9 @@ function UIBase:init()
|
||||
self.children = {}
|
||||
self.parent = nil
|
||||
self.textInput = false
|
||||
self.baseReturnFont = love.graphics.newFont(12)
|
||||
self.baseReturnFont = love.graphics.newFont(12)
|
||||
|
||||
self.onupdate = Event:new()
|
||||
end
|
||||
|
||||
function UIBase:keypressPass(key)
|
||||
@@ -91,7 +93,8 @@ function UIBase:render()
|
||||
end
|
||||
|
||||
function UIBase:update(delta)
|
||||
self:updateChildren(delta)
|
||||
self:updateChildren(delta)
|
||||
self.onupdate:call(delta)
|
||||
end
|
||||
|
||||
function UIBase:getName()
|
||||
@@ -99,7 +102,7 @@ function UIBase:getName()
|
||||
end
|
||||
|
||||
function UIBase:setName(name)
|
||||
self.name = name
|
||||
self.name = name
|
||||
end
|
||||
|
||||
function UIBase:getChild(name)
|
||||
@@ -142,7 +145,7 @@ function UIBase:getParent()
|
||||
end
|
||||
|
||||
function UIBase:setParent(instance)
|
||||
self.parent = instance
|
||||
self.parent = instance
|
||||
end
|
||||
|
||||
return UIBase
|
@@ -5,7 +5,7 @@ local UIButton = Label:subclass("UIButton")
|
||||
|
||||
function UIButton:init()
|
||||
self.super:init()
|
||||
self.mouseDown = true
|
||||
self.mouseDown = false
|
||||
self.buttonActivationAnimation = ""
|
||||
self.buttonDeactivationAnimation = ""
|
||||
|
||||
|
@@ -58,7 +58,8 @@ function UIRect:init()
|
||||
|
||||
-- events
|
||||
self.mouseEnter = Event:new()
|
||||
self.mouseExit = Event:new()
|
||||
self.mouseExit = Event:new()
|
||||
|
||||
end
|
||||
|
||||
function UIRect:getBackgroundColor()
|
||||
@@ -66,7 +67,8 @@ function UIRect:getBackgroundColor()
|
||||
end
|
||||
|
||||
function UIRect:setBackgroundColor(color)
|
||||
self.backgroundColor = color
|
||||
self.backgroundColor = color
|
||||
|
||||
end
|
||||
|
||||
function UIRect:getBorderColor()
|
||||
@@ -78,11 +80,13 @@ function UIRect:getBorderWidth()
|
||||
end
|
||||
|
||||
function UIRect:setBorderWidth(width)
|
||||
self.borderWidth = width
|
||||
self.borderWidth = width
|
||||
|
||||
end
|
||||
|
||||
function UIRect:setBorderColor(color)
|
||||
self.borderColor = color
|
||||
self.borderColor = color
|
||||
|
||||
end
|
||||
|
||||
function UIRect:getCornerRounding()
|
||||
@@ -94,15 +98,18 @@ function UIRect:isMouseInside()
|
||||
end
|
||||
|
||||
function UIRect:setCornerRounding(rounding)
|
||||
self.cornerRounding = rounding
|
||||
self.cornerRounding = rounding
|
||||
|
||||
end
|
||||
|
||||
function UIRect:setPosition(newPosition)
|
||||
self.position = newPosition
|
||||
self.position = newPosition
|
||||
|
||||
end
|
||||
|
||||
function UIRect:setSize(newSize)
|
||||
self.size = newSize
|
||||
self.size = newSize
|
||||
|
||||
end
|
||||
|
||||
function UIRect:getPosition()
|
||||
@@ -163,8 +170,8 @@ function UIRect:getAbsoluteSize()
|
||||
local parentAbsSize = parent:getAbsoluteSize()
|
||||
local parentAbsPos = parent:getAbsolutePosition()
|
||||
|
||||
local absoluteSizeX = size.x.pixel + parentAbsSize.x * size.x.scale
|
||||
local absoluteSizeY = size.y.pixel + parentAbsSize.y * size.y.scale
|
||||
local absoluteSizeX = size.x.pixel + (parentAbsSize.x * size.x.scale)
|
||||
local absoluteSizeY = size.y.pixel + (parentAbsSize.y * size.y.scale)
|
||||
|
||||
--return Vector2D:new(absoluteSizeX, absoluteSizeY)
|
||||
return {x = absoluteSizeX, y = absoluteSizeY}
|
||||
@@ -179,8 +186,8 @@ function UIRect:getAbsolutePosition()
|
||||
local parentAbsSize = parent:getAbsoluteSize()
|
||||
local parentAbsPos = parent:getAbsolutePosition()
|
||||
|
||||
local absolutePosX = parentAbsPos.x + pos.x.pixel + parentAbsSize.x * pos.x.scale
|
||||
local absolutePosY = parentAbsPos.y + pos.y.pixel + parentAbsSize.y * pos.y.scale
|
||||
local absolutePosX = parentAbsPos.x + pos.x.pixel + (parentAbsSize.x * pos.x.scale)
|
||||
local absolutePosY = parentAbsPos.y + pos.y.pixel + (parentAbsSize.y * pos.y.scale)
|
||||
|
||||
--return Vector2D:new(absolutePosX, absolutePosY)
|
||||
return {x = absolutePosX, y = absolutePosY}
|
||||
|
Reference in New Issue
Block a user