本文整理汇总了C#中GameWindowFlags类的典型用法代码示例。如果您正苦于以下问题:C# GameWindowFlags类的具体用法?C# GameWindowFlags怎么用?C# GameWindowFlags使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameWindowFlags类属于命名空间,在下文中一共展示了GameWindowFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameWindow
/// <summary>Constructs a new GameWindow with the specified attributes.</summary>
/// <param name="width">The width of the GameWindow in pixels.</param>
/// <param name="height">The height of the GameWindow in pixels.</param>
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GameWindow.</param>
/// <param name="title">The title of the GameWindow.</param>
/// <param name="options">GameWindow options regarding window appearance and behavior.</param>
/// <param name="device">The OpenTK.Graphics.DisplayDevice to construct the GameWindow in.</param>
public GameWindow(int width, int height, GraphicsMode mode, string title, bool nullContext,
GameWindowFlags options, DisplayDevice device)
: base(width, height, title, options, mode, device)
{
try {
glContext = nullContext ? new NullContext() :
Factory.Default.CreateGLContext(mode, WindowInfo);
glContext.MakeCurrent(WindowInfo);
glContext.LoadAll();
VSync = true;
} catch (Exception e) {
Debug.Print(e.ToString());
base.Dispose();
throw;
}
}
示例2: Initialize
static public void Initialize(Size resolution, int msaasamples, string mediapath, GameWindowFlags flags = GameWindowFlags.Default)
{
StartTime = DateTime.Now;
MSAASamples = msaasamples;
World = new World();
Media.SearchPath = mediapath;
Media.LoadFileMap();
ShadowMaps = new ShadowMapsArrayTexture(512, 512);
Resolution = resolution;
SetCurrentThreadCores(1);
ShaderPool = new ShaderPool();
var thread = Task.Factory.StartNew(() =>
{
SetCurrentThreadCores(2);
DisplayAdapter = new VEngineWindowAdapter("VEngine App", resolution.Width, resolution.Height, flags);
GraphicsSettings.UseDeferred = true;
GraphicsSettings.UseRSM = false;
GraphicsSettings.UseVDAO = true;
GraphicsSettings.UseFog = false;
GraphicsSettings.UseBloom = false;
GraphicsSettings.UseLightPoints = true;
DisplayAdapter.CursorVisible = false;
Invoke(() => Initialized = true);
DisplayAdapter.Run();
});
while(!Initialized)
;
}
示例3: Sdl2NativeWindow
public Sdl2NativeWindow(int x, int y, int width, int height,
string title, GameWindowFlags options, DisplayDevice device)
{
lock (sync)
{
var bounds = device.Bounds;
var flags = TranslateFlags(options);
flags |= WindowFlags.OPENGL;
flags |= WindowFlags.HIDDEN;
if (Toolkit.Options.EnableHighResolution)
{
flags |= WindowFlags.ALLOW_HIGHDPI;
}
if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 ||
(flags & WindowFlags.FULLSCREEN) != 0)
window_state = WindowState.Fullscreen;
if ((flags & WindowFlags.RESIZABLE) == 0)
window_border = WindowBorder.Fixed;
IntPtr handle;
lock (SDL.Sync)
{
handle = SDL.CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
exists = true;
}
ProcessEvents();
window = new Sdl2WindowInfo(handle, null);
window_id = SDL.GetWindowID(handle);
windows.Add(window_id, this);
}
}
示例4: Sdl2NativeWindow
public Sdl2NativeWindow(int x, int y, int width, int height,
string title, GameWindowFlags options, DisplayDevice device)
{
lock (sync)
{
var bounds = device.Bounds;
var flags = TranslateFlags(options);
flags |= WindowFlags.OPENGL;
flags |= WindowFlags.RESIZABLE;
flags |= WindowFlags.HIDDEN;
flags |= WindowFlags.ALLOW_HIGHDPI;
if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 ||
(flags & WindowFlags.FULLSCREEN) != 0)
window_state = WindowState.Fullscreen;
IntPtr handle;
lock (SDL.Sync)
{
EventFilterDelegate = Marshal.GetFunctionPointerForDelegate(EventFilterDelegate_GCUnsafe);
handle = SDL.CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
SDL.AddEventWatch(EventFilterDelegate, handle);
SDL.PumpEvents();
}
window = new Sdl2WindowInfo(handle, null);
window_id = SDL.GetWindowID(handle);
windows.Add(window_id, this);
window_title = title;
exists = true;
}
}
示例5: Main
public Main(GraphicsMode mode, string title, GameWindowFlags flags)
: base((int)Constants.Graphics.ScreenResolution.X, (int)Constants.Graphics.ScreenResolution.Y, mode, title, flags)
{
Engines = new List<Engine>();
Constants.SetupEngines(this);
Constants.Engines.Input.SetMouseShow(false);
}
示例6: SDL2GLNative
public SDL2GLNative(int x, int y, int width, int height, string title,
GraphicsMode mode,GameWindowFlags options, DisplayDevice device)
: this()
{
if (width <= 0)
throw new ArgumentOutOfRangeException("width", "Must be higher than zero.");
if (height <= 0)
throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");
Debug.Indent();
IntPtr windowId;
desiredSizeX = width;
desiredSizeY = height;
isFullscreen = options.HasFlag(GameWindowFlags.Fullscreen);
if (isFullscreen)
{
FixupFullscreenRes(width,height,out width, out height);
}
lock (API.sdl_api_lock) {
API.Init (API.INIT_VIDEO);
API.VideoInit("",0);
// NOTE: Seriously, letting the user set x and y coords is a _bad_ idea. We'll let the WM take care of it.
windowId = API.CreateWindow(title, 0x1FFF0000, 0x1FFF0000, width, height, API.WindowFlags.OpenGL | ((isFullscreen)?API.WindowFlags.Fullscreen:0));
}
window = new SDL2WindowInfo(windowId);
inputDriver = new SDL2Input(window);
Debug.Unindent();
}
示例7: LinuxNativeWindow
public LinuxNativeWindow(IntPtr display, IntPtr gbm, int fd,
int x, int y, int width, int height, string title,
GraphicsMode mode, GameWindowFlags options,
DisplayDevice display_device)
{
Debug.Print("[KMS] Creating window on display {0:x}", display);
Title = title;
display_device = display_device ?? DisplayDevice.Default;
if (display_device == null)
{
throw new NotSupportedException("[KMS] Driver does not currently support headless systems");
}
window = new LinuxWindowInfo(display, fd, gbm, display_device.Id as LinuxDisplay);
// Note: we only support fullscreen windows on KMS.
// We implicitly override the requested width and height
// by the width and height of the DisplayDevice, if any.
width = display_device.Width;
height = display_device.Height;
bounds = new Rectangle(0, 0, width, height);
client_size = bounds.Size;
if (!mode.Index.HasValue)
{
mode = new EglGraphicsMode().SelectGraphicsMode(window, mode, 0);
}
Debug.Print("[KMS] Selected EGL mode {0}", mode);
SurfaceFormat format = GetSurfaceFormat(display, mode);
SurfaceFlags usage = SurfaceFlags.Rendering | SurfaceFlags.Scanout;
if (!Gbm.IsFormatSupported(gbm, format, usage))
{
Debug.Print("[KMS] Failed to find suitable surface format, using XRGB8888");
format = SurfaceFormat.XRGB8888;
}
Debug.Print("[KMS] Creating GBM surface on {0:x} with {1}x{2} {3} [{4}]",
gbm, width, height, format, usage);
IntPtr gbm_surface = Gbm.CreateSurface(gbm,
width, height, format, usage);
if (gbm_surface == IntPtr.Zero)
{
throw new NotSupportedException("[KMS] Failed to create GBM surface for rendering");
}
window.Handle = gbm_surface;
Debug.Print("[KMS] Created GBM surface {0:x}", window.Handle);
window.CreateWindowSurface(mode.Index.Value);
Debug.Print("[KMS] Created EGL surface {0:x}", window.Surface);
cursor_default = CreateCursor(gbm, Cursors.Default);
cursor_empty = CreateCursor(gbm, Cursors.Empty);
Cursor = MouseCursor.Default;
exists = true;
}
示例8: GLWindow
/// <summary>
///
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="name"></param>
/// <param name="fullscreen"></param>
public GLWindow(int width, int height, string name, GameWindowFlags fullscreen)
: base(width, height, GraphicsMode.Default, name, fullscreen, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible)
{
Renderables = new List<IRenderable>();
ClearColor = new Color4();
OnLoadFunction = null;
OnUpdateFunction = null;
KeyEvents = new Dictionary<Key, Action>();
MouseEvents = new Dictionary<MouseInformation, Action>();
}
示例9: RouteViewer
//Deliberately specify the default constructor with various overrides
public RouteViewer(int width, int height, GraphicsMode currentGraphicsMode, string openbve, GameWindowFlags @default): base (width,height,currentGraphicsMode,openbve,@default)
{
try
{
System.Drawing.Icon ico = new System.Drawing.Icon("data\\icon.ico");
this.Icon = ico;
}
catch
{
}
}
示例10: WinGLNative
public WinGLNative(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device)
{
WindowProcedureDelegate = WindowProcedure;
// To avoid issues with Ati drivers on Windows 6+ with compositing enabled, the context will not be
// bound to the top-level window, but rather to a child window docked in the parent.
window = new WinWindowInfo(
CreateWindow(x, y, width, height, title, options, device, IntPtr.Zero), null);
child_window = new WinWindowInfo(
CreateWindow(0, 0, ClientSize.Width, ClientSize.Height, title, options, device, window.WindowHandle), window);
exists = true;
}
示例11: OpenBVEGame
//We need to explicitly specify the default constructor
public OpenBVEGame(int width, int height, GraphicsMode currentGraphicsMode, GameWindowFlags @default): base(width, height, currentGraphicsMode, Interface.GetInterfaceString("program_title"), @default)
{
try
{
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
System.Drawing.Icon ico = new System.Drawing.Icon(OpenBveApi.Path.CombineFile(OpenBveApi.Path.CombineDirectory(assemblyFolder, "Data"), "icon.ico"));
this.Icon = ico;
}
catch
{
}
}
示例12: DefaultWindow
public DefaultWindow(DefaultDevice device, int width, int height, ref SwapChainDescription implicitSwapChainDescription,
string title, GameWindowFlags gameWindowFlags, DisplayDevice displayDevice, ref Context glContext)
: base(width, height, GraphicsMode.Default, title, gameWindowFlags, displayDevice)
{
glContext = glContext ?? new Context(Context);
this.glContext = glContext;
this.device = device;
implicitSwapChainDesc = implicitSwapChainDescription;
swapChainSurfaces = new SwapChainSurfaces(device, width, height, ref implicitSwapChainDescription);
keyboard = new Keyboard(this);
mouse = new Mouse(this);
}
示例13: DesktopViewController
public DesktopViewController(Type rootClass, int windowWidth, int windowHeight, string windowTitle,
GameWindowFlags windowFlags, DisplayDevice device, GraphicsContextFlags flags)
: base(windowWidth, windowHeight, GraphicsMode.Default, windowTitle, windowFlags, device, -1, -1, flags)
{
Console.WriteLine("Sparrow-sharp: Starting");
_rootClass = rootClass;
Load += HandleLoad;
RenderFrame += HandleRenderFrame;
Mouse.Move += OnMouseMove;
Mouse.ButtonDown += OnMouseButtonChange;
Mouse.ButtonUp += OnMouseButtonChange;
// Run the game at 60 updates per second
Run(60.0);
}
示例14: Program
public Program(int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device,
int major, int minor, GraphicsContextFlags flags, IGraphicsContext sharedContext)
: base(width, height, title, options,
mode == null ? GraphicsMode.Default : mode,
device == null ? DisplayDevice.Default : device)
{
try
{
glContext = new GraphicsContext(mode == null ? GraphicsMode.Default : mode, WindowInfo, major, minor, flags);
glContext.MakeCurrent(WindowInfo);
(glContext as IGraphicsContextInternal).LoadAll();
}
catch (Exception e)
{
Debug.Print(e.ToString());
base.Dispose();
throw;
}
}
示例15: Sdl2NativeWindow
public Sdl2NativeWindow(int x, int y, int width, int height,
string title, GameWindowFlags options, DisplayDevice device)
{
lock (sync)
{
var bounds = device.Bounds;
var flags = TranslateFlags(options);
flags |= SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL;
flags |= SDL.SDL_WindowFlags.SDL_WINDOW_RESIZABLE;
flags |= SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN;
if ((flags & SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP) != 0 ||
(flags & SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN) != 0)
window_state = WindowState.Fullscreen;
IntPtr handle;
lock (SDL.Sync)
{
handle = SDL.SDL_CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
SDL.SDL_AddEventWatch(EventFilterDelegate, handle);
SDL.SDL_PumpEvents();
}
window = new Sdl2WindowInfo(handle, null);
window_id = SDL.SDL_GetWindowID(handle);
windows.Add(window_id, this);
window_title = title;
keyboard.Description = "Standard keyboard";
keyboard.NumberOfFunctionKeys = 12;
keyboard.NumberOfKeys = 101;
keyboard.NumberOfLeds = 3;
mouse.Description = "Standard mouse";
mouse.NumberOfButtons = 3;
mouse.NumberOfWheels = 1;
keyboards.Add(keyboard);
mice.Add(mouse);
exists = true;
}
}