|
|
|
|
@ -2,6 +2,10 @@
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include "../definitions.h"
|
|
|
|
|
#include "../MapObject/mapobject.h"
|
|
|
|
|
#include "../Sprite/sprite.h"
|
|
|
|
|
#include "../Input/inputHandler.h"
|
|
|
|
|
|
|
|
|
|
Selectable * SelectableInit(Texture2D textures[3], Texture2D backgroundTextures[3], int hasBackground, Vector2 *position, char *description,
|
|
|
|
|
int showDescripton, int descriptionLEN, int fontSize, int id, int groupID){
|
|
|
|
|
@ -39,6 +43,14 @@ void SelectableExecuteSelectable(Selectable *selectable, Game * game){
|
|
|
|
|
// Hier sollte eine Bedingung stehen die nur in einem Frame true sein kann
|
|
|
|
|
// Oder das selectable wird abgewählt indem seine ID auf default zurückgesetzt wird
|
|
|
|
|
// Sonst kann das hier jeden Frame passieren. ID wird nicht automatisch zurückgesetzt
|
|
|
|
|
if(IsMouseButtonDown(MOUSE_BUTTON_LEFT)){
|
|
|
|
|
Sprite *new = SpriteCreate(game->textures, TE_BAUSTELLE, game->inputHandler->cursorWorldPos.x, game->inputHandler->cursorWorldPos.y);
|
|
|
|
|
MapObject *newObject = MapObjectInit(new, MO_BAUSTELLE);
|
|
|
|
|
SpriteListInsert(game->sprites, new);
|
|
|
|
|
MapObjectListInsert(game->mapObjects, newObject);
|
|
|
|
|
|
|
|
|
|
selectable->state = SELECTABLE_STATE_DEFAULT;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf("\n\n\n\n\n\n WARNING: Unsupported SELECTABLE ID %d \n\n\n\n\n\n", selectable->id);
|
|
|
|
|
|