#ifndef ISOMETRICMAP_H_ #define ISOMETRICMAP_H_ #include "raylib.h" #include "tile.h" #include "../game.h" 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; } IsometricMap; // returns pointer to IsometricMap Instance IsometricMap * IsometricMapInit(); // For Rendering: calculates coordinate offset for a single tile at arrayPosition x y // Only works for tiles with texture width == height (and for 22.5 degree?) Vector2 * IsometricMapCalcOffsetForTileAt(int x, int y, int halfTextureSize, int quarterTextureSize); // 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 id); // returns Tile * -> tile at coordinates x y z=layer Tile * IsometricMapGetTileFromWorldCoordinates(IsometricMap *isometricMap, float x, float y); // Draws Isometric Map and Sprites in between :) void IsometricMapDraw(Game *game); #endif