Пример #1
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public void Dispose()
        {
            if (m_loop_x_image != null)
            {
                m_loop_x_image.Dispose();
            }
            if (m_icons != null)
            {
                m_icons.Dispose();
            }
            if (m_infonameimage != null)
            {
                m_infonameimage.Dispose();
            }
            if (m_seainfonameimage != null)
            {
                m_seainfonameimage.Dispose();
            }

            // 最後にD3Ddeviceを破棄する
            if (m_d3d_device != null)
            {
                m_d3d_device.Dispose();
            }

            m_loop_x_image     = null;
            m_icons            = null;
            m_infonameimage    = null;
            m_seainfonameimage = null;

            m_d3d_device = null;
        }
Пример #2
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public gvt_lib(System.Windows.Forms.Form form, string ini_file_name)
        {
            // 설정항목の읽기관리
            m_ini_manager = new IniProfileSetting(ini_file_name);

            // 설정항목
            m_setting = new GlobalSettings();
            // 키할당관리
            m_key_assign_manager = new KeyAssignManager();

            // 등록
            m_ini_manager.AddIniSaveLoad(m_setting);
            m_ini_manager.AddIniSaveLoad(m_key_assign_manager, "key_assign");

            // メイン윈도우그리기용
            m_d3d_device          = new d3d_device(form);
            m_d3d_device.skip_max = def.SKIP_DRAW_FRAME_MAX;                            // 그리기스킵수

            // 지도관리
            m_loop_x_image = new LoopXImage(m_d3d_device);

            // 아이콘관리
            m_icons = new icons(m_d3d_device, def.ICONSIMAGE_FULLNAME);

            // 도시등の문자の絵관리
            m_nameTexture = new nameTexture(m_d3d_device);

            // 키할당初期化
            init_key_assign();
        }
Пример #3
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public gvt_lib(System.Windows.Forms.Form form, string ini_file_name)
        {
            // 設定項目の読み書き管理
            m_ini_manager = new IniProfileSetting(ini_file_name);

            // 設定項目
            m_setting = new GlobalSettings();
            // キー割り当て管理
            m_key_assign_manager = new KeyAssignManager();

            // 登録
            m_ini_manager.AddIniSaveLoad(m_setting);
            m_ini_manager.AddIniSaveLoad(m_key_assign_manager, "key_assign");

            // メインウインドウ描画用
            m_d3d_device          = new d3d_device(form);
            m_d3d_device.skip_max = def.SKIP_DRAW_FRAME_MAX;                                    // 描画スキップ数

            // 地図管理
            m_loop_x_image = new LoopXImage(m_d3d_device);

            // アイコン管理
            m_icons = new icons(m_d3d_device, def.ICONSIMAGE_FULLNAME);
            // 街等の文字の絵管理
            m_infonameimage = new infonameimage(m_d3d_device, def.INFONAMEIMAGE_FULLNAME);
            // 海域の文字の絵管理
            m_seainfonameimage = new seainfonameimage(m_d3d_device, def.SEAINFONAMEIMAGE_FULLNAME);

            // キー割り当て初期化
            init_key_assign();
        }
Пример #4
0
 /*-------------------------------------------------------------------------
  * マスクから작성
  * ---------------------------------------------------------------------------*/
 public void CreateFromMask(d3d_device device, ref byte[] image, Size size, int stride)
 {
     foreach (data d in m_list)
     {
         d.CreateFromMask(device, ref image, size, stride);
     }
 }
Пример #5
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public cpubar(d3d_device device)
        {
            m_device = device;

            m_peak      = 0;
            m_peak_wait = 0;
        }
Пример #6
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/

        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/

        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public seainfonameimage(d3d_device device, string infoimage_fname)
            : base(device, infoimage_fname)
        {
            if (device.device == null)
            {
                return;
            }
            add_rects();
        }
