当前位置: 首页>>代码示例>>C#>>正文


C# Game.GetTexture方法代码示例

本文整理汇总了C#中Game.GetTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Game.GetTexture方法的具体用法?C# Game.GetTexture怎么用?C# Game.GetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game的用法示例。


在下文中一共展示了Game.GetTexture方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawCompass

    public void DrawCompass(Game game)
    {
        if (!CompassInActiveMaterials(game)) return;
        if (compassid == -1)
        {
            compassid = game.GetTexture("compass.png");
            needleid = game.GetTexture("compassneedle.png");
        }
        float size = 175;
        float posX = game.Width() - 100;
        float posY = 100;
        float playerorientation = -((game.player.position.roty / (2 * Game.GetPi())) * 360);

        compassvertex += (playerorientation - compassangle) / 50;
        compassvertex *= (one * 9 / 10);
        compassangle += compassvertex;

        // compass
        game.Draw2dTexture(compassid, posX - size / 2, posY - size / 2, size, size, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);

        // compass needle
        game.GLPushMatrix();
        game.GLTranslate(posX, posY, 0);
        game.GLRotate(compassangle, 0, 0, 90);
        game.GLTranslate(-size / 2, -size / 2, 0);
        game.Draw2dTexture(needleid, 0, 0, size, size, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
        game.GLPopMatrix();
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:28,代码来源:Compass.ci.cs

示例2: DrawPlayerHealth

 public void DrawPlayerHealth(Game game)
 {
     if (game.PlayerStats != null)
     {
         float progress = game.one * game.PlayerStats.CurrentHealth / game.PlayerStats.MaxHealth;
         int InventoryStartX = game.Width() / 2 - 540 / 2;
         int InventoryStartY = game.Height() - 110;
         int posX = InventoryStartX + 10;
         int posY = InventoryStartY + 10;
         game.Draw2dTexture(game.GetTexture("hobars.png"), posX, posY - barSizeY, barSizeX, barSizeY, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
         game.Draw2dTexture(game.GetTexture("hobars.png"), posX, posY - barSizeY, (progress) * barSizeX, barSizeY, null, 0, Game.ColorFromArgb(255, 255, 0, 0), false);
     }
     //if (test) { d_The3d.Draw2dTexture(d_The3d.WhiteTexture(), 50, 50, 200, 200, null, Color.Red); }
 }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:14,代码来源:Draw2dMisc.ci.cs

示例3: OnNewFrameDraw3d

 public override void OnNewFrameDraw3d(Game game, float deltaTime)
 {
     float one = 1;
     for (int i = 0; i < game.entitiesCount; i++)
     {
         Entity entity = game.entities[i];
         if (entity == null) { continue; }
         if (entity.sprite == null) { continue; }
         Sprite b = entity.sprite;
         game.GLMatrixModeModelView();
         game.GLPushMatrix();
         game.GLTranslate(b.positionX, b.positionY, b.positionZ);
         Billboard(game);
         game.GLScale((one * 2 / 100), (one * 2 / 100), (one * 2 / 100));
         game.GLTranslate(0 - b.size / 2, 0 - b.size / 2, 0);
         //d_Draw2d.Draw2dTexture(night ? moontexture : suntexture, 0, 0, ImageSize, ImageSize, null, Color.White);
         IntRef n = null;
         if (b.animationcount > 0)
         {
             float progress = one - (entity.expires.timeLeft / entity.expires.totalTime);
             n = IntRef.Create(game.platform.FloatToInt(progress * (b.animationcount * b.animationcount - 1)));
         }
         game.Draw2dTexture(game.GetTexture(b.image), 0, 0, b.size, b.size, n, b.animationcount, Game.ColorFromArgb(255, 255, 255, 255), true);
         game.GLPopMatrix();
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:26,代码来源:DrawSprites.ci.cs

示例4: DrawPlayerOxygen

 public void DrawPlayerOxygen(Game game)
 {
     if (game.PlayerStats != null)
     {
         if (game.PlayerStats.CurrentOxygen < game.PlayerStats.MaxOxygen)
         {
             float progress = game.one * game.PlayerStats.CurrentOxygen / game.PlayerStats.MaxOxygen;
             int InventoryStartX = game.Width() / 2 - 540 / 2;
             int InventoryStartY = game.Height() - 140;
             int posX = InventoryStartX + 10;
             int posY = InventoryStartY + 10;
             game.Draw2dTexture(game.GetTexture("hobars.png"), posX, posY - barSizeY, barSizeX, barSizeY, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
             game.Draw2dTexture(game.GetTexture("hobars.png"), posX, posY - barSizeY, (progress) * barSizeX, barSizeY, null, 0, Game.ColorFromArgb(255, 0, 0, 255), false);
         }
     }
 }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:16,代码来源:Draw2dMisc.ci.cs

示例5: OnNewFrameDraw3d

    public override void OnNewFrameDraw3d(Game game, float dt)
    {
        GamePlatform platform = game.platform;
        game.GLMatrixModeModelView();
        if (suntexture == -1)
        {
            suntexture = game.GetTexture("sun.png");
            moontexture = game.GetTexture("moon.png");
        }
        UpdateSunMoonPosition(game, dt);

        float posX;
        float posY;
        float posZ;
        if (!game.isNight)
        {
            posX = game.sunPositionX;
            posY = game.sunPositionY;
            posZ = game.sunPositionZ;
        }
        else
        {
            posX = game.moonPositionX;
            posY = game.moonPositionY;
            posZ = game.moonPositionZ;
        }
        posX += game.player.position.x;
        posY += game.player.position.y;
        posZ += game.player.position.z;

        game.GLPushMatrix();
        game.GLTranslate(posX, posY, posZ);
        ModDrawSprites.Billboard(game);
        game.GLScale(one * 2 / 100, one * 2 / 100, one * 2 / 100);
        //GL.Translate(-ImageSize / 2, -ImageSize / 2, 0);
        game.Draw2dTexture(game.isNight ? moontexture : suntexture, 0, 0, ImageSize, ImageSize, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
        game.GLPopMatrix();
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:38,代码来源:SunMoonRenderer.ci.cs

示例6: Handle

 public override void Handle(Game game, Packet_Server packet)
 {
     //Check if Entity has DownloadSkin set and texture is not empty or default player texture
     if (game.entities[packet.EntityDespawn.Id] != null)
     {
         if (game.entities[packet.EntityDespawn.Id].drawModel != null && game.entities[packet.EntityDespawn.Id].drawModel.DownloadSkin)
         {
             int currentTex = game.entities[packet.EntityDespawn.Id].drawModel.CurrentTexture;
             if (currentTex > 0 && currentTex != game.GetTexture("mineplayer.png"))
             {
                 //Entity probably is a player. Set CurrentTexture to -1 and then delete stored texture.
                 game.entities[packet.EntityDespawn.Id].drawModel.CurrentTexture = -1;
                 game.DeleteTexture(game.entities[packet.EntityDespawn.Id].drawName.Name);
             }
         }
     }
     game.entities[packet.EntityDespawn.Id] = null;
 }
开发者ID:samuto,项目名称:manicdigger,代码行数:18,代码来源:NetworkEntity.ci.cs

示例7: DrawTestModel

 void DrawTestModel(Game game, float deltaTime)
 {
     if (!game.ENABLE_DRAW_TEST_CHARACTER)
     {
         return;
     }
     if (testmodel == null)
     {
         testmodel = new AnimatedModelRenderer();
         byte[] data = game.GetFile("player.txt");
         int dataLength = game.GetFileLength("player.txt");
         string dataString = game.platform.StringFromUtf8ByteArray(data, dataLength);
         AnimatedModel model = AnimatedModelSerializer.Deserialize(game.platform, dataString);
         testmodel.Start(game, model);
     }
     game.GLPushMatrix();
     game.GLTranslate(game.map.MapSizeX / 2, game.blockheight(game.map.MapSizeX / 2, game.map.MapSizeY / 2 - 2, 128), game.map.MapSizeY / 2 - 2);
     game.platform.BindTexture2d(game.GetTexture("mineplayer.png"));
     testmodel.Render(deltaTime, 0, true, true, 1);
     game.GLPopMatrix();
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:21,代码来源:DrawTestModel.ci.cs

示例8: Draw

 public void Draw(Game game, float positionX, float positionY, float positionZ, VehicleDirection12 dir, VehicleDirection12 lastdir, float progress)
 {
     float one = 1;
     if (minecarttexture == -1)
     {
         minecarttexture = game.GetTexture("minecart.png");
     }
     game.GLPushMatrix();
     float pX = positionX;
     float pY = positionY;
     float pZ = positionZ;
     pY += -(one * 7 / 10);
     game.GLTranslate(pX, pY, pZ);
     float currot = vehiclerotation(dir);
     float lastrot = vehiclerotation(lastdir);
     //double rot = lastrot + (currot - lastrot) * progress;
     float rot = AngleInterpolation.InterpolateAngle360(game.platform, lastrot, currot, progress);
     game.GLRotate(-rot - 90, 0, 1, 0);
     RectangleFloat[] cc = CuboidRenderer.CuboidNet(8, 8, 8, 0, 0);
     CuboidRenderer.CuboidNetNormalize(cc, 32, 16);
     game.platform.BindTexture2d(minecarttexture);
     CuboidRenderer.DrawCuboid(game, -(one * 5 / 10), -(one * 3 / 10), -(one * 5 / 10), 1, 1, 1, cc, 1);
     game.GLPopMatrix();
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:24,代码来源:MinecartRenderer.ci.cs

示例9: DrawBackground

 void DrawBackground(Game game)
 {
     backgroundW = 512;
     backgroundH = 512;
     //Background tiling
     int countX = game.platform.FloatToInt(Width / backgroundW) + 1;
     int countY = game.platform.FloatToInt(Height / backgroundH) + 1;
     for (int x = 0; x < countX; x++)
     {
         for (int y = 0; y < countY; y++)
         {
             game.Draw2dTexture(game.GetTexture("background.png"), x * backgroundW, y * backgroundH, backgroundW, backgroundH, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
         }
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:15,代码来源:GuiMapLoading.ci.cs

示例10: LoadPlayerTextures

    internal void LoadPlayerTextures(Game game)
    {
        if (!game.issingleplayer)
        {
            if (skinserverResponse.done)
            {
                skinserver = game.platform.StringFromUtf8ByteArray(skinserverResponse.value, skinserverResponse.valueLength);
            }
            else if (skinserverResponse.error)
            {
                skinserver = null;
            }
            else
            {
                return;
            }
        }
        for (int i = 0; i < game.entitiesCount; i++)
        {
            Entity e = game.entities[i];
            if (e == null) { continue; }
            if (e.drawModel == null) { continue; }
            if (e.drawModel.CurrentTexture != -1)
            {
                continue;
            }
            // a) download skin
            if (!game.issingleplayer && e.drawModel.DownloadSkin && skinserver != null && e.drawModel.Texture_ == null)
            {
                if (e.drawModel.SkinDownloadResponse == null)
                {
                    e.drawModel.SkinDownloadResponse = new HttpResponseCi();
                    string url = StringTools.StringAppend(game.platform, skinserver, StringTools.StringSubstringToEnd(game.platform, e.drawName.Name, 2));
                    url = StringTools.StringAppend(game.platform, url, ".png");
                    game.platform.WebClientDownloadDataAsync(url, e.drawModel.SkinDownloadResponse);
                    continue;
                }
                if (!e.drawModel.SkinDownloadResponse.error)
                {
                    if (!e.drawModel.SkinDownloadResponse.done)
                    {
                        continue;
                    }
                    BitmapCi bmp_ = game.platform.BitmapCreateFromPng(e.drawModel.SkinDownloadResponse.value, e.drawModel.SkinDownloadResponse.valueLength);
                    if (bmp_ != null)
                    {
                        e.drawModel.CurrentTexture = game.GetTextureOrLoad(e.drawName.Name, bmp_);
                        game.platform.BitmapDelete(bmp_);
                        continue;
                    }
                }
            }
            // b) file skin
            if (e.drawModel.Texture_ == null)
            {
                e.drawModel.CurrentTexture = game.GetTexture("mineplayer.png");
                continue;
            }

            byte[] file = game.GetFile(e.drawModel.Texture_);
            if (file == null)
            {
                e.drawModel.CurrentTexture = 0;
                continue;
            }
            BitmapCi bmp = game.platform.BitmapCreateFromPng(file, game.platform.ByteArrayLength(file));
            if (bmp == null)
            {
                e.drawModel.CurrentTexture = 0;
                continue;
            }
            e.drawModel.CurrentTexture = game.GetTextureOrLoad(e.drawModel.Texture_, bmp);
            game.platform.BitmapDelete(bmp);
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:75,代码来源:LoadPlayerTextures.ci.cs


注:本文中的Game.GetTexture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。