Skip to content

Commit 66c5b41

Browse files
committed
wip
1 parent d8cc6f2 commit 66c5b41

File tree

83 files changed

+7680
-878
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+7680
-878
lines changed

.claude/settings.local.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(find:*)",
5+
"WebSearch",
6+
"WebFetch(domain:mikke89.github.io)",
7+
"WebFetch(domain:github.com)"
8+
],
9+
"deny": [],
10+
"ask": []
11+
}
12+
}

.github/workflows/launcher.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ jobs:
2727
arch: "--x64"
2828

2929
steps:
30-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v4
3131
with:
3232
# This should fix git rev-list --count HEAD
3333
# https://stackoverflow.com/a/65056108
3434
fetch-depth: 0
3535
path: repo-folder
3636

37-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v4
3838
with:
3939
repository: gajop/spring-launcher
4040
path: spring-launcher
4141

4242
- name: Setup NodeJs
43-
uses: actions/setup-node@v1
43+
uses: actions/setup-node@v4
4444
with:
4545
node-version: '17.x'
4646

.github/workflows/luacheck.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
with:
1212
submodules: 'true'
1313

14+
- name: Install dependencies
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y libreadline-dev
1418
1519
- name: Install luacheck
1620
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ env/
99

1010
# don't track local (dev) file
1111
*.local
12+
13+
*.code-workspace

.luacheckrc

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,43 @@ globals = {
4343
-- SB view fields
4444
"UnitField", "FeatureField", "AreaField", "TriggerField", "UnitTypeField", "FeatureTypeField",
4545
"TeamField", "NumericField", "StringField", "BooleanField", "NumericComparisonField", "IdentityComparisonField",
46-
"PositionField"
46+
"PositionField",
47+
48+
-- RmlUi core
49+
"RmlUiManager", "RmlUiBuilder", "RmlUiEditorBase", "RmlUiComponent",
50+
51+
-- RmlUi fields
52+
"RmlUiField", "RmlUiStringField", "RmlUiNumericField", "RmlUiBooleanField", "RmlUiChoiceField",
53+
"RmlUiColorField", "RmlUiAssetField", "RmlUiMaterialField", "RmlUiObjectField", "RmlUiObjectTypeField",
54+
"RmlUiTeamField", "RmlUiArrayField", "RmlUiGroupField",
55+
56+
-- RmlUi field compat (overwrites StringField, etc.)
57+
"ChoiceField", "ColorField", "AssetField", "MaterialField", "ObjectField", "ObjectTypeField", "ArrayField", "GroupField",
58+
59+
-- RmlUi pickers
60+
"RmlUiAssetPickerWindow", "RmlUiColorPickerWindow", "RmlUiMaterialPickerWindow",
61+
"AssetPickerWindow", "ColorPickerWindow", "MaterialPickerWindow",
62+
63+
-- RmlUi dialogs
64+
"RmlUiBaseDialog", "RmlUiFileDialog", "RmlUiNewProjectDialog",
65+
"RmlUiImportFileDialog", "RmlUiExportFileDialog", "RmlUiOpenProjectDialog", "RmlUiSaveProjectDialog",
66+
67+
-- RmlUi editors
68+
"RmlUiTriggerEditor", "RmlUiObjectEditor", "RmlUiHeightmapEditor", "RmlUiTextureEditor",
69+
"RmlUiGrassEditor", "RmlUiMetalEditor", "RmlUiWaterEditor", "RmlUiLightingEditor",
70+
"RmlUiSkyEditor", "RmlUiTerrainSettingsEditor", "RmlUiDNTSEditor", "RmlUiMaterialBrowser",
71+
72+
-- RmlUi floating windows
73+
"RmlUiCommandWindow", "RmlUiStatusWindow", "RmlUiControlButtons", "RmlUiTopLeftMenu",
74+
75+
-- RmlUi general windows
76+
"RmlUiScenarioInfoView", "RmlUiDiplomacyWindow", "RmlUiPlayerWindow", "RmlUiPlayersWindow",
77+
78+
-- RmlUi object components
79+
"RmlUiAnimationsView", "RmlUiCollisionWindow", "RmlUiObjectDefsPanel", "RmlUiObjectPropertyWindow",
80+
81+
-- RmlUi trigger components
82+
"RmlUiTriggerWindow", "RmlUiEventWindow", "RmlUiConditionWindow", "RmlUiActionWindow",
83+
"RmlUiAreasWindow", "RmlUiAreaView", "RmlUiVariablesWindow", "RmlUiVariableWindow",
84+
"RmlUiDebugTriggerView", "RmlUiDebugVariableView", "RmlUiCustomWindow"
4785
}

LuaUI/main.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ _G[("%s_VERSION"):format(LUA_NAME:upper())] = LUA_VERSION -- creates LUAUI_VERSI
2020

2121
VFS.DEF_MODE = VFS.RAW_FIRST
2222

23+
VFS.Include("LuaUI/rml_setup2.lua", nil, VFS.DEF_MODE)
24+
2325

2426
-------------------------------------------------------------------------------
2527
-------------------------------------------------------------------------------

