Exemple #1
0
        public MenuState(GameObject R)
            : base(R.Window)
        {
            SoundTrack = AudioMgr.GetMusic("soundtrack.ogg");

            ButtonOutlined StartButton = new ButtonOutlined(UI, "Start", FontMgr.GetFont("framd.ttf"));

            StartButton.Position    = new Vector2f(375f, 200f);
            StartButton.Size        = new Vector2f(95f, 50f);
            StartButton.MouseClick += (B, X, Y, Down) => {
                if (!Down)
                {
                    R.SwitchState(new GameState(R.Window));
                }
            };

            ButtonOutlined OptionsButton = new ButtonOutlined(UI, "Options", FontMgr.GetFont("framd.ttf"));

            OptionsButton.Position    = new Vector2f(365f, 300f);
            OptionsButton.Size        = new Vector2f(120f, 50f);
            OptionsButton.MouseClick += (B, X, Y, Down) => {
                Console.WriteLine("You clicked on the f*****g settings button. Are you happy now?");
            };

            ButtonOutlined QuitButton = new ButtonOutlined(UI, "Quit", FontMgr.GetFont("framd.ttf"));

            QuitButton.Position    = new Vector2f(385f, 400f);
            QuitButton.Size        = new Vector2f(85f, 50f);
            QuitButton.MouseClick += (B, X, Y, Down) => {
                if (!Down)
                {
                    R.Window.Close();
                }
            };
        }
Exemple #2
0
        protected override sealed void Draw(GameTime gameTime)
        {
            try
            {
                Device.Clear(Color.Blue);

                //Quake.Update();

                renderEngine.BeginRender();

                GameDraw(gameTime);

                if (showFps)
                {
                    FontMgr.DrawInScrnCoord("FPS = " + Fps.ToString(), new Vector2(30, 15), 0.5f, Color.White, 0f, GameFonts.Comic);
                }

                //TextEffect.Draw();

                renderEngine.EndRender();
                base.Draw(gameTime);
            }
            catch (Exception ex)
            {
                Log.Write(ex.Message);
            }
        }
Exemple #3
0
        private void LoadAssets()
        {
            FontMgr.Add("Fonts/Arial14");
            TextureMgr.Add("Sprites/Link");
            TextureMgr.Add("Sprites/Leaper");
            TextureMgr.Add("Sprites/character-4directions");
            TextureMgr.Add("Sprites/Pistol");
            TextureMgr.Add("Sprites/SMG");
            TextureMgr.Add("Sprites/Shotgun");
            TextureMgr.Add("Sprites/Bullet");
            TextureMgr.Add("Tilesets/alttp_tiles");
            TextureMgr.Add("Sprites/Monolith");
            TextureMgr.Add("Sprites/Pickme");

            SfxMgr.Add("Sounds/PistolShot");
            SfxMgr.Add("Sounds/PistolReload");
            SfxMgr.Add("Sounds/SMGShot");
            SfxMgr.Add("Sounds/SMGReload");
            SfxMgr.Add("Sounds/ShotgunShot");
            SfxMgr.Add("Sounds/ShotgunReload");
            SfxMgr.Add("Sounds/ShotgunPump");
            SfxMgr.Add("Sounds/DefaultDamage");
            SfxMgr.Add("Sounds/LinkDamage");
            SfxMgr.Add("Sounds/LeaperDamage");

            MusicMgr.Add("Music/song1");
        }
Exemple #4
0
        internal void PaintImageInShape(Graphics g)
        {
            List <Image>  imagesActual = new List <Image>();
            List <Image>  images       = new List <Image>();
            List <string> strings      = new List <string>();

            bool isReturnImage = FontMgr.GenerateBmps(imagesActual, images, strings);

            if (!isReturnImage)
            {
                return;
            }
            //Create shape
            Image image;

            image = images[0];
            //shape.Save("C:\\a.png",ImageFormat.Png);
            Font.FontFileName = FontMgr.FontFileName;
            if (FrameSizeFixed)
            {
                Font.Size = FontMgr.FontHeight / Zoom;
            }

            if (FontMgr.Bold)
            {
                Font.Style = Font.Style | FontStyle.Bold;
            }
            else
            {
                Font.Style = Font.Style & ((FontStyle.Bold | FontStyle.Italic | FontStyle.Strikeout | FontStyle.Underline) ^ FontStyle.Bold);
            }

            if (FontMgr.Italic)
            {
                Font.Style = FontStyle.Italic;
            }
            else
            {
                Font.Style = Font.Style & ((FontStyle.Bold | FontStyle.Italic | FontStyle.Strikeout | FontStyle.Underline) ^ FontStyle.Italic);
            }
            //Label shape
            _labelImage       = image;
            _labelImageActual = imagesActual[0];

            if (g == null) //get _labelImage, and _labelImageActual then exit
            {
                return;
            }
            Rectangle imageRectangle = new Rectangle(VirtualBounds.X, VirtualBounds.Y, image.Width, image.Height);

            VirtualBounds = imageRectangle;
            g.DrawImage(image, new Rectangle(VirtualBounds.X, VirtualBounds.Y, image.Width, image.Height));
            this._paintAction = PaintActionType.None;
        }
