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


C# Game.Height方法代码示例

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


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

示例1: GetPickingLine

    public void GetPickingLine(Game game, Line3D retPick, bool ispistolshoot)
    {
        int mouseX;
        int mouseY;

        if (game.cameratype == CameraType.Fpp || game.cameratype == CameraType.Tpp)
        {
            mouseX = game.Width() / 2;
            mouseY = game.Height() / 2;
        }
        else
        {
            mouseX = game.mouseCurrentX;
            mouseY = game.mouseCurrentY;
        }

        PointFloatRef aim = GetAim(game);
        if (ispistolshoot && (aim.X != 0 || aim.Y != 0))
        {
            mouseX += game.platform.FloatToInt(aim.X);
            mouseY += game.platform.FloatToInt(aim.Y);
        }

        tempViewport[0] = 0;
        tempViewport[1] = 0;
        tempViewport[2] = game.Width();
        tempViewport[3] = game.Height();

        unproject.UnProject(mouseX, game.Height() - mouseY, 1, game.mvMatrix.Peek(), game.pMatrix.Peek(), tempViewport, tempRay);
        unproject.UnProject(mouseX, game.Height() - mouseY, 0, game.mvMatrix.Peek(), game.pMatrix.Peek(), tempViewport, tempRayStartPoint);

        float raydirX = (tempRay[0] - tempRayStartPoint[0]);
        float raydirY = (tempRay[1] - tempRayStartPoint[1]);
        float raydirZ = (tempRay[2] - tempRayStartPoint[2]);
        float raydirLength = game.Length(raydirX, raydirY, raydirZ);
        raydirX /= raydirLength;
        raydirY /= raydirLength;
        raydirZ /= raydirLength;

        retPick.Start = new float[3];
        retPick.Start[0] = tempRayStartPoint[0];// +raydirX; //do not pick behind
        retPick.Start[1] = tempRayStartPoint[1];// +raydirY;
        retPick.Start[2] = tempRayStartPoint[2];// +raydirZ;

        float pickDistance1 = CurrentPickDistance(game) * ((ispistolshoot) ? 100 : 1);
        pickDistance1 += 1;
        retPick.End = new float[3];
        retPick.End[0] = tempRayStartPoint[0] + raydirX * pickDistance1;
        retPick.End[1] = tempRayStartPoint[1] + raydirY * pickDistance1;
        retPick.End[2] = tempRayStartPoint[2] + raydirZ * pickDistance1;
    }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:51,代码来源:Picking.ci.cs

