Esempio n. 1
0
        protected override void OnLoad(System.EventArgs e)
        {
            //generate stopwatch
            sw = new Stopwatch();

            //set size of the render
            virtual_size = new Vector2(1920, 1080);

            state = new GameState();

            string versionOpenGL = GL.GetString(StringName.Version);
            log(versionOpenGL);

            // make the Coursor disapear
            Cursor.Hide();

            // center it on the window
            Cursor.Position = new Point(
                (Bounds.Left + Bounds.Right) / 2,
                (Bounds.Top + Bounds.Bottom) / 2);

            // other state
            GL.ClearColor(System.Drawing.Color.Black);
            VSync = VSyncMode.On;
            screenSize = new Vector2(Width, Height);

            // create instances of necessary objects
            textureLoader = new TextureLoader(this);
            framebufferCreator = new FramebufferCreator(this);
            meshLoader = new MeshLoader(this);
            shaderLoader = new ShaderLoader(this);
            materialLoader = new MaterialLoader(this);
            templateLoader = new TemplateLoader(this);

            mScene = new Scene(this);

            // create gameInput
            gameInput = new GameInput(mScene, Keyboard, Mouse);

            // set files for displaying loading screen
            shaderLoader.fromXmlFile("shaders\\composite.xsp");

            shaderLoader.fromTextFile("shaders\\composite.vs", "shaders\\splash_shader.fs");

            meshLoader.fromObj("models\\sprite_plane.obj");

            textureLoader.fromFile("materials\\ultra_engine_back.png",true);
            textureLoader.fromFile("materials\\ultra_engine_back_h.png",true);

            materialLoader.fromXmlFile("materials\\composite.xmf");

            //loading noise manualy so we can disable multisampling
            textureLoader.fromFile("materials\\noise_pixel.png", false);

            // load files for loading screen
            textureLoader.LoadTextures();
            meshLoader.loadMeshes();
            shaderLoader.loadShaders();
            materialLoader.loadMaterials();

            // setup 2d filter (loading screen)
            splashFilter2d = new Quad2d(this);

            // set time to zero
            spawnTime = get_time();
        }
Esempio n. 2
0
        /*
        public Texture nameOnly()
        {
        Texture tmpTex = new Texture();

        tmpTex.texture = texture;
        tmpTex.name = name;

        return tmpTex;
        }
         */
        internal void resolveTextures(TextureLoader textureLoader)
        {
            int textureCount = textures.Length;
            for (int i = 0; i < textureCount; i++)
            {
                string texname = textures[i].name;
                if(texname != null)
                    textures[i] = textureLoader.getTexture(texname);
            }
        }