Esempio n. 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");
        }
Esempio n. 2
0
        public sealed override void Delete()
        {
            if (this.Undeletable)
            {
                Debug.LogWarning("Unable to delete " + this + " : wobject undeletable.");
                return;
            }

            if (this._Modules != null)
            {
                for (int i = 0; i < _Modules.Count; i++)
                {
                    _Modules[i].Delete();
                }
            }

            if (this._Children != null)
            {
                for (int i = 0; i < _Children.Count; i++)
                {
                    _Children[i].Delete();
                }
            }

            this._Parent = null;
            _Children?.Clear();
            _Children = null;

            _Modules?.Clear();
            _Modules = null;
            lock (wobjectLocker)
                _WObjects.Remove(this);

            base.Delete();
        }
Esempio n. 3
0
        internal sealed override void ForcedDelete()
        {
            for (int i = 0; i < _Modules.Count; i++)
            {
                _Modules[i].ForcedDelete();
            }

            for (int i = 0; i < _Children.Count; i++)
            {
                _Children[i].ForcedDelete();
            }

            this._Parent = null;
            _Children.Clear();
            _Children = null;

            _Modules.Clear();
            _Modules = null;
            lock (wobjectLocker)
                _WObjects.Remove(this);

            base.Delete();
        }
Esempio n. 4
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);
        }