示例2: DrawPlayerHealth

 public void DrawPlayerHealth(Game game)
 {
     if (game.PlayerStats != null)
     {
         float progress = game.one * game.PlayerStats.CurrentHealth / game.PlayerStats.MaxHealth;
         int posX = game.platform.FloatToInt(barDistanceToMargin * game.Scale());
         int posY = game.platform.FloatToInt(game.Height() - barDistanceToMargin * game.Scale());
         game.Draw2dTexture(game.WhiteTexture(), posX, posY - barSizeY * game.Scale(), barSizeX * game.Scale(), barSizeY * game.Scale(), null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
         game.Draw2dTexture(game.WhiteTexture(), posX, posY - (progress * barSizeY * game.Scale()), barSizeX * game.Scale(), (progress) * barSizeY * game.Scale(), 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:MagistrAVSH,项目名称:manicdigger,代码行数:12,代码来源:Draw2dMisc.ci.cs

示例3: 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 posX = barDistanceToMargin + barOffset;
             int posY = game.Height() - barDistanceToMargin;
             game.Draw2dTexture(game.WhiteTexture(), posX, posY - barSizeY, barSizeX, barSizeY, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
             game.Draw2dTexture(game.WhiteTexture(), posX, posY - (progress * barSizeY), barSizeX, (progress) * barSizeY, null, 0, Game.ColorFromArgb(255, 0, 0, 255), false);
         }
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:14,代码来源:Draw2dMisc.ci.cs

示例4: 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

示例5: OnNewFrameDraw3d

 public override void OnNewFrameDraw3d(Game game, float deltaTime)
 {
     if (ShouldDrawHand(game))
     {
         string img = HandImage2d(game);
         if (img != null)
         {
             game.OrthoMode(game.Width(), game.Height());
             if (lasthandimage != img)
             {
                 lasthandimage = img;
                 byte[] file = game.GetFile(img);
                 BitmapCi bmp = game.platform.BitmapCreateFromPng(file, game.platform.ByteArrayLength(file));
                 if (bmp != null)
                 {
                     game.handTexture = game.platform.LoadTextureFromBitmap(bmp);
                     game.platform.BitmapDelete(bmp);
                 }
             }
             game.Draw2dTexture(game.handTexture, game.Width() / 2, game.Height() - 512, 512, 512, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
             game.PerspectiveMode();
         }
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:24,代码来源:DrawHand2d.ci.cs

示例6: 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

示例7: DrawDialogs

 internal void DrawDialogs(Game game)
 {
     for (int i = 0; i < game.dialogsCount; i++)
     {
         if (game.dialogs[i] == null)
         {
             continue;
         }
         VisibleDialog d = game.dialogs[i];
         int x = game.Width() / 2 - d.value.Width / 2;
         int y = game.Height() / 2 - d.value.Height_ / 2;
         d.screen.screenx = x;
         d.screen.screeny = y;
         d.screen.DrawWidgets();
     }
 }
开发者ID:Matthewism,项目名称:manicdigger,代码行数:16,代码来源:Dialog.ci.cs

示例8: OnNewFrameDraw2d

    public override void OnNewFrameDraw2d(Game game_, float deltaTime)
    {
        if (!touchButtonsEnabled)
        {
            return;
        }

        game = game_;
        float dt = deltaTime;
        int buttonSize = 80;

        if (game.guistate != GuiState.Normal)
        {
            return;
        }

        buttonMenu.x = 16 * Scale();
        buttonMenu.y = (16 + 96 * 0) * Scale();
        buttonMenu.sizex = buttonSize * Scale();
        buttonMenu.sizey = buttonSize * Scale();

        buttonInventory.x = 16 * Scale();
        buttonInventory.y = (16 + 96 * 1) * Scale();
        buttonInventory.sizex = buttonSize * Scale();
        buttonInventory.sizey = buttonSize * Scale();

        buttonTalk.x = 16 * Scale();
        buttonTalk.y = (16 + 96 * 2) * Scale();
        buttonTalk.sizex = buttonSize * Scale();
        buttonTalk.sizey = buttonSize * Scale();

        buttonCamera.x = 16 * Scale();
        buttonCamera.y = (16 + 96 * 3) * Scale();
        buttonCamera.sizex = buttonSize * Scale();
        buttonCamera.sizey = buttonSize * Scale();

        if (!game.platform.IsMousePointerLocked())
        {
            if (game.cameratype == CameraType.Fpp || game.cameratype == CameraType.Tpp)
            {
                game.Draw2dText1("Move", game.Width() * 5 / 100, game.Height() * 85 / 100, game.platform.FloatToInt(Scale() * 50), null, false);
                game.Draw2dText1("Look", game.Width() * 80 / 100, game.Height() * 85 / 100, game.platform.FloatToInt(Scale() * 50), null, false);
            }
            DrawWidgets();
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:46,代码来源:GuiTouchButtons.ci.cs

示例9: OnTouchMove

 public override void OnTouchMove(Game game, TouchEventArgs e)
 {
     float one = 1;
     if (e.GetId() == touchIdMove)
     {
         float range = game.Width() * one / 20;
         game.touchMoveDx = e.GetX() - touchMoveStartX;
         game.touchMoveDy = -((e.GetY() - 1) - touchMoveStartY);
         float length = game.Length(game.touchMoveDx, game.touchMoveDy, 0);
         if (e.GetY() < game.Height() * 50 / 100)
         {
             game.touchMoveDx = 0;
             game.touchMoveDy = 1;
         }
         else
         {
             if (length > 0)
             {
                 game.touchMoveDx /= length;
                 game.touchMoveDy /= length;
             }
         }
     }
     if (e.GetId() == touchIdRotate)
     {
         game.touchOrientationDx += (e.GetX() - touchRotateStartX) / (game.Width() * one / 40);
         game.touchOrientationDy += (e.GetY() - touchRotateStartY) / (game.Width() * one / 40);
         touchRotateStartX = e.GetX();
         touchRotateStartY = e.GetY();
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:31,代码来源:GuiTouchButtons.ci.cs

示例10: DrawAim

 internal void DrawAim(Game game)
 {
     if (game.cameratype == CameraType.Overhead)
     {
         return;
     }
     int aimwidth = 32;
     int aimheight = 32;
     game.platform.BindTexture2d(0);
     if (game.CurrentAimRadius() > 1)
     {
         float fov_ = game.currentfov();
         game.Circle3i(game.Width() / 2, game.Height() / 2, game.CurrentAimRadius() * game.fov / fov_);
     }
     game.Draw2dBitmapFile("target.png", game.Width() / 2 - aimwidth / 2, game.Height() / 2 - aimheight / 2, aimwidth, aimheight);
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:16,代码来源:Draw2dMisc.ci.cs

示例11: DrawAmmo

 internal void DrawAmmo(Game game)
 {
     Packet_Item item = game.d_Inventory.RightHand[game.ActiveMaterial];
     if (item != null && item.ItemClass == Packet_ItemClassEnum.Block)
     {
         if (game.blocktypes[item.BlockId].IsPistol)
         {
             int loaded = game.LoadedAmmo[item.BlockId];
             int total = game.TotalAmmo[item.BlockId];
             string s = game.platform.StringFormat2("{0}/{1}", game.platform.IntToString(loaded), game.platform.IntToString(total - loaded));
             FontCi font = new FontCi();
             font.family = "Arial";
             font.size = 18;
             game.Draw2dText(s, font, game.Width() - game.TextSizeWidth(s, 18) - 50,
                 game.Height() - game.TextSizeHeight(s, 18) - 50, loaded == 0 ? IntRef.Create(Game.ColorFromArgb(255, 255, 0, 0)) : IntRef.Create(Game.ColorFromArgb(255, 255, 255, 255)), false);
             if (loaded == 0)
             {
                 font.size = 14;
                 string pressR = "Press R to reload";
                 game.Draw2dText(pressR, font, game.Width() - game.TextSizeWidth(pressR, 14) - 50,
                     game.Height() - game.TextSizeHeight(s, 14) - 80, IntRef.Create(Game.ColorFromArgb(255, 255, 0, 0)), false);
             }
         }
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:25,代码来源:Draw2dMisc.ci.cs


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