예제 #1
0
        /// <summary>
        /// Initiliaze all the basis to make the game run.
        /// </summary>
        protected void InitializeGame()
        {
            new Texture(); //todo: static constructor.

            // create the main game camera
            WObject camWobj = new WObject("Main Camera");
            Camera  cam     = camWobj.AddModule <Camera>();

            Camera.Main = cam;

            Shader.CreateError();                // el famoso pinko del shader

            GL.FrontFace(FrontFaceDirection.Cw); // set front to counter wise
            GL.CullFace(CullFaceMode.Front);     // set cull to front
            GL.Enable(EnableCap.CullFace);

            GL.Enable(EnableCap.DepthTest);     // enable depth test
            GL.DepthFunc(DepthFunction.Lequal); // set anything less or equal to current depth being drawn onto screen

            GL.Enable(EnableCap.Blend);         // transparency. further modes are available into shaders. or material, I don't remember

            // create basic shaders. if visual studio yells at you while underlining in green,
            // don't listen to it it's dumb, everything is stocked into the shader cache.
            new Shader("assets/shaders/Standard/Standard.vert", "assets/shaders/Standard/Standard.frag");
            new Shader("assets/shaders/Unlit/Unlit.vert", "assets/shaders/Unlit/Unlit.frag");
            new Shader("assets/shaders/Text/Text.vert", "assets/shaders/Text/Text.frag");

            new GUI.Font("assets/fonts/pixelized.json", "Pixelized");
        }
예제 #2
0
        private static WObject CreateEngineWObject()
        {
            WObject wobj = new WObject("Engine Core")
            {
                Undeletable = true
            };

            wobj.AddModule <Input>().ExecutionOrder = Int32.MinValue;
            wobj.AddModule <EngineCore>();

            WObject wobjcan = new WObject("Canvas")
            {
                Undeletable = true
            };

            wobjcan.AddModule <GUI.Canvas>();


            Layer.CreateOrGetLayer(0).Name = "Default Layer";
            Group.CreateOrGetGroup(-1, "3D Logic");

            EngineObject = wobj;
            return(wobj);
        }