mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
6eba57730f
* DPI scaling 1. Add the ability to query the operating system's DPI scaling values 2. Expose those values through a new Lua function 3. Add an asset that sets the CEF gui and the Dashboard font sizes and placements based on the DPI scaling 4. Add that new asset into the base_blank asset * Add message when including the dpiscaling
70 lines
2.3 KiB
Lua
70 lines
2.3 KiB
Lua
-- This is a blank scene that that just sets up the default menus/dasboard/keys, etc.
|
|
|
|
local propertyHelper = asset.require("util/property_helper")
|
|
|
|
-- Specifying which other assets should be loaded in this scene
|
|
asset.require("spice/base")
|
|
|
|
asset.require("dashboard/default_dashboard")
|
|
-- Load default key bindings applicable to most scenes
|
|
asset.require("util/default_keybindings")
|
|
|
|
-- Load web gui
|
|
local webGui = asset.require("util/webgui")
|
|
|
|
-- Scale the different UI components based on the operating system's DPI scaling value
|
|
asset.require("util/dpiscaling")
|
|
|
|
local toggle_trails = {
|
|
Identifier = "os_default.toggle_trails",
|
|
Name = "Toggle Trails",
|
|
Command = [[
|
|
local list = openspace.getProperty("{planetTrail_solarSystem}.Renderable.Enabled");
|
|
for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end
|
|
|
|
local moonlist = openspace.getProperty("{moonTrail_solarSystem}.Renderable.Enabled");
|
|
for _,v in pairs(moonlist) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end
|
|
]],
|
|
Documentation = "Toggles the visibility of planet and moon trails",
|
|
GuiPath = "/Rendering",
|
|
IsLocal = false,
|
|
|
|
Key = "h"
|
|
}
|
|
|
|
local toggle_planet_labels = {
|
|
Identifier = "os_default.toggle_planet_labels",
|
|
Name = "Toggle planet labels",
|
|
Command = [[
|
|
local list = openspace.getProperty("{solarsystem_labels}.Renderable.Enabled");
|
|
for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end
|
|
]],
|
|
Documentation = "Turns on visibility for all solar system labels",
|
|
GuiPath = "/Rendering",
|
|
IsLocal = false,
|
|
|
|
Key = "l"
|
|
}
|
|
|
|
asset.onInitialize(function ()
|
|
webGui.setCefRoute("onscreen")
|
|
|
|
openspace.action.registerAction(toggle_trails)
|
|
openspace.bindKey(toggle_trails.Key, toggle_trails.Identifier)
|
|
|
|
openspace.action.registerAction(toggle_planet_labels)
|
|
openspace.bindKey(toggle_planet_labels.Key, toggle_planet_labels.Identifier)
|
|
|
|
openspace.setDefaultGuiSorting()
|
|
|
|
openspace.setPropertyValueSingle("RenderEngine.VerticalLogOffset", 0.100000)
|
|
end)
|
|
|
|
asset.onDeinitialize(function ()
|
|
openspace.action.removeAction(toggle_trails)
|
|
openspace.clearKey(toggle_trails.Key)
|
|
|
|
openspace.action.removeAction(toggle_planet_labels)
|
|
openspace.clearKey(toggle_planet_labels.Key)
|
|
end)
|