PCKPacker

package
v0.0.0-...-357ca8a Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

The PCKPacker is used to create packages that can be loaded into a running project using ProjectSettings.LoadResourcePack.

package main

import "graphics.gd/classdb/PCKPacker"

func ExamplePCKPacker() {
	var packer = PCKPacker.New()
	packer.PckStart("test.pck")
	packer.AddFile("res://text.txt", "text.txt")
	packer.Flush()
}

The above PCKPacker creates package test.pck, then adds a file named text.txt at the root of the package.

Note: PCK is Godot's own pack file format. To create ZIP archives that can be read by any program, use ZIPPacker instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsPCKPacker() Instance
}

type Expanded

type Expanded = MoreArgs

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsPCKPacker

func (self *Extension[T]) AsPCKPacker() Instance

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.PCKPacker

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddFile

func (self Instance) AddFile(target_path string, source_path string) error

Adds the 'source_path' file to the current PCK package at the 'target_path' internal path. The res:// prefix for 'target_path' is optional and stripped internally. File content is immediately written to the PCK.

func (Instance) AddFileRemoval

func (self Instance) AddFileRemoval(target_path string) error

Registers a file removal of the 'target_path' internal path to the PCK. This is mainly used for patches. If the file at this path has been loaded from a previous PCK, it will be removed. The res:// prefix for 'target_path' is optional and stripped internally.

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsPCKPacker

func (self Instance) AsPCKPacker() Instance

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) Flush

func (self Instance) Flush() error

Writes the file directory and closes the PCK. If 'verbose' is true, a list of files added will be printed to the console for easier debugging.

Note: PCKPacker will automatically flush when it's freed, which happens when it goes out of scope or when it gets assigned with null. In C# the reference must be disposed after use, either with the using statement or by calling the Dispose method directly.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) PckStart

func (self Instance) PckStart(pck_path string) error

Creates a new PCK file at the file path 'pck_path'. The .pck file extension isn't added automatically, so it should be part of 'pck_path' (even though it's not required).

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type MoreArgs

type MoreArgs [1]gdclass.PCKPacker

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) AddFile

func (self MoreArgs) AddFile(target_path string, source_path string, encrypt bool) error

Adds the 'source_path' file to the current PCK package at the 'target_path' internal path. The res:// prefix for 'target_path' is optional and stripped internally. File content is immediately written to the PCK.

func (MoreArgs) Flush

func (self MoreArgs) Flush(verbose bool) error

Writes the file directory and closes the PCK. If 'verbose' is true, a list of files added will be printed to the console for easier debugging.

Note: PCKPacker will automatically flush when it's freed, which happens when it goes out of scope or when it gets assigned with null. In C# the reference must be disposed after use, either with the using statement or by calling the Dispose method directly.

func (MoreArgs) PckStart

func (self MoreArgs) PckStart(pck_path string, alignment int, key string, encrypt_directory bool) error

Creates a new PCK file at the file path 'pck_path'. The .pck file extension isn't added automatically, so it should be part of 'pck_path' (even though it's not required).

Jump to

Keyboard shortcuts

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