|
From: Jason H. <jas...@bt...> - 2001-10-17 04:20:44
|
Assuming that you need the x coordinate of the left most character in the string you need to output then the formula is fairly simple. left_coord = (area_width - text_width) / 2 Area_width meaning the width of whatever you are trying to center the text into. The formular is the same weather you are using console mode text, or pixels in a window. If you want to center verticaly then just use height values instead. If you don't understand why this works then just ask and I will explain it. It depends upon what environment you are working in as to how to clear the screen. In a console you could just scroll the entire area off view, althought there may be a dedicated function that clears the screen but I don't know it. Anyone else? If you are working in OpenGL or DirectX then there is probably a function to do it, but I don't know much about them so you should refer to the documentation if necessary. Jason. ----- Original Message ----- From: "Mansoor Nathani" <man...@sy...> To: "Dev users" <dev...@li...> Sent: Wednesday, October 17, 2001 6:44 AM Subject: [Dev-C++] simle formatting > I cant seem to be able to clear the screen. > > Another problem I am facing is the aligning of text. If I need to output > text, aligned in the centre, is there some sort of predefined function > to do that? > > Any help would be greatly appreciated. > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |