Beispiel #1
0
		private void INTERNAL_GenerateDisplayModes()
		{
			List<DisplayMode> modes = new List<DisplayMode>();
			SDL.SDL_DisplayMode filler = new SDL.SDL_DisplayMode();
			int numModes = SDL.SDL_GetNumDisplayModes(displayIndex);
			for (int i = 0; i < numModes; i += 1)
			{
				SDL.SDL_GetDisplayMode(displayIndex, i, out filler);

				// Check for dupes caused by varying refresh rates.
				bool dupe = false;
				foreach (DisplayMode mode in modes)
				{
					if (filler.w == mode.Width && filler.h == mode.Height)
					{
						dupe = true;
					}
				}
				if (!dupe)
				{
					modes.Add(
						new DisplayMode(
							filler.w,
							filler.h,
							SurfaceFormat.Color // FIXME: Assumption!
						)
					);
				}
			}
			supportedDisplayModes = new DisplayModeCollection(modes);
		}
Beispiel #2
0
		public static GraphicsAdapter[] GetGraphicsAdapters()
		{
			SDL.SDL_DisplayMode filler = new SDL.SDL_DisplayMode();
			GraphicsAdapter[] adapters = new GraphicsAdapter[SDL.SDL_GetNumVideoDisplays()];
			for (int i = 0; i < adapters.Length; i += 1)
			{
				List<DisplayMode> modes = new List<DisplayMode>();
				int numModes = SDL.SDL_GetNumDisplayModes(i);
				for (int j = 0; j < numModes; j += 1)
				{
					SDL.SDL_GetDisplayMode(i, j, out filler);

					// Check for dupes caused by varying refresh rates.
					bool dupe = false;
					foreach (DisplayMode mode in modes)
					{
						if (filler.w == mode.Width && filler.h == mode.Height)
						{
							dupe = true;
						}
					}
					if (!dupe)
					{
						modes.Add(
							new DisplayMode(
								filler.w,
								filler.h,
								SurfaceFormat.Color // FIXME: Assumption!
							)
						);
					}
				}
				SDL.SDL_GetCurrentDisplayMode(i, out filler);
				adapters[i] = new GraphicsAdapter(
					new DisplayMode(
						filler.w,
						filler.h,
						SurfaceFormat.Color // FIXME: Assumption!
					),
					new DisplayModeCollection(modes),
					SDL.SDL_GetDisplayName(i)
				);
			}
			return adapters;
		}