โ† All examples

godot components

Split-screen layouts for local multiplayer

Compute view rectangles for one to many local players (halves, one wide plus two, grids with full-width last rows), with gaps between views, and place Control nodes such as SubViewportContainers on them.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • inspect_gdscript.py
  • run_tests.gd
  • split_screen_layout.gd
  • test_package.py
  • tests/test_split_screen_layout.gd
  • verification/native.json

How it works

Class
BaltorSplitScreen, extends RefCounted
Methods
layout(count: int, screen: Rect2, stacked: bool = false, gap: float = 0.0) -> Array[Rect2]; arrange(controls: Array, screen: Rect2, stacked: bool = false, gap: float = 0.0) -> int
Placement
res://baltor/godot_components/split_screen_layout/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • godot_parse_check_only
  • godot_gdscript_tests
  • godot_tests_reject_gutted_component
  • godot_editor_import
  • godot_contract_reflection
  • godot_readme_usage_compiles

Limits to consider

Rectangles only; creating SubViewports, cameras and input routing per player is up to you. Views in a grid differ in size when the last row is short. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.