示例#1
0
        public Renderer()
        {
            this.gd = Static.Device;
            var window = Static.Window;
            var control = Static.RenderTarget;
            window.Move += Renderer_Move;
            window.Shown += Renderer_Move;
            control.Move += Renderer_Move;
            control.SizeChanged += control_Resize;

            effect = Static.Effect;
            AdjustDevice();

            volume = Static.Volume;

            Pen2D pen = new Pen2D(System.Drawing.Color.White, 3);
            var lineCross = new Bitmap2D(40, 40);
            Graphics2D glc = Graphics2D.FromImage(lineCross);
            glc.DrawLine(pen, 20, 0, 20, 16);
            glc.DrawLine(pen, 20, 24, 20, 40);
            glc.DrawLine(pen, 0, 20, 16, 20);
            glc.DrawLine(pen, 24, 20, 40, 20);

            layerLineCross = new Layer(GraphicsHelper.Convert(lineCross, gd), 1, 0.7f, LayerDock.Center, LayerDock.Center, () => true);
            layerLineCross.Push(new LayerCell
            {
                SourceTexture = new Rectangle(0, 0, 40, 40),
                DestinationScreen = new Rectangle(-18, -18, 36, 36)
            });
            layerCurrentChatLine = new TextLayer("> ", 0.7f, LayerDock.Near, LayerDock.Near, () => Static.GameManager.chat);
            layerCurrentChatLine.Translation = () => new Vector2(10, 10 + layerCurrentChatLine.Height - 30);

            chatHistory = new Queue<Layer>();
            debug1 = new TextLayer("", 0.7f, LayerDock.Near, LayerDock.Far, () => true);
            debug1.Translation = () => new Vector2(0, -30);
            debug2 = new TextLayer("", 0.7f, LayerDock.Near, LayerDock.Far, () => true);
            debug2.Translation = () => new Vector2(0, -60);
            debug3 = new TextLayer("", 0.7f, LayerDock.Near, LayerDock.Far, () => true);
            debug3.Translation = () => new Vector2(0, -90);
            currentMat = new TextLayer("", 0.7f, LayerDock.Near, LayerDock.Far, () => true);
            currentMat.Translation = () => new Vector2(0, -120);

            hoverBox = HelpfulStuff.getCube(0.51f, GraphicsHelper.TextureCoord(36));
        }
示例#2
0
文件: Chunk.cs 项目: olydis/FineCraft
 public void AssignVolume(DynamicRangeChunkVolume parentVolume)
 {
     this.parentVolume = parentVolume;
 }
