Skip to content

Commit

Permalink
Made port selector checkboxes radio buttons.
Browse files Browse the repository at this point in the history
Print all Lua/LuaJit/Love2d versioning info on startup.
  • Loading branch information
bkacjios committed Apr 8, 2021
1 parent 9c4c7d9 commit f999be8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
11 changes: 8 additions & 3 deletions source/modules/console.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
if jit.os ~= "Windows" then return end

local ffi = require("ffi")
local log = require("log")
local kernel = ffi.load("Kernel32.dll")
local user = ffi.load("User32.dll")

Expand Down Expand Up @@ -163,6 +164,10 @@ function love.console(opened)
end
end

print(string.format("Love2D %d.%d.%d - %s", love.getVersion()))
print(_VERSION)
print(jit.version)
if love.hasConsole() then
love.setConsoleTitle("M'Overlay Console")
love.enableConsoleColors()
end

log.debug(string.format("Love2D %d.%d.%d - %s", love.getVersion()))
log.debug("%s (%s)", _VERSION, jit.version)
7 changes: 6 additions & 1 deletion source/modules/gui/panels/core/checkbox.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function PANEL:Initialize()
self:super()

self:MakeAccessor("Radio", "m_bRadio", false)
self:MakeAccessor("Toggleable", "m_bToggleable", true)
self:MakeAccessor("Toggled", "m_bToggled", false)

Expand All @@ -27,7 +28,11 @@ end

function PANEL:Paint(w, h)
self:super("Paint", w, h)
gui.skinHook("Paint", "Checkbox", self, w, h)
if self.m_bRadio then
gui.skinHook("Paint", "Radio", self, w, h)
else
gui.skinHook("Paint", "Checkbox", self, w, h)
end
end

function PANEL:OnMousePressed(x, y, but)
Expand Down
4 changes: 4 additions & 0 deletions source/modules/gui/panels/core/portselect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,28 @@ function PANEL:Initialize()
self.PORT1:Dock(DOCK_TOP)
self.PORT1:SetToggleable(false)
self.PORT1:SetToggled(true)
self.PORT1:SetRadio(true)

self.PORT2 = self:Add("Checkbox")
self.PORT2:SetText("Port 2")
self.PORT2:DockMargin(1, 1, 1, 1)
self.PORT2:Dock(DOCK_TOP)
self.PORT2:SetToggleable(false)
self.PORT2:SetRadio(true)

self.PORT3 = self:Add("Checkbox")
self.PORT3:SetText("Port 3")
self.PORT3:DockMargin(1, 1, 1, 1)
self.PORT3:Dock(DOCK_TOP)
self.PORT3:SetToggleable(false)
self.PORT3:SetRadio(true)

self.PORT4 = self:Add("Checkbox")
self.PORT4:SetText("Port 4")
self.PORT4:DockMargin(1, 1, 1, 1)
self.PORT4:Dock(DOCK_TOP)
self.PORT4:SetToggleable(false)
self.PORT4:SetRadio(true)

self.PORT1.OnPressed = function()
self:ChangePort(1)
Expand Down
8 changes: 8 additions & 0 deletions source/modules/gui/skins/default.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ function SKIN:PaintCheckbox(panel, w, h)
graphics.rectangle("line", 4, 4, 16, 16)
end

function SKIN:PaintRadio(panel, w, h)
graphics.setColor(self.CheckboxBorder)
graphics.circle("fill", 12, 12, 9, 32)

graphics.setColor(panel:IsToggled() and self.CheckboxOn or self.CheckboxOff)
graphics.circle("fill", 12, 12, 8, 32)
end

function SKIN:InitHorizontalSelect(panel)
panel:SetBGColor(self.PanelBackground)
panel:SetBorderColor(self.PanelBorder)
Expand Down

0 comments on commit f999be8

Please sign in to comment.