Documentation
¶
Overview ¶
The graphics.gd/classdb/PCKPacker is used to create packages that can be loaded into a running project using graphics.gd/classdb/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 graphics.gd/classdb/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 graphics.gd/classdb/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) PckStart(pck_path string) error
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
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 Expanded ¶
func (Expanded) 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.
func (Expanded) Flush ¶
Writes the files specified using all Instance.AddFile calls since the last flush. If 'verbose' is true, a list of files added will be printed to the console for easier debugging.
func (Expanded) PckStart ¶
func (self Expanded) 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).
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.
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 files specified using all Instance.AddFile calls since the last flush. If 'verbose' is true, a list of files added will be printed to the console for easier debugging.