diff --git a/conf.lua b/conf.lua index 30aa13b..09562c5 100644 --- a/conf.lua +++ b/conf.lua @@ -1,11 +1,11 @@ -- conf.lua function love.conf(t) - t.window.title = "engine" - t.window.width = 1024 - t.window.height = 680 - t.window.resizable = true - t.window.minwidth = 640 - t.window.minheight = 480 - t.version = "11.4" - t.console = true -- shows console output on Windows + t.window.title = "engine" + t.window.width = 1024 + t.window.height = 680 + t.window.resizable = true + t.window.minwidth = 640 + t.window.minheight = 480 + t.version = "11.4" + t.console = true -- shows console output on Windows end \ No newline at end of file diff --git a/durrrrrrrrrr.png b/durrrrrrrrrr.png new file mode 100644 index 0000000..11e45c8 Binary files /dev/null and b/durrrrrrrrrr.png differ diff --git a/editor/ui.lua b/editor/ui.lua index 08e679e..2e9ea77 100644 --- a/editor/ui.lua +++ b/editor/ui.lua @@ -12,6 +12,20 @@ ui.theme = { 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) ui._wasDown = false ui._focused = nil @@ -23,10 +37,10 @@ ui._hoverConsumed = false -- so it sets hovered to the correct thing -- draws a basic bordered panel function ui._draw_panel(e) - love.graphics.setColor(ui.theme.panel) + love.graphics.setColor(ui.activeTheme.panel) love.graphics.rectangle("fill", e.x, e.y, e.w, e.h) - love.graphics.setColor(ui.theme.border) - love.graphics.setLineWidth(ui.theme.borderwidth) + love.graphics.setColor(ui.activeTheme.border) + love.graphics.setLineWidth(ui.activeTheme.borderwidth) love.graphics.rectangle("line", e.x, e.y, e.w, e.h) end @@ -38,7 +52,7 @@ function ui._draw_text(e) 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.setColor(ui.theme.text) + love.graphics.setColor(ui.activeTheme.text) love.graphics.printf(e.text, e.x, startY, e.w, "center") love.graphics.setScissor() -- reset clip end @@ -48,10 +62,10 @@ function ui._draw_button(e) 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 - love.graphics.setColor(e._hovered and ui.theme.hover or ui.theme.panel) + love.graphics.setColor(e._hovered and ui.activeTheme.hover or ui.activeTheme.panel) love.graphics.rectangle("fill", e.x, e.y, e.w, e.h) - love.graphics.setColor(ui.theme.border) - love.graphics.setLineWidth(ui.theme.borderwidth) + love.graphics.setColor(ui.activeTheme.border) + love.graphics.setLineWidth(ui.activeTheme.borderwidth) love.graphics.rectangle("line", e.x, e.y, e.w, e.h) ui._draw_text(e) end @@ -62,17 +76,17 @@ function ui._draw_textInput(e) local text = ui._inputs[e.placeholder] or "" if focused then - love.graphics.setColor(ui.theme.panel) + love.graphics.setColor(ui.activeTheme.panel) love.graphics.rectangle("fill", e.x, e.y, e.w, e.h) - love.graphics.setColor(ui.theme.accent) - love.graphics.setLineWidth(ui.theme.borderwidth) + love.graphics.setColor(ui.activeTheme.accent) + love.graphics.setLineWidth(ui.activeTheme.borderwidth) love.graphics.rectangle("line", e.x, e.y, e.w, e.h) if text == "" then -- show dimmed placeholder text when empty local font = love.graphics.getFont() local startY = e.y + (e.h - font:getHeight()) / 2 - love.graphics.setColor(ui.theme.text_dim) + love.graphics.setColor(ui.activeTheme.text_dim) love.graphics.printf(e.placeholder, e.x + 4, startY, e.w - 8, "left") else ui._draw_text({ x=e.x, y=e.y, w=e.w, h=e.h, text=text }) diff --git a/lovedd installation.bat b/lovedd installation.bat new file mode 100644 index 0000000..632f3e0 --- /dev/null +++ b/lovedd installation.bat @@ -0,0 +1,22 @@ +@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 \ No newline at end of file diff --git a/main.lua b/main.lua index 8a3f7af..6ff6edc 100644 --- a/main.lua +++ b/main.lua @@ -1,9 +1,13 @@ -- ctrl+shift+b for launching game local ui = require("editor.ui") +local OBVIOUSYLYYYYY = 0 + function love.load() - + local imagedata = love.image.newImageData("durrrrrrrrrr.png") + print(imagedata) + love.window.setIcon(imagedata) end function love.textinput(t) @@ -23,8 +27,9 @@ end function love.draw() ui.panel(50, 50, 50, 50) - ui.button(100, 200, 100, 100, "hello world", function() - print("clicked!") + ui.button(100, 200, 100, 100, OBVIOUSYLYYYYY, function() + OBVIOUSYLYYYYY = OBVIOUSYLYYYYY + 1 + print(OBVIOUSYLYYYYY) end) ui.textInput(50, 400, 100, 100, "textInput")