Some progress on selecting, hovering but still buggy and not a good design really.

This commit is contained in:
Sebastian
2024-11-17 02:40:31 +01:00
parent 55926a5021
commit e9633ff19d
10 changed files with 99 additions and 37 deletions
+19 -3
View File
@@ -1,11 +1,13 @@
#pragma once
#include "interactable.h"
#include "moveable.h"
#include "raylib.h"
#include "selectable.h"
#include "state.h"
#include "vmath.h"
namespace VISEQ::BASE {
class Draggable : public Movable, public Interactable{
class Draggable : public Movable, public Selectable{
public:
Draggable() {}
Draggable(float x, float y) : Movable(Vec2Df(x, y), 960.0f) {}
@@ -17,7 +19,7 @@ namespace VISEQ::BASE {
bool picked_up = false;
virtual bool pickedUp() {
if(clicked() && held()) {
if(clicked() && held() && state->istate == APP::InteractionState::HOVER_NODE) {
picked_up = true;
drag_offset = position - state->screen_mouse;
}
@@ -35,5 +37,19 @@ namespace VISEQ::BASE {
virtual void putDown(){
picked_up = false;
}
virtual void select() override {
selected = (state->keys_down.shift && selected) || CheckCollisionPointRec(position, state->selection);
/**/
/*//std::cout << "select" << std::endl;*/
/*if(CheckCollisionPointRec(position, state->selection)) {*/
/* in_selection_rect = true;*/
/*} else {*/
/* in_selection_rect = false;*/
/*}*/
/*if(released() && in_selection_rect) selected = true;*/
/*if(released() && !in_selection_rect) selected = false;*/
}
};
}