Beispiel #1
0
        /// <summary>
        /// Initiliaze all the basis to make the game run.
        /// </summary>
        protected void InitializeGame()
        {
            // create the main game camera
            WObject camWobj = new WObject("Main Camera");
            Camera  cam     = camWobj.AddModule <Camera>();

            Camera.Main = cam;

            OnUpdate += (e) => _updateEvent.Set();
            OnRender += (e) => _updateEvent.Reset();

            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 stored 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");

            if (Engine.Arguments != null && Engine.Arguments.Contains("-safe"))
            {
                Thread.Sleep(1000);
            }
        }
Beispiel #2
0
        private static WObject CreateEngineWObject()
        {
            WObject wobj = new WObject("Engine Core")
            {
                Undeletable = true
            };

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

            if (DoGUI)
            {
                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);
        }
Beispiel #3
0
        protected internal override void OnDelete()
        {
            lock(ActiveBoxCollidersLocker)
            { ActiveBoxColliders.Remove(this); }
            lock(BoxCollidersLocker)
            { BoxColliders.Remove(this); }
            
#if DEBUG
            DebugVolumeWobject?.Delete();
            DebugVolumeWobject = null;
#endif
            base.OnDelete();
        }