You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.7 KiB
59 lines
1.7 KiB
#ifndef ISOMETRICMAP_H_
|
|
#define ISOMETRICMAP_H_
|
|
#include "raylib.h"
|
|
#include "tile.c"
|
|
|
|
typedef struct IsometricMap{
|
|
// Array with all the needed textures for this layer
|
|
Texture2D tileTextures[10];
|
|
|
|
// twodimensional array of all the tiles in this layer
|
|
Tile ***tiles;
|
|
|
|
// amount of tiles in x-direction
|
|
int width;
|
|
|
|
// amount of tiles in y-direction
|
|
int height;
|
|
|
|
// pixel width of a single tile texture
|
|
int textureWidth;
|
|
|
|
// pixel height of a single tile texture
|
|
int textureHeight;
|
|
|
|
// pixel width of the entire map
|
|
int worldPixelWidth;
|
|
|
|
// pixel height of the entire map
|
|
int worldPixelHeight;
|
|
|
|
// layer of the map
|
|
int layer;
|
|
} IsometricMap;
|
|
|
|
// returns pointer to IsometricMap Instance
|
|
IsometricMap * IsometricMapInit(int layer);
|
|
|
|
// For Rendering: calculates
|
|
Vector2 * IsometricMapCalcOffsetForTileAt(int x, int y, int textureSize);
|
|
|
|
Tile * IsometricMapGetMostUpperTile(IsometricMap **isometricMap, Tile *tile);
|
|
|
|
Tile * IsometricMapGetTileFromArrayPosition(IsometricMap *isometricMap, int x, int y);
|
|
|
|
// Project: Screen Coordinates -> World Coordinates writes result in tmp Vector
|
|
// Currently only calcing coords on layer 0
|
|
void IsometricMapProject(IsometricMap *isometricMap, Camera2D *camera, float x, float y, Vector2 *tmp);
|
|
|
|
// Unproject: World Coordinates -> Screen Coordinates writes result in tmp Vector
|
|
void IsometricMapUnproject(IsometricMap **isometricMap, Camera2D *camera, int x, int y, float z, Vector2 *tmp);
|
|
|
|
// changes to Texture ID of tile at x y on maplayer layer
|
|
void IsometricMapChangeTextureIdOfTile(IsometricMap **map, int x, int y, int layer, int id);
|
|
|
|
Tile * IsometricMapGetTileFromWorldCoordinates(IsometricMap **isometricMap, float x, float y, float layer);
|
|
|
|
|
|
#endif
|