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 ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AddFile(target_path string, source_path string) error
- func (self Instance) AddFileRemoval(target_path string) error
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsPCKPacker() Instance
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) Flush() error
- func (self Instance) ID() ID
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) PckStart(pck_path string) error
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- type MoreArgs
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 Extension ¶
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]) AsPCKPacker ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
type 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.
type Instance ¶
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 (Instance) AddFile ¶
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 ¶
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) AsPCKPacker ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) Flush ¶
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) MoreArgs ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
type MoreArgs ¶
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) AddFile ¶
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 ¶
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).