Compare commits
No commits in common. "testing" and "main" have entirely different histories.
BIN
durrrrrrrrrr.png
BIN
durrrrrrrrrr.png
Binary file not shown.
|
Before Width: | Height: | Size: 761 B |
@ -12,20 +12,6 @@ ui.theme = {
|
|||||||
active = {0.20, 0.40, 0.75},
|
active = {0.20, 0.40, 0.75},
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.theme2 = {
|
|
||||||
bg = {0.5, 0, 0},
|
|
||||||
panel = {0.25, 0, 0},
|
|
||||||
border = {1, 0, 0},
|
|
||||||
borderwidth = 3,
|
|
||||||
text = {0, 0, 1},
|
|
||||||
text_dim = {1, 0, 0},
|
|
||||||
accent = {0.7, 0, 0},
|
|
||||||
hover = {1, 0, 0},
|
|
||||||
active = {1, 0, 0},
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.activeTheme = ui.theme
|
|
||||||
|
|
||||||
-- per-frame state (most/all gets reset if i remember)
|
-- per-frame state (most/all gets reset if i remember)
|
||||||
ui._wasDown = false
|
ui._wasDown = false
|
||||||
ui._focused = nil
|
ui._focused = nil
|
||||||
@ -37,10 +23,10 @@ ui._hoverConsumed = false -- so it sets hovered to the correct thing
|
|||||||
|
|
||||||
-- draws a basic bordered panel
|
-- draws a basic bordered panel
|
||||||
function ui._draw_panel(e)
|
function ui._draw_panel(e)
|
||||||
love.graphics.setColor(ui.activeTheme.panel)
|
love.graphics.setColor(ui.theme.panel)
|
||||||
love.graphics.rectangle("fill", e.x, e.y, e.w, e.h)
|
love.graphics.rectangle("fill", e.x, e.y, e.w, e.h)
|
||||||
love.graphics.setColor(ui.activeTheme.border)
|
love.graphics.setColor(ui.theme.border)
|
||||||
love.graphics.setLineWidth(ui.activeTheme.borderwidth)
|
love.graphics.setLineWidth(ui.theme.borderwidth)
|
||||||
love.graphics.rectangle("line", e.x, e.y, e.w, e.h)
|
love.graphics.rectangle("line", e.x, e.y, e.w, e.h)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -52,7 +38,7 @@ function ui._draw_text(e)
|
|||||||
local startY = e.y + (e.h - totalHeight) / 2
|
local startY = e.y + (e.h - totalHeight) / 2
|
||||||
|
|
||||||
love.graphics.setScissor(e.x, e.y, e.w, e.h) -- clip to box bounds
|
love.graphics.setScissor(e.x, e.y, e.w, e.h) -- clip to box bounds
|
||||||
love.graphics.setColor(ui.activeTheme.text)
|
love.graphics.setColor(ui.theme.text)
|
||||||
love.graphics.printf(e.text, e.x, startY, e.w, "center")
|
love.graphics.printf(e.text, e.x, startY, e.w, "center")
|
||||||
love.graphics.setScissor() -- reset clip
|
love.graphics.setScissor() -- reset clip
|
||||||
end
|
end
|
||||||
@ -62,10 +48,10 @@ function ui._draw_button(e)
|
|||||||
local mx, my = love.mouse.getPosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
local hovered = not ui._hoverConsumed and mx > e.x and mx < e.x + e.w and my > e.y and my < e.y + e.h
|
local hovered = not ui._hoverConsumed and mx > e.x and mx < e.x + e.w and my > e.y and my < e.y + e.h
|
||||||
|
|
||||||
love.graphics.setColor(e._hovered and ui.activeTheme.hover or ui.activeTheme.panel)
|
love.graphics.setColor(e._hovered and ui.theme.hover or ui.theme.panel)
|
||||||
love.graphics.rectangle("fill", e.x, e.y, e.w, e.h)
|
love.graphics.rectangle("fill", e.x, e.y, e.w, e.h)
|
||||||
love.graphics.setColor(ui.activeTheme.border)
|
love.graphics.setColor(ui.theme.border)
|
||||||
love.graphics.setLineWidth(ui.activeTheme.borderwidth)
|
love.graphics.setLineWidth(ui.theme.borderwidth)
|
||||||
love.graphics.rectangle("line", e.x, e.y, e.w, e.h)
|
love.graphics.rectangle("line", e.x, e.y, e.w, e.h)
|
||||||
ui._draw_text(e)
|
ui._draw_text(e)
|
||||||
end
|
end
|
||||||
@ -76,17 +62,17 @@ function ui._draw_textInput(e)
|
|||||||
local text = ui._inputs[e.placeholder] or ""
|
local text = ui._inputs[e.placeholder] or ""
|
||||||
|
|
||||||
if focused then
|
if focused then
|
||||||
love.graphics.setColor(ui.activeTheme.panel)
|
love.graphics.setColor(ui.theme.panel)
|
||||||
love.graphics.rectangle("fill", e.x, e.y, e.w, e.h)
|
love.graphics.rectangle("fill", e.x, e.y, e.w, e.h)
|
||||||
love.graphics.setColor(ui.activeTheme.accent)
|
love.graphics.setColor(ui.theme.accent)
|
||||||
love.graphics.setLineWidth(ui.activeTheme.borderwidth)
|
love.graphics.setLineWidth(ui.theme.borderwidth)
|
||||||
love.graphics.rectangle("line", e.x, e.y, e.w, e.h)
|
love.graphics.rectangle("line", e.x, e.y, e.w, e.h)
|
||||||
|
|
||||||
if text == "" then
|
if text == "" then
|
||||||
-- show dimmed placeholder text when empty
|
-- show dimmed placeholder text when empty
|
||||||
local font = love.graphics.getFont()
|
local font = love.graphics.getFont()
|
||||||
local startY = e.y + (e.h - font:getHeight()) / 2
|
local startY = e.y + (e.h - font:getHeight()) / 2
|
||||||
love.graphics.setColor(ui.activeTheme.text_dim)
|
love.graphics.setColor(ui.theme.text_dim)
|
||||||
love.graphics.printf(e.placeholder, e.x + 4, startY, e.w - 8, "left")
|
love.graphics.printf(e.placeholder, e.x + 4, startY, e.w - 8, "left")
|
||||||
else
|
else
|
||||||
ui._draw_text({ x=e.x, y=e.y, w=e.w, h=e.h, text=text })
|
ui._draw_text({ x=e.x, y=e.y, w=e.w, h=e.h, text=text })
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
@echo off
|
|
||||||
echo installing Love2D 11.5
|
|
||||||
|
|
||||||
set DOWNLOAD_URL=https://github.com/love2d/love/releases/download/11.5/love-11.5-win64.exe
|
|
||||||
set INSTALLER=%TEMP%\love-installer.exe
|
|
||||||
|
|
||||||
echo download started
|
|
||||||
curl -L -o "%INSTALLER%" "%DOWNLOAD_URL%"
|
|
||||||
|
|
||||||
if %errorlevel% neq 0 (
|
|
||||||
echo failed to install
|
|
||||||
pause
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
echo running installer...
|
|
||||||
"%INSTALLER%"
|
|
||||||
|
|
||||||
setx PATH "%PATH%;C:\Program Files\LOVE"
|
|
||||||
|
|
||||||
echo i think it installed idk
|
|
||||||
pause
|
|
||||||
11
main.lua
11
main.lua
@ -1,13 +1,9 @@
|
|||||||
-- ctrl+shift+b for launching game
|
-- ctrl+shift+b for launching game
|
||||||
|
|
||||||
local ui = require("editor.ui")
|
local ui = require("editor.ui")
|
||||||
local OBVIOUSYLYYYYY = 0
|
|
||||||
|
|
||||||
|
|
||||||
function love.load()
|
function love.load()
|
||||||
local imagedata = love.image.newImageData("durrrrrrrrrr.png")
|
|
||||||
print(imagedata)
|
|
||||||
love.window.setIcon(imagedata)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.textinput(t)
|
function love.textinput(t)
|
||||||
@ -27,9 +23,8 @@ end
|
|||||||
function love.draw()
|
function love.draw()
|
||||||
ui.panel(50, 50, 50, 50)
|
ui.panel(50, 50, 50, 50)
|
||||||
|
|
||||||
ui.button(100, 200, 100, 100, OBVIOUSYLYYYYY, function()
|
ui.button(100, 200, 100, 100, "hello world", function()
|
||||||
OBVIOUSYLYYYYY = OBVIOUSYLYYYYY + 1
|
print("clicked!")
|
||||||
print(OBVIOUSYLYYYYY)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
ui.textInput(50, 400, 100, 100, "textInput")
|
ui.textInput(50, 400, 100, 100, "textInput")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user