@ -58,7 +58,7 @@ void mouseInput(Game *game){
InputHandler * inputHandler = game - > inputHandler ;
List * sprites = game - > sprites ;
Camera2D * camera = game - > camera ;
IsometricMap * * layers = * ( game - > layers ) ;
IsometricMap * * layers = * game - > layers ;
Texture2D * texture = game - > worker + 4 ;
inputHandler - > cursorPos . x = GetMousePosition ( ) . x ;
@ -127,12 +127,17 @@ void mouseInput(Game *game){
}
// Berechnung, welche Sprites ausgewählt wurden, scuffed
// TODO: ist wirklich sehr scuffed wegen negativen koordinaten etc
// Problem: Theoretisch einfach nur schauen ob unprojected Sprite coords im Rect liegen
// Muss aber unterschieden werden ob width negativ oder so ist, aber einfach abs funktioniert nicht
// So wie es aktuell ist, funktioniert die Auswahl, aber nur solange die Kamera nicht bewegt wird
Vector2 rect = GetRectangle ( inputHandler - > rectStart ) ;
width = abs ( width ) ;
height = abs ( height ) ;
printf ( " Auswahl: x: %f, y: %f, w: %f, h: %f \n " , rect . x , rect . y , width , height ) ;
// TODO: update to World Coordinates
float deltaX ;
float deltaY ;
Node * current = sprites - > head ;
@ -140,8 +145,8 @@ void mouseInput(Game *game){
Vector2 currPos = { current - > data . x , current - > data . y } ;
IsometricMapUnproject ( layers [ 0 ] , camera , currPos . x , currPos . y , & currPos ) ;
deltaX = currPos . x + current - > data . texture - > width / 2 - ( rect . x + camera - > target . x ) ;
deltaY = currPos . y + current - > data . texture - > height / 2 - ( rect . y + camera - > target . y ) ;
deltaX = currPos . x - camera - > target . x - ( rect . x + camera - > target . x ) ;
deltaY = currPos . y - camera - > target . y - ( rect . y + camera - > target . y ) ;
printf ( " deltaX: %f, deltaY: %f \n " , deltaX , deltaY ) ;