This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
Content Optimization
Materials
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::TileSetFile Class

Header: #include <UnigineTilesetFile.h>

This class is used to create a tileset file — the file that keeps data that is based on X and Y indices. The values of X and Y are limited to the integer and can be both positive and negative. The maximum size of the tile is limited to 2Gb. The maximum size of a tileset is limited to the unsigned integer value. Tileset files are stored using the .UTS and .UTSH formats.

TilesetFile Class

Members


static TilesetFilePtr create ( ) #

Constructor. Creates a tileset file.

int getNumTiles ( ) #

Returns the number of tiles in the tileset file.

Return value

Number of tiles.

long long getOffset ( int x, int y ) #

Returns the offset for the tile with specified coordinates.

Arguments

  • int x - X-coordinate value.
  • int y - Y-coordinate value.

Return value

Offset value.

int isOpened ( ) #

Returns a value indicating if the tileset file is opened.

Return value

1 if the tileset file is opened; otherwise, 0.

int setTile ( int x, int y, unsigned char * data, int force = 1 ) #

Sets the data of the specified tile by copying from the source buffer.

Arguments

  • int x - X-coordinate value.
  • int y - Y-coordinate value.
  • unsigned char * data - Source buffer.
  • int force - Force flag.
    • If 1 is specified, the data will be updated immediately.
    • If 0 is specified, the data will be updated only when the flushHeader() method is called.
    Notice
    To improve performance it is recommended to set this flag to 0 to accumulate multiple tile update operations and apply them all at once by calling the flushHeader() method.

Return value

1, if the operation was successful; otherwise, 0.

int getTile ( int x, int y, unsigned char * data ) #

Copies the data of the specified tile to the destination buffer.

Arguments

  • int x - X-coordinate value.
  • int y - Y-coordinate value.
  • unsigned char * data - Destination buffer.

Return value

1, if the operation was successful; otherwise, 0.

int getTilePos ( int num, int & x, int & y ) #

Retrieves the coordinates of the tile with a given index and puts them to x and y respectively.

Arguments

  • int num - Tile index.
  • int & x - X-coordinate of the tile.
  • int & y - Y-coordinate of the tile.

Return value

1, if the operation was successful; otherwise, 0.

int getTileSize ( ) #

Returns the size of the tile for the tileset file.

Return value

Tile size.

int close ( ) #

Closes the tileset file.

Return value

1, if the operation was successful; otherwise, 0.

int createFile ( const char * name, int tile_size ) #

Creates a tileset file with a given name and tile size.

Arguments

  • const char * name - File name.
  • int tile_size - Tile size.

Return value

1, if the operation was successful; otherwise, 0.

int flushHeader ( ) #

Applies all pending setTile() and removeTile() operations.
Notice
The tileset file must be opened.

Return value

1, if the operation was successful; otherwise, 0.

int hasTile ( int x, int y ) #

Returns a value indicating if there is a tile with the specified coordinates in the file.

Arguments

  • int x - X-coordinate value.
  • int y - Y-coordinate value.

Return value

1, if the file contains the specified tile; otherwise, 0.

int load ( const char * name ) #

Loads the given tileset file.

Arguments

  • const char * name - File name.

Return value

1, if the operation was successful; otherwise, 0.

int removeTile ( int x, int y, int force = 1 ) #

Removes the tile with specified coordinates from the file.

Arguments

  • int x - X-coordinate value.
  • int y - Y-coordinate value.
  • int force - Force flag.
    • If 1 is specified, the data will be updated immediately.
    • If 0 is specified, the data will be updated only when the flushHeader() method is called.
    Notice
    To improve performance it is recommended to set this flag to 0 to accumulate multiple tile update operations and apply them all at once by calling the flushHeader() method.

Return value

1, if the operation was successful; otherwise, 0.

int setDoubleAttribute ( const char * name, double value, int force = 1 ) #

Sets the given value for the attribute with the specified name.

