示例#1
0
        public override void Update(GameLoop gameLoop)
        {
            FontHandler.AddText(new Text("My house is secure", "menu1", new Vector2(Program.Window.Width / 2, 100), 2f, false));
            FontHandler.AddText(new Text("start game", "menu2", new Vector2(Program.Window.Width / 2, 350), 1f, false));
            FontHandler.AddText(new Text("exit", "menu3", new Vector2(Program.Window.Width / 2, 420), 1f, false));

            if (Input.GetState(0).Mouse.LeftButton)
            {
                if (GameObject.Contains(Input.GetState(0).MousePosition, button1))
                {
                    button1.color        = Color4.DarkBlue;
                    button1Outline.color = Color4.Blue;
                }
                else if (GameObject.Contains(Input.GetState(0).MousePosition, button2))
                {
                    button2.color        = Color4.DarkGreen;
                    button2Outline.color = Color4.Green;
                }
            }
            else
            {
                button1.color        = Color4.Blue;
                button1Outline.color = Color4.DarkBlue;
                button2.color        = Color4.Green;
                button2Outline.color = Color4.DarkGreen;
            }
        }
示例#2
0
        public DialogResult ShowDialog(Window parent)
        {
            if (parent != null)
            {
                var owner = parent.ControlObject as sw.Window;
                Control.Owner = owner;
                Control.WindowStartupLocation = sw.WindowStartupLocation.CenterOwner;
            }
            if (Font != null)
            {
                var fontHandler = (FontHandler)Font.Handler;
                Control.SelectedFontFamily    = fontHandler.WpfFamily;
                Control.SelectedFontPointSize = fontHandler.Size;
                Control.SelectedFontStyle     = fontHandler.WpfFontStyle;
                Control.SelectedFontWeight    = fontHandler.WpfFontWeight;
            }
            var result = Control.ShowDialog();

            if (result == true)
            {
                var fontHandler = new FontHandler(Widget.Generator, Control.SelectedFontFamily, Control.SelectedFontPointSize, Control.SelectedFontStyle, Control.SelectedFontWeight);
                Font = new Font(Widget.Generator, fontHandler);
                Widget.OnFontChanged(EventArgs.Empty);
            }

            return(result != null && result.Value ? DialogResult.Ok : DialogResult.Cancel);
        }
示例#3
0
        public Result <IReadOnlyList <Tag> > Build(IEnumerable <Word> wordsFrequency)
        {
            cloudLayouter.ClearLayout();

            var tags = new List <Tag>();

            foreach (var word in wordsFrequency)
            {
                var fontCalculateResult = Result.Of(() => FontHandler.CalculateFont(word.Weight, fontSettings));
                var tagResult           = fontCalculateResult
                                          .Then(fnt => word.Value.MeasureString(fnt))
                                          .Then(tagSize => cloudLayouter.PutNextRectangle(tagSize))
                                          .Then(rect => new Tag(word.Value, rect, fontCalculateResult.Value));

                if (tagResult.IsSuccess)
                {
                    tags.Add(tagResult.Value);
                }
                else
                {
                    return(Result.Fail <IReadOnlyList <Tag> >(tagResult.Error));
                }
            }

            return(tags);
        }
示例#4
0
        public void DrawText(Font font, SolidBrush brush, float x, float y, string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            StartDrawing();
#if OSX
            var nsfont = FontHandler.GetControl(font);
            var str    = new NSString(text);
            var dic    = new NSMutableDictionary();
            dic.Add(NSAttributedString.ForegroundColorAttributeName, brush.Color.ToNS());
            dic.Add(NSAttributedString.FontAttributeName, nsfont);
            //context.SetShouldAntialias(true);
            if (!Flipped)
            {
                var size = str.StringSize(dic);
                Control.ConcatCTM(new CGAffineTransform(1, 0, 0, -1, 0, ViewHeight));
                y = ViewHeight - y - size.Height;
            }
            str.DrawString(TranslateView(new SD.PointF(x, y)), dic);
            //context.SetShouldAntialias(antialias);
#elif IOS
            var uifont = font.ToUI();
            var str    = new NSString(text);
            var size   = str.StringSize(uifont);
            //context.SetShouldAntialias(true);
            Control.SetFillColor(brush.Color.ToCGColor());
            str.DrawString(TranslateView(new SD.PointF(x, y), elementHeight: size.Height), uifont);
#endif

            EndDrawing();
        }
