Fullscreen Derma

How do I make a Window that is fullscreen for all windows and each of its Child objects are in the portion(sorry if I didn’t spell that right)? I know ScrH() and SrchW() will help.


local frame = vgui.Create("DFrame")
frame:SetPos(0,0)
frame:SetSize(ScrW(),ScrH()
frame:SetTitle("Fullscreen Frame")

Like that?

Yea but the real problem I don’t know how to make the child objects change too. For Example lets say I got a Frame with 4 equal size squares and they take the whole frame up(which is fullscreen).

Erm, if you’re talking about resizing, that’s a bit tougher. Really, if you want to resize, you have to set each child individually along with the parents. If that’s what not what you’re talking about, then I’m not really sure what you’re asking for.

Yea I’m talking about resizing sorry for not being clear

Well, I think if you did:

[lua]frame:SetSize(ScrW(), ScrH())
//More code here
square1:SetSize(frame:GetWide()/4, frame:GetTall()/4)
square1:SetPos(5,5)
//more code
square2:SetSize(frame:GetWide()/4, GetTall()/4)
square2:SetPos(frame:GetWide()/2 + 5,5)
//more code
square3:SetPos(5, frame:GetTall()/2 + 5)
//more code
square4:SetPos(frame:GetWide()/2 + 5/ frame:GetTall()/2 + 5)[/lua]

I do just think that may work, not sure may just give you errors, but it just might work because it is resizing for every kind of screen the client have.

The above post said it pretty well, however, I would clean it up a bit:

[lua]
local wide, height = ScrW(), ScrH()
frame:SetSize(wide, height)
//More code here
square1:SetSize(wide/4, height)/4)
square1:SetPos(5,5)
//more code
square2:SetSize(wide/4, height/4)
square2:SetPos(wide/2 + 5,5)
//more code
square3:SetPos(5, height/2 + 5)
//more code
square4:SetPos(wide/2 + 5/ height/2 + 5)
[/lua]

But then it wouldn’t be inside the frame :sigh:

1/4 the size of the parent frame != divide width and height by 4. Imagine your screen: Now cut it in half horizontally. Now cut that in half vertically. What do you have? 1/4 of your originally screen. You’re working on two dimensions, so dividing each by 4 is actually going to get you 1/16 the original size. Yay fractions.

[lua]local width, height = ScrW(), ScrH()
//Make ur frame
frame:SetSize(width, height)
//Make square1
square1:SetSize(width/2, height/2) --Now set size
square1:SetPos(0,0) --Now set pos
//Make square2
square2:SetSize(width/2, height/2)
square2:SetPos(width/2, 0)
//Make square3
square3:SetSize(width/2, height/2)
square2:SetPos(0, height/2)
//Make square4
square4:SetSize(width/2, height/2)
square4:SetPos(width/2, height/2)
[/lua]

Whatever you guys were doing before with your +5’s and whatnot isn’t going to work because you didn’t size them accordingly - not only that but there’s not reason for the offset if they are supposed to take up the whole screen.

I will go in game and code something up maybe and see if I can get the desired effect you were looking for.