Arguments

  • const char * name - Attribute name.
  • double value - Attribute value.
  • int force - Force flag.
    • If 1 is specified, the data will be updated immediately.
    • If 0 is specified, the data will be updated only when the flushAttributes() method is called.
    Notice
    To improve performance it is recommended to set this flag to 0 to accumulate multiple tile update operations and apply them all at once by calling the flushAttributes() method.

Return value

1, if the operation was successful; otherwise, 0.

double getDoubleAttribute ( const char * name ) #

Returns the current value of the attribute with the specified name.

Arguments

  • const char * name - Attribute name.

Return value

Attribute value.

int setIntAttribute ( const char * name, int value, int radix = 10, int force = 1 ) #

Sets the given value for the attribute with the specified name.

Arguments

  • const char * name - Attribute name.
  • int value - Attribute value to be set.
  • int radix - Numerical base used to represent the value as a string, one of the following values:
    • 2 - binary
    • 10 - octal
    • 10 - decimal
    • 16 - hexadecimal
  • int force - Force flag.
    • If 1 is specified, the data will be updated immediately.
    • If 0 is specified, the data will be updated only when the flushAttributes() method is called.
    Notice
    To improve performance it is recommended to set this flag to 0 to accumulate multiple tile update operations and apply them all at once by calling the flushAttributes() method.

Return value

1, if the operation was successful; otherwise, 0.

int getIntAttribute ( const char * name ) #

Returns the current value of the attribute with the specified name.

Arguments

  • const char * name - Attribute name.

Return value

Attribute value.

int setFloatAttribute ( const char * name, float value, int force = 1 ) #

Sets the given value for the attribute with the specified name.

Arguments

  • const char * name - Attribute name.
  • float value - Attribute value to be set.
  • int force - Force flag.
    • If 1 is specified, the data will be updated immediately.
    • If 0 is specified, the data will be updated only when the flushAttributes() method is called.
    Notice
    To improve performance it is recommended to set this flag to 0 to accumulate multiple tile update operations and apply them all at once by calling the flushAttributes() method.

Return value

1, if the operation was successful; otherwise, 0.

float getFloatAttribute ( const char * name ) #

Returns the current value of the attribute with the specified name.

Arguments

  • const char * name - Attribute name.

Return value

Attribute value.

int hasAttribute ( const char * name ) #

Returns a value indicating if an attribute with the specified name exists in the tileset file.

Arguments

  • const char * name - Attribute name.

Return value

1, if an attribute with the specified name exists; otherwise, 0.

int setAttribute ( const char * name, const char * value, int force = 1 ) #

Sets the given value for the attribute with the specified name.

Arguments

  • const char * name - Attribute name.
  • const char * value - Attribute value to be set as a string.
  • int force - Force flag.
    • If 1 is specified, the data will be updated immediately.
    • If 0 is specified, the data will be updated only when the flushAttributes() method is called.
    Notice
    To improve performance it is recommended to set this flag to 0 to accumulate multiple tile update operations and apply them all at once by calling the flushAttributes() method.

Return value

1, if the operation was successful; otherwise, 0.

String getAttribute ( const char * name ) #

Returns the current value of the attribute with the specified name.

Arguments

  • const char * name - Attribute name.

Return value

Attribute value as a string.

int removeAttribute ( const char * name, int force = 1 ) #

Removes the attribute with the given name.

Arguments

  • const char * name - Name of the attribute to be removed.
  • int force - Force flag.
    • If 1 is specified, the data will be updated immediately.
    • If 0 is specified, the data will be updated only when the flushAttributes() method is called.
    Notice
    To improve performance it is recommended to set this flag to 0 to accumulate multiple tile update operations and apply them all at once by calling the flushAttributes() method.

Return value

1, if the operation was successful; otherwise, 0.

int flushAttributes ( ) #

Applies all pending setAttribute(), setDoubleAttribute(), setIntAttribute(), setFloatAttribute()and removeAttribute() operations.
Notice
The tileset file must be opened.

Return value

1, if the operation was successful; otherwise, 0.

Vector< String > getAttributeNames ( ) #

Returns the list of names of all attributes in the tileset file.

Return value

Vector containing names of all attributes in the tileset file.
Last update: 2021-04-29
Build: ()