ZtaF Class¶
The ZtaF class is the main class for parsing and working with Zoo Tycoon 1 animation graphic files.
Source code in include/ztalib/ZtaF.h and src/ZtaF.cpp.
Import¶
Import the ZtaF class as so:
class ZtaF¶
class ZtaF
{
ZtaF();
std::shared_ptr<ZtaData> load(
std::string fileName,
int colorProfile = 0,
std::string ioPal = ""
);
void save(std::string fileName);
std::shared_ptr<ZtaData> data();
std::vector<ZtaFrameBufferObject> getFrameBuffer();
};
Example¶
meth load¶
std::shared_ptr<ZtaData> load(
std::string fileName,
int colorProfile = 0,
std::string ioPal = ""
);
Load a ZtaF file from disk. Returns a std::shared_ptr to a ZtaData object containing the parsed data.
Example
| Parameter | Description |
|---|---|
fileName |
The path to the ZtaF file to load. |
colorProfile |
(Optional) The color profile to use when parsing the file. 0 == RGBA, 1 == BGRA |
ioPal |
(Optional) The path to a PalF file to use for color information. If not provided, the parser will attempt to extract the correct palette from the ZtaF file. |
| Parameter | Description |
|---|---|
file_name |
The path to the ZtaF file to load. |
color_profile |
(Optional) The color profile to use when parsing the file. 0 == RGBA, 1 == BGRA |
io_pal |
(Optional) The path to a PalF file to use for color information. If not provided, the parser will attempt to extract the correct palette from the ZtaF file. |
meth save¶
Save the current data to a ZtaF file on disk.
Example
#include "ztalib/ZtaF.h"
int main()
{
ZtaF zta;
// Assume data is loaded and modified
zta.save("path/to/new_file", "path/to/project", "path/to/palette");
}
| Parameter | Description |
|---|---|
fileName |
The path to the ZtaF file to save. |
projectRoot |
The root directory of the project. |
palettePath |
The path to the palette file to reference in the ZtaF file. This should be a relative path from the project root. |
from pyzta import ZtaF
zta = ZtaF()
# Assume data is loaded and modified
zta.save("path/to/new_file", "path/to/project", "path/to/palette")
| Parameter | Description |
|---|---|
file_name |
The path to the ZtaF file to save. |
project_root |
The root directory of the project. |
palette_path |
The path to the palette file to reference in the ZtaF file. This should be a relative path from the project root. |
meth data¶
Returns a std::shared_ptr to the ZtaData object containing the parsed data. This can be used after calling load to access the parsed data.
Example
meth getFrameBuffer¶
Returns a std::vector of ZtaFrameBufferObjects containing the frame buffer data for each frame in the animation. This is the primary buffer that can be used for rendering the animation frames to compatible graphics APIs.
Example