Beispiel #1
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public override void Dispose()
        {
            if (m_textured_font != null)
            {
                m_textured_font.Dispose();
            }
            if (m_systemfont != null)
            {
                m_systemfont.Dispose();
            }
            if (m_sprite != null)
            {
                m_sprite.Dispose();
            }
            if (m_font_sprite != null)
            {
                m_font_sprite.Dispose();
            }
            if (m_line != null)
            {
                m_line.Dispose();
            }
            if (m_font_small != null)
            {
                m_font_small.Dispose();
            }
            if (m_font != null)
            {
                m_font.Dispose();
            }

            m_textured_font = null;
            m_systemfont    = null;
            m_sprite        = null;
            m_font_sprite   = null;
            m_line          = null;
            m_font_small    = null;
            m_font          = null;

            // device
            base.Dispose();
        }
Beispiel #2
0
        /*-------------------------------------------------------------------------
         * 初期化
         * ---------------------------------------------------------------------------*/
        public d3d_device(System.Windows.Forms.Form form)
            : base()
        {
            // 作成パラメータ
            PresentParameters param = new PresentParameters();

            param.Windowed               = true;
            param.SwapEffect             = SwapEffect.Discard;
            param.PresentationInterval   = PresentInterval.Immediate;
            param.EnableAutoDepthStencil = true;
            param.AutoDepthStencilFormat = DepthFormat.D16;
            param.BackBufferCount        = 1;
            param.BackBufferFormat       = Format.Unknown;

            // デバイスを作成
            try{
                base.Create(form, param);
            }catch {
                MessageBox.Show("DirectXの初期化に失敗しました。", "初期化エラー");
                return;
            }

            try{
                // リセット時のデリゲート追加
                base.device.DeviceReset += new System.EventHandler(device_reset);
                // シェーダのバージョンを調べる
                check_shader_support();

                // フォントを作成
                m_font       = new Microsoft.DirectX.Direct3D.Font(base.device, new System.Drawing.Font("MS UI Gothic", 9));
                m_font_small = new Microsoft.DirectX.Direct3D.Font(base.device, new System.Drawing.Font("MS UI Gothic", 8));
// CreaTypeで描画できないのでメイリオはやめ
//				m_font			= new Microsoft.DirectX.Direct3D.Font(base.device, new System.Drawing.Font("メイリオ", 9));
//				m_font_small	= new Microsoft.DirectX.Direct3D.Font(base.device, new System.Drawing.Font("メイリオ", 7));

                m_font_sprite        = new Sprite(base.device);
                m_is_use_font_sprite = false;

                // ライン描画
                m_line = new Line(base.device);

                // ステートの初期化
                device_reset(this, null);

                // 描画支援
                m_points = new d3d_point(device);
                m_sprite = new d3d_sprite(device, is_use_ve1_1_ps1_1);

                // システムフォント
                m_systemfont = new d3d_systemfont(this);
                // テクスチャ化されたフォント
                // あまり変動しない文字列描画用
                m_textured_font = new d3d_textured_font(this, m_font);

                // デバイスの情報を得る
                get_device_information();
                // クライアントサイズ更新
                UpdateClientSize();
            }catch {
                MessageBox.Show("DirectXの初期化後の設定に失敗しました。", "初期化エラー");
                base.Dispose();
            }

            m_skip_count   = 0;
            m_skip_max     = 0;
            m_is_must_draw = false;
        }
Beispiel #3
0
        /*-------------------------------------------------------------------------
         * 初期化
         * ---------------------------------------------------------------------------*/
        public d3d_device(System.Windows.Forms.Form form)
            : base()
        {
            // 작성パラメータ
            PresentParameters param = new PresentParameters();

            param.Windowed               = true;
            param.SwapEffect             = SwapEffect.Discard;
            param.PresentationInterval   = PresentInterval.Immediate;
            param.EnableAutoDepthStencil = true;
            param.AutoDepthStencilFormat = DepthFormat.D16;
            param.BackBufferCount        = 1;
            param.BackBufferFormat       = Format.Unknown;

            // デバイスを작성
            try{
                base.Create(form, param);
            }catch {
                MessageBox.Show("DirectX 초기화에 실패하였습니다. ", "초기화오류");
                return;
            }

            try{
                // リセット時のデリゲート추가
                base.device.DeviceReset += new System.EventHandler(device_reset);
                // 쉐이더の버전を調べる
                check_shader_support();

                // フォントを작성
                m_font       = new Microsoft.DirectX.Direct3D.Font(base.device, new System.Drawing.Font("MS UI Gothic", 9));
                m_font_small = new Microsoft.DirectX.Direct3D.Font(base.device, new System.Drawing.Font("MS UI Gothic", 8));
// CreaTypeで그리기できないのでメイリオはやめ
//				m_font			= new Microsoft.DirectX.Direct3D.Font(base.device, new System.Drawing.Font("メイリオ", 9));
//				m_font_small	= new Microsoft.DirectX.Direct3D.Font(base.device, new System.Drawing.Font("メイリオ", 7));

                m_font_sprite        = new Sprite(base.device);
                m_is_use_font_sprite = false;

                // 라인그리기
                m_line = new Line(base.device);

                // ステートの初期化
                device_reset(this, null);

                // 그리기支援
                m_points = new d3d_point(device);
                m_sprite = new d3d_sprite(device, is_use_ve1_1_ps1_1);

                // 시스템フォント
                m_systemfont = new d3d_systemfont(this);
                // 텍스쳐化されたフォント
                // あまり変動しない문자열그리기용
                m_textured_font = new d3d_textured_font(this, m_font);

                // デバイスの정보を得る
                get_device_information();
                // クライアント사이즈更新
                UpdateClientSize();
            }catch {
                MessageBox.Show("DirectX 초기화후 설정에 실패하였습니다. ", "초기화오류");
                base.Dispose();
            }

            m_skip_count   = 0;
            m_skip_max     = 0;
            m_is_must_draw = false;
        }