Beispiel #1
0
        void DrawFont(TRectF screen)
        {
            string  txt;
            uint    width, height;
            TColor4 c;

            txt = "I'm rotating... +_+";
            pFontBold.GetTextDimensions(txt, out width, out height);
            c = TColor4.ColorWhite();
            pFontBold.Draw2D(screen.x + screen.width - width - 10f, 200, txt, ref c, counter % 360);

            txt = "I'm just right aligned text. -_-";
            pFontBold.GetTextDimensions(txt, out width, out height);
            pFontBold.Draw2D((int)(screen.x + screen.width - width), 10, txt, ref c);

            txt = "I have a shadow! ;-)";
            pFontBold.GetTextDimensions(txt, out width, out height);
            c = TColor4.ColorBlack();
            pFontBold.Draw2D((int)(screen.x + screen.width - width - 7f), 53, txt, ref c);
            c = TColor4.ColorWhite();
            pFontBold.Draw2D((int)(screen.x + screen.width - width - 10f), 50, txt, ref c);

            txt = "Cool colored me! ^_^";
            pFontBold.GetTextDimensions(txt, out width, out height);
            TColor4 c1 = TColor4.ColorRed();
            TColor4 c2 = TColor4.ColorGreen();

            pRender2D.SetVerticesColors(ref c1, ref c2, ref c1, ref c2);
            c = TColor4.ColorWhite();
            pFontBold.Draw2D(screen.x + screen.width - width - 10f, 100f, txt, ref c, 0, true);

            txt = "I'm randomly colored... >_<";
            pFont.Draw2D(screen.x + 5f, 10, txt, ref stRandomCol);

            txt = "I'm per vertex colored! -_0";
            TColor4 c3 = TColor4.ColorAqua();
            TColor4 c4 = TColor4.ColorOrange();

            pRender2D.SetVerticesColors(ref c3, ref c3, ref c4, ref c4);
            c = TColor4.ColorWhite();
            pFontBold.Draw2D(screen.x + 5f, 50f, txt, ref c, 0, true);

            txt = "А я могу говорить по-русски! [:-|";
            c   = TColor4.ColorRed();
            pFont.Draw2D(screen.x + 5f, 100, txt, ref c);

            txt = "I'm scaling... o_O";
            pFontBold.SetScale((float)Math.Abs(Math.Sin(counter / 50f)) * 2f);
            c = TColor4.ColorWhite();
            pFontBold.Draw2D(screen.x + 5f, 200, txt, ref c);
            pFontBold.SetScale(1f);

            txt = "I am just very brutal..!";
            pFontHard.GetTextDimensions(txt, out width, out height);
            c = TColor4.ColorOfficialOrange();
            pFontHard.Draw2D((int)(screen.x + (screen.width - width) / 2f), 300f, txt, ref c);
        }
Beispiel #2
0
        public virtual void Draw()
        {
            if (!_pObjMan.IsDebugMode())
            {
                return;
            }
            TColor4 c = TColor4.ColorWhite();

            _pRender2D.DrawCircle(ref _stPos, (uint)(_fSize / 2f), 32, ref c);
            c = TColor4.ColorRed();
            _pRender2D.DrawCircle(ref _stPos, (uint)(_fSize * _fColScale / 2f), 32, ref c);
        }
Beispiel #3
0
        public override void Draw()
        {
            TColor4 c = TColor4.ColorRed();

            _pRender2D.SetColorMix(ref c);

            TPoint2 pos = new TPoint2(_stPos.x - _fSize / 2f, _stPos.y - _fSize / 2f);
            TPoint2 dim = new TPoint2(_fSize, _fSize);

            _pRender2D.DrawTexture(pTexSpark, ref pos, ref dim, _uiCounter * 2f, E_EFFECT2D_FLAGS.EF_COLOR_MIX |
                                   E_EFFECT2D_FLAGS.EF_BLEND);

            base.Draw();
        }
Beispiel #4
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);
        }