Exemplo n.º 1
0
        public idFontFamily FindFont(string name)
        {
            string nameLower = name.ToLower();

            foreach (idFontFamily fontFamily in _fontFamilies)
            {
                if (fontFamily.Name.Equals(nameLower) == true)
                {
                    return(fontFamily);
                }
            }

            // if the font was not found, try to register it
            string       fileName    = name.Replace("fonts", string.Format("fonts/{0}", _fontLanguage));
            idFontFamily fontFamily2 = idE.RenderSystem.RegisterFont(name, fileName);

            if (fontFamily2 != null)
            {
                _fontFamilies.Add(fontFamily2);
            }
            else
            {
                idConsole.WriteLine("Could not register font {0} [{1}]", name, fileName);
            }

            return(fontFamily2);
        }
Exemplo n.º 2
0
        private void Clear()
        {
            _initialized = false;

            _currentFont       = null;
            _currentFontFamily = null;
            _mbcs = false;
        }
Exemplo n.º 3
0
        public void Init()
        {
            _scaleX = 0.0f;

            _whiteImage      = idE.DeclManager.FindMaterial("guis/assets/white.tga");
            _whiteImage.Sort = (float)MaterialSort.Gui;

            SetupFonts();

            _matrix         = Matrix.Identity;
            _origin         = Vector3.Zero;
            _enableClipping = true;
            _mbcs           = false;

            SetSize(idE.VirtualScreenWidth, idE.VirtualScreenHeight);

            _currentFontFamily = _fontFamilies[0];

            /*
             * TODO*/

            _cursorImages[(int)Cursor.Arrow]      = idE.DeclManager.FindMaterial("ui/assets/guicursor_arrow.tga");
            _cursorImages[(int)Cursor.Hand]       = idE.DeclManager.FindMaterial("ui/assets/guicursor_hand.tga");
            _cursorImages[(int)Cursor.Arrow].Sort = (float)MaterialSort.Gui;
            _cursorImages[(int)Cursor.Hand].Sort  = (float)MaterialSort.Gui;

            /*scrollBarImages[SCROLLBAR_HBACK] = declManager->FindMaterial("ui/assets/scrollbarh.tga");
             * scrollBarImages[SCROLLBAR_VBACK] = declManager->FindMaterial("ui/assets/scrollbarv.tga");
             * scrollBarImages[SCROLLBAR_THUMB] = declManager->FindMaterial("ui/assets/scrollbar_thumb.tga");
             * scrollBarImages[SCROLLBAR_RIGHT] = declManager->FindMaterial("ui/assets/scrollbar_right.tga");
             * scrollBarImages[SCROLLBAR_LEFT] = declManager->FindMaterial("ui/assets/scrollbar_left.tga");
             * scrollBarImages[SCROLLBAR_UP] = declManager->FindMaterial("ui/assets/scrollbar_up.tga");
             * scrollBarImages[SCROLLBAR_DOWN] = declManager->FindMaterial("ui/assets/scrollbar_down.tga");*/

            /*crollBarImages[SCROLLBAR_HBACK]->SetSort( SS_GUI );
            *  scrollBarImages[SCROLLBAR_VBACK]->SetSort( SS_GUI );
            *  scrollBarImages[SCROLLBAR_THUMB]->SetSort( SS_GUI );
            *  scrollBarImages[SCROLLBAR_RIGHT]->SetSort( SS_GUI );
            *  scrollBarImages[SCROLLBAR_LEFT]->SetSort( SS_GUI );
            *  scrollBarImages[SCROLLBAR_UP]->SetSort( SS_GUI );
            *  scrollBarImages[SCROLLBAR_DOWN]->SetSort( SS_GUI );*/

            _cursor = Cursor.Arrow;

            /*overStrikeMode = true;*/

            _initialized = true;
        }
Exemplo n.º 4
0
        public idSimpleWindow(idWindow win)
        {
            _gui     = win.UserInterface;
            _context = win.DeviceContext;

            _drawRect   = win.DrawRectangle;
            _clientRect = win.ClientRectangle;
            _textRect   = win.TextRectangle;

            _origin     = win.Origin;
            _fontFamily = win.FontFamily;
            _name       = win.Name;

            _materialScaleX = win.MaterialScaleX;
            _materialScaleY = win.MaterialScaleY;

            _borderSize = win.BorderSize;
            _textAlign  = win.TextAlign;
            _textAlignX = win.TextAlignX;
            _textAlignY = win.TextAlignY;
            _background = win.Background;
            _flags      = win.Flags;
            _textShadow = win.TextShadow;

            _visible.Set(win.IsVisible);
            _text.Set(win.Text);
            _rect.Set(win.Rectangle);
            _backColor.Set(win.BackColor);
            _materialColor.Set(win.MaterialColor);
            _foreColor.Set(win.ForeColor);
            _borderColor.Set(win.BorderColor);
            _textScale.Set(win.TextScale);
            _rotate.Set(win.Rotate);
            _shear.Set(win.Shear);
            _backgroundName.Set(win.BackgroundName);

            if (_backgroundName != string.Empty)
            {
                _background      = idE.DeclManager.FindMaterial(_backgroundName);
                _background.Sort = (float)MaterialSort.Gui;;
                _background.ImageClassification = 1;                 // just for resource tracking
            }

            _backgroundName.Material = _background;

            _parent = win.Parent;
            _hideCursor.Set(win.HideCursor);

            if (_parent != null)
            {
                if (_text.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_text);
                }

                if (_visible.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_visible);
                }

                if (_rect.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_rect);
                }

                if (_backColor.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_backColor);
                }

                if (_materialColor.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_materialColor);
                }

                if (_foreColor.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_foreColor);
                }

                if (_borderColor.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_borderColor);
                }

                if (_textScale.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_textScale);
                }

                if (_rotate.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_rotate);
                }

                if (_shear.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_shear);
                }

                if (_backgroundName.NeedsUpdate == true)
                {
                    _parent.AddUpdateVariable(_backgroundName);
                }
            }
        }