This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

So basically im trying i guess, remake an OS within a game engine for a game im working on, i have it so i can resize the window From the Right and bottom, but right now i cant figure out how to Be able to resize it from the Left and top without the length/height moving position

Here's My Code so far, any Ideas as to How i could do this?

extends Panel

# member variables here, example:
# var a=2
# var b="textvar"

func _ready():

func _fixed_process(delta):
    var WindowTop = get_node("Top")
    var WindowOutline = self
    var St_L = get_node("Strech_Left")
    var St_R = get_node("Strech_Right")
    var St_U = get_node("Strech_Up")
    var St_D = get_node("Strech_Down")
    var Drag = get_node("Drag")
    var mouse_pos = get_global_mouse_pos()
    var mx = mouse_pos.x
    var my = mouse_pos.y

    ##Right Dragging
    if St_R.is_pressed():
        WindowOutline.set_size(Vector2(mx - WindowOutline.get_pos().x +5, WindowOutline.get_size().height))
        WindowTop.set_size(Vector2(WindowOutline.get_size().width, WindowTop.get_size().height))
        St_R.set_pos(Vector2(WindowOutline.get_size().width-7, St_R.get_pos().y))
        St_U.set_size(Vector2(WindowOutline.get_size().width, St_U.get_size().height))
        St_D.set_size(Vector2(WindowOutline.get_size().width, St_D.get_size().height))
        Drag.set_size(Vector2(WindowOutline.get_size().width, Drag.get_size().height))

        ##Down Dragging
    elif St_D.is_pressed():
        WindowOutline.set_size(Vector2(WindowOutline.get_size().width, my - WindowOutline.get_pos().y +13))
        St_R.set_size(Vector2(St_R.get_size().width, WindowOutline.get_size().height-41))
        St_L.set_size(Vector2(St_R.get_size().width, WindowOutline.get_size().height-41))
        St_D.set_pos(Vector2(St_D.get_pos().x, my - WindowOutline.get_pos().y))
in Engine by (483 points)

1 Answer

0 votes
Best answer

Found the answer to my problem by using the get_margin and set_margin Rather than x, y, length, and height properties

So this is Solved ;P

by (483 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.