class ui_system { int base_window(ui_system::window win, int xb, int yb, int zb); int window(int xw, int yw, int zw); } ui_system; int ui_system::window(int xw, int yw, int zw) { //draw window and set it's default position } int ui_system::base_window(ui_system::window win, int xb, int yb, int zb){ win.xw = xb/2 //however you would do that... this would center the window inside the base window on the x axis win.yw = yb/2 //same thing but for y axis } int main(int argc, char *Argv[]) { ui_system uis; int windowhandle uis.window(10,10,1); uis.base_window(windowhandle, 25, 25, 0); };