Пример #7
0
        /*-------------------------------------------------------------------------
         * image から rect 사이즈を切り取って텍스쳐を작성
         * マスク용
         * ---------------------------------------------------------------------------*/
        virtual public void CreateFromMask(d3d_device device, ref byte[] image, Size size, int stride, Rectangle rect)
        {
            m_device   = device;
            m_offset.X = rect.X;
            m_offset.Y = rect.Y;

            m_size.Width  = rect.Width;
            m_size.Height = rect.Height;
            if ((m_size.Width + rect.X) > size.Width)
            {
                m_size.Width = size.Width - rect.X;
            }
            if ((m_size.Height + rect.Y) > size.Height)
            {
                m_size.Height = size.Height - rect.Y;
            }

            m_texture_size = m_size;

            // 텍스쳐の작성とロック
            using (Texture texture = new Texture(m_device.device, m_size.Width, m_size.Height,
                                                 1, Usage.Dynamic, Format.A1R5G5B5, Pool.SystemMemory))
            {
                UInt16[,] buf = (UInt16[, ])texture.LockRectangle(typeof(UInt16), 0, LockFlags.Discard, m_size.Height, m_size.Width);

                // 텍스쳐내용の生成
                int index = (stride * rect.Y) + (rect.X * sizeof(UInt16));
                for (int y = 0; y < m_size.Height; y++)
                {
                    for (int x = 0; x < m_size.Width; x++)
                    {
                        UInt16 color = (UInt16)((image[index + x * sizeof(UInt16) + 1] << 8)
                                                | (image[index + x * sizeof(UInt16) + 0] << 0));

                        // jpgなのである程도誤差を認める
                        if ((((color >> 0) & 0x1f) < 0x10) ||
                            (((color >> 5) & 0x3f) < 0x30) ||
                            (((color >> 5 + 6) & 0x1f) < 0x10))
                        {
                            color = 0x7fff;                              // 抜き
                        }

                        buf[y, x] = color;
                    }
                    index += stride;
                }
                texture.UnlockRectangle(0);

                // Managedな텍스쳐に전送する
                if (m_texture != null)
                {
                    m_texture.Dispose();
                }
                m_texture = d3d_utility.CreateTextureFromTexture(m_device.device, texture);
            }
        }
Пример #8
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public spot(gvt_lib lib, GvoWorldInfo world)
        {
            m_device     = lib.device;
            m_loop_image = lib.loop_image;
            m_icons      = lib.icons;
            m_world      = world;

            m_spots     = new List <GvoWorldInfo.Info>();
            m_spot_list = new List <spot_once>();
            m_spot_type = type.none;
        }
Пример #9
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public icons(d3d_device device, string fname)
            : base(device, fname)
        {
            if (device.device == null)
            {
                return;
            }

            // 矩形등록
            add_rects();
        }
Пример #10
0
                /*-------------------------------------------------------------------------
                 * マスクから작성
                 * ---------------------------------------------------------------------------*/
                public void CreateFromMask(d3d_device device, ref byte[] image, Size size, int stride)
                {
                    // マスクから作る必要のない해역は矩形でよい
                    if (!m_is_create_from_mask)
                    {
                        return;
                    }

                    Rectangle rect = new Rectangle((int)m_pos.X, (int)m_pos.Y, (int)m_size.X & ~1, (int)m_size.Y & ~1);

                    base.CreateFromMask(device, ref image, size, stride, rect);
                }
Пример #11
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public LoopXImage(d3d_device device)
        {
            m_device           = device;
            m_offset           = new Vector2(0, 0);
            m_textures         = new List <TextureUnit>();
            m_is_pushed_params = false;

            m_scale = 1;

            m_offset_shelter = new Vector2(0, 0);
            m_scale_shelter  = 1;

            m_device_lost = false;
            if (m_device.device != null)
            {
                m_device.device.DeviceReset += new System.EventHandler(device_reset);
            }
        }
