panorama

package
v0.1.119 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package panorama compiles Panorama layouts, scripts and style sheets into the resources the game loads, without Valve's resource compiler, and decompiles layouts back to XML and style sheets back to CSS. The output follows what the resource compiler writes, so the game reads it the same way on every platform.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(addon, path string, source []byte, read func(name string) ([]byte, error)) ([]byte, error)

Compile builds the source at path, such as panorama/layout/hud.xml, panorama/scripts/hud.js or panorama/styles/hud.css inside the addon named addon, into its compiled resource. A layout is parsed into the tree the game reads, a style sheet is minified with its paths rewritten, and a script is stored as it is. read returns a compiled resource by its path, such as panorama/images/x_png.vtex_c, so a sheet records the size of each image it names; a nil read records none, which the game accepts.

func CompileTree

func CompileTree(addon string, tree fs.FS, game func(name string) ([]byte, error)) (fstest.MapFS, error)

CompileTree compiles the addon content directory tree, such as content/citadel_addons/<addon>, into the addon's game files: each layout, script and style sheet under panorama/ becomes its compiled resource, and every other file is kept as it is, so already compiled resources, such as images, ship beside them. Each style sheet under panorama/styles/<dir>/ also gets its sheet layout (see SheetLayout). game reads a file from the game's own archive, such as panorama/images/x_png.vtex_c, so a sheet that names a stock image records its size as the game's sheets do; nil reads none.

func Compiled

func Compiled(source string) (string, bool)

Compiled returns the path of the resource the game loads for a source path, such as panorama/layout/hud.vxml_c for panorama/layout/hud.xml, and whether Compile builds that kind of source.

func Decompile

func Decompile(compiled []byte) (string, error)

Decompile prints a compiled .vxml_c layout as XML that Compile builds back to the same tree, apart from source positions. A layout is the only Panorama resource that needs it; a compiled script's DATA block is its source.

func DecompileFile added in v0.1.92

func DecompileFile(path string, compiled []byte) ([]byte, error)

DecompileFile prints the compiled resource at path as the source Compile builds it from: a layout as XML, a style sheet as CSS and a script as its stored text.

func DecompileStyle added in v0.1.59

func DecompileStyle(compiled []byte) (string, error)

DecompileStyle prints a compiled .vcss_c style sheet with one declaration per line, which Compile builds back to the same text.

func SheetLayout added in v0.1.63

func SheetLayout(name string) (string, []byte, bool)

SheetLayout returns the layout the build writes beside the style sheet at name, such as panorama/layout/<dir>/hud.css.xml for panorama/styles/<dir>/hud.css, with its source, and whether name is such a sheet. The layout includes the sheet and draws nothing, so loading it into a panel styles the panels a script adds beneath it; Modlock's interface renderer loads a mod's sheets this way.

func Source added in v0.1.92

func Source(compiled string) (string, bool)

Source returns the source path of a compiled Panorama resource path, such as panorama/layout/hud.xml for panorama/layout/hud.vxml_c, and whether DecompileFile prints that kind of resource. It inverts Compiled.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL