Archived

This topic is now archived and is closed to further replies.

Telamon

Dynamically Rescaleable GUI

Recommended Posts

Hello, It''s a common problem among application developers: designing a GUI that looks good at resolutions ranging from 800x600 to 1600x1200 and up. I''m writing a windowed DirectX game (a space exploration elite-like game) that is going to have a rather large set of GUI controls. I definately want to use Visual Studio''s form designer to draw controls on the screen (on the side of the screen, not in the DirectX window). I''ve been researching other approaches for a while now, and they are all much too involved and don''t lend themselves to rapid development. I like to develop incrementally and add new features as I get something that is playable. Thus I don''t know what the final GUI will look like and I want to be able to rearrange things easily, thus the need for the form designer. The problem is, when you lay controls on a form, they normally don''t resize to different resolutions. I''m developing on a 1600x1200 laptop and I want to design the game to look good on my own machine (or what the hell is the point), but I also want people on crappy computers to be able to play. One thing that I though might work would be to lay out the controls so that they look good on a 1024x768 screen, render them to a DirectDraw surface (is this even possible?) and then let DirectX smoothly rescale the image to the native screen size. I would write an intermediate input handler to map mouse clicks and keypresses to the right control (since pixel coords would change when rescaling). The only real problem is that I suspect drawing windows controls involves GDI directly locking the surface (I know it does, in fact) and this is slow. Also, the code for drawing the controls is not designed with performance in mind. Is there a better way? I''ve looked into third party GUI libraries - but they are all garbage. They might be good for the occasional dialog box, but I absolutely don''t want to write code to explicitely place 200 different controls on a sidebar when VS will let me simply draw them (and if let you decide to rearrange some of those 200 controls, changing the pixel coords by hand will make me cry at the tedium). Otherwise, something like GLGooey (or GLOW, I guess) might be attractive, since it renders to a OpenGL surface (and thus rescales nicely). Any input would be greatly appreciated! ---------------------------------------- Let be be finale of seem, seems to me. ---------------------------------------- Coding: http://www.stanford.edu/~jjshed/coding Miscellany: http://www.stanford.edu/~jjshed

Share this post


Link to post
Share on other sites
If I understand you correctly – you are creating a windowed game and you’re using Windows controls in a panel along the side of the main window.

If that is the case then I would suggest that you design the controls at the lowest resolution that you want to support (800x600) and leave it at that


Dave "Dak Lozar" Loeser

Share this post


Link to post
Share on other sites
I assume you''ve read the excellent series of articles here at gamedev.net aobut developing a GUI with c++ and directx (http://www.gamedev.net/reference/articles/article994.asp). The only problem with this tutorial is that the author decides to write his own dialog layout tool rather than use visual studio''s, which he claims took him an entire month. I think a better solution would be to use visual studio to design your GUI and then work out a scheme to translate the resulting .rc to a format which your game can work with directly. Good luck.

Share this post


Link to post
Share on other sites
so far i helped myself with relative coords. percent instead of pixels and multiply it with the current resolution before drawing.
of course its more work and the numbers less easy to interpret. another option: do it for one resolution (like 800x600) and before drawing divided by 800/600 to get percent and multiply with current resolution.

wouldnt know of any drag and drop editors or gui libs that do it this way, so you would again have some work do write one yourself or change an existing one.

Share this post


Link to post
Share on other sites
As for the flash GUI, it''s possible, but it''s not easy to write a Flash renderer... however, I''ve seen someone working on it, it was mentioned in GD-General or something... but it was incomplete and still not usable. I''d suggest using relative coordinates.

--------
Leave all your expectations behind, or
they''ll pull you down on your way to the top.

-Ivan

Share this post


Link to post
Share on other sites
Use 10''000 x 10''000 as virtual coordinates (as suggested in the GUI tutorial series by Mason on this very site). Your editor would probably have a 4:3 dimension editable area so that what you see in the editor is how you''ll see it on any resolution. When the window gadgets are loaded from file just scale the coordinates for the current resolution.

Share this post


Link to post
Share on other sites