示例#5
0
        private void Title()
        {
            var name = $"Anteckningar för {PreviousYear}";
            var font = FontHandler.FontFromName("Arial");

            font.SetStyle("bold");
            font.Size = 24;

            var title = new Paragraph(name, font)
            {
                Alignment = Element.ALIGN_CENTER
            };

            title.Chunks.First().SetBackground(BaseColor.WHITE);

            var cell = new PdfPCell(title)
            {
                HorizontalAlignment = Element.ALIGN_CENTER,
                BackgroundColor     = BaseColor.WHITE,
                Border = PdfPCell.NO_BORDER
            };

            cell.AddElement(title);
            AddCell(cell);
        }
 public void SetNumber(int number)
 {
     if (FontHandler.Numbers()[number] == m_scoreImage.texture)
     {
         return;
     }
     StartCoroutine(SetNumberCoroutine(FontHandler.Numbers()[number]));
 }
示例#7
0
 public static void LoadPreContent(ContentManager content, GameWindow window, GraphicsDevice graphics)
 {
     graphicsDevice = graphics;
     //Load Pre textures and assets
     FontHandler.LoadContent(content);
     TextureHandler.LoadPreContent(content);
     background = new Background(TextureHandler.Sprites["Backgrounds/background1"], window);
 }
示例#8
0
 public static void Draw()
 {
     FontHandler.AddText(new Text(PlayerAmmo.ToString(), "ammo", new Vector2(35, 85), 0.4f, true));
     FontHandler.AddText(new Text(PlayerHealth.ToString(), "health", new Vector2(35, 110), 0.5f, true));
     FontHandler.AddText(new Text(PlayerMoney.ToString(), "monies", new Vector2(35, 143.5f), 0.5f, true));
     Weapon.Draw();
     Hud.Draw();
 }
示例#9
0
        protected override void UpdateListView()
        {
            Font defFont  = ListView.Font;
            var  boldFont = new FontHandler(new Font(defFont, FontStyle.Bold));

            var lv = GetControlHandler <IListView>(ListView);

            ModelPresenter.FillTransfersLV(lv, fModel, boldFont);
        }
示例#10
0
        public IReadOnlyList <Tag> Build(IEnumerable <Word> wordsFrequency)
        {
            cloudLayouter.ClearLayout();

            return((from word in wordsFrequency
                    let font = FontHandler.CalculateFont(word.Weight, fontSettings)
                               let tagSize = word.Value.MeasureString(font)
                                             let rectangle = cloudLayouter.PutNextRectangle(tagSize)
                                                             select new Tag(word.Value, rectangle, font)).ToList());
        }
示例#11
0
        private StackPanel GetFontPanel(FontHandler F)
        {
            #region Sequential Code
            StackPanel parent = new StackPanel();

            TextBlock tb = new TextBlock();

            tb.Text       = "The quick brown fox jumps over the crazy dog";
            tb.Margin     = new Thickness(2);
            tb.FontSize   = 32;
            tb.Background = (Brush)(new BrushConverter()).ConvertFrom("#222");
            tb.Padding    = new Thickness(10);
            tb.Cursor     = Cursors.Hand;

            Label lb = new Label();
            lb.Foreground = (Brush)(new BrushConverter()).ConvertFrom("#CCC");
            lb.FontSize   = 16;

            tb.FontFamily = F.Family;
            lb.Content    = F.FontName;

            parent.Children.Add(lb);
            parent.Children.Add(tb);

            tb.MouseEnter += (s, e) =>
            {
                tb.Background = (Brush)(new BrushConverter()).ConvertFrom("#CCC");
                tb.Foreground = (Brush)(new BrushConverter()).ConvertFrom("#222");
            };
            tb.MouseLeave += (s, e) =>
            {
                tb.Background = (Brush)(new BrushConverter()).ConvertFrom("#222");
                tb.Foreground = (Brush)(new BrushConverter()).ConvertFrom("#FFF");
            };
            tb.MouseLeftButtonDown += (s, e) =>
            {
                this.Topmost = false;
                string     _fn = lb.Content.ToString();
                FontFamily _ff = tb.FontFamily;
                Thread     T   = new Thread(() =>
                {
                    (new FontPreviewWindow(_fn, _ff)).Show();
                    System.Windows.Threading.Dispatcher.Run();
                })
                {
                    IsBackground = true
                };
                T.SetApartmentState(ApartmentState.STA);
                T.Start();
            };
            return(parent);

            #endregion
        }
    public void SetTime(int seconds)
    {
        int mins = seconds / 60;

        seconds %= 60;

        m_minutesLeft.texture  = FontHandler.Number(mins / 10);
        m_minutesRight.texture = FontHandler.Number(mins % 10);
        m_secondsLeft.texture  = FontHandler.Number(seconds / 10);
        m_secondsRight.texture = FontHandler.Number(seconds % 10);
    }
