Advertisement

Viewports or Clipping of Windows/Menus inside of game

Started by October 21, 2018 09:11 PM
0 comments, last by Chrispikula 6 years, 3 months ago

So I'm getting to the point in my engine design that I'm trying to implement some dynamic menus.  It's going well, until I've hit a recent conceptual stumbling block that I'm not how to sure to get around.  It has to do with drawing resizable, internally scrollable windows inside each monitor.

Some background first.

I'm creating a multi-monitor capable game, so I needed to roll my own GUI.  The window & menu system works, for fixed sized windows.  My menus are all made many sprites, utilizing DirectXTK SpriteBatch, and text via SpriteFont.  I load the images using WICTextureLoader. 

For the case where I have activated elements in a window exceed the size of the window, that's okay.  They need to be visible, and there's only one active element at a time.  The problem comes with hiding passive elements as they are scrolled out of their parent window, and then drawn outside of it.  Also of note:  I have a *single* application drawing to all of the monitors, not multiple applications drawing to multiple monitors.  So solutions based around options that use the singleton pattern are not workable.  (This, sadly, omits most GUI frameworks).

I've looked at using viewports, but I can't seem to get them to work properly when I'm dealing with multi-monitor displays, especially when the monitors have different resolutions, and are not aligned perfectly.  I'm not even sure where to begin if I have overlapping viewports, ie, overlapping windows.

Should I keep struggling with viewports, or should I look into a way of dynamically clipping the images/text/sprites as they are edged out of the windows?  If so, what is such a technique called, and where can I read up more on it?

Or am I missing a forest for the trees, and there's an easy solution to my problem that I've overlooked?

 

This topic is closed to new replies.

Advertisement