|
|
|
|
@ -58,7 +58,13 @@ void mouseInput(InputHandler *inputHandler, List *sprites, Texture2D *texture, C
|
|
|
|
|
inputHandler->cursorPos.x = GetMousePosition().x;
|
|
|
|
|
inputHandler->cursorPos.y = GetMousePosition().y;
|
|
|
|
|
|
|
|
|
|
// resetting last selected Tile to grass texture
|
|
|
|
|
IsometricMapChangeTextureIdOfTile(map, (int) inputHandler->selectedTile.x, (int) inputHandler->selectedTile.y, 0);
|
|
|
|
|
// updating selected tile
|
|
|
|
|
IsometricMapProject(map, camera, inputHandler->cursorPos.x, inputHandler->cursorPos.y, &inputHandler->selectedTile);
|
|
|
|
|
// setting currently selected tile to tower
|
|
|
|
|
IsometricMapChangeTextureIdOfTile(map, (int) inputHandler->selectedTile.x, (int) inputHandler->selectedTile.y, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT)){
|
|
|
|
|
if(inputHandler->pressed == 0){
|
|
|
|
|
@ -80,7 +86,6 @@ void mouseInput(InputHandler *inputHandler, List *sprites, Texture2D *texture, C
|
|
|
|
|
|
|
|
|
|
// Add Sprite
|
|
|
|
|
if(width + height <= 1){
|
|
|
|
|
//SpriteAdd(sprites, spriteAmount, texture, inputHandler->cursorPos.x + (*camera).target.x - (texture->width)/2, inputHandler->cursorPos.y + (*camera).target.y - (texture->height)/2);
|
|
|
|
|
ListInsertBack(sprites, SpriteCreate(texture, inputHandler->cursorPos.x + (*camera).target.x - (texture->width)/2, inputHandler->cursorPos.y + (*camera).target.y - (texture->height)/2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -126,7 +131,6 @@ void mouseInput(InputHandler *inputHandler, List *sprites, Texture2D *texture, C
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void keyboardInput(InputHandler *inputHandler, Camera2D *camera){
|
|
|
|
|
if(IsKeyDown(KEY_W)){
|
|
|
|
|
(*camera).target.y -= 1000.0f * GetFrameTime();
|
|
|
|
|
|