Ejemplo n.º 1
0
        /// <summary>
        /// Create a new vulkan enabled window with GLFW.
        /// </summary>
        /// <param name="name">Caption of the window</param>
        /// <param name="_width">Width.</param>
        /// <param name="_height">Height.</param>
        /// <param name="vSync">Vertical synchronisation status for creating the swapchain.</param>
        public VkWindow(string name = "VkWindow", uint _width = 800, uint _height = 600, bool vSync = true)
        {
            Width  = _width;
            Height = _height;
            VSync  = vSync;

            Glfw3.Init();

            Glfw3.WindowHint(WindowAttribute.ClientApi, 0);
            Glfw3.WindowHint(WindowAttribute.Resizable, 1);

            hWin = Glfw3.CreateWindow((int)Width, (int)Height, name, MonitorHandle.Zero, IntPtr.Zero);

            if (hWin == IntPtr.Zero)
            {
                throw new Exception("[GLFW3] Unable to create vulkan Window");
            }

            Glfw3.SetKeyCallback(hWin, HandleKeyDelegate);
            Glfw3.SetMouseButtonPosCallback(hWin, HandleMouseButtonDelegate);
            Glfw3.SetCursorPosCallback(hWin, HandleCursorPosDelegate);
            Glfw3.SetScrollCallback(hWin, HandleScrollDelegate);
            Glfw3.SetCharCallback(hWin, HandleCharDelegate);

            windows.Add(hWin, this);
        }
        public void Run()
        {
            var helper = new VkHelperFunctions();

            Glfw3.Init();

            Glfw3.WindowHint(WindowAttribute.ClientApi, 0);
            var window   = Glfw3.CreateWindow(1024, 768, "shit", default, default);
Ejemplo n.º 3
0
        private void InitialiseWindow()
        {
            Glfw3.Init();

            Glfw3.WindowHint(0x00022001, 0);
            this.window             = Glfw3.CreateWindow(SurfaceWidth, SurfaceHeight, "Hello Triangle", IntPtr.Zero, IntPtr.Zero);
            this.windowSizeCallback = (x, y, z) => this.RecreateSwapChain();

            Glfw3.SetWindowSizeCallback(this.window, this.windowSizeCallback);
        }
Ejemplo n.º 4
0
        public override void Initialise(Game game)
        {
            Glfw3.Init();

            Glfw3.WindowHint(0x00022001, 0);
            this.WindowHandle = Glfw3.CreateWindow(this.options.InitialWidth, this.options.InitialHeight, this.options.Title, IntPtr.Zero, IntPtr.Zero);

            this.windowSizeChanged = this.OnWindowSizeChanged;
            Glfw3.SetWindowSizeCallback(this.WindowHandle, this.windowSizeChanged);

            this.game = game;
        }
Ejemplo n.º 5
0
        public VkWindow(bool debugMarkers = false, string name = "VkWindow", uint _width = 1024, uint _height = 768, bool vSync = false)
        {
            currentWindow = this;

            width  = _width;
            height = _height;

            Glfw3.Init();

            Glfw3.WindowHint(WindowAttribute.ClientApi, 0);
            Glfw3.WindowHint(WindowAttribute.Resizable, 1);

            hWin = Glfw3.CreateWindow((int)width, (int)height, name, MonitorHandle.Zero, IntPtr.Zero);

            Glfw3.SetKeyCallback(hWin, HandleKeyDelegate);
            Glfw3.SetMouseButtonPosCallback(hWin, HandleMouseButtonDelegate);
            Glfw3.SetCursorPosCallback(hWin, HandleCursorPosDelegate);
            Glfw3.SetWindowSizeCallback(hWin, HandleWindowSizeDelegate);
            Glfw3.SetScrollCallback(hWin, HandleScrollDelegate);
            Glfw3.SetCharCallback(hWin, HandleCharDelegate);

            initVulkan(vSync, debugMarkers);
        }