示例#13
0
        protected override void UpdateListView()
        {
            var boldFont = new FontHandler(new Font(ListView.Font, FontStyle.Bold));
            var lv       = GetControlHandler <IListView>(ListView);
            var records  = fModel.QueryTransferExpenses();

            ModelPresenter.FillBudgetLV(lv, fModel, records, boldFont);

            fTotalFooter = CalcFooter(records);

            CollectBrands(records);
            CollectShops(records);
        }
示例#14
0
        public Main()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory    = "Content";
            Window.Title             = "Sandboxin 4 days";
            Window.AllowUserResizing = true;

            Window.ClientSizeChanged += OnResize;
            Window.TextInput         += TextInputHandler;

            graphics.PreferredBackBufferHeight = 450;
            textureHandler = new TextureHandler();
            fontHandler    = new FontHandler();
        }
    public void SetValue(int value)
    {
        int digitCount = 1;
        int tmp        = value;

        while (tmp >= 10)
        {
            tmp /= 10;
            digitCount++;
        }

        if (m_images != null)
        {
            foreach (RawImage image in m_images)
            {
                if (image == m_base)
                {
                    continue;
                }

                GameObject.Destroy(image.gameObject);
            }
        }

        m_images = new List <RawImage>();
        m_images.Add(m_base);

        for (int i = 1; i < digitCount; i++)
        {
            RawImage image = GameObject.Instantiate(m_base);

            Vector3 pos = m_base.transform.position;
            pos.x += i * 30 * m_base.transform.lossyScale.x;
            image.transform.position = pos;

            image.transform.SetParent(transform);
            image.transform.localScale = m_base.transform.localScale;

            m_images.Add(image);
        }

        tmp = value;
        for (int i = digitCount - 1; i >= 0; i--)
        {
            m_images[i].texture = FontHandler.Number(tmp % 10);
            tmp /= 10;
        }
    }
示例#16
0
        private Phrase Title()
        {
            var name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Name);
            var font = FontHandler.FontFromName("Arial");

            font.SetStyle("bold");
            font.Size = 24;

            var paragraph = new Paragraph(name, font)
            {
                Alignment = Element.ALIGN_CENTER
            };

            paragraph.Chunks.First().SetBackground(BaseColor.WHITE);
            return(paragraph);
        }
示例#17
0
        private void panDefFont_Click(object sender, EventArgs e)
        {
            TreeChartOptions chartOptions = fOptions.TreeChartOptions;

            var   sdFont = new Font(chartOptions.DefFontName, chartOptions.DefFontSize);
            IFont font   = new FontHandler(sdFont);

            font = AppHost.StdDialogs.SelectFont(font);
            if (font != null)
            {
                chartOptions.DefFontName = font.Name;
                chartOptions.DefFontSize = (int)(Math.Round(font.Size));
            }

            UpdateTreeChartFont();
        }
