예제 #1
0
        private void CreateFont()
        {
            if (font != null)
            {
                font.Dispose();
            }
            var width   = CellSize / (float)stoneSize;
            var gdiFont = new System.Drawing.Font(ConfigManager.Settings.DefaultFontName,
                                                  RequiredFontSize / width,
                                                  FontStyle.Bold);

            font = new Microsoft.WindowsMobile.DirectX.Direct3D.Font(device, gdiFont);
        }
예제 #2
0
        public Direct3DRenderer(Size screenSize, Control target) : base()
        {
            device = new Device(0, DeviceType.Default,
                                target, CreateFlags.None,
                                new PresentParameters()
            {
                Windowed   = true,
                SwapEffect = SwapEffect.Discard
            });
            device.RenderState.AlphaBlendEnable = true;
            device.RenderState.SourceBlend      = Blend.SourceAlpha;
            device.RenderState.DestinationBlend = Blend.InvSourceAlpha;

            device.DeviceReset += delegate { CreateResources(); };

            CreateResources();

            messageFont = new Microsoft.WindowsMobile.DirectX.Direct3D.Font(device,
                                                                            new System.Drawing.Font(ConfigManager.Settings.DefaultFontName, 10, FontStyle.Bold));
        }
예제 #3
0
        public Sprites()
        {
            PresentParameters present;
            System.Drawing.Font gdiFont;

            this.Text = "Using Sprites";

            // Give the application a way to be closed.
            // This must be done before the device is created
            // as it will cause the hwnd of the Form to change.
            this.MinimizeBox = false;

            present = new PresentParameters();
            present.Windowed = true;
            present.SwapEffect = SwapEffect.Discard;

            device = new Device(0, DeviceType.Default, this,
                CreateFlags.None, present);
            device.DeviceReset += new EventHandler(OnDeviceReset);

            // Construct a new Sprite.
            // Sprites do not need to be recreated
            // when a device is reset.
            sprite = new Sprite(device);

            gdiFont = new System.Drawing.Font
                (FontFamily.GenericSansSerif,
            10.0f, FontStyle.Regular);

            // Construct a new font. Fonts do not need
            // to be recreated when a device is reset.
            d3dFont = new Microsoft.WindowsMobile.DirectX.Direct3D.Font
                (device, gdiFont);

            OnDeviceReset(null, EventArgs.Empty);
        }