Open Game Engine 2D API
 All Functions Variables
Functions
Map

Functions

int OGE_GetMap ()
 Get the map of current scene.
int OGE_GetMapByName (string sMapName)
 Get the map by name.
string OGE_GetMapName (int iMapId)
 Get the name of the map.
int OGE_GetMapWidth (int iMapId)
 Get the width of the map.
int OGE_GetMapHeight (int iMapId)
 Get the height of the map.
int OGE_GetMapImage (int iMapId)
 Get the image ID of the map.
bool OGE_GetEightDirectionMode (int iMapId)
 Check if the map is in eight-direction mode or not.
void OGE_SetEightDirectionMode (int iMapId, bool value)
 Let the map use eight-direction mode or four-direction mode.
int OGE_GetColumnCount (int iMapId)
 Get column count of the tiles of the map.
int OGE_GetRowCount (int iMapId)
 Get the row count of tiles of the map.
int OGE_GetTileValue (int iMapId, int iTileX, int iTileY)
 Get the value of the tile.
int OGE_SetTileValue (int iMapId, int iTileX, int iTileY, int iValue)
 Set the value of one tile of the map.
void OGE_ReloadTileValues (int iMapId)
 Reload all the values of the tiles form the config file.
void OGE_ResetGameMap (int iMapId)
 Reload all values of the tiles from the config file and reset all tile data to be zero.
int OGE_GetTileData (int iMapId, int iTileX, int iTileY)
 Get the data value of a tile of a map.
int OGE_SetTileData (int iMapId, int iTileX, int iTileY, int iValue)
 Set the value of the data related to a tile of a map.
void OGE_InitTileData (int iMapId, int iInitValue)
 Reset all data of all tiles to be a same value.
void OGE_InitTileValues (int iMapId, int iInitValue)
 Reset the values of all the tiles to be a same number.
bool OGE_PixelToTile (int iMapId, int iPixelX, int iPixelY, int &iTileX, int &iTileY)
 Input the position of the pixel and output the position of the tile (column and row)
bool OGE_TileToPixel (int iMapId, int iTileX, int iTileY, int &iPixelX, int &iPixelY)
 Input the position of the tile (column and row) and output the position of the pixel.
bool OGE_AlignPixel (int iMapId, int iInPixelX, int iInPixelY, int &iOutPixelX, int &iOutPixelY)
 Align pixel to tile.
int OGE_FindWay (int iMapId, int iStartX, int iStartY, int iEndX, int iEndY, int iTileListId)
 Find the way out for walking from one tile to another.
int OGE_FindRange (int iMapId, int iPosX, int iPosY, int iMovementPoints, int iTileListId)
 Find the movement range in a tile map.
int OGE_GetTileListSize (int iTileListId)
 Get the size of the tile list.
int OGE_GetTileXFromList (int iTileListId, int iIndex)
 Get the column number of the tile in the list.
int OGE_GetTileYFromList (int iTileListId, int iIndex)
 Get row number of a tile in a list.
int OGE_GetTileIndexInList (int iTileListId, int iTileX, int iTileY)
 Get the index of a tile in a list.
int OGE_AddTileToList (int iTileListId, int iTileX, int iTileY)
 Add a tile to a list.
int OGE_RemoveTileFromList (int iTileListId, int iIndex)
 Remove a tile from a list.
void OGE_ClearTileList (int iTileListId)
 Clear the tile list.
void OGE_RemoveGameMap (string sName)
 Remove a map by name.

Function Documentation

int OGE_AddTileToList ( int  iTileListId,
int  iTileX,
int  iTileY 
)

Add a tile to a list.

Parameters:
[in]iTileListIdThe ID of the tile list
[in]iTileXThe column number of the tile
[in]iTileYThe row number of the tile
Returns:
The index of the tile in the list
bool OGE_AlignPixel ( int  iMapId,
int  iInPixelX,
int  iInPixelY,
int &  iOutPixelX,
int &  iOutPixelY 
)