示例#18
0
        //Initialization and content loading
        public static void Initialize()
        {
            //Creates folder structure if nescessary
            CreateFolderStructure();
            frameCounter = new FrameCounter();

            random = new Random();

            TextureHandler.Initialize();
            InputHandler.Initialize();
            FontHandler.Initialize();
            displayGames             = new DisplayGames();
            playerInformationHandler = PlayerInformationHandler.Initialize();
            Tick = 0;
            MouseHandler.Initialize();
            store = new Store(playerInformationHandler, (int)States.Store);
        }
    private void UpdateTimer()
    {
        float elapsedTime    = Time.time - m_startTime;
        int   elapsedSeconds = ((int)elapsedTime) % 60;
        int   elapsedMins    = (int)elapsedTime / 60;

        int minutesLeftIdx  = elapsedMins / 10;
        int minutesRightIdx = elapsedMins % 10;
        int secondsLeftIdx  = elapsedSeconds / 10;
        int secondsRightIdx = elapsedSeconds % 10;


        m_minutesLeft.texture  = FontHandler.Number(minutesLeftIdx);
        m_minutesRight.texture = FontHandler.Number(minutesRightIdx);
        m_secondsLeft.texture  = FontHandler.Number(secondsLeftIdx);
        m_secondsRight.texture = FontHandler.Number(secondsRightIdx);
    }
示例#20
0
        private void NoteHeader()
        {
            var text = $"Anteckningar om året {PreviousYear}";
            var font = FontHandler.FontFromName("Arial");

            font.SetStyle("bold");
            font.Size = 16;
            var paragraph = new Paragraph(text, font);

            var cell = new PdfPCell(paragraph)
            {
                Border          = PdfPCell.NO_BORDER,
                BackgroundColor = BaseColor.WHITE
            };

            AddCell(cell);
        }
示例#21
0
        private Bitmap resizeImage(Bitmap imgPhoto, int Width, int Height)
        {
            int sourceWidth  = imgPhoto.Width;
            int sourceHeight = imgPhoto.Height;
            int sourceX      = 0;
            int sourceY      = 0;
            int destX        = 0;
            int destY        = 0;

            float nPercent  = 0;
            float nPercentW = 0;
            float nPercentH = 0;

            nPercentW = ((float)Width / (float)sourceWidth);
            nPercentH = ((float)Height / (float)sourceHeight);
            if (nPercentH < nPercentW)
            {
                nPercent = nPercentH;
                destX    = Convert.ToInt16((Width - (sourceWidth * nPercent)) / 2);
            }
            else
            {
                nPercent = nPercentW;
                destY    = Convert.ToInt16((Height - (sourceHeight * nPercent)) / 2);
            }
            int destWidth  = (int)(sourceWidth * nPercent);
            int destHeight = (int)(sourceHeight * nPercent);

            Bitmap bmPhoto = new Bitmap(Width, Height,
                                        System.Drawing.Imaging.PixelFormat.Format24bppRgb);

            bmPhoto.SetResolution(imgPhoto.HorizontalResolution,
                                  imgPhoto.VerticalResolution);

            using (Graphics grPhoto = Graphics.FromImage(bmPhoto))
            {
                grPhoto.Clear(System.Drawing.Color.White);
                grPhoto.InterpolationMode =
                    System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                grPhoto.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                grPhoto.DrawImage(imgPhoto, new Rectangle(destX, destY, destWidth, destHeight),
                                  new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), GraphicsUnit.Pixel);
                bmPhoto = FontHandler.Crop(bmPhoto);
                return(bmPhoto);
            }
        }
示例#22
0
        private void Title()
        {
            var text = $"Kalender {Year}";
            var font = FontHandler.FontFromName("Arial");

            font.SetStyle("bold");
            font.Size = 78;

            var paragraph = new Paragraph(text, font)
            {
                Alignment = Element.ALIGN_CENTER
            };

            var cell = new PdfPCell(paragraph)
            {
                HorizontalAlignment = PdfPCell.ALIGN_CENTER,
                Border          = PdfPCell.NO_BORDER,
                BackgroundColor = BaseColor.WHITE
            };

            AddCell(cell);
        }
示例#23
0
        private void Header(PdfPTable table)
        {
            var cells = new List <PdfPCell>();

            for (int i = 0; i < 8; i++)
            {
                var cell = new PdfPCell
                {
                    FixedHeight         = 25,
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER,
                    VerticalAlignment   = PdfPCell.ALIGN_MIDDLE,
                    UseAscender         = true, // Needed to fix vertical alignment.
                    BackgroundColor     = BaseColor.WHITE
                };
                cells.Add(cell);
            }

            var font = FontHandler.FontFromName("Arial");

            font.SetStyle("bold");
            font.Size = 16;

            cells[0].Phrase = new Phrase("Vecka", font);
            cells[1].Phrase = new Phrase("Måndag", font);
            cells[2].Phrase = new Phrase("Tisdag", font);
            cells[3].Phrase = new Phrase("Onsdag", font);
            cells[4].Phrase = new Phrase("Torsdag", font);
            cells[5].Phrase = new Phrase("Fredag", font);
            cells[6].Phrase = new Phrase("Lördag", font);
            cells[7].Phrase = new Phrase("Söndag", font);

            foreach (var cell in cells)
            {
                table.AddCell(cell);
            }
        }
示例#24
0
 public WebSafeFontsHandler(string[] webSafeFontNames)
 {
     WebSafeFontNames = webSafeFontNames;
     FontHandler      = new FontHandler();
 }
示例#25
0
 public override void Update(GameLoop gameLoop)
 {
     FontHandler.TextList = new List <Text>();
     FontHandler.AddText(new Text("UR DEAD :]", "teehee", new Vector2(Program.Window.Width / 2, Program.Window.Height / 2), 2f, false));
     FontHandler.AddText(new Text("SPACE TO TRY AGAIN", "teehee2", new Vector2(Program.Window.Width / 2, Program.Window.Height / 2 + 50), 1f, false));
 }
