Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to use OpenGL when launching game #78

Merged
merged 5 commits into from
Feb 14, 2024
Merged
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
1 change: 1 addition & 0 deletions src/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function config.load()
default(data, "loennInstalledVersion", "")

default(data, "updateModsOnStartup", "none")
default(data, "useOpenGL", "disabled")

default(data, "extradata", {})
end
Expand Down
19 changes: 19 additions & 0 deletions src/scenes/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ local updateModsOnStartupOptions = {
{ text = "Disabled (Default)", data = "none" }
}

local useOpenGLOptions = {
{ text = "Enabled", data = "enabled" },
{ text = "Disabled (Default)", data = "disabled" }
}

local extradatas = {
{ text = "Noto Sans CJK (~50 MB)", info = "Chinese, Japanese, Korean font files.", path = "olympus-extra-cjk.zip", url = "https://0x0a.de/olympus-extra/olympus-extra-cjk.zip" }
}
Expand Down Expand Up @@ -297,6 +302,8 @@ local root = uie.column({
}):with(uiu.fillWidth)
}):with(uiu.fillWidth(8 + 1 / optioncount)):with(uiu.at(4 / optioncount, 0)),



}):with(uiu.fillWidth),

uie.group({}),
Expand Down Expand Up @@ -350,6 +357,18 @@ local root = uie.column({
}):with(uiu.fillWidth)
}):with(uiu.fillWidth(8 + 1 / optioncount)):with(uiu.at(3 / optioncount, 0)),

uie.column({
uie.label("Use OpenGL"),
uie.dropdown(useOpenGLOptions, function(self, value)
config.useOpenGL = value
config.save()
end):with({
placeholder = "???",
selectedData = config.useOpenGL
}):with(uiu.fillWidth)
}):with(uiu.fillWidth(8 + 1 / optioncount)):with(uiu.at(4 / optioncount, 0)),


}):with(uiu.fillWidth),

uie.group({}),
Expand Down
13 changes: 11 additions & 2 deletions src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ end

local launching = {}


function utils.launch(path, vanilla, notify, force)
local key = string.format("%s | %s", path, vanilla and "vanilla" or "everest")
if launching[key] then
Expand All @@ -333,8 +334,10 @@ function utils.launch(path, vanilla, notify, force)
end

launching[key] = threader.routine(function()

local config = require("config")

if not path then
local config = require("config")
if config then
path = config.installs[config.install].path
end
Expand All @@ -348,7 +351,13 @@ function utils.launch(path, vanilla, notify, force)
local alert = require("alert")
notify = notify and require("notify") or alert

local launch = sharp.launch(path, vanilla and "--vanilla" or "", (force or not notify) and true or false)
local opengl = false
if config then
opengl = config.useOpenGL == "enabled"
end

local flags = (vanilla and "--vanilla " or "") .. (opengl and "--graphics OpenGL " or "")
local launch = sharp.launch(path, flags, (force or not notify) and true or false)
local container

if vanilla then
Expand Down