|
|
|
@ -1,6 +1,7 @@
|
|
|
|
#include "isometricRenderer.h"
|
|
|
|
#include "isometricRenderer.h"
|
|
|
|
#include "raylib.h"
|
|
|
|
#include "raylib.h"
|
|
|
|
#include "isometricMap.h"
|
|
|
|
#include "isometricMap.h"
|
|
|
|
|
|
|
|
#include "../Input/inputHandler.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: Isometric Tilemap Struct, which can be scanned for clicked Tile
|
|
|
|
//TODO: Isometric Tilemap Struct, which can be scanned for clicked Tile
|
|
|
|
@ -34,10 +35,7 @@ void IsometricRendererDrawMap(IsometricRenderer *renderer, int height){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IsometricRendererRenderIsometricMap(IsometricMap *map){
|
|
|
|
void IsometricRendererRenderIsometricMap(IsometricMap *map, InputHandler *input){
|
|
|
|
|
|
|
|
|
|
|
|
float originX = 0.0f;
|
|
|
|
|
|
|
|
float originY = 0.0f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
int j = 0;
|
|
|
|
int j = 0;
|
|
|
|
@ -45,13 +43,13 @@ void IsometricRendererRenderIsometricMap(IsometricMap *map){
|
|
|
|
for(j=0; j < map->sizeY; j++){
|
|
|
|
for(j=0; j < map->sizeY; j++){
|
|
|
|
Vector2 *offset = IsometricMapCalcOffsetForTileAt(i,j, map->tileTextures[0].width);
|
|
|
|
Vector2 *offset = IsometricMapCalcOffsetForTileAt(i,j, map->tileTextures[0].width);
|
|
|
|
|
|
|
|
|
|
|
|
float x = originX + offset->x;
|
|
|
|
float x = map->originX + offset->x;
|
|
|
|
float y = originY + offset->y;
|
|
|
|
float y = map->originY + offset->y;
|
|
|
|
|
|
|
|
|
|
|
|
// TODO -> results in Segmentation fault
|
|
|
|
// TODO -> results in Segmentation fault
|
|
|
|
//int textureId = map->tiles[i][j].textureId;
|
|
|
|
//int textureId = map->tiles[i][j].textureId;
|
|
|
|
int textureId = 0;
|
|
|
|
int textureId = 0;
|
|
|
|
if(i + j == 9){
|
|
|
|
if(i == input->selectedTile.x && j == input->selectedTile.y){
|
|
|
|
textureId = 1;
|
|
|
|
textureId = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DrawTexture(map->tileTextures[textureId], x, y, WHITE);
|
|
|
|
DrawTexture(map->tileTextures[textureId], x, y, WHITE);
|
|
|
|
|