Пример #1
0
 public UIBackground(string _Name, Control _Parent)
     : base(_Name, _Parent)
 {
     Transformation = new Float3x3(1, 0, 0, 0, 1, 0, 0, 0, 1);
     shader = ShaderCompiler.Compile(System.IO.File.ReadAllText("Default.fx"));
     OnControllerInput += new OnControllerInputHandler(UIButton_OnControllerInput);
 }
Пример #2
0
        public UIButton(string _Name, Control _Parent)
            : base(_Name, _Parent)
        {
            Transformation = new Float3x3(0.1f, 0, 0, 0, 0.1f, 0, 0, 0, 0);
            shader = ShaderCompiler.Compile(System.IO.File.ReadAllText("Default.fx"));
            loadingshader = ShaderCompiler.Compile(System.IO.File.ReadAllText("Loading.fx"));

            font = new SpriteFont("./content/Arial.png", "./content/Arial.xml");

            OnControllerInput += new OnControllerInputHandler(UIButton_OnControllerInput);
        }
Пример #3
0
        public Form1()
        {
            InitializeComponent();

            Graphics.Initialize(this.Handle, TargetResolution);
            ClientResources.Load();
            ScreenSaverTarget = new RenderTarget(TargetResolution);
            ScreenSaverWobbleTarget = new RenderTarget(TargetResolution / 8, RenderTarget.SurfaceFormat.Float4Half);
            ScreenSaverShader = ShaderCompiler.Compile(System.IO.File.ReadAllText("screensaver.fx"));
            ScreenSaverBuffer = new TextureGPU(TargetResolution);

            ScreenSaverDroplet = new TextureGPUResource("./content/droplet.png");

            //Root = new GenericBrowser(null);
            #if true
            Root = new UIBackground("", null);

            UIFloor floor4 = new UIFloor("floor4", Root); floor4.Level = 3;
            UIFloor floor3 = new UIFloor("floor3", Root); floor3.Level = 2;
            UIFloor floor2 = new UIFloor("floor2", Root); floor2.Level = 1;
            UIFloor floor1 = new UIFloor("floor1", Root); floor1.Level = 0;

            Floors.Add(floor1);
            Floors.Add(floor2);
            Floors.Add(floor3);
            Floors.Add(floor4);

            Control button1 = new UIButton("b1", floor4);
            button1.Transformation = Float3x3.Scale(0.1f) * Float3x3.Translate(new Float2(1, 1));

            Control button2 = new UIAnalog("b2", floor4);
            button2.Transformation = Float3x3.Scale(0.1f) * Float3x3.Translate(new Float2(0, 0));

            UIProgressBar progress = new UIProgressBar("p1", floor4);
            progress.Transformation = Float3x3.Scale(new Float2(0.3f, 0.1f)) * Float3x3.Translate(new Float2(0, 0.5f));
            progress.Value = 50;
            #else
            Control button1 = new UIButton("b1", null);
            button1.Transformation = Float3x3.Translate(new Float2(0.5f, 0.5f)) * Float3x3.Scale(0.1f);
            Control button2 = new UIAnalog("b2", null);
            button2.Transformation = Float3x3.Translate(new Float2(0.5f, -0.5f)) * Float3x3.Scale(0.1f);
            Control button3 = new UIAnalog("b3", null);
            button3.Transformation = Float3x3.Translate(new Float2(-0.5f, 0.5f)) * Float3x3.Scale(0.1f);
            Control button4 = new UIAnalog("b4", null);
            button4.Transformation = Float3x3.Translate(new Float2(-0.5f, -0.5f)) * Float3x3.Scale(0.1f);

            ((UIButton)button1).Text = "button1";
            ((UIAnalog)button2).Text = "button2";
            ((UIAnalog)button3).Text = "button3";
            ((UIAnalog)button4).Text = "button4";

            Root = new UIBackground("", null);

            Root.AddChild(button1);
            Root.AddChild(button2);
            Root.AddChild(button3);
            Root.AddChild(button4);
            #endif
            //Root.Transformation = Float3x3.Scale(new Float2(2, -2)) * Float3x3.Translate(new Float2(-0.5f, -0.5f));
            System.Windows.Forms.Application.Idle += new EventHandler(Application_Idle);
        }