|
|
|
|
@ -19,7 +19,7 @@ int main(){
|
|
|
|
|
int pressed = 0;
|
|
|
|
|
Vector2 rectStart = {0,0};
|
|
|
|
|
|
|
|
|
|
texture = LoadTexture("amulet.png");
|
|
|
|
|
texture = LoadTexture("assets/amulet.png");
|
|
|
|
|
|
|
|
|
|
int j = 0;
|
|
|
|
|
struct Sprite cursor = {&texture, 450, 225};
|
|
|
|
|
@ -54,7 +54,7 @@ int main(){
|
|
|
|
|
cursor.x = GetMousePosition().x - texture.width / 2;
|
|
|
|
|
cursor.y = GetMousePosition().y - texture.height / 2;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
/*
|
|
|
|
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)){
|
|
|
|
|
printf("Klick\n");
|
|
|
|
|
addSprite(sprites, &j, &texture, cursor.x + camera.target.x, cursor.y + camera.target.y);
|
|
|
|
|
@ -63,8 +63,8 @@ int main(){
|
|
|
|
|
|
|
|
|
|
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT)){
|
|
|
|
|
if(pressed == 0){
|
|
|
|
|
rectStart.x = cursor.x;
|
|
|
|
|
rectStart.y = cursor.y;
|
|
|
|
|
rectStart.x = GetMousePosition().x;
|
|
|
|
|
rectStart.y = GetMousePosition().y;
|
|
|
|
|
pressed = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -72,14 +72,23 @@ int main(){
|
|
|
|
|
if(pressed){
|
|
|
|
|
float width = GetMousePosition().x - rectStart.x;
|
|
|
|
|
float height = GetMousePosition().y - rectStart.y;
|
|
|
|
|
|
|
|
|
|
DrawRectangleLines(rectStart.x, rectStart.y, width, height, GREEN);
|
|
|
|
|
if(width + height > 1){
|
|
|
|
|
//TODO: Fallunterscheidung für negative width / height?
|
|
|
|
|
// Auslagern in eigene Funktion
|
|
|
|
|
DrawRectangleLines(rectStart.x, rectStart.y, width, height, GREEN);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT)){
|
|
|
|
|
pressed = 0;
|
|
|
|
|
float width = GetMousePosition().x - rectStart.x;
|
|
|
|
|
float height = GetMousePosition().y - rectStart.y;
|
|
|
|
|
if(width + height <= 1){
|
|
|
|
|
printf("Klick\n");
|
|
|
|
|
addSprite(sprites, &j, &texture, cursor.x + camera.target.x, cursor.y + camera.target.y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)){
|
|
|
|
|
|