Пример #12
0
        /*-------------------------------------------------------------------------
         * 初期化
         * ---------------------------------------------------------------------------*/
        public nameTexture(d3d_device device)
        {
            if (device == null)
            {
                return;
            }

            PrivateFontCollection privateFonts = new PrivateFontCollection();

            //privateFonts.AddFontFile("font/NanumBarunpenB.ttf");
            privateFonts.AddFontFile("font/NanumGothicExtraBold.ttf");

            m_font_desc          = new FontDescription();
            m_font_desc.FaceName = privateFonts.Families[0].Name;
            //m_font_desc.FaceName = "Dotum";
            m_font_desc.CharSet         = CharacterSet.Hangul;
            m_font_desc.Height          = 14;
            m_font_desc.PitchAndFamily  = PitchAndFamily.DefaultPitch;
            m_font_desc.Quality         = FontQuality.Proof;
            m_font_desc.OutputPrecision = Precision.Default;
            m_font_desc.Weight          = FontWeight.ExtraBold;

            m_nameRect = new Dictionary <string, d3d_sprite_rects.rect>(512);

            m_d3d_device = device;

            m_d3d_device.device.DeviceReset += new System.EventHandler(device_reset);

            m_font = new Microsoft.DirectX.Direct3D.Font(m_d3d_device.device, m_font_desc);

            m_sprite = new Sprite(m_d3d_device.device);

            m_textureSize = new Vector2(1024, 1024);
            m_offset      = new Vector2(0, 0);

            m_isInitialized = false;
        }
Пример #13
0
        /*-------------------------------------------------------------------------
         * image から rect 사이즈を切り取って텍스쳐を작성
         * 렌더링 타겟を작성함ことにより, 사이즈を2のべき乗に조정する
         * ---------------------------------------------------------------------------*/
        virtual public void Create(d3d_device device, ref byte[] image, Size size, int stride, Rectangle rect)
        {
            m_device   = device;
            m_offset.X = rect.X;
            m_offset.Y = rect.Y;

            m_size.Width  = rect.Width;
            m_size.Height = rect.Height;
            if ((m_size.Width + rect.X) > size.Width)
            {
                m_size.Width = size.Width - rect.X;
            }
            if ((m_size.Height + rect.Y) > size.Height)
            {
                m_size.Height = size.Height - rect.Y;
            }

            // 텍스쳐사이즈を2のべき乗にする
            m_texture_size = d3d_utility.TextureSizePow2(m_size);
            //			m_texture_size	= m_size;

            // 텍스쳐の작성とロック
            if (m_texture_sysmem != null)
            {
                m_texture_sysmem.Dispose();
            }
            m_texture_sysmem = new Texture(m_device.device, m_texture_size.Width, m_texture_size.Height,
                                           1, Usage.Dynamic, Format.R5G6B5, Pool.SystemMemory);
            UInt16[,] buf = (UInt16[, ])m_texture_sysmem.LockRectangle(typeof(UInt16), 0, LockFlags.Discard, m_texture_size.Height, m_texture_size.Width);

            // 텍스쳐내용の生成
            int index = (stride * rect.Y) + (rect.X * sizeof(UInt16));

            for (int y = 0; y < m_size.Height; y++)
            {
                UInt16 color = 0;
                for (int x = 0; x < m_size.Width; x++)
                {
                    color = (UInt16)((image[index + x * sizeof(UInt16) + 1] << 8)
                                     | (image[index + x * sizeof(UInt16) + 0] << 0));
                    buf[y, x] = color;
                }
                // 사이즈조정をした場合は1ドット余분にコピーする
                // バイリニア時の참조장소対策
                if (m_texture_size.Width > m_size.Width)
                {
                    buf[y, m_size.Width] = color;
                }
                index += stride;
            }
            m_texture_sysmem.UnlockRectangle(0);

            if (m_texture != null)
            {
                m_texture.Dispose();
            }

            // Managedな텍스쳐に전送する
            //			m_texture	= d3d_utility.CreateTextureFromTexture(m_device.Device, Texture);
            // 렌더링 타겟の텍스쳐に전送する
            RefreshTexture();
        }
Пример #14
0
 /*-------------------------------------------------------------------------
  *
  * ---------------------------------------------------------------------------*/
 public TextureUnit()
 {
     m_device         = null;
     m_texture        = null;
     m_texture_sysmem = null;
 }