示例#1
0
        private int Handle = -1;         // -1 == Unloaded

        /*
         *      fontThick: 0 ~ 9 (デフォルト値:6)
         *
         *              値域の根拠
         *                      マニュアル
         *                              --https://dxlib.xsrv.jp/function/dxfunc_graph2.html#R17N10
         *
         *              デフォルト値の根拠
         *                      マニュアル
         *                              --https://dxlib.xsrv.jp/function/dxfunc_graph2.html#R17N8
         *
         *                      src
         *                              C:\wb2\20191209_src\DxLibMake3_20\DxFont.cpp
         *                                      CreateFontToHandle_Static()
         *                                              if( Thick < 0 ) Thick = DEFAULT_FONT_THINCK ;
         *
         *                              C:\wb2\20191209_src\DxLibMake3_20\DxLib.h
         #define DEFAULT_FONT_THINCK (6)
         */

        public DDFont(string fontName, int fontSize, int fontThick = 6, bool antiAliasing = true, int edgeSize = 0, bool italicFlag = false)
        {
            if (string.IsNullOrEmpty(fontName))
            {
                throw new DDError();
            }
            if (fontSize < 1 || IntTools.IMAX < fontSize)
            {
                throw new DDError();
            }
            if (fontThick < 0 || 9 < fontThick)
            {
                throw new DDError();
            }
            // antiAliasing
            if (edgeSize < 0 || IntTools.IMAX < edgeSize)
            {
                throw new DDError();
            }
            // italicFlag

            this.FontName     = fontName;
            this.FontSize     = fontSize;
            this.FontThick    = fontThick;
            this.AntiAliasing = antiAliasing;
            this.EdgeSize     = edgeSize;
            this.ItalicFlag   = italicFlag;

            DDFontUtils.Add(this);
        }
示例#2
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void ApplyScreenSize(int w, int h)
        {
            bool mdm = DDUtils.GetMouseDispMode();

            //DDDerivationUtils.UnloadAll(); // -> DDPictureUtils.UnloadAll
            DDPictureUtils.UnloadAll();
            DDSubScreenUtils.UnloadAll();
            DDFontUtils.UnloadAll();

            if (DX.SetGraphMode(w, h, 32) != DX.DX_CHANGESCREEN_OK)
            {
                throw new DDError();
            }

            DX.SetDrawScreen(DX.DX_SCREEN_BACK);
            DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);

            DDUtils.SetMouseDispMode(mdm);
        }