Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/
.lovelyignore
.nolovelyignore
config.json
23 changes: 23 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mod.config.showVanilla = helpers.InputBool("Launch Vanilla button", mod.config.showVanilla)
mod.config.showConsole = helpers.InputBool("Launch with console button", mod.config.showConsole)
mod.config.showConsoleless = helpers.InputBool("Launch without console button", mod.config.showConsoleless)
mod.config.showRelaunch = helpers.InputBool("Relaunch Launcher button", mod.config.showRelaunch)

imgui.Separator()

mod.config.useBeatblockPlusStyle = helpers.InputBool("Use BBP style in launcher", mod.config.useBeatblockPlusStyle or false)

imgui.Separator()

if bs.states.Launcher then
if imgui.Button("Open Launcher") then
cs = bs.load("Launcher")
cs:init()
end
imgui.SameLine()
if imgui.Button("Relaunch") then
cs = bs.load("Launcher")
cs.doRelaunch = {}
cs:init()
end
end
19 changes: 15 additions & 4 deletions lovely/prelaunch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ sources = ["prelaunch.lua"]
[[patches]]
[patches.pattern]
target = "main.lua"
pattern = "function love.load()"
position = "after"
pattern = "dofile('preload/states.lua')"
position = "at"
payload = "-- dofile('preload/states.lua') -- do it later to maybe prevent mod conflicts crashing the game"
match_indent = true

[[patches]]
[patches.pattern]
target = "main.lua"
pattern = "cs = bs.load(project.initState)"
position = "at"
payload = '''
if not launch then
return
cs = bs.load("Launcher")
else
if bs.states.Menu == nil then dofile('preload/states.lua') end
cs = bs.load(project.initState) -- i'm scared this conflicts with the bbp mod loading
end
'''
match_indent = true
match_indent = true
18 changes: 17 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
{"description":"Mod launcher for BeatblockPlus","enabled":true,"config":[],"version":"1.0.0","id":"beatblock-plus-launcher","name":"Beatblock Plus Launcher","author":"erenkarakal"}
{
"version": "2.0.2",
"description": "Mod launcher for BeatblockPlus",
"enabled": true,
"id": "beatblock-plus-launcher",
"config": {
"useBeatblockPlusStyle": false,
"currentProfile": "Enable All",
"profiles": {},
"showRelaunch": false,
"showVanilla": true,
"showConsole": true,
"showConsoleless": true
},
"name": "Beatblock Plus Launcher",
"author": "erenkarakal & Pentatrate"
}
84 changes: 1 addition & 83 deletions prelaunch.lua
Original file line number Diff line number Diff line change
@@ -1,84 +1,2 @@
launch = table.concat(arg, " "):find("--launch")

if not launch then
buttons = {}
padding = 20

function addButton(label, callback)
local buttonWidth = love.graphics.getWidth() * 0.85
local buttonHeight = love.graphics.getHeight() * 0.1

table.insert(buttons, {
label = label,
x = (love.graphics.getWidth() - buttonWidth) / 2,
y = (#buttons + 1) * (padding + buttonHeight) + 100,
width = buttonWidth,
height = buttonHeight,
callback = callback
})
end

function launchGame(args)
local osName = love.system.getOS()
local command

if osName == "Windows" then
command = "start beatblock.exe " .. args
elseif osName == "OS X" then
command = "open beatblock.app " .. args .. " &"
else -- assume Linux
command = "./beatblock " .. args .. " &"
end

love.window.close()
os.execute(command)
love.event.quit()
end

love.window.setTitle("Select a launch option")
love.graphics.setBackgroundColor(1, 1, 1) -- white

logo = love.graphics.newImage("assets/title/logo.png")
logo:setFilter('nearest', 'nearest')

love.graphics.setDefaultFilter('nearest', 'nearest')
love.graphics.setLineStyle('rough')
love.graphics.setLineJoin('miter')

font = love.graphics.newFont("assets/fonts/DigitalDisco-Thin.ttf", 32)
font:setFilter('nearest', 'nearest', 0)

addButton("Launch Vanilla", function()
launchGame("--launch --disable-mods")
end)
addButton("Launch Modded", function()
launchGame("--launch")
end)
addButton("Launch Modded Without Console", function()
launchGame("--launch --disable-console")
end)

function love.mousepressed(x, y)
for _, btn in ipairs(buttons) do
if x >= btn.x and x <= btn.x + btn.width and y >= btn.y and y <= btn.y + btn.height then
btn.callback()
end
end
end

function love.draw()
love.graphics.setColor(1, 1, 1)
local scale = 1.5
love.graphics.draw(logo, (love.graphics.getWidth() - logo:getWidth() * scale) / 2, 46, 0, scale, scale)

for _, btn in ipairs(buttons) do
love.graphics.setColor(0, 0, 0) -- black
love.graphics.rectangle("line", btn.x, btn.y, btn.width, btn.height)

love.graphics.setFont(font)
love.graphics.printf(btn.label, btn.x, btn.y + (btn.height / 6), btn.width, "center")
end
end

return
end
print("launch args: " .. table.concat(arg, " "))
Loading