Skip to content
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
3 changes: 3 additions & 0 deletions .github/workflows/check-lua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ on:
paths:
- rts/Lua/**
- rts/Rml/SolLua/**/*.cpp
- rts/Sim/Units/Scripts/**/*.cpp
- doc/site/mise.toml
push:
branches:
- master
paths:
- rts/Lua/**
- rts/Rml/SolLua/**/*.cpp
- rts/Sim/Units/Scripts/**/*.cpp
- doc/site/mise.toml
env:
RECOIL_LUA_LIBRARY_DIR: "rts/Lua/library"
Expand All @@ -29,6 +31,7 @@ jobs:
sparse-checkout: |
rts/Lua
rts/Rml/SolLua
rts/Sim/Units/Scripts
doc/site/mise.toml

- uses: jdx/mise-action@v2
Expand Down
37 changes: 9 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ endif (APPLE)
### Compiler flags and defines based on build type
include(TestCXXFlags)

## 32bit or 64bit?
## 64-bit architecture check
set(MARCH_FLAG ${MARCH} CACHE STRING "CPU optimization (use `generic` for generic optimization)")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(MARCH_BITS 64 CACHE INTERNAL "" FORCE)
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR "RecoilEngine does not support 32 bits." )
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR "RecoilEngine requires a 64-bit build environment.")
endif (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
set(MARCH_BITS 64 CACHE INTERNAL "" FORCE)

# Detect architecture
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64|armv8|ARM64|AARCH64")
Expand All @@ -119,9 +118,8 @@ else()
message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}. Only ARM64 and x86-64 are supported.")
endif()

message(STATUS "Building Spring on ${MARCH_BITS}bit environment")
set(BUILD_BITS "${MARCH_BITS}" CACHE STRING "Target arch machine type")
message(STATUS "Targetting ${BUILD_BITS}bit")
message(STATUS "Building Spring on a 64-bit environment")
set(BUILD_BITS 64 CACHE INTERNAL "Target architecture bitness" FORCE)


### Install paths (relative to CMAKE_INSTALL_PREFIX)
Expand Down Expand Up @@ -489,12 +487,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
set(FALLBACK_SSE_FLAGS "${FALLBACK_SSE_FLAGS} -mno-avx -mno-fma -mno-fma4 -mno-xop -mno-lwp")
set(FALLBACK_SSE_FLAGS "${FALLBACK_SSE_FLAGS} -mno-avx2")

if (MARCH_BITS EQUAL 64)
set(FALLBACK_MARCH "x86-64")
else (MARCH_BITS EQUAL 64)
set(FALLBACK_MARCH "i686")
endif (MARCH_BITS EQUAL 64)

set(FALLBACK_MARCH "x86-64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${FALLBACK_MARCH} -mtune=generic ${FALLBACK_SSE_FLAGS}")
endif (NOT MARCH_FLAG STREQUAL "generic")

Expand Down Expand Up @@ -581,22 +574,10 @@ else (MSVC)
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb3") #cmake has -g it by default
#set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ggdb3") #cmake has -g it by default

if (MARCH_BITS EQUAL 64 AND BUILD_BITS EQUAL 32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
endif (MARCH_BITS EQUAL 64 AND BUILD_BITS EQUAL 32)

if (MINGW)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++ -Wl,--enable-auto-import")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++ -Wl,--enable-auto-import")
if (BUILD_BITS EQUAL 32)
# Increase memory limit from 2GB to 3GB on 32bit Windows and 2GB->4GB on 64bit Windows (assuming spring.exe is 32bit)
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778(v=vs.85).aspx
message(STATUS "Enable IMAGE_FILE_LARGE_ADDRESS_AWARE (>2GB memory limit)")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--large-address-aware")
else (BUILD_BITS EQUAL 32)
message(WARNING "The 64bit version of spring on windows is experimental and may not sync with regular builds")
endif (BUILD_BITS EQUAL 32)
endif (MINGW)
endif (MSVC)