示例#26
0
        public override void Update(GameLoop gameLoop)
        {
            if (!startedMusic && Program.MenuMusic != null)
            {
                Program.MenuMusic.Gain = 0;
                Program.MenuMusic.Play();
                startedMusic = true;
            }

            if (!begin && alpha > 0)
            {
                alpha -= 0.001f;
                if (Program.MenuMusic != null && Program.MenuMusic.Gain < 0.25)
                {
                    Program.MenuMusic.Gain += 0.00025f;
                }
                if (Program.Music != null && Program.Music.Gain > 0)
                {
                    Program.Music.Gain -= 0.00025f;
                }
            }
            if (alpha <= 0 && !begin)
            {
                if (Program.MenuMusic != null && Program.MenuMusic.Gain < 0.25)
                {
                    Program.MenuMusic.Gain += 0.00025f;
                }
                if (Program.Music != null && Program.Music.Gain > 0)
                {
                    Program.Music.Gain -= 0.00025f;
                }
                if (!showQuitMessage)
                {
                    if (Input.GetState(0).Keyboard[Key.Up] && arrow.Position.Y != 228)
                    {
                        ContentManager.GetSound("select").Play();
                        arrow.Position.Y = 228;
                    }
                    if (Input.GetState(0).Keyboard[Key.Down] && arrow.Position.Y != 228 + 45)
                    {
                        ContentManager.GetSound("select").Play();
                        arrow.Position.Y = 228 + 45;
                    }
                    if (Input.GetState(0).Keyboard[Key.Enter] && !Input.GetState(1).Keyboard[Key.Enter])
                    {
                        ContentManager.GetSound("select").Play();
                        if (arrow.Position.Y == 228)
                        {
                            begin = true;
                        }
                        else
                        {
                            showQuitMessage = true;
                            Random rand = new Random();
                            switch (rand.Next(0, 8))
                            {
                            case 0:
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("For guns and glory, press N ", "quit1", new Vector2(640 / 2, 480 / 2 - 25), 0.5f, false));
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("For work and worry, press Y", "quit2", new Vector2(640 / 2, 480 / 2 + 25), 0.5f, false));
                                break;

                            case 1:
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Press N if you are brave", "quit1", new Vector2(640 / 2, 480 / 2 - 25), 0.5f, false));
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Press Y to cower in shame", "quit2", new Vector2(640 / 2, 480 / 2 + 25), 0.5f, false));
                                break;

                            case 2:
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("You are at an intersection", "quit1", new Vector2(640 / 2, 480 / 2 - 25), 0.5f, false));
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("A sign says, `press Y to quit.`", "quit2", new Vector2(640 / 2, 480 / 2 + 25), 0.5f, false));
                                break;

                            case 3:
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Press N to save the world", "quit1", new Vector2(640 / 2, 480 / 2 - 25), 0.5f, false));
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Press Y to abandon it in its hour of need", "quit2", new Vector2(640 / 2, 480 / 2 + 25), 0.5f, false));
                                break;

                            case 4:
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Press N for more carnage", "quit1", new Vector2(640 / 2, 480 / 2 - 25), 0.5f, false));
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Press Y to be a weenie", "quit2", new Vector2(640 / 2, 480 / 2 + 25), 0.5f, false));
                                break;

                            case 5:
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Heroes, press N", "quit1", new Vector2(640 / 2, 480 / 2 - 25), 0.5f, false));
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Whimps, press Y", "quit2", new Vector2(640 / 2, 480 / 2 + 25), 0.5f, false));
                                break;

                            case 6:
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Chickening out...", "quit1", new Vector2(640 / 2, 480 / 2 - 25), 0.5f, false));
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("already?", "quit2", new Vector2(640 / 2, 480 / 2 + 25), 0.5f, false));
                                break;

                            default:
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("Dost thou wish to leave with ", "quit1", new Vector2(640 / 2, 480 / 2 - 25), 0.5f, false));
                                FontHandler.AddText(new MetalLib.Pencil.Gaming.Text("such hasty abandon? Y / N", "quit2", new Vector2(640 / 2, 480 / 2 + 25), 0.5f, false));
                                break;
                            }
                        }
                    }
                }
                else
                {
                    if (Input.GetState(0).Keyboard['Y'])
                    {
                        ContentManager.GetSound("select").Play();
                        gameLoop.Run = false;
                    }
                    else if (Input.GetState(0).Keyboard['N'])
                    {
                        ContentManager.GetSound("select").Play();
                        showQuitMessage      = false;
                        FontHandler.TextList = new List <MetalLib.Pencil.Gaming.Text>();
                    }
                }
            }
            if (begin)
            {
                if (Program.MenuMusic.Gain > 0.0)
                {
                    Program.MenuMusic.Gain -= 0.00025f;
                }
                if (alpha < 1f)
                {
                    alpha += 0.001f;
                    Glfw.SetTime(0.0);
                }
                else
                {
                    Program.TotalTime += (float)Glfw.GetTime();
                    double delta = Glfw.GetTime();
                    if (Program.TotalTime > 1f)
                    {
                        Glfw.SetTime(0.0);
                    }
                    psycheTime -= delta;
                    if (psycheTime <= 0)
                    {
                        GL.Color4(Color4.White);
                        if (gameplayState == null)
                        {
                            gameLoop.ActiveGameState = new GamePlayState();
                        }
                        else
                        {
                            gameLoop.ActiveGameState = gameplayState;
                        }
                    }
                }
            }
        }
示例#27
0
        public override void Draw()
        {
            if (begin && alpha >= 1f)
            {
                GL.Enable(EnableCap.Blend);
                GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);
                GL.Begin(BeginMode.Quads);

                GL.Color4(0, 0, 0, 0.5f);


                GL.Vertex2(0, 0);
                GL.Vertex2(640, 0);
                GL.Vertex2(640, 480);
                GL.Vertex2(0, 480);

                GL.End();
                GL.Disable(EnableCap.Blend);

                menuScreen = new Sprite("getpsyched", new Vector2(640 / 2, 480 / 2));
                menuScreen.Draw();

                GL.LineWidth(4f);
                GL.Begin(BeginMode.Lines);

                GL.Color4(Color4.DarkRed);
                GL.Vertex2((640 / 2) - menuScreen.Texture.Width / 2, (480 / 2) + 38);
                GL.Color4(Color4.Red);
                GL.Vertex2(((640 / 2) + menuScreen.Texture.Width / 2) - menuScreen.Texture.Width * psycheTime, (480 / 2) + 38);
                GL.End();
            }
            else
            {
                menuScreen.Draw();
                arrow.Draw();
                if (showQuitMessage)
                {
                    GL.Color4(Color4.DarkGray);
                    GL.Begin(BeginMode.Quads);

                    GL.Vertex2(640 / 2 - 240, 480 / 2 - 70);
                    GL.Vertex2(640 / 2 + 240, 480 / 2 - 70);
                    GL.Vertex2(640 / 2 + 240, 480 / 2 + 70);
                    GL.Vertex2(640 / 2 - 240, 480 / 2 + 70);

                    GL.End();
                    FontHandler.Draw();
                }
                GL.Enable(EnableCap.Blend);
                GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);
                GL.Begin(BeginMode.Quads);

                GL.Color4(0, 0, 0, alpha);


                GL.Vertex2(0, 0);
                GL.Vertex2(640, 0);
                GL.Vertex2(640, 480);
                GL.Vertex2(0, 480);

                GL.End();
                GL.Disable(EnableCap.Blend);
            }
        }
示例#28
0
 public static ag.Typeface ToAndroid(this Font font)
 {
     return(FontHandler.GetControl(font));
 }
 public void Start()
 {
     s_singleton = this;
 }
示例#30
0
        public override void Update(GameLoop gameLoop)
        {
            FontHandler.AddText(new Text("150", "0", new Vector2(150, 480), 1f, false));
            FontHandler.AddText(new Text("150", "1", new Vector2(150 + 248, 480), 1f, false));
            FontHandler.AddText(new Text("50", "2", new Vector2(150 + (248 * 2), 480), 1f, false));
            FontHandler.AddText(new Text("50", "3", new Vector2(150 + (248 * 3), 480), 1f, false));
            FontHandler.AddText(new Text("125", "4", new Vector2(150 + (248 * 4), 480), 1f, false));
            FontHandler.AddText(new Text("TO SPEND: " + HudHandler.PlayerMoney, "money", new Vector2(Program.Window.Width / 2, 600), 1f, false));



            if (Input.GetState(0).Mouse.LeftButton&& !Input.GetState(1).Mouse.LeftButton)
            {
                int i = 0;
                foreach (GameObject g in boxes)
                {
                    if (GameObject.Contains(Input.GetState(0).MousePosition, g))
                    {
                        if (i == 0 && !Player.hasMP7 && HudHandler.PlayerMoney >= 150)
                        {
                            Player.hasMP7           = true;
                            HudHandler.PlayerMoney -= 150;
                            ContentManager.GetSound("cashRegister").Play();
                        }
                        if (i == 1 && !Player.hasShotgun && HudHandler.PlayerMoney >= 150)
                        {
                            Player.hasShotgun       = true;
                            HudHandler.PlayerMoney -= 150;
                            ContentManager.GetSound("cashRegister").Play();
                        }
                        if (i == 2 && HudHandler.PlayerMoney >= 50)
                        {
                            HudHandler.PlayerAmmo  += 100;
                            HudHandler.PlayerMoney -= 50;
                            ContentManager.GetSound("cashRegister").Play();
                        }
                        if (i == 3 && HudHandler.PlayerMoney >= 50)
                        {
                            HudHandler.PlayerHealth = 100;
                            HudHandler.PlayerMoney -= 50;
                            ContentManager.GetSound("cashRegister").Play();
                        }
                        if (i == 4 && HudHandler.PlayerMoney >= 125)
                        {
                            HudHandler.PlayerHealth = 250;
                            HudHandler.PlayerMoney -= 125;
                            ContentManager.GetSound("cashRegister").Play();
                        }
                        if (i == 5)
                        {
                            FontHandler.TextList = new List <Text>();
                            GameplayState.InShop = false;
                            GameplayState.currentWave++;
                            game.GameWorld      = Loader.LoadMap();
                            game.zombiesSpawned = 0;
                        }
                    }
                    i++;
                }
            }
        }