public override void ScaleToScreenResolution() { base.ScaleToScreenResolution(); GUIGraphicsContext.ScalePosToScreenResolution(ref _fillBackgroundOffsetX, ref _fillBackgroundOffsetY); GUIGraphicsContext.ScaleVertical(ref _fillBackgroundHeight); GUIGraphicsContext.ScaleVertical(ref _topTextureOffsetY); }
public override void FinalizeConstruction() { base.FinalizeConstruction(); int x1 = 16; int y1 = 16; GUIGraphicsContext.ScalePosToScreenResolution(ref x1, ref y1); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _textureFocusName); _imageFocused.ParentControl = this; _imageFocused.DimColor = DimColor; _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _textureNoFocusName); _imageNonFocused.ParentControl = this; _imageNonFocused.DimColor = DimColor; _imageBackground = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _backgroundTextureName); _imageBackground.ParentControl = this; _imageBackground.DimColor = DimColor; _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureWidth, _leftTextureHeight, _leftTextureName); _imageLeft.DimColor = DimColor; _imageLeft.ParentControl = this; _imageLeftFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureFocusWidth, _leftTextureFocusHeight, _leftFocusName); _imageLeftFocus.ParentControl = this; _imageLeftFocus.DimColor = DimColor; _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureWidth, _rightTextureHeight, _rightTextureName); _imageRight.ParentControl = this; _imageRight.DimColor = DimColor; _imageRightFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureFocusWidth, _rightTextureFocusHeight, _rightFocusName); _imageRightFocus.ParentControl = this; _imageRightFocus.DimColor = DimColor; if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } GUILocalizeStrings.LocalizeLabel(ref _label); _imageFocused.Filtering = false; _imageNonFocused.Filtering = false; _imageBackground.Filtering = false; _imageLeft.Filtering = false; _imageLeftFocus.Filtering = false; _imageRight.Filtering = false; _imageRightFocus.Filtering = false; _labelControl = new GUILabelControl(_parentControlId); _labelControl.CacheFont = true; _labelControl.ParentControl = this; _labelControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor); }
public override void ScaleToScreenResolution() { base.ScaleToScreenResolution(); GUIGraphicsContext.ScalePosToScreenResolution(ref _upBtnWidth, ref _upBtnHeight); GUIGraphicsContext.ScalePosToScreenResolution(ref _downBtnWidth, ref _downBtnHeight); GUIGraphicsContext.ScalePosToScreenResolution(ref _deleteBtnWidth, ref _deleteBtnHeight); GUIGraphicsContext.ScaleHorizontal(ref _upBtnXOffset); GUIGraphicsContext.ScaleHorizontal(ref _downBtnXOffset); GUIGraphicsContext.ScaleHorizontal(ref _deleteBtnXOffset); GUIGraphicsContext.ScaleVertical(ref _upBtnYOffset); GUIGraphicsContext.ScaleVertical(ref _downBtnYOffset); GUIGraphicsContext.ScaleVertical(ref _deleteBtnYOffset); }
public override void ScaleToScreenResolution() { base.ScaleToScreenResolution(); GUIGraphicsContext.ScalePosToScreenResolution(ref _textOffsetX, ref _textOffsetY); }
public override void Render(float timePassed) { if (GUIGraphicsContext.EditMode == false) { if (!IsVisible) { if (_setVideoWindow) { // Here is to hide video window madVR when skin didn't handle video overlay (the value need to be different from Process() player like VMR7) GUIGraphicsContext.VideoWindow = new Rectangle(0, 0, 0, 0); } base.Render(timePassed); return; } } if (!GUIGraphicsContext.Calibrating) { float x = base.XPosition; float y = base.YPosition; GUIGraphicsContext.Correct(ref x, ref y); _videoWindows[0].X = (int)x; _videoWindows[0].Y = (int)y; _videoWindows[0].Width = base.Width; _videoWindows[0].Height = base.Height; if (_setVideoWindow) { GUIGraphicsContext.VideoWindow = _videoWindows[0]; } if (GUIGraphicsContext.ShowBackground) { if (Focus) { x = base.XPosition; y = base.YPosition; int xoff = 5; int yoff = 5; int w = 10; int h = 10; GUIGraphicsContext.ScalePosToScreenResolution(ref xoff, ref yoff); GUIGraphicsContext.ScalePosToScreenResolution(ref w, ref h); _imageFocusRectangle.SetPosition((int)x - xoff, (int)y - yoff); _imageFocusRectangle.Width = base.Width + w; _imageFocusRectangle.Height = base.Height + h; _imageFocusRectangle.Render(timePassed); } if (GUIGraphicsContext.graphics != null) { GUIGraphicsContext.graphics.FillRectangle(Brushes.Black, _videoWindows[0].X, _videoWindows[0].Y, base.Width, base.Height); } else { //image.SetPosition(_videoWindows[0].X,_videoWindows[0].Y); //image.Width=_videoWindows[0].Width; //image.Height=_videoWindows[0].Height; if (GUIGraphicsContext.VideoWindow.Width < 1) { thumbImage.Render(timePassed); } else { blackImage.Render(timePassed); // causes flickering in fullscreen } } } else { if (GUIGraphicsContext.graphics != null) { GUIGraphicsContext.graphics.FillRectangle(Brushes.Black, _videoWindows[0].X, _videoWindows[0].Y, base.Width, base.Height); } } } base.Render(timePassed); }
/// <summary> /// This method gets called when the control is created and all properties has been set /// It allows the control to scale itself to the current screen resolution /// </summary> public override void ScaleToScreenResolution() { base.ScaleToScreenResolution(); GUIGraphicsContext.ScalePosToScreenResolution(ref _maxWidth, ref _maxHeight); }
public override void AllocResources() { base.AllocResources(); m_Font = GUIFontManager.GetFont((m_strFont != "" && m_strFont != "-") ? m_strFont : "font18"); if (m_imgTexture != null) { m_imgTexture.AllocResources(); } if (m_imgTextureFocused != null) { m_imgTextureFocused.AllocResources(); } if (m_imgGuide != null) { if (m_imgGuide[0] != null) { m_imgGuide[0].AllocResources(); } if (m_imgGuide[1] != null) { m_imgGuide[1].AllocResources(); } } if (m_imgBlocks != null) { foreach (GUIImage image in m_imgBlocks) { image.AllocResources(); } } if (m_imgGuide[0] != null) { m_imgGuide[0].Height = m_nBoardHeight - (m_cyBlock * 2); m_imgGuide[0].SetPosition(m_nBoardX - (m_imgGuide[0].Width + 2), ((m_nBoardY + m_cyBlock) + (Game.Height * m_cyBlock)) - m_imgGuide[0].Height); } if (m_imgGuide[1] != null) { m_imgGuide[1].Height = m_nBoardHeight - (m_cyBlock * 2); m_imgGuide[1].SetPosition(m_nBoardX + m_nBoardWidth + 2, ((m_nBoardY + m_cyBlock) + (Game.Height * m_cyBlock)) - m_imgGuide[1].Height); } if (m_imgBlocksGlow != null) { foreach (GUIImage image in m_imgBlocksGlow) { image.AllocResources(); } } // we must use local variables for the following transform or we'll lose the original next // block positions and experience problems if the user performs multiple fullscreen toggles int nNextBlockX = m_nNextBlockX; int nNextBlockY = m_nNextBlockY; GUIGraphicsContext.ScalePosToScreenResolution(ref nNextBlockX, ref nNextBlockY); if (m_imgBlocksNext != null) { foreach (GUIImage image in m_imgBlocksNext) { image.AllocResources(); if (m_nNextBlockAlign == Alignment.ALIGN_LEFT) { image.SetPosition(nNextBlockX, nNextBlockY - (image.Height / 2)); } else if (m_nNextBlockAlign == Alignment.ALIGN_CENTER) { image.SetPosition(nNextBlockX - (image.Width / 2), nNextBlockY - (image.Height / 2)); } else if (m_nNextBlockAlign == Alignment.ALIGN_RIGHT) { image.SetPosition(nNextBlockX - image.Width, nNextBlockY - (image.Height / 2)); } } } }
protected override void RenderKeyboardLatin(float timePassed) { // Compute the width and height of the keyboard (not including the input text box) int keyboardWidth = _modeKeyWidth + _modeKeySpacing + (_keyWidth * 10) + (_keyHorizontalSpacing * 9); int keyboardHeight = (_keyHeight * 5); keyboardX = _keyboardPosX; keyboardY = _keyboardPosY; if (_keyboardPosX < 0) { keyboardX = (GUIGraphicsContext.SkinSize.Width - keyboardWidth) / 2; } if (_keyboardPosY < 0) { keyboardY = (GUIGraphicsContext.SkinSize.Height - keyboardHeight) / 2; } GUIGraphicsContext.ScalePosToScreenResolution(ref keyboardX, ref keyboardY); int x1, y1, x2, y2; // Skip drawing the label if there is no text or it should be used as initial text. if (_labelText != "" && !_showLabelAsInitialText) { // Show the label x1 = _labelBoxPosX; y1 = _labelBoxPosY; x2 = x1 + _labelBoxWidth; y2 = _labelBoxPosY + _labelBoxHeight; // Negative value for the label box width indicates that it should be calculated to be the same width as the keyboard. if (_labelBoxWidth < 0) { int modeKeyWidth = _modeKeyWidth; if (_useSearchLayout) { modeKeyWidth = _searchModeKeyWidth; } x2 = x1 + keyboardWidth; } fLabelBoxWidth = (float)(x2 - x1); DrawLabelBox(timePassed, x1, y1, x2, y2); // Show text input and caret switch (_labelAlign) { case GUIControl.Alignment.ALIGN_LEFT: x1 = _labelBoxPosX + _labelOffX; y1 = _labelBoxPosY + _labelOffY; break; case GUIControl.Alignment.ALIGN_CENTER: x1 = _labelBoxPosX + (int)(fLabelBoxWidth / 2.0); y1 = _labelBoxPosY + _labelOffY; break; case GUIControl.Alignment.ALIGN_RIGHT: x1 = _labelBoxPosX + (int)fLabelBoxWidth - _labelOffX; y1 = _labelBoxPosY + _labelOffY; break; } DrawLabel(timePassed, x1, y1); } // Show the text input box x1 = _inputTextBoxPosX; y1 = _inputTextBoxPosY; x2 = x1 + _inputTextBoxWidth; y2 = _inputTextBoxPosY + _inputTextBoxHeight; // Negative value for the text box width indicates that it shold be calculated to be the same width as the keyboard. if (_inputTextBoxWidth < 0) { int modeKeyWidth = _modeKeyWidth; if (_useSearchLayout) { modeKeyWidth = _searchModeKeyWidth; } x2 = x1 + keyboardWidth; } fTextBoxWidth = (float)(x2 - x1 - 2 * _inputTextOffX); DrawTextBox(timePassed, x1, y1, x2, y2); // Show text input and caret switch (_inputTextAlign) { case GUIControl.Alignment.ALIGN_LEFT: x1 = _inputTextBoxPosX + _inputTextOffX; y1 = _inputTextBoxPosY + _inputTextOffY; break; case GUIControl.Alignment.ALIGN_CENTER: x1 = _inputTextBoxPosX + (int)(fTextBoxWidth / 2.0); y1 = _inputTextBoxPosY + _inputTextOffY; break; case GUIControl.Alignment.ALIGN_RIGHT: x1 = _inputTextBoxPosX + (int)fTextBoxWidth - _inputTextOffX; y1 = _inputTextBoxPosY + _inputTextOffY; break; } DrawText(timePassed, x1, y1); x1 = keyboardX; y1 = keyboardY; // Draw each row float fY = y1; ArrayList keyBoard = (ArrayList)_keyboardList[(int)_currentKeyboard]; for (int row = 0; row < _maxRows; ++row, fY += (_keyHeightScaled + _keyVerticalSpacing)) { float fX = x1; float fWidthSum = 0.0f; ArrayList keyRow = (ArrayList)keyBoard[row]; int dwIndex = 0; for (int i = 0; i < keyRow.Count; i++) { // Determine key name Key key = (Key)keyRow[i]; long selKeyColor = 0xffffffff; long selTextColor = _keyFontColor; // Handle special key coloring switch (key.xKey) { case Xkey.XK_SHIFT: switch (_currentKeyboard) { case KeyboardTypes.TYPE_ALPHABET: case KeyboardTypes.TYPE_ACCENTS: if (_shiftTurnedOn) { selKeyColor = _keyPressedColor; } break; case KeyboardTypes.TYPE_SYMBOLS: selKeyColor = _keyDisabledColor; selTextColor = _keyDisabledFontColor; break; } break; case Xkey.XK_CAPSLOCK: switch (_currentKeyboard) { case KeyboardTypes.TYPE_ALPHABET: case KeyboardTypes.TYPE_ACCENTS: if (_capsLockTurnedOn) { selKeyColor = _keyPressedColor; } break; case KeyboardTypes.TYPE_SYMBOLS: selKeyColor = _keyDisabledColor; selTextColor = _keyDisabledFontColor; break; } break; case Xkey.XK_SMS: if (SmsStyleText) { selKeyColor = _keyPressedColor; //key.name = "SMS"; } else { //key.name = "STANDARD"; } break; } // Highlight the current key key.inFocus = false; if (row == _currentRow && dwIndex == _currentKey) { selKeyColor = _keyHighlightColor; selTextColor = _keySelFontColor; key.inFocus = true; } RenderKey(timePassed, fX + fWidthSum, fY, key, selKeyColor, selTextColor); int width = key.dwWidth; GUIGraphicsContext.ScaleHorizontal(ref width); fWidthSum += width; // There's a slightly larger gap between the leftmost keys (mode keys) and the main keyboard if (dwIndex == 0) { width = _modeKeySpacing; } else { width = _keyHorizontalSpacing; } GUIGraphicsContext.ScaleHorizontal(ref width); fWidthSum += width; ++dwIndex; } } }
public override void ScaleToScreenResolution() { base.ScaleToScreenResolution(); GUIGraphicsContext.ScalePosToScreenResolution(ref _sortButtonWidth, ref _sortButtonHeight); GUIGraphicsContext.ScalePosToScreenResolution(ref _sortButtonOffsetX, ref _sortButtonOffsetY); }