Expand Down Expand Up @@ -723,4 +704,4 @@ if (INSTALL_PORTABLE)
install(DIRECTORY DESTINATION maps)
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/springsettings_portable.cfg) # empty settings file for portable install
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/springsettings_portable.cfg DESTINATION . RENAME springsettings.cfg)
endif (INSTALL_PORTABLE)
endif (INSTALL_PORTABLE)
7 changes: 6 additions & 1 deletion doc/site/content/changelogs/_index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ This is the bleeding-edge changelog since version 2026.06, for **pre-release 202
- Added GetPrevFrameChecksum() to the Lua API
- Add multi-platform sync testing (amd64-windows/linux + arm64-linux) [PR 2921](https://github.com/beyond-all-reason/RecoilEngine/pull/2921)
- Optimize LuaPushNamedFoo using compile time key hashing [PR 2986](https://github.com/beyond-all-reason/RecoilEngine/pull/2986)
- fix(synctest): workaround widget timing nondeterminism [PR 3124](https://github.com/beyond-all-reason/RecoilEngine/pull/3124)
- Fixed (synctest): workaround widget timing nondeterminism [PR 3124](https://github.com/beyond-all-reason/RecoilEngine/pull/3124)
- Remove refrences to 32-bit support [PR 3033](https://github.com/beyond-all-reason/RecoilEngine/pull/3033)
- Improved setup foir ASAN build [PR 2663](https://github.com/beyond-all-reason/RecoilEngine/pull/2663)

## Documentation
- Added 'First Steps with the Engine' guide for game developers
Expand Down Expand Up @@ -58,6 +60,7 @@ This is the bleeding-edge changelog since version 2026.06, for **pre-release 202
- Added GetPrevFrameChecksum() to the Lua API [PR 2922](https://github.com/beyond-all-reason/RecoilEngine/pull/2922)
- Fixes to Spring.SetMapShader [PR 3127](https://github.com/beyond-all-reason/RecoilEngine/pull/3127)
- MouseHandler: route XButtons (Mouse4/5) as keybinds instead of mouse ownership [PR 2613](https://github.com/beyond-all-reason/RecoilEngine/pull/2613)
- Fixed Lua EmmyLua type annotations [PR 2888](https://github.com/beyond-all-reason/RecoilEngine/pull/2888)

## Misc
- Restored lowercasing in FileSystem::GetExtension
Expand Down Expand Up @@ -111,3 +114,5 @@ This is the bleeding-edge changelog since version 2026.06, for **pre-release 202
- Dump state handles resource packs
- Fix units having the wrong path id after loading a save game. [PR 3120](https://github.com/beyond-all-reason/RecoilEngine/pull/3120)
- Avoid UB in float-to-short angle casts (fixes arm64/x86 desync) [PR 3075](https://github.com/beyond-all-reason/RecoilEngine/pull/3075)
- Send gameprogress packet on connection initialization [PR 2872](https://github.com/beyond-all-reason/RecoilEngine/pull/2872)
- Separate and make sonar and RADAR jamming function as they logicall should. [PR 2980](https://github.com/beyond-all-reason/RecoilEngine/pull/2980)
2 changes: 1 addition & 1 deletion doc/site/mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
lua_doc_gen_dest = "$RECOIL_LUA_LIBRARY_DIR/generated"
site_dir = 'doc/site'
site_temp_dir = "{{vars.site_dir}}/temp"
lua_doc_paths = 'rts/{Lua,Rml/SolLua}/**/*.cpp'
lua_doc_paths = 'rts/{Lua,Rml/SolLua,Sim/Units/Scripts}/**/*.cpp'
lua_pages_dir = "{{vars.site_dir}}/content/docs/lua-api"
emmylua_cli_template = "{{vars.site_dir}}/emmylua-doc-cli-template"
latest_release_data = 'data/latest_release.json'
Expand Down
77 changes: 77 additions & 0 deletions rts/Lua/LuaFonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ int LuaFonts::meta_index(lua_State* L)
/******************************************************************************/
/******************************************************************************/

/*** Load a font from a file.
*
* @function gl.LoadFont
* @param fontFile string
* @param size integer?
* @param outlineWidth integer?
* @param outlineWeight number?
* @return LuaFont font
*/
int LuaFonts::LoadFont(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand All @@ -208,6 +217,11 @@ int LuaFonts::LoadFont(lua_State* L)
}


/*** Delete a font object.
*
* @function gl.DeleteFont
* @param font LuaFont
*/
int LuaFonts::DeleteFont(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand Down Expand Up @@ -261,6 +275,15 @@ int LuaFonts::ClearFallbackFonts(lua_State* L)
/******************************************************************************/
/******************************************************************************/

/*** Draws text in screen space at the given position.
*
* @function LuaFont:Print
* @param text string
* @param x number
* @param y number
* @param size number? Defaults to the font's point size.
* @param options string? Flag characters for alignment, outline, shadow, scaling, etc. (e.g. `"co"` for center and outline).
*/
int LuaFonts::Print(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand Down Expand Up @@ -309,6 +332,16 @@ int LuaFonts::Print(lua_State* L)
return 0;
}

/*** Draws text in world space at the given position.
*
* @function LuaFont:PrintWorld
* @param text string
* @param x number
* @param y number
* @param z number
* @param size number? Defaults to the font's point size.
* @param options string? Flag characters for alignment, outline, shadow, scaling, etc. (e.g. `"co"` for center and outline).
*/
int LuaFonts::PrintWorld(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand Down Expand Up @@ -388,6 +421,10 @@ int LuaFonts::Begin(lua_State* L)
return 0;
}

/*** Ends a font command block started with `LuaFont:Begin`.
*
* @function LuaFont:End
*/
int LuaFonts::End(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand Down Expand Up @@ -426,6 +463,16 @@ int LuaFonts::SubmitBuffered(lua_State* L)
/******************************************************************************/
/******************************************************************************/

/*** Wraps text to fit within a maximum width (and optional max height), in-place.
*
* @function LuaFont:WrapText
* @param text string
* @param maxWidth number
* @param maxHeight number? Defaults to an engine-defined maximum height.
* @param size number? Defaults to the font's point size.
* @return string wrappedText
* @return number lineCount
*/
int LuaFonts::WrapText(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand All @@ -447,6 +494,12 @@ int LuaFonts::WrapText(lua_State* L)
/******************************************************************************/
/******************************************************************************/

/*** Returns the horizontal extent of a string for this font at its current size.
*
* @function LuaFont:GetTextWidth
* @param text string
* @return number width
*/
int LuaFonts::GetTextWidth(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand All @@ -457,6 +510,14 @@ int LuaFonts::GetTextWidth(lua_State* L)
}


/*** Returns layout metrics for a string: total height, descender depth, and line count.
*
* @function LuaFont:GetTextHeight
* @param text string
* @return number height
* @return number descender
* @return number lines
*/
int LuaFonts::GetTextHeight(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand Down Expand Up @@ -508,10 +569,26 @@ static int SetTextColorShared(lua_State* L, bool outline)
return 0;
}

/*** Sets the RGBA color used when drawing text (fill).
*
* @function LuaFont:SetTextColor
* @param color table Four-component RGBA array (`{r, g, b, a}`), or pass `r`, `g`, `b`, and optional `a` as separate numbers (requires at least three numeric components after the font).
*/
int LuaFonts::SetTextColor(lua_State* L) { return (SetTextColorShared(L, false)); }

/*** Sets the RGBA color used for text outline when outline rendering is enabled.
*
* @function LuaFont:SetOutlineColor
* @param color table Four-component RGBA array (`{r, g, b, a}`), or pass `r`, `g`, `b`, and optional `a` as separate numbers (requires at least three numeric components after the font).
*/
int LuaFonts::SetOutlineColor(lua_State* L) { return (SetTextColorShared(L, true)); }


/*** When enabled, outline color is derived automatically instead of using `SetOutlineColor`.
*
* @function LuaFont:SetAutoOutlineColor
* @param enabled boolean
*/
int LuaFonts::SetAutoOutlineColor(lua_State* L)
{
RECOIL_DETAILED_TRACY_ZONE;
Expand Down
Loading
Loading