1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #include "position_2d.h"
- #include "core/engine.h"
- #include "scene/resources/texture.h"
- void Position2D::_draw_cross() {
- draw_line(Point2(-10, 0), Point2(+10, 0), Color(1, 0.5, 0.5));
- draw_line(Point2(0, -10), Point2(0, +10), Color(0.5, 1, 0.5));
- }
- Rect2 Position2D::_edit_get_rect() const {
- return Rect2(Point2(-10, -10), Size2(20, 20));
- }
- bool Position2D::_edit_use_rect() const {
- return false;
- }
- void Position2D::_notification(int p_what) {
- switch (p_what) {
- case NOTIFICATION_ENTER_TREE: {
- update();
- } break;
- case NOTIFICATION_DRAW: {
- if (!is_inside_tree())
- break;
- if (Engine::get_singleton()->is_editor_hint())
- _draw_cross();
- } break;
- }
- }
- Position2D::Position2D() {
- }
|