Exemple #5
0
        internal void FontMgrSetup(bool frameSizeFixed, bool fontSizeFixed, DrawMode isPlay)
        {
            var tmpZoom = isPlay == DrawMode.Upload ? 1 : Zoom;

            FontMgr.ShowGrid = false;
            //Zoom
            FontMgr.ScaleIndex = tmpZoom;
            //Paint type
            FontMgr.SetStyle(frameSizeFixed, fontSizeFixed);
            //Font info
            FontMgr.TextColor     = IsUpload ? SourceForeColor: ForeColor;
            FontMgr.BackColor     = IsUpload ? SourceBackColor: BackColor;
            FontMgr.FontName      = Font.Name;
            FontMgr.FontHeight    = int.Parse((Font.Size * tmpZoom).ToString());
            FontMgr.Alignment     = _textAlign;;
            FontMgr.LineAlignment = _textVAlign;
            FontMgr.Bold          = (Font.Style & FontStyle.Bold) == FontStyle.Bold;
            FontMgr.Italic        = (Font.Style & FontStyle.Italic) == FontStyle.Italic;
            FontMgr.KernAmount    = KernAmount * tmpZoom;
            FontMgr.LeadAmount    = LeadAmount * tmpZoom;
            //FontMgr.ShowGrid = hideGrid ? false : true;

            if (isPlay == DrawMode.Upload)
            {
                FontMgr.FrameSize = new Size(Math.Abs(base.VirtualBounds.Size.Width.PopulatePixel(-Zoom)), Math.Abs(base.VirtualBounds.Size.Height.PopulatePixel(-Zoom)));
            }
            else
            {
                FontMgr.FrameSize = new Size(Math.Abs(base.VirtualBounds.Size.Width), Math.Abs(base.VirtualBounds.Size.Height));
            }
            //FontMgr.FrameSize = new Size(base.VirtualInnerBounds.Width + base.BorderWidth, base.VirtualInnerBounds.Height + base.BorderWidth);
            //FontMgr.FrameSize = base.VirtualInnerBounds.Size;// InnerSize.ToSize();
            //Text
            FontMgr.Text = Text;

            switch (TextEffect.Effect)
            {
            case OutlineShadowType.SHADED:
                FontMgr.SetShadowAttri(this.TextEffect.EffectColor, this.TextEffect.ShadowLateralShift * Zoom, this.TextEffect.ShadowVerticalShift * Zoom);
                //FontMgr.SetShadowAttri(IsUpload ? this.TextEffect.EffectColor : SignTypeHandler.ConvertColor(this.TextEffect.EffectColor, SignType), this.TextEffect.ShadowLateralShift * Zoom, this.TextEffect.ShadowVerticalShift * Zoom);
                break;

            case OutlineShadowType.OUTLINE:
                FontMgr.SetOutlineAttri(this.TextEffect.EffectColor, (ushort)(this.TextEffect.OutlineWidth * Zoom));
                //FontMgr.SetOutlineAttri(IsUpload ? this.TextEffect.EffectColor : SignTypeHandler.ConvertColor(this.TextEffect.EffectColor, SignType), (ushort)(this.TextEffect.OutlineWidth * Zoom));
                break;

            case OutlineShadowType.NONE:
                FontMgr.CancelTextEffect();
                break;
            }
        }
Exemple #6
0
    FontMgr()
    {
        if (_Instance != null)
        {
            Debug.LogError("Attempt to create multiple FontMgr's");
        }
        _Instance = this;
        FontList  = new List <Font>();

        // Menu font
        FontList.Add(new Font("Karloff_40px_4outline"));
        FontList.Add(new Font("pescadero_32px_2outline"));
    }
Exemple #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="device">图形设备</param>
        /// <param name="contentMgr">素材管理者</param>
        /// <param name="contentPath">引擎所需资源路径</param>
        public RenderEngine(GraphicsDevice device, ContentManager contentMgr, string contentPath)
        {
            if (device == null)
            {
                throw new NullReferenceException();
            }

            this.contentPath   = contentPath;
            this.device        = device;
            this.coordinMgr    = new CoordinMgr();
            this.spriteMgr     = new SpriteMgr(this);
            this.basicGraphics = new BasicGraphics(this);
            this.fontMgr       = new FontMgr(this, contentMgr);

            Log.Initialize();
        }
        internal void DrawString(bool hideGrid)
        {
            FontMgrSetup(FrameSizeFixed, FontSizeFixed, hideGrid);
            List <Image>  imagesActual = new List <Image>();
            List <Image>  images       = new List <Image>();
            List <string> strings      = new List <string>();

            FontMgr.GenerateBmps(imagesActual, images, strings);


            if (images.Count > 0)
            {
                BitmapOverlay   = images[0];
                base.InnerImage = new Bitmap(BitmapOverlay);
            }
        }
 private void FontMgrSetup(bool frameSizeFixed, bool fontSizeFixed, bool hideGrid)
 {
     FontMgr.ShowGrid   = !hideGrid;
     FontMgr.ScaleIndex = Zoom;
     FontMgr.SetStyle(frameSizeFixed, fontSizeFixed);
     FontMgr.TextColor     = ForeColor;
     FontMgr.BackColor     = BackColor;
     FontMgr.FontName      = Font.Name;
     FontMgr.FontHeight    = int.Parse((Font.Size * Zoom).ToString());
     FontMgr.Alignment     = _Align;
     FontMgr.LineAlignment = _Valign;
     FontMgr.Bold          = (Font.Style & FontStyle.Bold) == FontStyle.Bold;
     FontMgr.Italic        = (Font.Style & FontStyle.Italic) == FontStyle.Italic;
     FontMgr.SignSize      = new Size(SignSize.Width * Zoom - 2, SignSize.Height * Zoom - 2);
     FontMgr.FrameSize     = base.VirtualBounds.Size;
     FontMgr.Text          = Text;
 }
Exemple #10
0
    FontMgr()
    {
        if (_Instance != null)
            Debug.LogError("Attempt to create multiple FontMgr's");
        _Instance = this;
        FontList = new List<Font>();

        // Menu font
        FontList.Add(new Font("Karloff_40px_4outline"));
        FontList.Add(new Font("pescadero_32px_2outline"));
    }