Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExampleWindow"/> class.
        /// </summary>
        /// <param name="width">The window width.</param>
        /// <param name="height">The window height.</param>
        /// <param name="updateRenderRate">The update and render rate.</param>
        public ExampleWindow(int width = 512, int height = 512, double updateRenderRate = 60)
        {
            gameWindow = new GameWindow
            {
                X          = 200,                     //DPI scaling screws everything up, so use some hacked values
                Y          = 100,
                ClientSize = new Size(width, height), //do not set extents in the constructor, because windows 10 with enabled scale != 100% scales our given sizes in the constructor of GameWindow
            };

            ProcessCommandLineArguments();

            RenderContext = new RenderContextGL();

            CreateIOCcontainer();

            gameWindow.TargetUpdateFrequency = updateRenderRate;
            gameWindow.TargetRenderFrequency = updateRenderRate;
            gameWindow.VSync = VSyncMode.On;
            //register callback for resizing of window
            gameWindow.Resize += GameWindow_Resize;
            //register callback for keyboard
            gameWindow.KeyDown += INativeWindowExtensions.DefaultExampleWindowKeyEvents;

            contentManager = ContentManagerGL.Create(Assembly.GetEntryAssembly());
            //contentManager.RegisterImporter();
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExampleWindow"/> class.
        /// </summary>
        /// <param name="width">The window width.</param>
        /// <param name="height">The window height.</param>
        /// <param name="updateRenderRate">The update and render rate.</param>
        public ExampleWindow(int width = 512, int height = 512, double updateRenderRate = 60)
        {
            gameWindow = new GameWindow
            {
                X          = 200,                     //DPI scaling screws everything up, so use some hacked values
                Y          = 100,
                ClientSize = new Size(width, height), //do not set extents in the constructor, because windows 10 with enabled scale != 100% scales our given sizes in the constructor of GameWindow
            };

            ProcessCommandLineArguments();

            RenderContext = new RenderContextGL();

            CreateIOCcontainer();

            gameWindow.TargetUpdateFrequency = updateRenderRate;
            gameWindow.TargetRenderFrequency = updateRenderRate;
            gameWindow.VSync = VSyncMode.On;
            //register callback for resizing of window
            gameWindow.Resize += GameWindow_Resize;
            //register callback for keyboard
            gameWindow.KeyDown += INativeWindowExtensions.DefaultExampleWindowKeyEvents;
            gameWindow.KeyDown += GameWindow_KeyDown;

            var assembly = Assembly.GetEntryAssembly();
            //check if entry assembly was built with SOLUTION attribute
            var solutionMode = !(assembly.GetCustomAttribute <SolutionAttribute>() is null);

            contentManager = ContentManagerGL.Create(assembly, solutionMode);

            var contentDir = assembly.GetCustomAttribute <ContentSearchDirectoryAttribute>()?.ContentSearchDirectory;

            contentManager.SetContentSearchDirectory(contentDir);
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContentLoader"/> class.
        /// </summary>
        public ContentLoader()
        {
            var assembly = Assembly.GetEntryAssembly();
            //check if entry assembly was built with SOLUTION attribute
            var solutionMode = !(assembly.GetCustomAttribute <SolutionAttribute>() is null);

            contentManager = ContentManagerGL.Create(assembly, solutionMode);

            var contentDir = assembly.GetCustomAttribute <ContentSearchDirectoryAttribute>()?.ContentSearchDirectory;

            contentManager.SetContentSearchDirectory(contentDir);
        }