Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Services contain GraphicsDeviceManager by default

$
0
0

@johmarjac wrote:

Hi,

I wanted to know how MonoGame can detect whether no GraphicsDeviceManager has been instantiated, I figoured that out by looking at the source, it's adding it to the Services. This means the Services always contain a reference to the GraphicsDeviceManager.

Now my question, can I safely use this:
var deviceManager = (GraphicsDeviceManager)Services.GetService<IGraphicsDeviceService>();

to change display settings while MonoGame is already running?
I am asking because I wanted to use that in my yet to implement GUI Options later to change display settings in the game. I think I will implement GUI with a normal DrawableGameComponent.. and since that one got reference to Game I can use Services and these contain GraphicsDeviceManager... Instead I would have to pass the GraphicsDeviceManager from my class that inherits from Game to GUI somehow which is crappy.

Thanks in advance.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles