ID:273355
 
This is related to an Interface file. I've created a new window, problem is it spawns at the top of the screen. I'm asking how I would be able to make it centered in the middle of the screen. I have tried basically moving it when editing the window but that did not work. I'm also not sure if coding would fix this or if there is a special way to edit the file. Help would be greatly appreciated.

-ZMD Productions
winset(src,windowname,"pos=100x100")


That isn't the POS to center but that's how I get my windows to center. Just find the center by adjusting the pos.
In response to Gizhy
That worked exactly how I wanted thanks a lot.
// Gets the screen x and y size of our player's resolution.
proc/get_screen(screen_size, client/c)

// Find the resolution divider "x" exp: 1920x1020
var/x_pos = findtext(screen_size, "x")

// Copy from the beginning of the screen size to x.
var/_x = copytext(screen_size, 1, x_pos)

// Set our client variable,to _x as a number.
c.screen_x = text2num(_x)

// Copy from x to the end of the string.
var/_y = copytext(screen_size, x_pos+1, 0)

// Do the same for y.
c.screen_y = text2num(_y)

client

// These variables don't need to be saved. \
They will be used to break down the player's resolution.

var/tmp/screen_x
var/tmp/screen_y

// When a new human connects our world.
New()
. = ..()

// Maximize your main window, be sure to have a control \
located in it. Preferably a child.

winset(src, "main_window","is-maximized = true")

// Get the size of the control.
var/screen_size = winget(src, "main_window.main_child", "size")

// Set it back to it's normal size.
winset(src, "main_window", "is-maximized = false")

// Call our get_screen() procedure using the correct arguments.
get_screen(screen_size, src)

// Set the windows position on the screen. To, center you will \
need to add the width of your window like below.

winset(src, "main_window", "pos = [(src.screen_x + 640) / (4)],[(src.screen_y / 4)]")


I just thought I would through this out there. It works best if you make the window you are using transparent, and the window doesn't have a status bar, title bar, etc. You can change these at runtime.
In response to ZMD Productions
No problem.
In response to ZMD Productions
Just remember that not everyone has the same resolution as you.

Similar to Ulterior Motives, but this one works:
//STEP 1! create a new interface window, I'm naming mine RESIZEPLX. Make it invisible and just throw it in a corner, you're done with it.

client
var
res_x
res_y
proc
icanhasresize()
//resize that "RESIZEPLX" window to a high number, it'll auto adjust size to your screen resolution
winset(src,"RESIZEPLX","size=9001x9001")
//bla bla
var/sizexy=winget(src,"RESIZEPLX","size")
res_x=text2num(copytext(sizexy,1,findtext(sizexy,"x")))
res_y=text2num(copytext(sizexy,findtext(sizexy,"x")+1))
New()
..()
//can you has?
icanhasresize()
//center using simple math
winset(src,"MAINWINDOWw.e","pos=[round((res_x-800)/2)]x[round((res_y-600)/2)]")
//800x600 being my window's dimensions <.<