main
JanEhehalt 3 years ago
parent 251a876d5f
commit df6d4b1a6c

@ -13,6 +13,4 @@ Fantasy Welt oder Realistisch?
## TODO
- Bug with movement of sprite after spawning a few other sprites
- Drawn Rectangle problems with negative width/height
- Selecting Sprites for moving all selected to the same destination
- Macht es Sinn ein einzelnes "Game" struct zu haben, das alle möglichen Pointer hat zu allen arrays, camera, textures etc?

@ -3,9 +3,6 @@
#include "sprite.h"
#include <stdio.h>
//TODO: Macht es Sinn ein einzelnes "Game" struct zu haben, das alle möglichen Pointer hat zu allen arrays, camera, textures etc?
// Man hat einen Übergabeparameter mit dem man dann alles verändern kann, man muss nicht alles was man verändern will einzeln übergeben
void mouseInput(InputHandler *inputHandler, Sprite *sprites, int *spriteAmount, Texture2D *texture, Camera2D *camera){
inputHandler->cursorPos.x = GetMousePosition().x;
@ -28,7 +25,6 @@ void mouseInput(InputHandler *inputHandler, Sprite *sprites, int *spriteAmount,
float width = GetMousePosition().x - inputHandler->rectStart.x;
float height = GetMousePosition().y - inputHandler->rectStart.y;
if(width + height <= 1){
//printf("Klick\n");
SpriteAdd(sprites, spriteAmount, texture, inputHandler->cursorPos.x + (*camera).target.x - (texture->width)/2, inputHandler->cursorPos.y + (*camera).target.y - (texture->height)/2);
}
}

Binary file not shown.

@ -4,10 +4,8 @@
IsometricMap * IsometricMapInit(int x, int y){
IsometricMap* map = (IsometricMap *) malloc(sizeof(IsometricMap));
//Texture2D textures[10];
map->tileTextures[0] = LoadTexture("assets/grass.png");
map->tileTextures[1] = LoadTexture("assets/tower.png");
//map->tileTextures = textures;
Tile* tiles[x];
int n = 0;
@ -15,15 +13,12 @@ IsometricMap * IsometricMapInit(int x, int y){
tiles[n] = (Tile*)malloc(y*sizeof(Tile));
}
//printf("%ld\n", sizeof(tiles));
map->sizeX = x;
map->sizeY = y;
int i = 0;
int j = 0;
for(i=0; i < x; i++){
for(j=0; j < y; j++){
if(i != j){
@ -44,8 +39,6 @@ IsometricMap * IsometricMapInit(int x, int y){
Vector2 * IsometricMapCalcOffsetForTileAt(int x, int y, int textureSize){
//Vector2 offset = {0, 0};
Vector2* offset = (Vector2 *)malloc(sizeof(Vector2));
offset->x = x * textureSize/2;

@ -5,20 +5,18 @@
typedef struct IsometricMap{
Texture2D tileTextures[10];
//tiles -> two dimensional Array
Tile **tiles;
int sizeX;
int sizeY;
} IsometricMap;
// TODO:
void IsometricMapAddTile(IsometricMap isometricMap);
Tile IsometricMapGetTileFromArrayPosition(int x, int y);
Tile IsometricMapGetTileFromWorldCoordinates(float x, float y);
Vector2 * IsometricMapCalcOffsetForTileAt(int x, int y, int textureSize);
// Working
IsometricMap * IsometricMapInit(int x, int y);
#endif

Binary file not shown.

Binary file not shown.

@ -43,8 +43,6 @@ int main(){
BeginMode2D(camera);
//IsometricRendererRenderMap(&isometricRenderer, 50);
IsometricRendererRenderIsometricMap(map);
int i;

BIN
main.o

Binary file not shown.

BIN
spiel

Binary file not shown.

Binary file not shown.

BIN
tile.o

Binary file not shown.
Loading…
Cancel
Save