Jump to content

[mod] CENTEREDUI MOD v1.0


Recommended Posts

Posted (edited)

CenteredUI v1.0


Centered Interface for CK2 Ultrawide Monitors


CK2's interface is pinned to the upper-left corner by default — on ultrawide monitors all panels and buttons sit far to the left while the rest of the screen is empty. CenteredUI fixes this by centering the topbar buttons and all domestic panels on screen.

The mod includes an auto-patcher script that reads your resolution and GUI scale from settings.txt and recalculates all positions dynamically. Works with any resolution and any gui_scale setting.


━ WHAT GETS CENTERED

Topbar:

  • All 26 topbar elements — ruler portrait, shield, crown, tab buttons, extensions, diplomacy message icons

Domestic Panels:

  • Overview, Court, Diplomacy, Dynastic, Factions, Law, Military, Missions, Nomad, Plots, Religion, Republic, Societies, Technology, Treasury
  • Court companion windows (jobs_view, honorary_titles_view, council_view)
  • Religion sub-windows (saints, cardinal, fraticelli cardinal)

Not centered: Offmap buttons (China etc.), character view, event popups, and other floating windows — these are handled separately by the game.


━ HOW IT WORKS

CK2 has no dynamic layout system — all positions are absolute pixel values. CenteredUI uses a two-part approach:

1. Domestic Panels use CK2's Orientation = "CENTER" feature, positioning windows relative to screen center. The x-offset is static (−288 = half panel width); the y-offset is recalculated whenever gui_scale changes to maintain topbar clearance.

2. Topbar Elements are children of the main fullscreen window and cannot use CENTER orientation. The patcher calculates the required pixel offset:

effective_width = resolution_x / gui_scale
		topbar_offset = effective_width / 2 - 288


Each topbar element's original x-position is shifted by this offset.

The patcher reads settings.txt on every launch, patches the GUI files, and starts CK2 via Steam — fully automatic.


━ HOW TO USE

Option A — Batch launcher (recommended):

  1. Run Launch_CK2_Centered.bat
  2. It patches GUI files and launches CK2 automatically

Option B — Manual patch:

  1. Run CenteredUI_Patcher.ps1 in PowerShell
  2. Launch CK2 normally through Steam

Important: Re-run the patcher whenever you change your resolution or gui_scale in CK2's settings. Using the batch file handles this automatically every launch.


━ REQUIREMENTS

  • A Bigger Interface mod — must be loaded before CenteredUI (set automatically in CenteredUI.mod)
  • PowerShell — included with Windows 10/11


━ INSTALLATION

  1. Place CenteredUI.mod in the /mod/ folder
  2. Place the CenteredUI/ folder in the /mod/ folder
  3. Enable "Centered UI" in the CK2 launcher
  4. Enable "A Bigger Interface" in the CK2 launcher
  5. Launch via Launch_CK2_Centered.bat (or run the patcher first)

No manual configuration needed — the patcher reads resolution and gui_scale directly from CK2's settings.txt.


━ TECHNICAL DETAILS

Topbar offset formula:

effective_width = resolution_x / gui_scale
		topbar_offset = floor(effective_width / 2) - 288

Panel Y-position formula:

effective_height = resolution_y / gui_scale
		center_y = floor(effective_height / 2)
		y_tall = 100 - center_y          (100px topbar clearance)
		y_honorary = y_tall + 175        (court companion offset)
		y_council  = y_tall + 350        (court companion offset)

Example at 5120×1440, gui_scale=1.2: effective = 4266×1200 · topbar_offset = +1845 · y_tall = −500

All files are written UTF-8 WITHOUT BOM — CK2 crashes with BOM.


━ COMPATIBILITY

  • Overrides 15 domestic_*.gui files from A Bigger Interface
  • Overrides main.gui from base game (auto-generated from template)
  • Compatible with most mods that don't modify domestic panel positions
  • Not compatible with other mods that override the same GUI files
  • Safe to add or remove at any time — no save game dependency


━ KNOWN LIMITATIONS

  • Windows are not draggable yet (planned for a future version)
  • Offmap buttons (China) are not centered — use a separate offmap mod
  • If you change gui_scale in-game, restart via the batch file for new positions to take effect
  • The template file (main.gui.template) must remain unmodified — it is the vanilla base the patcher reads from


━ VERSION HISTORY

  • v1.0 — Initial release. Centered topbar (26 elements) and domestic panels (15 files). Auto-patcher for dynamic resolution + gui_scale support. Batch launcher for automatic patching on game start. UTF-8 NO BOM output to prevent CK2 crashes.


  • Submitter
  • Submitted
    03/02/26
  • Category
  • Requirements
    - A Bigger Interface mod — MUST be loaded before CenteredUI
    - PowerShell (included with Windows 10/11)
    - The dependency is set automatically in CenteredUI.mod

 

Edited by santardo

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...