LuaUI/rml_setup2.lua

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
-- file: rml.lua
2+
-- brief: RmlUi Setup
3+
-- author: lov + ChrisFloofyKitsune
4+
--
5+
-- Copyright (C) 2024.
6+
-- Licensed under the terms of the GNU GPL, v2 or later.
7+
8+
if (RmlGuard or not RmlUi) then
9+
return
10+
end
11+
-- don't allow this initialization code to be run multiple times
12+
RmlGuard = true
13+
14+
--[[
15+
Recoil uses a custom set of Lua bindings (check out rts/Rml/SolLua/bind folder in the C++ engine code)
16+
Aside from the Lua API, the rest of the RmlUi documentation is still relevant
17+
https://mikke89.github.io/RmlUiDoc/index.html
18+
]]
19+
20+
--[[ create a common Context to be used for widgets
21+
pros:
22+
* Documents in the same Context can make use of the same DataModels, allowing for less duplicate data
23+
* Documents can be arranged in front/behind of each other dynamically
24+
cons:
25+
* Documents in the same Context can make use of the same data models, leading to side effects
26+
* DataModels must have unique names within the same Context
27+
28+
If you have lots of DataModel use you may want to create your own Context
29+
otherwise you should be able to just use the shared Context
30+
31+
Contexts created with the Lua API are automatically disposed of when the LuaUi environment is unloaded
32+
]]
33+
34+
local oldCreateContext = RmlUi.CreateContext
35+
36+
local function NewCreateContext(name)
37+
local context = oldCreateContext(name)
38+
39+
-- set up dp_ratio considering the user's UI scale preference and the screen resolution
40+
local viewSizeX, viewSizeY = Spring.GetViewGeometry()
41+
42+
local userScale = Spring.GetConfigFloat("ui_scale", 1)
43+
44+
local baseWidth = 1920
45+
local baseHeight = 1080
46+
local resFactor = math.min(viewSizeX / baseWidth, viewSizeY / baseHeight)
47+
48+
context.dp_ratio = resFactor * userScale
49+
50+
context.dp_ratio = math.floor(context.dp_ratio * 100) / 100
51+
return context
52+
end
53+
54+
RmlUi.CreateContext = NewCreateContext
55+
56+
-- Load fonts
57+
RmlUi.LoadFontFace("fonts/Poppins-Regular.ttf", true)
58+
local font_files = VFS.DirList('fonts/exo2', '*.ttf')
59+
for _, file in ipairs(font_files) do
60+
Spring.Echo("loading font", file)
61+
RmlUi.LoadFontFace(file, true)
62+
end
63+
64+
--RmlUi.LoadFontFace("fonts/fallbacks/SourceHanSans-Regular.ttc", true)
65+
--RmlUi.LoadFontFace("fonts/monospaced/SourceCodePro-Medium.otf")
66+
67+
-- Mouse Cursor Aliases
68+
--[[
69+
These let standard CSS cursor names be used when doing styling.
70+
If a cursor set via RCSS does not have an alias, it is unchanged.
71+
CSS cursor list: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
72+
RmlUi documentation: https://mikke89.github.io/RmlUiDoc/pages/rcss/user_interface.html#cursor
73+
]]
74+
75+
-- when "cursor: normal" is set via RCSS, "cursornormal" will be sent to the engine... and so on for the rest
76+
RmlUi.SetMouseCursorAlias("default", 'cursornormal')
77+
RmlUi.SetMouseCursorAlias("pointer", 'Move') -- command cursors use the command name. TODO: replace with actual pointer cursor?
78+
RmlUi.SetMouseCursorAlias("move", 'uimove')
79+
RmlUi.SetMouseCursorAlias("nesw-resize", 'uiresized2')
80+
RmlUi.SetMouseCursorAlias("nwse-resize", 'uiresized1')
81+
RmlUi.SetMouseCursorAlias("ns-resize", 'uiresizev')
82+
RmlUi.SetMouseCursorAlias("ew-resize", 'uiresizeh')
83+
84+
RmlUi.CreateContext("shared")

LuaUI/rmlui/common.css

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Hide horizontal scrollbar entirely */
2+
scrollbarhorizontal,
3+
scrollbarhorizontal slidertrack,
4+
scrollbarhorizontal sliderbar,
5+
scrollbarhorizontal sliderarrowdec,
6+
scrollbarhorizontal sliderarrowinc {
7+
display: none;
8+
}
9+
10+
/* Vertical scrollbar container */
11+
scrollbarvertical {
12+
width: 10dp; /* visible gutter */
13+
background-color: #1c1d20;
14+
}
15+
16+
/* Remove arrow buttons (optional, keeps things minimal) */
17+
scrollbarvertical sliderarrowdec,
18+
scrollbarvertical sliderarrowinc {
19+
width: 0dp;
20+
height: 0dp;
21+
}
22+
23+
/* Track + thumb (bar) */
24+
scrollbarvertical slidertrack {
25+
margin-left: 1dp; /* center the 8dp bar inside the 10dp gutter */
26+
width: 8dp;
27+
background-color: #121315;
28+
}
29+
30+
scrollbarvertical sliderbar {
31+
width: 8dp;
32+
min-height: 20dp; /* ensure it’s visible & draggable */
33+
background-color: #44484e;
34+
border: 1dp #2a2b2e;
35+
cursor: pointer;
36+
}
37+
38+
scrollbarvertical sliderbar:hover {
39+
background-color: #5fc878;
40+
}
41+

0 commit comments

Comments
 (0)