PCKPacker

package
v0.0.0-...-c858641 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 22 Imported by: 0

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

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 [1]gdclass.PCKPacker

func (Expanded) AddFile

func (self Expanded) 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.

func (Expanded) Flush

func (self Expanded) Flush(verbose bool) error

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

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.

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 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 (Instance) ID

func (self Instance) ID() ID

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

Jump to

Keyboard shortcuts

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