summaryrefslogtreecommitdiff
path: root/scene/main/viewport.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/viewport.h')
-rw-r--r--scene/main/viewport.h40
1 files changed, 38 insertions, 2 deletions
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index e717d27069..278350b1c9 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -31,7 +31,7 @@
#ifndef VIEWPORT_H
#define VIEWPORT_H
-#include "math_2d.h"
+#include "core/math/transform_2d.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
#include "scene/resources/world_2d.h"
@@ -45,10 +45,12 @@ class Camera2D;
class Listener;
class Control;
class CanvasItem;
+class CanvasLayer;
class Panel;
class Label;
class Timer;
class Viewport;
+class CollisionObject;
class ViewportTexture : public Texture {
@@ -163,6 +165,7 @@ private:
Camera *camera;
Set<Camera *> cameras;
+ Set<CanvasLayer *> canvas_layers;
RID viewport;
RID current_canvas;
@@ -203,7 +206,25 @@ private:
List<Ref<InputEvent> > physics_picking_events;
ObjectID physics_object_capture;
ObjectID physics_object_over;
+ Transform physics_last_object_transform;
+ Transform physics_last_camera_transform;
+ ObjectID physics_last_id;
Vector2 physics_last_mousepos;
+ struct {
+
+ bool alt;
+ bool control;
+ bool shift;
+ bool meta;
+ int mouse_mask;
+
+ } physics_last_mouse_state;
+
+ void _collision_object_input_event(CollisionObject *p_object, Camera *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape, bool p_discard_empty_motion);
+
+ bool handle_input_locally;
+ bool local_input_handled;
+
void _test_new_mouseover(ObjectID new_collider);
Map<ObjectID, uint64_t> physics_2d_mouseover;
@@ -251,7 +272,7 @@ private:
bool key_event_accepted;
Control *mouse_focus;
Control *mouse_click_grabber;
- int mouse_focus_button;
+ int mouse_focus_mask;
Control *key_focus;
Control *mouse_over;
Control *tooltip;
@@ -274,6 +295,7 @@ private:
bool roots_order_dirty;
List<Control *> roots;
int canvas_sort_index; //for sorting items with canvas as root
+ bool dragging;
GUI();
} gui;
@@ -353,6 +375,12 @@ private:
void _camera_remove(Camera *p_camera);
void _camera_make_next_current(Camera *p_exclude);
+ friend class CanvasLayer;
+ void _canvas_layer_add(CanvasLayer *p_canvas_layer);
+ void _canvas_layer_remove(CanvasLayer *p_canvas_layer);
+
+ void _drop_mouse_focus();
+
protected:
void _notification(int p_what);
static void _bind_methods();
@@ -474,6 +502,14 @@ public:
void _subwindow_visibility_changed();
+ void set_input_as_handled();
+ bool is_input_handled() const;
+
+ void set_handle_input_locally(bool p_enable);
+ bool is_handling_input_locally() const;
+
+ bool gui_is_dragging() const;
+
Viewport();
~Viewport();
};