Exemplo n.º 1
0
        public override void Draw()
        {
            string res = _uiScore.ToString();

            uint w, h;

            _pFnt.SetScale(_fSize);
            _pFnt.GetTextDimensions(res, out w, out h);
            _pRender2D.SetBlendMode(E_BLENDING_EFFECT.BE_NORMAL);
            TColor4 c = TColor4.ColorWhite((byte)(255 - _uiCounter * 5));

            _pFnt.Draw2D(_stPos.x - w / 2f, _stPos.y - h / 2f, res, ref c);
        }
Exemplo n.º 2
0
        void Render(IntPtr pParam)
        {
            TColor4 c;
            uint    w, h;
            string  acTxt;

            // render game objects
            for (int i = 0; i < _clObjects.Count; i++)
            {
                _clObjects[i].Draw();
            }

            // render in-game user interface
            pRender2D.SetBlendMode(E_BLENDING_EFFECT.BE_NORMAL);
            pFnt.SetScale(1f);

            // if player is dead draw message
            if (!IsPlayerExists())
            {
                acTxt = "You are dead! Press \"Enter\" to restart.";
                pFnt.GetTextDimensions(acTxt, out w, out h);
                c = TColor4.ColorRed();
                pFnt.Draw2DSimple((int)((Res.GameVpWidth - w) / 2), (int)(Res.GameVpHeight - h) / 2, acTxt, ref c);
            }

            // draw help before game start
            if (_uiScore == 0)
            {
                acTxt = "Use \"Arrows\" to move and \"Space Bar\" to shoot.";
                pFnt.GetTextDimensions(acTxt, out w, out h);
                c = TColor4.ColorWhite();
                pFnt.Draw2DSimple((int)((Res.GameVpWidth - w) / 2), (int)(Res.GameVpHeight - h), acTxt, ref c);
            }

            acTxt = "Score: " + _uiScore.ToString();
            pFnt.GetTextDimensions(acTxt, out w, out h);
            c = TColor4.ColorWhite();
            pFnt.Draw2DSimple((int)((Res.GameVpWidth - w) / 2), 0, acTxt, ref c);
        }