Align pixel to tile.

Parameters:
[in]iMapIdThe ID of the map
[in]iInPixelXThe x coordinate of the pixel position
[in]iInPixelYThe y coordinate of the pixel position
[out]iOutPixelXThe x coordinate of the pixel aligned
[out]iOutPixelYthe y coordinate of the pixel aligned
Returns:
Returns true if succeed
void OGE_ClearTileList ( int  iTileListId)

Clear the tile list.

Parameters:
[in]iTileListIdThe ID of the tile list
int OGE_FindRange ( int  iMapId,
int  iPosX,
int  iPosY,
int  iMovementPoints,
int  iTileListId 
)

Find the movement range in a tile map.

Parameters:
[in]iMapIdThe ID of the map
[in]iPosXThe column number of current tile
[in]iPosYThe row number of current tile
[in]iMovementPointsThe points of the movement
[in]iTileListIdThe list of the tiles in the range
Returns:
Returns count of the tiles in the range
int OGE_FindWay ( int  iMapId,
int  iStartX,
int  iStartY,
int  iEndX,
int  iEndY,
int  iTileListId 
)

Find the way out for walking from one tile to another.

Parameters:
[in]iMapIdThe ID of the map
[in]iStartXThe column number of the start position
[in]iStartYThe row number of the start position
[in]iEndXThe column number of the end position
[in]iEndYThe row number of the end position
[in]iTileListIdThe list of the tiles which are used to store the way
Returns:
Returns step counts of the way if succeed
int OGE_GetColumnCount ( int  iMapId)

Get column count of the tiles of the map.

Parameters:
[in]iMapIdThe ID of the map
Returns:
The column count of the tiles of the map
bool OGE_GetEightDirectionMode ( int  iMapId)

Check if the map is in eight-direction mode or not.

Parameters:
[in]iMapIdThe ID of the map
Returns:
Returns true if the map is in eight-direction mode
int OGE_GetMap ( )

Get the map of current scene.

Returns:
The ID of the map
int OGE_GetMapByName ( string  sMapName)

Get the map by name.

Parameters:
[in]sMapNameThe name of the map
Returns:
The ID of the map
int OGE_GetMapHeight ( int  iMapId)

Get the height of the map.

Parameters:
[in]iMapIdThe ID of the map
Returns:
The height of the map
int OGE_GetMapImage ( int  iMapId)

Get the image ID of the map.

Parameters:
[in]iMapIdThe ID of the map
Returns:
The ID of the image
string OGE_GetMapName ( int  iMapId)

Get the name of the map.

Parameters:
[in]iMapIdThe ID of the map
Returns:
The name of the map
int OGE_GetMapWidth ( int  iMapId)

Get the width of the map.

Parameters:
[in]iMapIdThe ID of the map
Returns:
The width of the map
int OGE_GetRowCount ( int  iMapId)

Get the row count of tiles of the map.

Parameters:
[in]iMapIdThe ID of the map
Returns:
The row count of tiles of the map
int OGE_GetTileData ( int  iMapId,
int  iTileX,
int  iTileY 
)

Get the data value of a tile of a map.

Parameters:
[in]iMapIdThe ID of the map
[in]iTileXThe column number of the tile
[in]iTileYThe row number of the tile
Returns:
The value of the data related to the tile
int OGE_GetTileIndexInList ( int  iTileListId,
int  iTileX,
int  iTileY 
)

Get the index of a tile in a list.

Parameters:
[in]iTileListIdThe ID of the tile list
[in]iTileXThe column number of the tile
[in]iTileYThe row number of the tile
Returns:
The index of the tile in the list
int OGE_GetTileListSize ( int  iTileListId)

Get the size of the tile list.

Parameters:
[in]iTileListIdThe ID of the tile list
Returns:
The size of the list
int OGE_GetTileValue ( int  iMapId,
int  iTileX,
int  iTileY 
)

