From ac70e60dc226331bf8479cead85ff86e2567d9d5 Mon Sep 17 00:00:00 2001 From: Sara Date: Wed, 29 Oct 2025 23:14:11 +0100 Subject: [PATCH] feat: started work on pinboard mechanics --- modules/you_done_it/pinboard.cpp | 14 ++++++++++++++ modules/you_done_it/pinboard.h | 13 +++++++++++++ modules/you_done_it/pinned_photo.cpp | 14 ++++++++++++++ modules/you_done_it/pinned_photo.h | 15 +++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 modules/you_done_it/pinboard.cpp create mode 100644 modules/you_done_it/pinboard.h create mode 100644 modules/you_done_it/pinned_photo.cpp create mode 100644 modules/you_done_it/pinned_photo.h diff --git a/modules/you_done_it/pinboard.cpp b/modules/you_done_it/pinboard.cpp new file mode 100644 index 00000000..99442b15 --- /dev/null +++ b/modules/you_done_it/pinboard.cpp @@ -0,0 +1,14 @@ +#include "pinboard.h" +#include "pinned_photo.h" + +void Pinboard::_bind_methods() { +} + +void Pinboard::enter_tree() { + connect("body_entered", callable_mp(this, &self_type::on_body_entered)); +} + +void Pinboard::on_body_entered(Node2D *node) { + if (PinnedPhoto * photo{ cast_to(node) }) { + } +} diff --git a/modules/you_done_it/pinboard.h b/modules/you_done_it/pinboard.h new file mode 100644 index 00000000..8963918e --- /dev/null +++ b/modules/you_done_it/pinboard.h @@ -0,0 +1,13 @@ +#pragma once + +#include "scene/2d/physics/area_2d.h" + +class Pinboard : public Area2D { + GDCLASS(Pinboard, Area2D); + static void _bind_methods(); + void enter_tree(); + void on_body_entered(Node2D *node); + +protected: + void _notification(int what); +}; diff --git a/modules/you_done_it/pinned_photo.cpp b/modules/you_done_it/pinned_photo.cpp new file mode 100644 index 00000000..35a7f285 --- /dev/null +++ b/modules/you_done_it/pinned_photo.cpp @@ -0,0 +1,14 @@ +#include "pinned_photo.h" +#include "macros.h" + +void PinnedPhoto::_bind_methods() { + BIND_PROPERTY(Variant::BOOL, can_drop); +} + +void PinnedPhoto::set_can_drop(bool value) { + this->can_drop = value; +} + +bool PinnedPhoto::get_can_drop() const { + return this->can_drop; +} diff --git a/modules/you_done_it/pinned_photo.h b/modules/you_done_it/pinned_photo.h new file mode 100644 index 00000000..ac752626 --- /dev/null +++ b/modules/you_done_it/pinned_photo.h @@ -0,0 +1,15 @@ +#pragma once + +#include "scene/2d/physics/animatable_body_2d.h" + +class PinnedPhoto : public AnimatableBody2D { + GDCLASS(PinnedPhoto, AnimatableBody2D); + static void _bind_methods(); + +public: + void set_can_drop(bool value); + bool get_can_drop() const; + +private: + bool can_drop{ false }; +};