示例#3
0
        public static void InitGame(Control renderTarget, string ip, string username, string password)
        {
            indices = new ushort[16384 * 6];
            for (ushort i = 0; i < 16384; i++)
            {
                indices[6 * i + 0] = (ushort)(4 * i + 0);
                indices[6 * i + 1] = (ushort)(4 * i + 1);
                indices[6 * i + 2] = (ushort)(4 * i + 2);
                indices[6 * i + 3] = (ushort)(4 * i + 2);
                indices[6 * i + 4] = (ushort)(4 * i + 1);
                indices[6 * i + 5] = (ushort)(4 * i + 3);
            }

            //PREPARE PHASE
            //DataProvider
            DataProvider = new MultiPlayerDataProvider(() =>
            {
                TcpClient tc = new TcpClient();
                tc.Connect(ip, 8080);
                return tc;
            }, username, "joch");

            //UserData: DataProvider
            UserData = DataProvider.Login();

            //RenderTarget
            RenderTarget = renderTarget;
            
            //Window
            Window = renderTarget.TopLevelControl as Form;

            //SoundManager: Window
            //SoundManager.PlayForever();

            //Device: RenderTarget
            Device = Renderer.CreateDevice();

            var ib = new IndexBuffer(Device, IndexElementSize.SixteenBits, indices.Length, BufferUsage.WriteOnly);
            ib.SetData<ushort>(indices);
            Indices = ib;

            //DPerson: Device
            DPerson.Init();

            //GraphicsHelper: Device
            GraphicsHelper.Init();

            //Effect: Device
            Effect = new AwesomeEffect();

            //Volume: Device, DataProvider, Effect
            Volume = new DynamicRangeChunkVolume(Device, DataProvider);

            //Renderer: Window, Effect, RenderTarget, Device, Volume
            Renderer = new Renderer();

            //GameManager: RenderTarget, Window, Renderer, Volume
            GameManager = new GameManager();

            //RUN PHASE
            DataProvider.Start();
            Renderer.Start();
            Paused = false;
        }
 public void WishSomethingTest()
 {
     GraphicsDevice device = null; // TODO: Passenden Wert initialisieren
     GameDataProvider provider = null; // TODO: Passenden Wert initialisieren
     DynamicRangeChunkVolume target = new DynamicRangeChunkVolume(device, provider); // TODO: Passenden Wert initialisieren
     int toDo = 0; // TODO: Passenden Wert initialisieren
     int toDoExpected = 0; // TODO: Passenden Wert initialisieren
     target.WishSomething(ref toDo);
     Assert.AreEqual(toDoExpected, toDo);
     Assert.Inconclusive("Eine Methode, die keinen Wert zurückgibt, kann nicht überprüft werden.");
 }
 public void UpdatePositionTest()
 {
     GraphicsDevice device = null; // TODO: Passenden Wert initialisieren
     GameDataProvider provider = null; // TODO: Passenden Wert initialisieren
     DynamicRangeChunkVolume target = new DynamicRangeChunkVolume(device, provider); // TODO: Passenden Wert initialisieren
     target.UpdatePosition();
     Assert.Inconclusive("Eine Methode, die keinen Wert zurückgibt, kann nicht überprüft werden.");
 }
 public void ReadValueTest()
 {
     GraphicsDevice device = null; // TODO: Passenden Wert initialisieren
     GameDataProvider provider = null; // TODO: Passenden Wert initialisieren
     DynamicRangeChunkVolume target = new DynamicRangeChunkVolume(device, provider); // TODO: Passenden Wert initialisieren
     uint x = 0; // TODO: Passenden Wert initialisieren
     uint y = 0; // TODO: Passenden Wert initialisieren
     uint z = 0; // TODO: Passenden Wert initialisieren
     uint expected = 0; // TODO: Passenden Wert initialisieren
     uint actual;
     actual = target.ReadValue(x, y, z);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Überprüfen Sie die Richtigkeit dieser Testmethode.");
 }
 public void DynamicRangeChunkVolumeConstructorTest()
 {
     GraphicsDevice device = null; // TODO: Passenden Wert initialisieren
     GameDataProvider provider = null; // TODO: Passenden Wert initialisieren
     DynamicRangeChunkVolume target = new DynamicRangeChunkVolume(device, provider);
     Assert.Inconclusive("TODO: Code zum Überprüfen des Ziels implementieren");
 }
示例#8
0
        public static void InitGame(Control renderTarget, string ip, string username, string password)
        {
            //PREPARE PHASE
            //DataProvider
            DataProvider = new MultiPlayerDataProvider(() =>
            {
                TcpClient tc = new TcpClient();
                tc.Connect(ip, 8080);
                return tc;
            }, username, "joch");

            //UserData: DataProvider
            UserData = DataProvider.Login();

            //RenderTarget
            RenderTarget = renderTarget;

            //Window
            Window = renderTarget.TopLevelControl as Form;

            //SoundManager: Window
            SoundManager.PlayForever();

            //Device: RenderTarget
            Device = Renderer.CreateDevice();

            //DPerson: Device
            DPerson.Init();

            //GraphicsHelper: Device
            GraphicsHelper.Init();

            //Effect: Device
            Effect = new AwesomeEffect();

            //Volume: Device, DataProvider, Effect
            Volume = new DynamicRangeChunkVolume(Device, DataProvider);

            //Renderer: Window, Effect, RenderTarget, Device, Volume
            Renderer = new Renderer();

            //GameManager: RenderTarget, Window, Renderer, Volume
            GameManager = new GameManager();

            //RUN PHASE
            DataProvider.Start();
            Renderer.Start();
            Paused = false;
        }