Get the value of the tile.

Parameters:
[in]iMapIdThe ID of the map
[in]iTileXThe column number of the tile
[in]iTileYThe row number of the tile
Returns:
The value of the tile
int OGE_GetTileXFromList ( int  iTileListId,
int  iIndex 
)

Get the column number of the tile in the list.

Parameters:
[in]iTileListIdThe ID of the tile list
[in]iIndexThe index of the tile in the list
Returns:
The column number of the tile
int OGE_GetTileYFromList ( int  iTileListId,
int  iIndex 
)

Get row number of a tile in a list.

Parameters:
[in]iTileListIdThe ID of the tile list
[in]iIndexThe index of the tile in the list
Returns:
The row number of the tile
void OGE_InitTileData ( int  iMapId,
int  iInitValue 
)

Reset all data of all tiles to be a same value.

Parameters:
[in]iMapIdThe ID of the map
[in]iInitValueThe value of all the data
void OGE_InitTileValues ( int  iMapId,
int  iInitValue 
)

Reset the values of all the tiles to be a same number.

Parameters:
[in]iMapIdThe ID of the map
[in]iInitValueThe value for all the tiles
bool OGE_PixelToTile ( int  iMapId,
int  iPixelX,
int  iPixelY,
int &  iTileX,
int &  iTileY 
)

Input the position of the pixel and output the position of the tile (column and row)

Parameters:
[in]iMapIdThe ID of the map
[in]iPixelXThe x coordinate of the pixel position
[in]iPixelYThe y coordinate of the pixel position
[out]iTileXThe column number of the tile
[out]iTileYThe row number of the tile
Returns:
Returns true if succeed
void OGE_ReloadTileValues ( int  iMapId)

Reload all the values of the tiles form the config file.

Parameters:
[in]iMapIdThe ID of the map
void OGE_RemoveGameMap ( string  sName)

Remove a map by name.

Parameters:
[in]sNameThe name of the map
int OGE_RemoveTileFromList ( int  iTileListId,
int  iIndex 
)

Remove a tile from a list.

Parameters:
[in]iTileListIdThe ID of the tile list
[in]iIndexThe index of the tile
Returns:
The size of the list
void OGE_ResetGameMap ( int  iMapId)

Reload all values of the tiles from the config file and reset all tile data to be zero.

Parameters:
[in]iMapIdThe ID of the map
void OGE_SetEightDirectionMode ( int  iMapId,
bool  value 
)

Let the map use eight-direction mode or four-direction mode.

Parameters:
[in]iMapIdThe ID of the map
[in]valueIf true then the map will use eight-direction mode
int OGE_SetTileData ( int  iMapId,
int  iTileX,
int  iTileY,
int  iValue 
)

Set the value of the data related to a tile of a map.

Parameters:
[in]iMapIdThe ID of the map
[in]iTileXThe column number of the tile
[in]iTileYThe row number of the tile
[in]iValueThe value of the data related to the tile
Returns:
Returns the value of the data related to the tile
int OGE_SetTileValue ( int  iMapId,
int  iTileX,
int  iTileY,
int  iValue 
)

Set the value of one tile of the map.

Parameters:
[in]iMapIdThe ID of the map
[in]iTileXThe column number of the tile
[in]iTileYThe row number of the tile
[in]iValueThe value of the tile
Returns:
Return the value of the tile if succeed
bool OGE_TileToPixel ( int  iMapId,
int  iTileX,
int  iTileY,
int &  iPixelX,
int &  iPixelY 
)

Input the position of the tile (column and row) and output the position of the pixel.

Parameters:
[in]iMapIdThe ID of the map
[in]iTileXThe column number of the tile
[in]iTileYThe row number of the tile
[out]iPixelXThe x coordinate of the pixel position
[out]iPixelYThe y coordinate of the pixel position
Returns:
Returns true if succeed