コード例 #1
0
ファイル: CBackGround.cs プロジェクト: yunatoomi/DGLE
        public override void Draw()
        {
            _pTexSpace.Draw2D(0, 0, Res.GameVpWidth, Res.GameVpHeight, 0f, 0);

            _pRender2D.DrawMesh(_pMeshPlanet, _pTexEarth, ref coordPl, ref dimPl, ref axisPl, _uiCounter / 4f,
                                E_EFFECT2D_FLAGS.EF_DEFAULT, false);

            _pRender2D.SetColorMix(ref c);
            _pRender2D.DrawMesh(_pMeshPlanet, _pTexClouds, ref coordAtm, ref dimAtm, ref axisAtm, _uiCounter / 2f,
                                E_EFFECT2D_FLAGS.EF_BLEND | E_EFFECT2D_FLAGS.EF_COLOR_MIX, false, 90f, true);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: yunatoomi/DGLE
        void Render(IntPtr pParam)
        {
            pTex.Draw2D(0, 0, ScreenWidth, ScreenHeight, 0, 0);

            uint width, height, framecount;

            TColor4 c = TColor4.ColorWhite();

            const string txt = AppCaption;

            pFont.GetTextDimensions(txt, out width, out height);
            pFont.Draw2DSimple((int)((ScreenWidth - width) / 2),
                               (int)((ScreenHeight - height) / 2), txt, ref c);

            pTexSprite.GetFrameSize(out width, out height);
            pTexSprite.FramesCount(out framecount);
            pTexSprite.Draw2DSimple((int)((ScreenWidth - width) / 2),
                                    5, (counter / 2) % framecount);
        }
コード例 #3
0
        void DrawSprites(TRectF screen)
        {
            pTexGrass.Draw2D((int)screen.x, (int)screen.y, (uint)screen.width, (uint)screen.height, 0, 0);
            pTexGirl.Draw2DSimple((int)(screen.x + 400), (int)(screen.y + 30), (counter / 5) % 16); // simpliest way to draw animated sprite

            // draw tank
            uint width, height;

            TPoint2 scale = new TPoint2(2f, 2f); // scale X and Y axes by two

            pRender2D.SetScale(ref scale);

            pTexTankBody.GetDimensions(out width, out height);
            TPoint2 pos       = new TPoint2(screen.x + 50f, screen.y + 150f);
            TPoint2 dimension = new TPoint2(width, height);

            pRender2D.DrawTexture(pTexTankBody, ref pos, ref dimension, 0, E_EFFECT2D_FLAGS.EF_ALPHA_TEST /* better than blending if we want to have sharp edges */ |
                                  E_EFFECT2D_FLAGS.EF_SCALE);

            pTexTankTurret.GetDimensions(out width, out height);
            TPoint2 rot = new TPoint2(48f, 64f);

            pRender2D.SetRotationPoint(ref rot); // rotate turret around it's base center, not the center of the image
            TPoint2 turretCenter = new TPoint2(screen.x + 50f - 10f, screen.y + 150f + 18f);
            float   turretAngle  = (float)(-30f + Math.Sin(counter / 15f) * 20f);

            dimension = new TPoint2(width, height);
            pRender2D.DrawTexture(pTexTankTurret, ref turretCenter, ref dimension, turretAngle, E_EFFECT2D_FLAGS.EF_ALPHA_TEST |
                                  E_EFFECT2D_FLAGS.EF_SCALE | E_EFFECT2D_FLAGS.EF_ROTATION_POINT);

            // draw light at the end of tank cannon
            pRender2D.SetBlendMode(E_BLENDING_EFFECT.BE_ADD);
            pTexLight.GetFrameSize(out width, out height);
            dimension = new TPoint2(width, height);
            pos       = turretCenter + new TPoint2((float)Math.Cos(ToRad(turretAngle)) * 165f,
                                                   (float)(Math.Sin(ToRad(turretAngle - 15f)) * 165f));
            pRender2D.DrawTextureSprite(pTexLight, ref pos, ref dimension, (counter / 2) % 14, 0, E_EFFECT2D_FLAGS.EF_BLEND);

            pRender2D.SetBlendMode(E_BLENDING_EFFECT.BE_NORMAL); // switch back blending mode to common one
        }