Ejemplo n.º 1
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            Title = $"{_title}: FPS:{1f / e.Time:0000.0}, obj:{_gameObjects.Count}, score:{_score}";
            if (_clicks < 10)
            {
                _text.SetText($"Object picking by mouse");
            }
            else if (_clicks < 50)
            {
                _text.SetText($"This seems to work quite well");
            }
            else if (_clicks < 75)
            {
                _text.SetText($"Not a single false positive!");
            }
            else if (_clicks < 100)
            {
                _text.SetText($"dreamstatecoding.blogspot.com");
            }
            GL.ClearColor(_backColor);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            int lastProgram = -1;

            foreach (var obj in _gameObjects)
            {
                lastProgram = RenderOneElement(obj, lastProgram);
            }
            // render after all opaque objects to get transparency right
            RenderOneElement(_text, lastProgram);
            SwapBuffers();
        }
Ejemplo n.º 2
0
 public void SetText(int characterID, int iconArrayIndex, int newValue)
 {
     if (uis.ContainsKey(characterID))
     {
         Entity     ui           = uis[characterID];
         Childrens  children     = World.EntityManager.GetComponentData <Childrens>(ui);
         Entity     icon         = children.children[iconArrayIndex];
         Childrens  iconChildren = World.EntityManager.GetComponentData <Childrens>(icon);
         Entity     textEntity   = iconChildren.children[0];
         RenderText renderText   = World.EntityManager.GetComponentData <RenderText>(textEntity);
         renderText.SetText(newValue.ToString());
         World.EntityManager.SetComponentData(textEntity, renderText);
     }
 }
Ejemplo n.º 3
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            Title = $"{_title}: FPS:{1f / e.Time:0000.0}, obj:{_gameObjects.Count}, score:{_score}";
            _text.SetText($"Score: {_score}");
            GL.ClearColor(_backColor);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            int lastProgram = -1;

            foreach (var obj in _gameObjects)
            {
                lastProgram = RenderOneElement(obj, lastProgram);
            }
            // render after all opaque objects to get transparency right
            RenderOneElement(_text, lastProgram);
            SwapBuffers();
        }
Ejemplo n.º 4
0
        private Entity SpawnMenuButton(Entity panelUI, string text)
        {
            float2 iconSize = uiDatam.defaultIconSize;
            Entity button   = UIUtilities.SpawnButton(
                World.EntityManager,
                panelUI,
                new float3(0, 0, -0.01f),
                new float2(iconSize.x * text.Length * 0.6f, iconSize.y),
                null, uiDatam.menuButton);

            UIUtilities.SetEntityColor(EntityManager, button, uiDatam.defaultMenuColor);
            RenderText renderText = new RenderText {
            };

            renderText.fontSize = 0.03f;
            renderText.SetColor(uiDatam.menuTextColor);
            renderText.SetText(text);
            World.EntityManager.AddComponentData(button, renderText);
            //RenderTextSystem.SetLetterColor(World.EntityManager, button, uiDatam.menuTextColor);
            return(button);
        }