Ejemplo n.º 1
0
        protected override void draw(SdlDotNet.Graphics.Surface s)
        {
            if (_prevSurface == null)
            {
                _prevSurface = new Surface(s);
                _prevSurface.Transparent = true;
                _prevSurface.AlphaBlending = true;
                _prevSurface.Alpha = 64;
            }

            s.Fill(Color.Black);
            s.Blit(_prevSurface, Point.Empty);

            if (_errorMessageSurface == null && _errorMessages != null)
            {
                _errorMessageSurface = new SurfaceCollection();
                _errorMessageRects = new Rectangle[_errorMessages.Length];
                ImageUtil.CreateStrMenu(_errorMessages, Color.White, ref _errorMessageSurface, ref _errorMessageRects, s.Width);
            }
            if (_errorMessageSurface != null)
            {
                ImageUtil.DrawSurfaces(s, _errorMessageSurface, _errorMessageRects, new Point(0, 100), MenuItemAlign.TopCenter);
            }
        }
Ejemplo n.º 2
0
        private void drawMaps(SdlDotNet.Graphics.Surface s)
        {
            s.Fill(Constants.Color_Background);

            // ヘッダ
            if (_headerSurface == null)
            {
                _headerSurface = ResourceManager.LargePFont.Render(Properties.Resources.HeaderTitle_MapSelect,
                    Constants.Color_Strong);
            }
            s.Blit(_headerSurface, new Point(Constants.HeaderX, Constants.HeaderY));

            // 説明文
            if (_expSurface == null)
            {
                _expSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Explanation_MapSelect,
                    Constants.Color_Strong);
            }
            s.Blit(_expSurface, _expRect.Location);

            // ビルトインマップメニュー
            ImageUtil.DrawSelections(s, _randSurfaces, _randRects, _cursor,
                _randRect.Location, ((_mapFocus || _escFocus) ? -1 : _randSelectedIdx), MenuItemAlign.MiddleLeft);

            // 読み込んだマップメニュー
            ImageUtil.DrawSelections(s, _mapDrawSurfaces, _mapDrawRects, _cursor,
                _mapRect.Location, (_mapFocus ? _mapSelectedIdx - _mapDrawFirstIdx : -1), MenuItemAlign.MiddleLeft);

            // タイトルに戻るメニュー
            ImageUtil.DrawSelections(s, _escSurfaces, _escRects, _strongCursor,
                _escRect.Location, (_escFocus ? 0 : -1), MenuItemAlign.MiddleLeft);
        }
Ejemplo n.º 3
0
 private void drawLoading(SdlDotNet.Graphics.Surface s)
 {
     s.Fill(Constants.Color_Foreground);
     if (_loadingSurface == null)
     {
         _loadingSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Str_MapLoading, Constants.Color_Background);
     }
     s.Blit(_loadingSurface, new Point(
         (int)(Constants.ScreenWidth / 2.0 - _loadingSurface.Width / 2.0),
         (int)(Constants.ScreenHeight / 2.0 - _loadingSurface.Height / 2.0)));
 }
Ejemplo n.º 4
0
        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);
            }
        }