protected override void draw(SdlDotNet.Graphics.Surface s) { s.Fill(Constants.Color_Background); // タイトル if (_optSurface == null) { _optSurface = ResourceManager.LargePFont.Render(Properties.Resources.HeaderTitle_Option, Constants.Color_Strong); } s.Blit(_optSurface, new Point(Constants.HeaderX, Constants.HeaderY)); // 今選択中のドメイン if (_state == SelectionState.Device) { s.Fill(new Rectangle(_devHeadRect.Left, _devRect.Top, _devHeadRect.Width, _devRect.Height), Constants.Color_Selection); } else if (_state == SelectionState.Calibration) { s.Fill(new Rectangle(_calHeadRect.Left, _calMenuRect.Top, _calHeadRect.Width, _calMenuRect.Height), Constants.Color_Selection); } // Audio Device / Calibration Header if (_devHeadSurface == null) { _devHeadSurface = ResourceManager.MiddlePFont.Render(Properties.Resources.HeaderTitle_AudioDevices, Constants.Color_Foreground); } s.Blit(_devHeadSurface, _devHeadRect.Location); if (_calHeadSurface == null) { _calHeadSurface = ResourceManager.MiddlePFont.Render(Properties.Resources.HeaderTitle_Calibration, Constants.Color_Foreground); } s.Blit(_calHeadSurface, _calHeadRect.Location); if (_expSurface == null) { _expSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Explanation_Calibration, Constants.Color_Strong); } s.Blit(_expSurface, new Point(_calHeadRect.X, _calRect.Y)); // 選択肢 ImageUtil.DrawSelections(s, _endHeadSurfaces, _endHeadRects, _headCursor, _endHeadRect.Location, (_state == SelectionState.Back ? 0 : -1), MenuItemAlign.TopLeft); ImageUtil.DrawSelections(s, _calSurfaces, _calRects, _cursor, _calMenuRect.Location, (_state == SelectionState.Calibration ? _calSelectedIdx : -1), MenuItemAlign.TopLeft); ImageUtil.DrawSelections(s, _devDrawSurfaces, _devDrawRects, _cursor, _devRect.Location, _devSelectedIdx - _devDrawFirstIdx, MenuItemAlign.TopLeft); // 高音・低音の値 Surface hs = _calSurfaces[0]; Surface ls = _calSurfaces[1]; double maxFreq = Config.Instance.MaxFreq; double minFreq = Config.Instance.MinFreq; if (_isCalStarted) { switch (_calSelectedIdx) { case IDX_MAXPITCH: maxFreq = getAvgValue(IDX_MAXPITCH); break; case IDX_MINPITCH: minFreq = getAvgValue(IDX_MINPITCH); break; } } using (Surface ts = ResourceManager.SmallPFont.Render(maxFreq.ToString("F1"), Constants.Color_Foreground)) { s.Blit(ts, new Point(_calRects[0].X + hs.Width + _calMenuRect.X + 10, _calRects[0].Y + _calMenuRect.Y)); } using (Surface ts = ResourceManager.SmallPFont.Render(minFreq.ToString("F1"), Constants.Color_Foreground)) { s.Blit(ts, new Point(_calRects[1].X + ls.Width + _calMenuRect.X + 10, _calRects[1].Y + _calMenuRect.Y)); } // 計測中かどうか if (_isCalStarted) { using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Calibrating, Constants.Color_Strong)) { s.Blit(ts, new Point(_calMenuRect.X, _calMenuRect.Bottom)); } } // 波形 if (_audioInput.Capturing) { using (Surface ts = ResourceManager.SmallTTFont.Render( _curToneResult.ToString(), Constants.Color_Strong)) { s.Blit(ts, new Point(_calMenuRect.X, _calMenuRect.Bottom + ResourceManager.SmallPFont.Height + 5)); } drawWave(s, _parent.PitchResult, _parent.ToneResult, ResourceManager.SmallTTFont, _calWaveRect); } }
protected virtual void renderPlayerInformation(Surface s) { #region ヘッダ部分初期化 if (_playerInfoSurface == null) { _playerInfoHeaderMaxWidth = 0; _playerInfoSurface = new Surface(_playerInfoRect.Width, _playerInfoRect.Height); _playerInfoSurface.Fill(_foreColor); int dh = (int)((_playerInfoRect.Height - Constants.PlayerInfoPadding * 2) / 3.0); int x = Constants.PlayerInfoPadding; int y = Constants.PlayerInfoPadding + (int)(dh / 2.0 - ResourceManager.SmallPFont.Height / 2.0); using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Life + Properties.Resources.Str_Separator, _backColor)) { _playerInfoSurface.Blit(ts, new Point(x, y)); if (_playerInfoHeaderMaxWidth < ts.Width) { _playerInfoHeaderMaxWidth = ts.Width; } } y += dh; using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Pitch + Properties.Resources.Str_Separator, _backColor)) { _playerInfoSurface.Blit(ts, new Point(x, y)); if (_playerInfoHeaderMaxWidth < ts.Width) { _playerInfoHeaderMaxWidth = ts.Width; } } y += dh; using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Distance + Properties.Resources.Str_Separator, _backColor)) { _playerInfoSurface.Blit(ts, new Point(x, y)); if (_playerInfoHeaderMaxWidth < ts.Width) { _playerInfoHeaderMaxWidth = ts.Width; } } } #endregion s.Blit(_playerInfoSurface, _playerInfoRect.Location); #region 現在の情報を描画 { int dh = (int)((_playerInfoRect.Height - Constants.PlayerInfoPadding * 2) / 3.0); int x = _playerInfoRect.X + Constants.PlayerInfoPadding + _playerInfoHeaderMaxWidth; int y = _playerInfoRect.Y + Constants.PlayerInfoPadding + (int)(dh / 2.0 - ResourceManager.SmallTTFont.Height / 2.0); int px = x; int py = _playerInfoRect.Y + Constants.PlayerInfoPadding + (int)(dh / 2.0); for (int i = 0; i < _parent.Player.Hp; i++) { s.Blit(_coloredLifeSurfaces[0], new Point(px, (int)(py - _coloredLifeSurfaces[0].Height / 2.0))); px += _coloredLifeSurfaces[0].Width; } for (int i = _parent.Player.Hp; i < _parent.Player.MaxHp; i++) { s.Blit(_coloredLifeSurfaces[1], new Point(px, (int)(py - _coloredLifeSurfaces[1].Height / 2.0))); px += _coloredLifeSurfaces[1].Width; } y += dh; using (Surface ts = ResourceManager.SmallTTFont.Render(_toneResult.ToString(), _backColor)) { s.Blit(ts, new Point(x, y)); } y += dh; if (_map.HasEnd) { using (Surface ts = ResourceManager.SmallTTFont.Render(string.Format("{0:F0} / {1}", _parent.Player.X, _map.Width), _backColor)) { s.Blit(ts, new Point(x, y)); } } else { using (Surface ts = ResourceManager.SmallTTFont.Render(string.Format("{0:F0}", _parent.Player.X), _backColor)) { s.Blit(ts, new Point(x, y)); } } } #endregion }