コード例 #1
0
        public void CreateTextureTest()
        {
            GraphicsDevice device = MockDrawable.GraphicsDevice; // TODO: Initialize to an appropriate value
            //Assert.Inconclusive("Write this this test method.");
            TextureFactory      target         = new TextureFactory(device);
            int                 width          = 20;
            int                 height         = 35;
            Func <Point, Color> colorDetermine = new Func <Point, Color>(CreateTexturetestDelegate); // TODO: Initialize to an appropriate value

            Color[]   expectedData = new Color[width * height];
            Texture2D actual;

            Color[] actualData = new Color[width * height];
            actual = target.CreateTexture(width, height, colorDetermine);
            actual.GetData(actualData);
            for (int w_en = 0; w_en < width; w_en++)
            {
                for (int h_en = 0; h_en < height; h_en++)
                {
                    expectedData[h_en * width + w_en] = CreateTexturetestDelegate(new Point(w_en, h_en));
                }
            }
            Assert.AreEqual(expectedData.Length, actualData.Length);
            for (int i = 0; i < expectedData.Length; i++)
            {
                Assert.AreEqual(expectedData[i], actualData[i]);
            }
        }
コード例 #2
0
        public UIView(ICore core, UIType menuType, int width, int height, UIFlags flags, bool transparent)
            : base(core)
        {
            webCore            = core.GetService <IUIManagerService>().GetWebCore();
            this.menuType      = menuType;
            this.width         = width;
            this.height        = height;
            this.flags         = flags;
            this.isTransparent = transparent;
            isLoading          = false;
            pageLoaded         = false;
            webTextureID       = TextureFactory.CreateTexture(width, height, isTransparent);
            hudPosX            = 0;
            hudPosY            = 0;
            hud      = new TVScreen2DImmediate();
            Keyboard = core.GetService <IKeyboardService>();
            Mouse    = core.GetService <IMouseService>();
            JoyStick = core.GetService <IJoyStickService>();
            Gamepad  = core.GetService <IGamepadsService>();

            CanculateHudPosition(flags);

            View = webCore.CreateWebView(width, height, isTransparent, true);
            View.OnFinishLoading += OnFinishLoading;
            View.OnCallback      += OnCallback;
            View.Focus();

            buttonClickSound = Core.GetService <ISoundManagerService>().Load2DSound(Path.Combine(Application.StartupPath, @"Data\Sounds\menu\button_click.mp3"));
            buttonFocusSound = Core.GetService <ISoundManagerService>().Load2DSound(Path.Combine(Application.StartupPath, @"Data\Sounds\menu\button_focus.mp3"));
            Core.GetService <ISoundManagerService>().SetVolume(buttonClickSound, 0.5f);
            Core.GetService <ISoundManagerService>().SetVolume(buttonFocusSound, 0.5f);
        }