/// <summary> /// Create a window /// </summary> /// <param name="title">title for the window</param> /// <param name="x">x position</param> /// <param name="y">y position</param> /// <param name="width">width of the window</param> /// <param name="height">height of the window</param> /// <param name="flags">flags for window</param> public Window( string title, int x, int y, int width, int height, WindowFlags flags = ( WindowFlags.AllowHighDpi | WindowFlags.Shown ) ) : base( Engine.Instance.GetModule <GraphicsModule>().GraphicsService.PrimaryDevice, Convert.ToUInt32(width), Convert.ToUInt32(height) ) { Windows.Add(this); _graphicsModule = Engine.Instance.GetModule <GraphicsModule>(); _nativeWindow = new NativeWindow( _graphicsModule.GraphicsService, title, x, y, width, height, (SDL_WindowFlags)flags ); _swapchain = new Swapchain( _graphicsModule.GraphicsService.PrimaryDevice, _nativeWindow ); _fence = new Fence(_graphicsModule.GraphicsService.PrimaryDevice); }
/// <summary> /// ウィンドウ名と画像の表示モードと始めから表示しておく画像を指定して初期化 /// </summary> /// <param name="name">ウィンドウの識別に用いられるウィンドウ名で,ウィンドウのタイトルバ ーに表示される.</param> /// <param name="flags">ウィンドウのフラグ</param> /// <param name="image">ウィンドウに表示する画像</param> #else /// <summary> /// Creates a window /// </summary> /// <param name="name">Name of the window which is used as window identifier and appears in the window caption. </param> /// <param name="image">Image to be shown.</param> /// <param name="flags">Flags of the window. Currently the only supported flag is WindowMode.AutoSize. /// If it is set, window size is automatically adjusted to fit the displayed image (see cvShowImage), while user can not change the window size manually. </param> #endif public Window(string name, Mat?image = null, WindowFlags flags = WindowFlags.AutoSize) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Null or empty window name.", nameof(name)); } this.name = name; NativeMethods.HandleException( NativeMethods.highgui_namedWindow(name, (int)flags)); if (image != null) { ShowImage(image); } trackbars = new Dictionary <string, CvTrackbar>(); if (!Windows.ContainsKey(name)) { Windows.Add(name, this); } callbackHandle = null; }
public static unsafe bool BeginDock(string label, ref bool opened, WindowFlags extraflags) { fixed(bool *ptr = &opened) { return(igBeginDock(label, (IntPtr)ptr, (int)extraflags)); } }
public static bool BeginChild(string name, LayoutOptions?options, WindowFlags extra_flags) { bool open = true; var window = GetCurrentWindow(); var id = window.GetID(name); var childWindowContainer = window.RenderTree.CurrentContainer.GetNodeById(id); if (childWindowContainer == null) { childWindowContainer = new Node(id, name); childWindowContainer.AttachLayoutGroup(true); if (options.HasValue) { childWindowContainer.RuleSet.ApplyOptions(options); } else { childWindowContainer.RuleSet.ApplyOptions(GUILayout.ExpandWidth(true).ExpandHeight(true)); } } window.RenderTree.CurrentContainer.AppendChild(childWindowContainer); childWindowContainer.ActiveSelf = true; if (childWindowContainer.Rect.Width == 0 || childWindowContainer.Rect.Height == 0) { return(false); } WindowFlags flags = WindowFlags.NoTitleBar | WindowFlags.NoResize | WindowFlags.ChildWindow | WindowFlags.VerticalScrollbar; return(GUI.Begin(name, ref open, childWindowContainer.Rect.TopLeft, childWindowContainer.Rect.Size, 1.0, flags | extra_flags)); }
public FigureEditor(QGraphicsScene c, QWidget parent, string name, WindowFlags f) : base(c, parent) { SetObjectName(name); SetWindowFlags(f); SetRenderHint(RenderHint.Antialiasing | RenderHint.SmoothPixmapTransform); }
public Window(string title, int x, int y, int width, int height, WindowFlags flags) { if (String.IsNullOrEmpty(title)) { title = "SharpDL Window"; } Title = title; X = x; Y = y; Width = width; Height = height; List <WindowFlags> copyFlags = new List <WindowFlags>(); foreach (WindowFlags flag in Enum.GetValues(typeof(WindowFlags))) { if (flags.HasFlag(flag)) { copyFlags.Add(flag); } } Flags = copyFlags; Handle = SDL.SDL_CreateWindow(this.Title, this.X, this.Y, this.Width, this.Height, (SDL.SDL_WindowFlags)flags); if (Handle == IntPtr.Zero) { throw new InvalidOperationException(String.Format("SDL_CreateWindow: {0}", SDL.SDL_GetError())); } }
private static WindowFlags TranslateFlags(GameWindowFlags flags) { WindowFlags windowFlags = WindowFlags.Default; if ((flags & GameWindowFlags.Fullscreen) != 0) { if (Sdl2Factory.UseFullscreenDesktop) { windowFlags |= WindowFlags.FULLSCREEN_DESKTOP; } else { windowFlags |= WindowFlags.FULLSCREEN; } #if TIZEN // disable SDL indicator windowFlags |= WindowFlags.BORDERLESS; #endif } if ((flags & GameWindowFlags.FixedWindow) == 0) { windowFlags |= WindowFlags.RESIZABLE; } return(windowFlags); }
public Window(string title, int w, int h, WindowFlags flags = WindowFlags.None) : base(SDL_CreateWindow( Util.FromString(title), WindowPositionCentered, WindowPositionCentered, w, h, flags)) { }
internal Window CreateWindow(string name, Point position, Size size, WindowFlags flags) { var window = new Window(MainForm, name, position, size, flags); this.Windows.Add(window); return(window); }
public static Window CreateWindow(string title, int x, int y, int w, int h, WindowFlags flags) { var titlePtr = Marshal.StringToHGlobalAnsi(title); var window = SDL_CreateWindow(titlePtr, x, y, w, h, flags); Marshal.FreeHGlobal(titlePtr); return(window); }
public static bool igBeginPopupModal(string name, ref bool p_opened, WindowFlags extra_flags) { byte value = p_opened ? (byte)1 : (byte)0; bool result = igBeginPopupModal(name, &value, extra_flags); p_opened = value == 1 ? true : false; return(result); }
public static extern Window SDL_CreateWindow( /*const char*/ byte *title, int x, int y, int w, int h, WindowFlags flags );
public static unsafe bool BeginWindow(string windowTitle, ref bool opened, WindowFlags flags) { byte openedLocal = opened ? (byte)1 : (byte)0; bool ret = ImGuiNative.igBegin(windowTitle, &openedLocal, flags); opened = openedLocal != 0; return(ret); }
public static bool BeginWindowCenter(string title, int width, int height, WindowFlags flags = WindowFlags.Default) { var size = CenterWindow(width, height); ImGui.SetNextWindowPos(new ImGuiVector2(size.X, size.Y), Condition.Appearing, new ImGuiVector2(1, 1)); ImGui.SetNextWindowSize(new ImGuiVector2(size.Z, size.W), Condition.Appearing); return(ImGui.BeginWindow(title, flags)); }
Window BuildWindow() { ScreenRect wRect = new ScreenRect(Window.Center, Window.Center, 640, 480); WindowFlags wFlags = WindowFlags.Shown; RendererFlags rFlags = RendererFlags.Accelerated | RendererFlags.PresentVSync; return(new Window(windowID, "heng", wRect, wFlags, rFlags)); }
public static void SetWindowPosition(IntPtr windowHandle, Rect rect, bool resizeWindow = true) { WindowFlags flags = resizeWindow ? (WindowFlags.AsyncWindowPos | WindowFlags.NoZOrder) : (WindowFlags.AsyncWindowPos | WindowFlags.NoZOrder | WindowFlags.NoSize); if (rect.Left > 0 && rect.Right > 0 && rect.Top > 0 && rect.Bottom > 0) { SetWindowPos(windowHandle, 0, rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top, (int)flags); } }
internal IntPtr CreateGlfwWindow(string title, int width, int height, WindowFlags flags) { GLFW.WindowHint(GLFW_Enum.VISIBLE, false); GLFW.WindowHint(GLFW_Enum.FOCUS_ON_SHOW, true); GLFW.WindowHint(GLFW_Enum.FOCUSED, true); GLFW.WindowHint(GLFW_Enum.TRANSPARENT_FRAMEBUFFER, flags.HasFlag(WindowFlags.Transparent)); GLFW.WindowHint(GLFW_Enum.SCALE_TO_MONITOR, flags.HasFlag(WindowFlags.ScaleToMonitor)); GLFW.WindowHint(GLFW_Enum.SAMPLES, flags.HasFlag(WindowFlags.MultiSampling) ? 4 : 0); GLFW.WindowHint(GLFW_Enum.MAXIMIZED, flags.HasFlag(WindowFlags.Maximized)); IntPtr shared = IntPtr.Zero; if (App.Graphics is IGraphicsOpenGL && windowPointers.Count > 0) { shared = windowPointers[0]; } var monitor = IntPtr.Zero; if (flags.HasFlag(WindowFlags.Fullscreen)) { monitor = GLFW.GetPrimaryMonitor(); } // create the GLFW Window and return thr pointer var ptr = GLFW.CreateWindow(width, height, title, monitor, shared); if (ptr == IntPtr.Zero) { GLFW.GetError(out string error); throw new Exception($"Unable to create a new Window: {error}"); } windowPointers.Add(ptr); // create the Vulkan surface if (App.Graphics is IGraphicsVulkan vkGraphics) { var vkInstance = vkGraphics.GetVulkanInstancePointer(); var result = GLFW.CreateWindowSurface(vkInstance, ptr, IntPtr.Zero, out var surface); if (result != GLFW_VkResult.Success) { throw new Exception($"Unable to create a Vulkan Surface, {result}"); } vkSurfaces.Add(ptr, surface); } // show window if (!flags.HasFlag(WindowFlags.Hidden)) { GLFW.ShowWindow(ptr); } return(ptr); }
/// <summary> /// Initializes a new instance of the <see cref="NamedWindow"/> class with the /// specified name. /// </summary> /// <param name="name">The name of the window in the window caption.</param> /// <param name="flags">The flags of the window.</param> public NamedWindow(string name, WindowFlags flags = WindowFlags.AutoSize) { if (name == null) { throw new ArgumentNullException("name"); } this.name = name; NativeMethods.cvNamedWindow(name, flags); }
/// <summary> /// Creates a window. /// </summary> /// <param name="winName">Name of the window in the window caption that may be used as a window identifier.</param> /// <param name="flags"> /// Flags of the window. Currently the only supported flag is CV WINDOW AUTOSIZE. If this is set, /// the window size is automatically adjusted to fit the displayed image (see imshow ), and the user can not change the window size manually. /// </param> public static void NamedWindow(string winName, WindowFlags flags = WindowFlags.Normal) { if (string.IsNullOrEmpty(winName)) { throw new ArgumentException("null or empty string.", nameof(winName)); } NativeMethods.HandleException( NativeMethods.highgui_namedWindow(winName, (int)flags)); }
/// <summary> /// Initializes a new instance of the <see cref="Window"/> class with <paramref name="title"/> as the title of the Window. /// </summary> /// <param name="title">Title of the window, see Text property.</param> public unsafe Window(string title) { WindowFlags flags = WindowFlags.WindowAllowHighdpi; #if STRIDE_GRAPHICS_API_OPENGL flags |= WindowFlags.WindowOpengl; #elif STRIDE_GRAPHICS_API_VULKAN flags |= WindowFlags.WindowVulkan; #endif #if STRIDE_PLATFORM_ANDROID || STRIDE_PLATFORM_IOS flags |= WindowFlags.WindowBorderless | WindowFlags.WindowFullscreen | WindowFlags.WindowShown; #else flags |= WindowFlags.WindowHidden | WindowFlags.WindowResizable; #endif // Create the SDL window and then extract the native handle. sdlHandle = SDL.CreateWindow(title, Sdl.WindowposUndefined, Sdl.WindowposUndefined, 640, 480, (uint)flags); #if STRIDE_PLATFORM_ANDROID || STRIDE_PLATFORM_IOS GraphicsAdapter.DefaultWindow = sdlHandle; #endif if (sdlHandle == null) { throw new Exception("Cannot allocate SDL Window: " + SDL.GetErrorS()); } SysWMInfo info = default; SDL.GetVersion(&info.Version); if (!SDL.GetWindowWMInfo(sdlHandle, &info)) { throw new Exception("Cannot get Window information: " + SDL.GetErrorS()); } if (Core.Platform.Type == Core.PlatformType.Windows) { Handle = info.Info.Win.Hwnd; } else if (Core.Platform.Type == Core.PlatformType.Linux) { Handle = (IntPtr)info.Info.X11.Window; Display = (IntPtr)info.Info.X11.Display; } else if (Core.Platform.Type == Core.PlatformType.Android) { Handle = (IntPtr)info.Info.Android.Window; Surface = (IntPtr)info.Info.Android.Surface; } else if (Core.Platform.Type == Core.PlatformType.macOS) { Handle = (IntPtr)info.Info.Cocoa.Window; } Application.RegisterWindow(this); Application.ProcessEvents(); }
/// <summary> /// Starts running the Application /// You must register the System Module before calling this /// </summary> public static void Start(string title, int width, int height, WindowFlags flags = WindowFlags.ScaleToMonitor, Action?callback = null) { if (Running) { throw new Exception("App is already running"); } if (Exiting) { throw new Exception("App is still exiting"); } Name = title; Log.Message(Name, $"Version: {Version}"); Log.Message(Name, $"Platform: {RuntimeInformation.OSDescription} ({RuntimeInformation.OSArchitecture})"); Log.Message(Name, $"Framework: {RuntimeInformation.FrameworkDescription}"); #if DEBUG Launch(); #else try { Launch(); } catch (Exception e) { Log.Error(e); Log.WriteTo("ErrorLog.txt"); throw e; } #endif void Launch() { // init modules Modules.ApplicationStarted(); if (!Modules.Has <System>()) { throw new Exception("App requires a System Module to be registered before it can Start"); } // our primary Window primaryWindow = new Window(System, title, width, height, flags); Modules.FirstWindowCreated(); // startup application Running = true; Modules.Startup(); callback?.Invoke(); Run(); } }
/// <summary> /// To be used in a derived class. /// </summary> /// <param name="title"> /// The title of the window. /// </param> /// <param name="x"> /// The X position where to place the window. Pass in WindowPosCentered to center the window. /// </param> /// <param name="y"> /// The Y position where to place the window. Pass in WindowPosCentered to center the window. /// </param> /// <param name="w"> /// The width of the window. Graphics and and rendering will be set to these dimensions. /// </param> /// <param name="h"> /// The height of the window. Graphics and and rendering will be set to these dimensions. /// </param> /// <param name="flags"> /// Options about a window. /// </param> protected SDLWindow(string title, int x, int y, int w, int h, WindowFlags flags) { sdlWindowPtr = SDL.SDL_CreateWindow(title, x, y, w, h, (SDL.SDL_WindowFlags)flags); if (sdlWindowPtr == IntPtr.Zero) { throw new SDLException(); } SDL.SDL_ShowWindow(sdlWindowPtr); Width = w; Height = h; Renderer = new SDLRenderer(sdlWindowPtr); }
public Window(WindowFlags flags) : base(null) { m_flags = flags | WindowFlags.Controlling; if ((m_flags & WindowFlags.FullScreen) != 0) // auto scale, TODO: separate flag or even remove this { Position = Vector2.Zero; Scale = WindowController.Instance.ScreenWidth / Size.X; } m_children = new WindowObjectArray <WindowObject> (); }
public static void BringWindowToFront(IntPtr windowHandle, Rect rect, bool resizeWindow = true) { WindowFlags flags = WindowFlags.AsyncWindowPos | WindowFlags.NoActivate; if (!resizeWindow) { flags |= WindowFlags.NoSize; } if (rect.Left > 0 && rect.Right > 0 && rect.Top > 0 && rect.Bottom > 0) { SetWindowPos(windowHandle, IntPtr.Zero, rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top, (int)flags); } }
/// <summary> /// Constructs a new Window instance, based on an old instance. /// <para>The window's ID is always kept, but any other parameters set to null /// will carry settings over from the old instance.</para> /// </summary> /// <param name="old">The old instance upon which the new Window is based.</param> /// <param name="title">The title of the window.</param> /// <param name="rect">The dimensions of the window.</param> /// <param name="windowFlags">Configuration settings for the window.</param> /// <param name="rendererFlags">Configuration settings for the window's renderer.</param> public Window(Window old, string title = null, ScreenRect?rect = null, WindowFlags?windowFlags = null, RendererFlags?rendererFlags = null) { if (old != null) { ID = old.ID; Title = title ?? old.Title; Rect = rect ?? old.Rect; WindowFlags = windowFlags ?? old.WindowFlags; RendererFlags = rendererFlags ?? old.RendererFlags; } else { Log.Error("couldn't construct new Window: old Window is null"); } }
internal Window(string title, int x, int y, int width, int height, WindowFlags flags, ILogger <Window> logger = null) { if (string.IsNullOrWhiteSpace(title)) { title = "SharpDL Window"; } if (width < 0) { width = 0; } if (height < 0) { height = 0; } this.logger = logger; Title = title; X = x; Y = y; Width = width; Height = height; List <WindowFlags> copyFlags = new List <WindowFlags>(); foreach (WindowFlags flag in Enum.GetValues(typeof(WindowFlags))) { if (flags.HasFlag(flag)) { copyFlags.Add(flag); } } Flags = copyFlags; IntPtr unsafeHandle = SDL.SDL_CreateWindow(this.Title, this.X, this.Y, this.Width, this.Height, (SDL.SDL_WindowFlags)flags); if (unsafeHandle == IntPtr.Zero) { throw new InvalidOperationException($"SDL_CreateWindow: {SDL.SDL_GetError()}"); } safeHandle = new SafeWindowHandle(unsafeHandle); }
/// <summary> /// Creates a window with the specified position, dimensions, and flags. /// </summary> /// <param name="title">The title of the window, in UTF-8 encoding</param> /// <param name="x">The x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED</param> /// <param name="y">The y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED</param> /// <param name="width">The width of the window</param> /// <param name="height">The height of the window</param> /// <param name="flags">0, or one or more SDL_WindowFlags OR'd together</param> public Window(string title, int x, int y, int width, int height, WindowFlags flags) { Title = title; if (string.IsNullOrEmpty(Title)) { Title = "SDL window"; } X = x; Y = y; Width = width; Height = height; Flags = flags; // create the window Handle = SDL.SDL_CreateWindow(this.Title, this.X, this.Y, this.Width, this.Height, (SDL.SDL_WindowFlags)this.Flags); if (IntPtr.Zero == Handle) { throw new Exception("Error while trying to create the window: " + SDL.SDL_GetError()); } }
/// <summary> /// Constructs a new Window instance. /// </summary> /// <param name="id">The unique ID of the window.</param> /// <param name="title">The title of the window.</param> /// <param name="rect">The dimensions of the window.</param> /// <param name="windowFlags">Configuration settings for the window.</param> /// <param name="rendererFlags">Configuration settings for the window's renderer.</param> public Window(int id, string title, ScreenRect rect, WindowFlags windowFlags, RendererFlags rendererFlags) { if (id > -1) { if (title == null) { Log.Warning("new Window has null title"); title = ""; } ID = id; Title = title; Rect = rect; WindowFlags = windowFlags; RendererFlags = rendererFlags; } else { Log.Error("couldn't construct new Window: ID is negative"); } }
private static WindowFlags TranslateFlags(GameWindowFlags flags) { WindowFlags windowFlags = WindowFlags.Default; if ((flags & GameWindowFlags.Fullscreen) != 0) { if (Sdl2Factory.UseFullscreenDesktop) { windowFlags |= WindowFlags.FULLSCREEN_DESKTOP; } else { windowFlags |= WindowFlags.FULLSCREEN; } } if ((flags & GameWindowFlags.FixedWindow) == 0) { windowFlags |= WindowFlags.RESIZABLE; } return(windowFlags); }
public static bool BeginChild(string str_id, Size size, WindowFlags extra_flags, LayoutOptions?options) { var window = GetCurrentWindow(); WindowFlags flags = WindowFlags.NoTitleBar | WindowFlags.NoResize | WindowFlags.ChildWindow | WindowFlags.VerticalScrollbar; string name = string.Format("{0}.{1}", window.Name, str_id); int id = window.GetID(name); GUIStyle style = GUIStyle.Basic; style.Save(); style.ApplyOption(options); var rect = window.GetRect(id); style.Restore(); if (rect == Layout.StackLayout.DummyRect) { return(false); } bool open = true; return(GUI.Begin(name, ref open, rect.TopLeft, rect.Size, 1.0, flags | extra_flags)); }
public Window(string title, int x, int y, int width, int height, WindowFlags flags) { if (String.IsNullOrEmpty(title)) { title = "SharpDL Window"; } Title = title; X = x; Y = y; Width = width; Height = height; List<WindowFlags> copyFlags = new List<WindowFlags>(); foreach (WindowFlags flag in Enum.GetValues(typeof(WindowFlags))) if (flags.HasFlag(flag)) copyFlags.Add(flag); Flags = copyFlags; Handle = SDL.SDL_CreateWindow(this.Title, this.X, this.Y, this.Width, this.Height, (SDL.SDL_WindowFlags)flags); if (Handle == IntPtr.Zero) throw new Exception(String.Format("SDL_CreateWindow: {0}", SDL.SDL_GetError())); }
/// <summary> /// Inicjalizuje nowe okno. /// </summary> /// <param name="width">Szerokość okna.</param> /// <param name="height">Wysokość okna.</param> /// <param name="title">Tytuł.</param> /// <param name="flags">Flagi.</param> /// <param name="openGLVer">Żądana wersja OpenGL.</param> public Window(int width, int height, string title, WindowFlags flags, Version openGLVer) : this(width, height, title, flags, openGLVer, null, null) { }
/// <summary> /// Creates a multithreaded window for rendering /// </summary> /// <param name="overlay">Optional path of a bmp file to overlay (for emulating RGB mask, scanlines, etc)</param> /// <param name="flags">Combined mask of the possible creation flags</param> /// <returns>Window instance</returns> /// <remarks>This is a singleton object: calling Init multiple times will return the same reference</remarks> public static Window CreateThreaded(string overlay, WindowFlags flags) { // singleton if (!init) { bool retval = TLN_CreateWindowThread (overlay, flags); if (retval) { init = true; instance = new Window(); } else throw new CreationException(); } return instance; }
private static extern bool TLN_CreateWindowThread(string overlay, WindowFlags flags);
public static bool BeginChild(uint id, Vector2 size, bool border, WindowFlags flags) { return ImGuiNative.igBeginChildEx(id, size, border, flags); }
public static bool BeginWindow(string windowTitle, ref bool opened, Vector2 startingSize, float backgroundAlpha, WindowFlags flags) { return ImGuiNative.igBegin2(windowTitle, ref opened, startingSize, backgroundAlpha, flags); }
public static bool BeginWindow(string windowTitle, ref bool opened, WindowFlags flags) { return ImGuiNative.igBegin(windowTitle, ref opened, flags); }
public static extern bool igBeginChildFrame(uint id, Vector2 size, WindowFlags extra_flags);
private void Transition() { bool clear = true; int count = _transitions.Count; for(int i = 0; i < count; i++) { TransitionData data = _transitions[i]; idWinRectangle r = null; idWinVector4 v4 = data.Variable as idWinVector4; idWinFloat value = null; if(v4 == null) { r = data.Variable as idWinRectangle; if(r == null) { value = data.Variable as idWinFloat; } } if((data.Variable != null) && (data.Interp.IsDone(this.UserInterface.Time) == true)) { if(v4 != null) { v4.Set(data.Interp.EndValue); } else if(value != null) { value.Set(data.Interp.EndValue.X); } else { r.Set(data.Interp.EndValue); } } else { clear = false; if(data.Variable != null) { if(v4 != null) { v4.Set(data.Interp.GetCurrentValue(this.UserInterface.Time)); } else if(value != null) { value.Set(data.Interp.GetCurrentValue(this.UserInterface.Time).X); } else { r.Set(data.Interp.GetCurrentValue(this.UserInterface.Time)); } } else { idConsole.Warning("Invalid transitional data for window {0} in gui {1}", this.Name, this.UserInterface.SourceFile); } } } if(clear == true) { _transitions.Clear(); _flags &= ~WindowFlags.InTransition; } }
public static extern IntPtr CreateWindow(string title, int x, int y, int w, int h, WindowFlags flags);
extern public static int SetWindowFullscreen(IntPtr window, WindowFlags flags);
public Game(int width, int height, string title, WindowFlags flags = WindowFlags.Default) : this(new Window(width, height, title, flags)) { }
/// <summary> /// Inicjalizuje nowe okno. /// </summary> /// <param name="width">Szerokość okna.</param> /// <param name="height">Wysokość okna.</param> /// <param name="title">Tytuł.</param> /// <param name="flags">Flagi.</param> /// <param name="openGLVer">Żądana wersja OpenGL.</param> /// <param name="mode">Używany tryb graficzny.</param> /// <param name="device">Ekran, na którym będzie wyświetlone dane okno.</param> public Window(int width, int height, string title, WindowFlags flags, Version openGLVer, GraphicsMode mode, DisplayDevice device = null) : base(width, height, title, ((flags & WindowFlags.Fullscreen) == WindowFlags.Fullscreen ? GameWindowFlags.Fullscreen : GameWindowFlags.Default), (mode != null ? mode : GraphicsMode.Default), (device != null ? device : DisplayDevice.Default)) { Logger.Info("Creating window"); Logger.Info("\tTitle: {0}", title); Logger.Info("\tWindow size: {0} x {1}", width, height); Logger.Info("\tFlags: {0}", flags.ToString()); if (openGLVer.Major == int.MaxValue) Logger.Info("\tOpenGL Version: newest"); else Logger.Info("\tOpenGL Version: {0}.{1}", openGLVer.Major, openGLVer.Minor); this._Input = new Internals.WindowInput(this); this._Context = new GraphicsContext((mode != null ? mode : GraphicsMode.Default), this.WindowInfo, openGLVer.Major, openGLVer.Minor, GraphicsContextFlags.Default); this._Context.MakeCurrent(this.WindowInfo); this._Context.LoadAll(); try { string versionStr = GL.GetString(StringName.Version); int idx = versionStr.IndexOf(' '); if (idx > 0) { versionStr = versionStr.Substring(0, idx); } this.OpenGLVersion = Version.Parse(versionStr); } catch (Exception ex) { Logger.WarnException("Cannot parse OpenGL version string " + GL.GetString(StringName.Version) + ". This should never occur.", ex); this.OpenGLVersion = new Version(0, 0, 0, 0); } this.Flags = flags; this.Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(Window_Closing); this.Closed += new EventHandler<EventArgs>(Window_Closed); this.Resize += new EventHandler<EventArgs>(Window_Resize); this.VisibleChanged += new EventHandler<EventArgs>(Window_VisibleChanged); this.WindowBorderChanged += new EventHandler<EventArgs>(Window_WindowBorderChanged); this.WindowStateChanged += new EventHandler<EventArgs>(Window_WindowStateChanged); Logger.Info("Window created(OpenGL version: {0}.{1})", this.OpenGLVersion.Major, this.OpenGLVersion.Minor); }
public static bool igBeginPopupModal(string name, WindowFlags extra_flags) { return igBeginPopupModal(name, null, extra_flags); }
public static bool igBeginPopupModal(string name, ref bool p_opened, WindowFlags extra_flags) { byte value = p_opened ? (byte)1 : (byte)0; bool result = igBeginPopupModal(name, &value, extra_flags); p_opened = value == 1 ? true : false; return result; }
public static extern bool CreateWindowThread(string overlay, WindowFlags flags);
private void Window_WindowBorderChanged(object sender, EventArgs e) { if (base.WindowBorder == OpenTK.WindowBorder.Fixed) this._Flags |= WindowFlags.FixedSize; else this._Flags &= ~WindowFlags.FixedSize; }
private void Window_VisibleChanged(object sender, EventArgs e) { if (base.Visible) this._Flags |= WindowFlags.Visible; else this._Flags &= ~WindowFlags.Visible; }
public static bool BeginWindow(string windowTitle, ref bool opened, Vector2 startingSize, WindowFlags flags) { return ImGuiNative.igBegin2(windowTitle, ref opened, startingSize, 1f, flags); }
public static extern bool igBegin(string name, ref bool p_opened, WindowFlags flags);
public static bool BeginChildFrame(uint id, Vector2 size, WindowFlags flags) { return ImGuiNative.igBeginChildFrame(id, size, flags); }
public static extern bool igBegin2(string name, ref bool p_opened, Vector2 size_on_first_use, float bg_alpha, WindowFlags flags);
public static bool BeginPopupModal(string name, ref bool opened, WindowFlags extraFlags) { return ImGuiNative.igBeginPopupModal(name, ref opened, extraFlags); }
public static extern bool igBeginChild(string str_id, Vector2 size, bool border, WindowFlags extra_flags);
public static extern bool igBeginChildEx(uint id, Vector2 size, bool border, WindowFlags extra_flags);
public static extern bool igBeginPopupModal(string name, byte* p_opened, WindowFlags extra_flags);
private void Window_WindowStateChanged(object sender, EventArgs e) { if (base.WindowState == OpenTK.WindowState.Fullscreen) this._Flags |= WindowFlags.Fullscreen; else this._Flags &= ~WindowFlags.Fullscreen; }
/// <summary> /// Inicjalizuje nowe okno. /// </summary> /// <param name="width">Szerokość okna.</param> /// <param name="height">Wysokość okna.</param> /// <param name="title">Tytuł.</param> /// <param name="flags">Flagi.</param> public Window(int width, int height, string title, WindowFlags flags = WindowFlags.Default) : this(width, height, title, flags, new Version(int.MaxValue, int.MaxValue), null, null) { }
public idSimpleWindow(idWindow win) { _gui = win.UserInterface; _context = win.DeviceContext; _drawRect = win.DrawRectangle; _clientRect = win.ClientRectangle; _textRect = win.TextRectangle; _origin = win.Origin; _fontFamily = win.FontFamily; _name = win.Name; _materialScaleX = win.MaterialScaleX; _materialScaleY = win.MaterialScaleY; _borderSize = win.BorderSize; _textAlign = win.TextAlign; _textAlignX = win.TextAlignX; _textAlignY = win.TextAlignY; _background = win.Background; _flags = win.Flags; _textShadow = win.TextShadow; _visible.Set(win.IsVisible); _text.Set(win.Text); _rect.Set(win.Rectangle); _backColor.Set(win.BackColor); _materialColor.Set(win.MaterialColor); _foreColor.Set(win.ForeColor); _borderColor.Set(win.BorderColor); _textScale.Set(win.TextScale); _rotate.Set(win.Rotate); _shear.Set(win.Shear); _backgroundName.Set(win.BackgroundName); if(_backgroundName != string.Empty) { _background = idE.DeclManager.FindMaterial(_backgroundName); _background.Sort = (float) MaterialSort.Gui; ; _background.ImageClassification = 1; // just for resource tracking } _backgroundName.Material = _background; _parent = win.Parent; _hideCursor.Set(win.HideCursor); if(_parent != null) { if(_text.NeedsUpdate == true) { _parent.AddUpdateVariable(_text); } if(_visible.NeedsUpdate == true) { _parent.AddUpdateVariable(_visible); } if(_rect.NeedsUpdate == true) { _parent.AddUpdateVariable(_rect); } if(_backColor.NeedsUpdate == true) { _parent.AddUpdateVariable(_backColor); } if(_materialColor.NeedsUpdate == true) { _parent.AddUpdateVariable(_materialColor); } if(_foreColor.NeedsUpdate == true) { _parent.AddUpdateVariable(_foreColor); } if(_borderColor.NeedsUpdate == true) { _parent.AddUpdateVariable(_borderColor); } if(_textScale.NeedsUpdate == true) { _parent.AddUpdateVariable(_textScale); } if(_rotate.NeedsUpdate == true) { _parent.AddUpdateVariable(_rotate); } if(_shear.NeedsUpdate == true) { _parent.AddUpdateVariable(_shear); } if(_backgroundName.NeedsUpdate == true) { _parent.AddUpdateVariable(_backgroundName); } } }