예제 #1
0
 public CompanyMakerState(DwarfGame game, GameStateManager stateManager)
     : base(game, "CompanyMakerState", stateManager)
 {
     CompanyName = DefaultName;
     CompanyMotto = DefaultMotto;
     CompanyLogo = DefaultLogo;
     CompanyColor = DefaultColor;
     EdgePadding = 32;
     Input = new InputManager();
     Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
     TextGenerator = new TextGenerator();
 }
예제 #2
0
        public MenuInicial(string pathRecursos, TgcThirdPersonCamera camara, EjemploAlumno main)
        {
            this.main = main;
            this.camara = camara;
            this.drawer2D = new Drawer2D();

            //Titulo
            this.titulo = new TgcText2D();
            this.titulo.Text = "Socketes";
            this.titulo.Color = Color.White;
            this.titulo.Align = TgcText2D.TextAlign.CENTER;
            this.titulo.Position = new Point(280, 0);
            this.titulo.Size = new Size(400, 100);
            this.titulo.changeFont(new System.Drawing.Font("Arial", 35));

            //Brazuca
            this.pelota = new TgcSphere();
            //TODO cambiar por matrices
            this.pelota.AutoTransformEnable = true;
            this.pelota.setTexture(TgcTexture.createTexture(pathRecursos + Settings.Default.textureBall));
            this.pelota.Radius = 2.5f;
            this.pelota.LevelOfDetail = 4;
            this.pelota.Position = new Vector3(3, 0, -4);
            this.pelota.updateValues();

            //Cancha donde esta la pelota
            this.cancha = TgcBox.fromSize(new Vector3(20, 0, 20), TgcTexture.createTexture(pathRecursos + Settings.Default.textureMenuField));
            //TODO cambiar por matrices
            this.cancha.AutoTransformEnable = true;
            this.cancha.Position = new Vector3(0, -2.5f, 0);

            //Menu
            this.menus = new List<MenuItem>();
            this.menus.Add(new MenuItem("picadito", new Vector3(-5, 2, 0), new Vector3(8, 1, 0), pathRecursos + Settings.Default.texturePicadito1, pathRecursos + Settings.Default.texturePicadito2));
            this.menus.Add(new MenuItem("configuracion", new Vector3(-5, 0.8f, 0), new Vector3(8, 1, 0), pathRecursos + Settings.Default.textureControles1, pathRecursos + Settings.Default.textureControles2));
            this.menus.Add(new MenuItem("salir", new Vector3(-5, -0.4f, 0), new Vector3(8, 1, 0), pathRecursos + Settings.Default.textureSalir1, pathRecursos + Settings.Default.textureSalir2));

            this.menus[0].Select();

            //Menu de configuracion
            //Crear Sprite
            this.panelConfiguracion = new CustomSprite();
            this.panelConfiguracion.Bitmap = new CustomBitmap(pathRecursos + Settings.Default.texturePanelcontroles, D3DDevice.Instance.Device);
            this.panelConfiguracion.Scaling = new Vector2(0.75f, 0.75f);

            Size textureSize = this.panelConfiguracion.Bitmap.Size;
            this.panelConfiguracion.Position = new Vector2(FastMath.Max(D3DDevice.Instance.Width / 2 - textureSize.Width / 2, 0), FastMath.Max(D3DDevice.Instance.Height / 2 - textureSize.Height / 2, 0));
        }
예제 #3
0
        public override void OnEnter()
        {
            DefaultFont            = Game.Content.Load <SpriteFont>("Default");
            GUI                    = new DwarfGUI(Game, DefaultFont, Game.Content.Load <SpriteFont>("Title"), Game.Content.Load <SpriteFont>("Small"), Input);
            IsInitialized          = true;
            Drawer                 = new Drawer2D(Game.Content, Game.GraphicsDevice);
            MainWindow             = new Panel(GUI, GUI.RootComponent);
            MainWindow.LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2);
            Layout                 = new GridLayout(GUI, MainWindow, 10, 4);
            Label label = new Label(GUI, Layout, "GUI Elements", GUI.TitleFont);

            Layout.SetComponentPosition(label, 0, 0, 1, 1);

            Checkbox check = new Checkbox(GUI, Layout, "Check 1", GUI.DefaultFont, true);

            Layout.SetComponentPosition(check, 0, 1, 1, 1);

            Checkbox check2 = new Checkbox(GUI, Layout, "Check 2", GUI.DefaultFont, true);

            Layout.SetComponentPosition(check2, 0, 2, 1, 1);

            Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.PushButton, null);

            Layout.SetComponentPosition(apply, 2, 9, 1, 1);

            Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.PushButton, null);

            Layout.SetComponentPosition(back, 3, 9, 1, 1);

            Label sliderLabel = new Label(GUI, Layout, "Slider", GUI.DefaultFont);

            Layout.SetComponentPosition(sliderLabel, 0, 3, 1, 1);
            sliderLabel.Alignment = Drawer2D.Alignment.Right;

            Slider slider = new Slider(GUI, Layout, "Slider", 0, -1000, 1000, Slider.SliderMode.Integer);

            Layout.SetComponentPosition(slider, 1, 3, 1, 1);

            Label comboLabel = new Label(GUI, Layout, "Combobox", GUI.DefaultFont);

            comboLabel.Alignment = Drawer2D.Alignment.Right;

            Layout.SetComponentPosition(comboLabel, 0, 4, 1, 1);

            ComboBox combo = new ComboBox(GUI, Layout);

            combo.AddValue("Foo");
            combo.AddValue("Bar");
            combo.AddValue("Baz");
            combo.AddValue("Quz");
            combo.CurrentValue = "Foo";
            Layout.SetComponentPosition(combo, 1, 4, 1, 1);

            back.OnClicked += back_OnClicked;

            GroupBox groupBox = new GroupBox(GUI, Layout, "");

            Layout.SetComponentPosition(groupBox, 2, 1, 2, 6);
            Layout.UpdateSizes();

            /*
             * Texture2D Image = Game.Content.Load<Texture2D>("pine");
             * string[] tags = {""};
             * DraggableItem image = new DraggableItem(GUI, groupBox,new GItem("Item", new ImageFrame(Image, Image.Bounds), 0, 1, 1, tags));
             * image.LocalBounds = new Rectangle(50, 50, Image.Width, Image.Height);
             *
             * Label imageLabel = new Label(GUI, image, "Image Panel", GUI.DefaultFont);
             * imageLabel.LocalBounds = new Rectangle(0, 0, Image.Width, Image.Height);
             * imageLabel.Alignment = Drawer2D.Alignment.Top | Drawer2D.Alignment.Left;
             */

            GridLayout groupLayout = new GridLayout(GUI, groupBox, 1, 2);


            DragManager dragManager = new DragManager();

            DragGrid dragGrid  = new DragGrid(GUI, groupLayout, dragManager, 32, 32);
            DragGrid dragGrid2 = new DragGrid(GUI, groupLayout, dragManager, 32, 32);

            groupLayout.SetComponentPosition(dragGrid, 0, 0, 1, 1);
            groupLayout.SetComponentPosition(dragGrid2, 1, 0, 1, 1);
            Layout.UpdateSizes();
            groupLayout.UpdateSizes();
            dragGrid.SetupLayout();
            dragGrid2.SetupLayout();


            foreach (Resource r in ResourceLibrary.Resources.Values)
            {
                if (r.ResourceName != "Container")
                {
                    GItem gitem = new GItem(r.ResourceName, r.Image, 0, 32, 2, 1);
                    gitem.CurrentAmount = 2;
                    dragGrid.AddItem(gitem);
                }
            }

            ProgressBar progress      = new ProgressBar(GUI, Layout, 0.7f);
            Label       progressLabel = new Label(GUI, Layout, "Progress Bar", GUI.DefaultFont);

            progressLabel.Alignment = Drawer2D.Alignment.Right;

            Layout.SetComponentPosition(progressLabel, 0, 5, 1, 1);
            Layout.SetComponentPosition(progress, 1, 5, 1, 1);


            LineEdit line      = new LineEdit(GUI, Layout, "");
            Label    lineLabel = new Label(GUI, Layout, "Line Edit", GUI.DefaultFont);

            lineLabel.Alignment = Drawer2D.Alignment.Right;

            Layout.SetComponentPosition(lineLabel, 0, 6, 1, 1);
            Layout.SetComponentPosition(line, 1, 6, 1, 1);

            base.OnEnter();
        }
예제 #4
0
 public abstract void RenderSprites(Drawer2D drawer);
예제 #5
0
 /// <summary>
 /// Called by the loading thread just before the game is loaded.
 /// </summary>
 public void Preload()
 {
     drawer2D = new Drawer2D(Content, GraphicsDevice);
 }
예제 #6
0
 public override void Render(float elapsedTime, Drawer2D drawer)
 {
     drawer.DrawSprite(sprites[currentSprite]);
 }
예제 #7
0
        public override void OnEnter()
        {
            DefaultFont   = Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default);
            GUI           = new DwarfGUI(Game, DefaultFont, Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Small), Input);
            IsInitialized = true;
            Drawer        = new Drawer2D(Game.Content, Game.GraphicsDevice);
            MainWindow    = new Panel(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };
            Layout = new GridLayout(GUI, MainWindow, 10, 6);

            Label label = new Label(GUI, Layout, "Options", GUI.TitleFont);

            Layout.SetComponentPosition(label, 0, 0, 1, 1);

            TabSelector = new TabSelector(GUI, Layout, 6);
            Layout.SetComponentPosition(TabSelector, 0, 1, 6, 8);

            TabSelector.Tab graphicsTab = TabSelector.AddTab("Graphics");

            GroupBox graphicsBox = new GroupBox(GUI, graphicsTab, "Graphics")
            {
                WidthSizeMode  = GUIComponent.SizeMode.Fit,
                HeightSizeMode = GUIComponent.SizeMode.Fit
            };

            Categories["Graphics"] = graphicsBox;
            CurrentBox             = graphicsBox;

            GridLayout graphicsLayout = new GridLayout(GUI, graphicsBox, 6, 5);


            Label resolutionLabel = new Label(GUI, graphicsLayout, "Resolution", GUI.DefaultFont)
            {
                Alignment = Drawer2D.Alignment.Right
            };

            ComboBox resolutionBox = new ComboBox(GUI, graphicsLayout)
            {
                ToolTip = "Sets the size of the screen.\nSmaller for higher framerates."
            };

            foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
            {
                if (mode.Format != SurfaceFormat.Color)
                {
                    continue;
                }

                if (mode.Width <= 640)
                {
                    continue;
                }

                string s = mode.Width + " x " + mode.Height;
                DisplayModes[s] = mode;
                if (mode.Width == GameSettings.Default.ResolutionX && mode.Height == GameSettings.Default.ResolutionY)
                {
                    resolutionBox.AddValue(s);
                    resolutionBox.CurrentValue = s;
                }
                else
                {
                    resolutionBox.AddValue(s);
                }
            }

            graphicsLayout.SetComponentPosition(resolutionLabel, 0, 0, 1, 1);
            graphicsLayout.SetComponentPosition(resolutionBox, 1, 0, 1, 1);


            resolutionBox.OnSelectionModified += resolutionBox_OnSelectionModified;

            Checkbox fullscreenCheck = new Checkbox(GUI, graphicsLayout, "Fullscreen", GUI.DefaultFont, GameSettings.Default.Fullscreen)
            {
                ToolTip = "If this is checked, the game takes up the whole screen."
            };

            graphicsLayout.SetComponentPosition(fullscreenCheck, 0, 1, 1, 1);

            fullscreenCheck.OnCheckModified += fullscreenCheck_OnClicked;


            Label  drawDistance    = new Label(GUI, graphicsLayout, "Draw Distance", GUI.DefaultFont);
            Slider chunkDrawSlider = new Slider(GUI, graphicsLayout, "", GameSettings.Default.ChunkDrawDistance, 1, 1000, Slider.SliderMode.Integer)
            {
                ToolTip = "Maximum distance at which terrain will be drawn\nSmaller for faster."
            };


            graphicsLayout.SetComponentPosition(drawDistance, 0, 2, 1, 1);
            graphicsLayout.SetComponentPosition(chunkDrawSlider, 1, 2, 1, 1);
            chunkDrawSlider.OnValueModified += ChunkDrawSlider_OnValueModified;

            Label  cullDistance = new Label(GUI, graphicsLayout, "Cull Distance", GUI.DefaultFont);
            Slider cullSlider   = new Slider(GUI, graphicsLayout, "", GameSettings.Default.VertexCullDistance, 0.1f, 1000, Slider.SliderMode.Integer)
            {
                ToolTip = "Maximum distance at which anything will be drawn\n Smaller for faster."
            };

            cullSlider.OnValueModified += CullSlider_OnValueModified;

            graphicsLayout.SetComponentPosition(cullDistance, 0, 3, 1, 1);
            graphicsLayout.SetComponentPosition(cullSlider, 1, 3, 1, 1);

            Label  generateDistance = new Label(GUI, graphicsLayout, "Generate Distance", GUI.DefaultFont);
            Slider generateSlider   = new Slider(GUI, graphicsLayout, "", GameSettings.Default.ChunkGenerateDistance, 1, 1000, Slider.SliderMode.Integer)
            {
                ToolTip = "Maximum distance at which terrain will be generated."
            };

            generateSlider.OnValueModified += GenerateSlider_OnValueModified;

            graphicsLayout.SetComponentPosition(generateDistance, 0, 4, 1, 1);
            graphicsLayout.SetComponentPosition(generateSlider, 1, 4, 1, 1);

            Checkbox glowBox = new Checkbox(GUI, graphicsLayout, "Enable Glow", GUI.DefaultFont, GameSettings.Default.EnableGlow)
            {
                ToolTip = "When checked, there will be a fullscreen glow effect."
            };

            graphicsLayout.SetComponentPosition(glowBox, 1, 1, 1, 1);
            glowBox.OnCheckModified += glowBox_OnCheckModified;

            Label aaLabel = new Label(GUI, graphicsLayout, "Antialiasing", GUI.DefaultFont)
            {
                Alignment = Drawer2D.Alignment.Right
            };

            ComboBox aaBox = new ComboBox(GUI, graphicsLayout)
            {
                ToolTip = "Determines how much antialiasing (smoothing) there is.\nHigher means more smooth, but is slower."
            };

            aaBox.AddValue("None");
            aaBox.AddValue("FXAA");
            aaBox.AddValue("2x MSAA");
            aaBox.AddValue("4x MSAA");
            aaBox.AddValue("16x MSAA");

            foreach (string s in AAModes.Keys.Where(s => AAModes[s] == GameSettings.Default.AntiAliasing))
            {
                aaBox.CurrentValue = s;
            }


            aaBox.OnSelectionModified += AABox_OnSelectionModified;

            graphicsLayout.SetComponentPosition(aaLabel, 2, 0, 1, 1);
            graphicsLayout.SetComponentPosition(aaBox, 3, 0, 1, 1);


            Checkbox reflectTerrainBox = new Checkbox(GUI, graphicsLayout, "Reflect Chunks", GUI.DefaultFont, GameSettings.Default.DrawChunksReflected)
            {
                ToolTip = "When checked, water will reflect terrain."
            };

            reflectTerrainBox.OnCheckModified += reflectTerrainBox_OnCheckModified;
            graphicsLayout.SetComponentPosition(reflectTerrainBox, 2, 1, 1, 1);

            Checkbox refractTerrainBox = new Checkbox(GUI, graphicsLayout, "Refract Chunks", GUI.DefaultFont, GameSettings.Default.DrawChunksRefracted)
            {
                ToolTip = "When checked, water will refract terrain."
            };

            refractTerrainBox.OnCheckModified += refractTerrainBox_OnCheckModified;
            graphicsLayout.SetComponentPosition(refractTerrainBox, 2, 2, 1, 1);

            Checkbox reflectEntities = new Checkbox(GUI, graphicsLayout, "Reflect Entities", GUI.DefaultFont, GameSettings.Default.DrawEntityReflected)
            {
                ToolTip = "When checked, water will reflect trees, dwarves, etc."
            };

            reflectEntities.OnCheckModified += reflectEntities_OnCheckModified;
            graphicsLayout.SetComponentPosition(reflectEntities, 3, 1, 1, 1);

            Checkbox refractEntities = new Checkbox(GUI, graphicsLayout, "Refract Entities", GUI.DefaultFont, GameSettings.Default.DrawEntityReflected)
            {
                ToolTip = "When checked, water will reflect trees, dwarves, etc."
            };

            refractEntities.OnCheckModified += refractEntities_OnCheckModified;
            graphicsLayout.SetComponentPosition(refractEntities, 3, 2, 1, 1);

            Checkbox sunlight = new Checkbox(GUI, graphicsLayout, "Sunlight", GUI.DefaultFont, GameSettings.Default.CalculateSunlight)
            {
                ToolTip = "When checked, terrain will be lit/shadowed by the sun."
            };

            sunlight.OnCheckModified += sunlight_OnCheckModified;
            graphicsLayout.SetComponentPosition(sunlight, 2, 3, 1, 1);

            Checkbox ao = new Checkbox(GUI, graphicsLayout, "Ambient Occlusion", GUI.DefaultFont, GameSettings.Default.AmbientOcclusion)
            {
                ToolTip = "When checked, terrain will smooth shading effects."
            };

            ao.OnCheckModified += AO_OnCheckModified;
            graphicsLayout.SetComponentPosition(ao, 3, 3, 1, 1);

            Checkbox ramps = new Checkbox(GUI, graphicsLayout, "Ramps", GUI.DefaultFont, GameSettings.Default.CalculateRamps)
            {
                ToolTip = "When checked, some terrain will have smooth ramps."
            };

            ramps.OnCheckModified += ramps_OnCheckModified;
            graphicsLayout.SetComponentPosition(ramps, 2, 4, 1, 1);

            Checkbox cursorLight = new Checkbox(GUI, graphicsLayout, "Cursor Light", GUI.DefaultFont, GameSettings.Default.CursorLightEnabled)
            {
                ToolTip = "When checked, a light will follow the player cursor."
            };

            cursorLight.OnCheckModified += cursorLight_OnCheckModified;
            graphicsLayout.SetComponentPosition(cursorLight, 2, 5, 1, 1);

            Checkbox entityLight = new Checkbox(GUI, graphicsLayout, "Entity Lighting", GUI.DefaultFont, GameSettings.Default.EntityLighting)
            {
                ToolTip = "When checked, dwarves, objects, etc. will be lit\nby the sun, lamps, etc."
            };

            entityLight.OnCheckModified += entityLight_OnCheckModified;
            graphicsLayout.SetComponentPosition(entityLight, 3, 4, 1, 1);

            Checkbox selfIllum = new Checkbox(GUI, graphicsLayout, "Ore Glow", GUI.DefaultFont, GameSettings.Default.SelfIlluminationEnabled)
            {
                ToolTip = "When checked, some terrain elements will glow."
            };

            selfIllum.OnCheckModified += selfIllum_OnCheckModified;
            graphicsLayout.SetComponentPosition(selfIllum, 3, 5, 1, 1);

            Checkbox particlePhysics = new Checkbox(GUI, graphicsLayout, "Particle Body", GUI.DefaultFont, GameSettings.Default.ParticlePhysics)
            {
                ToolTip = "When checked, some particles will bounce off terrain."
            };

            particlePhysics.OnCheckModified += particlePhysics_OnCheckModified;
            graphicsLayout.SetComponentPosition(particlePhysics, 0, 5, 1, 1);



            TabSelector.Tab graphics2Tab = TabSelector.AddTab("Graphics II");
            GroupBox        graphicsBox2 = new GroupBox(GUI, graphics2Tab, "Graphics II")
            {
                HeightSizeMode = GUIComponent.SizeMode.Fit,
                WidthSizeMode  = GUIComponent.SizeMode.Fit
            };

            Categories["Graphics II"] = graphicsBox2;
            GridLayout graphicsLayout2 = new GridLayout(GUI, graphicsBox2, 6, 5);

            Checkbox moteBox = new Checkbox(GUI, graphicsLayout2, "Generate Motes", GUI.DefaultFont, GameSettings.Default.GrassMotes)
            {
                ToolTip = "When checked, trees, grass, etc. will be visible."
            };

            moteBox.OnCheckModified += MoteBox_OnCheckModified;
            graphicsLayout2.SetComponentPosition(moteBox, 1, 2, 1, 1);

            Label  numMotes    = new Label(GUI, graphicsLayout2, "Num Motes", GUI.DefaultFont);
            Slider motesSlider = new Slider(GUI, graphicsLayout2, "", (int)(GameSettings.Default.NumMotes * 100), 0, 1000, Slider.SliderMode.Integer)
            {
                ToolTip = "Determines the maximum amount of trees/grass that will be visible."
            };



            graphicsLayout2.SetComponentPosition(numMotes, 0, 1, 1, 1);
            graphicsLayout2.SetComponentPosition(motesSlider, 1, 1, 1, 1);
            motesSlider.OnValueModified += MotesSlider_OnValueModified;
            TabSelector.Tab gameplayTab = TabSelector.AddTab("Gameplay");
            GroupBox        gameplayBox = new GroupBox(GUI, gameplayTab, "Gameplay")
            {
                WidthSizeMode  = GUIComponent.SizeMode.Fit,
                HeightSizeMode = GUIComponent.SizeMode.Fit
            };

            Categories["Gameplay"] = gameplayBox;

            GridLayout gameplayLayout = new GridLayout(GUI, gameplayBox, 6, 5);

            Label  moveSpeedLabel = new Label(GUI, gameplayLayout, "Camera Move Speed", GUI.DefaultFont);
            Slider moveSlider     = new Slider(GUI, gameplayLayout, "", GameSettings.Default.CameraScrollSpeed, 0.0f, 20.0f, Slider.SliderMode.Float)
            {
                ToolTip = "Determines how fast the camera will move when keys are pressed."
            };

            gameplayLayout.SetComponentPosition(moveSpeedLabel, 0, 0, 1, 1);
            gameplayLayout.SetComponentPosition(moveSlider, 1, 0, 1, 1);
            moveSlider.OnValueModified += MoveSlider_OnValueModified;

            Label  zoomSpeedLabel = new Label(GUI, gameplayLayout, "Zoom Speed", GUI.DefaultFont);
            Slider zoomSlider     = new Slider(GUI, gameplayLayout, "", GameSettings.Default.CameraZoomSpeed, 0.0f, 2.0f, Slider.SliderMode.Float)
            {
                ToolTip = "Determines how fast the camera will go\nup and down with the scroll wheel."
            };

            gameplayLayout.SetComponentPosition(zoomSpeedLabel, 0, 1, 1, 1);
            gameplayLayout.SetComponentPosition(zoomSlider, 1, 1, 1, 1);
            zoomSlider.OnValueModified += ZoomSlider_OnValueModified;

            Checkbox invertZoomBox = new Checkbox(GUI, gameplayLayout, "Invert Zoom", GUI.DefaultFont, GameSettings.Default.InvertZoom)
            {
                ToolTip = "When checked, the scroll wheel is reversed\nfor zooming."
            };

            gameplayLayout.SetComponentPosition(invertZoomBox, 2, 1, 1, 1);
            invertZoomBox.OnCheckModified += InvertZoomBox_OnCheckModified;


            Checkbox edgeScrollBox = new Checkbox(GUI, gameplayLayout, "Edge Scrolling", GUI.DefaultFont, GameSettings.Default.EnableEdgeScroll)
            {
                ToolTip = "When checked, the camera will scroll\nwhen the cursor is at the edge of the screen."
            };

            gameplayLayout.SetComponentPosition(edgeScrollBox, 0, 2, 1, 1);
            edgeScrollBox.OnCheckModified += EdgeScrollBox_OnCheckModified;

            Checkbox introBox = new Checkbox(GUI, gameplayLayout, "Play Intro", GUI.DefaultFont, GameSettings.Default.DisplayIntro)
            {
                ToolTip = "When checked, the intro will be played when the game starts"
            };

            gameplayLayout.SetComponentPosition(introBox, 1, 2, 1, 1);
            introBox.OnCheckModified += IntroBox_OnCheckModified;

            /*
             * Label chunkWidthLabel = new Label(GUI, gameplayLayout, "Chunk Width", GUI.DefaultFont);
             * Slider chunkWidthSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.ChunkWidth, 4, 256, Slider.SliderMode.Integer)
             * {
             *  ToolTip = "Determines the number of blocks in a chunk of terrain."
             * };
             *
             * gameplayLayout.SetComponentPosition(chunkWidthLabel, 0, 3, 1, 1);
             * gameplayLayout.SetComponentPosition(chunkWidthSlider, 1, 3, 1, 1);
             * chunkWidthSlider.OnValueModified += ChunkWidthSlider_OnValueModified;
             *
             * Label chunkHeightLabel = new Label(GUI, gameplayLayout, "Chunk Height", GUI.DefaultFont);
             * Slider chunkHeightSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.ChunkHeight, 4, 256, Slider.SliderMode.Integer)
             * {
             *  ToolTip = "Determines the maximum depth,\nin blocks, of a chunk of terrain."
             * };
             *
             * gameplayLayout.SetComponentPosition(chunkHeightLabel, 2, 3, 1, 1);
             * gameplayLayout.SetComponentPosition(chunkHeightSlider, 3, 3, 1, 1);
             *
             *
             * chunkHeightSlider.OnValueModified += ChunkHeightSlider_OnValueModified;
             *
             * Label worldWidthLabel = new Label(GUI, gameplayLayout, "World Width", GUI.DefaultFont);
             * Slider worldWidthSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldWidth, 4, 2048, Slider.SliderMode.Integer)
             * {
             *  ToolTip = "Determines the size of the overworld."
             * };
             *
             * gameplayLayout.SetComponentPosition(worldWidthLabel, 0, 4, 1, 1);
             * gameplayLayout.SetComponentPosition(worldWidthSlider, 1, 4, 1, 1);
             * worldWidthSlider.OnValueModified += WorldWidthSlider_OnValueModified;
             *
             * Label worldHeightLabel = new Label(GUI, gameplayLayout, "World Height", GUI.DefaultFont);
             * Slider worldHeightSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldHeight, 4, 2048, Slider.SliderMode.Integer)
             * {
             *  ToolTip = "Determines the size of the overworld."
             * };
             *
             * gameplayLayout.SetComponentPosition(worldHeightLabel, 2, 4, 1, 1);
             * gameplayLayout.SetComponentPosition(worldHeightSlider, 3, 4, 1, 1);
             * worldHeightSlider.OnValueModified += WorldHeightSlider_OnValueModified;
             *
             *
             * Label worldScaleLabel = new Label(GUI, gameplayLayout, "World Scale", GUI.DefaultFont);
             * Slider worldScaleSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldScale, 2, 128, Slider.SliderMode.Integer)
             * {
             *  ToolTip = "Determines the number of voxel\nper pixel of the overworld"
             * };
             *
             * gameplayLayout.SetComponentPosition(worldScaleLabel, 0, 5, 1, 1);
             * gameplayLayout.SetComponentPosition(worldScaleSlider, 1, 5, 1, 1);
             * worldScaleSlider.OnValueModified += WorldScaleSlider_OnValueModified;
             */

            TabSelector.Tab audioTab = TabSelector.AddTab("Audio");

            GroupBox audioBox = new GroupBox(GUI, audioTab, "Audio")
            {
                WidthSizeMode  = GUIComponent.SizeMode.Fit,
                HeightSizeMode = GUIComponent.SizeMode.Fit
            };

            Categories["Audio"] = audioBox;

            GridLayout audioLayout = new GridLayout(GUI, audioBox, 6, 5);

            Label  masterLabel  = new Label(GUI, audioLayout, "Master Volume", GUI.DefaultFont);
            Slider masterSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.MasterVolume, 0.0f, 1.0f, Slider.SliderMode.Float);

            audioLayout.SetComponentPosition(masterLabel, 0, 0, 1, 1);
            audioLayout.SetComponentPosition(masterSlider, 1, 0, 1, 1);
            masterSlider.OnValueModified += MasterSlider_OnValueModified;

            Label  sfxLabel  = new Label(GUI, audioLayout, "SFX Volume", GUI.DefaultFont);
            Slider sfxSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.SoundEffectVolume, 0.0f, 1.0f, Slider.SliderMode.Float);

            audioLayout.SetComponentPosition(sfxLabel, 0, 1, 1, 1);
            audioLayout.SetComponentPosition(sfxSlider, 1, 1, 1, 1);
            sfxSlider.OnValueModified += SFXSlider_OnValueModified;

            Label  musicLabel  = new Label(GUI, audioLayout, "Music Volume", GUI.DefaultFont);
            Slider musicSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.MusicVolume, 0.0f, 1.0f, Slider.SliderMode.Float);

            audioLayout.SetComponentPosition(musicLabel, 0, 2, 1, 1);
            audioLayout.SetComponentPosition(musicSlider, 1, 2, 1, 1);
            musicSlider.OnValueModified += MusicSlider_OnValueModified;

            TabSelector.Tab keysTab = TabSelector.AddTab("Keys");
            GroupBox        keysBox = new GroupBox(GUI, keysTab, "Keys")
            {
                WidthSizeMode  = GUIComponent.SizeMode.Fit,
                HeightSizeMode = GUIComponent.SizeMode.Fit
            };

            Categories["Keys"] = keysBox;

            KeyEditor  keyeditor = new KeyEditor(GUI, keysBox, new KeyManager(), 8, 4);
            GridLayout keyLayout = new GridLayout(GUI, keysBox, 1, 1);

            keyLayout.SetComponentPosition(keyeditor, 0, 0, 1, 1);
            keyLayout.UpdateSizes();
            keyeditor.UpdateLayout();

            /*
             * GroupBox customBox = new GroupBox(GUI, Layout, "Customization")
             * {
             *  IsVisible = false
             * };
             * Categories["Customization"] = customBox;
             * TabSelector.AddItem("Customization");
             *
             * GridLayout customBoxLayout = new GridLayout(GUI, customBox, 6, 5);
             *
             * List<string> assets = TextureManager.DefaultContent.Keys.ToList();
             *
             * AssetManager assetManager = new AssetManager(GUI, customBoxLayout, assets);
             * customBoxLayout.SetComponentPosition(assetManager, 0, 0, 5, 6);
             */

            Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check));

            Layout.SetComponentPosition(apply, 5, 9, 1, 1);
            apply.OnClicked += apply_OnClicked;

            Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow));

            Layout.SetComponentPosition(back, 4, 9, 1, 1);
            back.OnClicked += back_OnClicked;

            Layout.UpdateSizes();
            TabSelector.UpdateSize();
            TabSelector.SetTab("Graphics");
            base.OnEnter();
        }
예제 #8
0
        public SelectorVehiculo(GameModel gameModel)
        {
            this.gameModel = gameModel;

            var  screenHeight = D3DDevice.Instance.Device.Viewport.Height;
            var  screenWidth  = D3DDevice.Instance.Device.Viewport.Width;
            Size maxSize      = new Size(1920, 1017);

            drawer2D = new Drawer2D();

            //cargo los vehiculos disponibles para seleccionar
            foreach (string name in Game.Default.VehicleNames)
            {
                Vehiculo v = new Vehiculo(name);
                v.SampleMesh.Scale = TGCVector3.One * 15f;
                vehiculos.Add(v);
            }
            selected = vehiculos[0];

            //cargo los colores
            colors = new string[Game.Default.VehicleColors.Count];
            Game.Default.VehicleColors.CopyTo(colors, 0);

            //cargo el fondo en 3D del selector
            var loader    = new TgcSceneLoader();
            var scenesDir = Game.Default.MediaDirectory + Game.Default.ScenariosDirectory;

            this.background = loader.loadSceneFromFile(scenesDir + "selector-vehiculo-TgcScene.xml");

            this.gameModel.Camara = new TgcThirdPersonCamera(selected.SampleMesh.Position, 100f, 170f);

            //Cargo los sprites
            var imgDir = Game.Default.MediaDirectory + Game.Default.ImagesDirectory;

            //flecha izquierda
            flechaIzq = new CustomSprite
            {
                Bitmap   = new CustomBitmap(imgDir + "left-arrow.png", D3DDevice.Instance.Device),
                Scaling  = TGCVector2.One * 0.25f * (screenHeight / (float)maxSize.Height),
                Position = new TGCVector2(screenWidth * 0.236f, screenHeight * 0.4f)
            };

            //flecha derecha
            flechaDer = new CustomSprite
            {
                Bitmap   = new CustomBitmap(imgDir + "right-arrow.png", D3DDevice.Instance.Device),
                Scaling  = TGCVector2.One * 0.25f * (screenHeight / (float)maxSize.Height),
                Position = new TGCVector2(screenWidth * 0.7f, screenHeight * 0.4f)
            };

            //flecha arriba
            flechaArriba = new CustomSprite
            {
                Bitmap   = new CustomBitmap(imgDir + "up-arrow.png", D3DDevice.Instance.Device),
                Scaling  = TGCVector2.One * 0.25f * (screenHeight / (float)maxSize.Height),
                Position = new TGCVector2(screenWidth * 0.464f, screenHeight * 0.05f)
            };

            //Nombre vehiculo
            vehicleName = new TgcText2D
            {
                Text     = selected.Name,
                Color    = Color.Gold,
                Position = new Point(0, (int)(screenHeight * 0.72f)),
            };
            vehicleName.changeFont(UtilMethods.createFont("Twisted Stallions", (int)(45 * (screenHeight / (float)maxSize.Height))));

            //Select Vehicle
            select = new TgcText2D
            {
                Text     = "SELECT VEHICLE",
                Color    = Color.DarkOrange,
                Position = new Point(0, (int)(screenHeight * 0.80f)),
            };
            select.changeFont(UtilMethods.createFont("Twisted Stallions", (int)(75 * (screenHeight / (float)maxSize.Height))));
        }
예제 #9
0
 public override void Render(float elapsedTime, Drawer2D drawer)
 {
     drawText.drawText(Titulo, 20, 20, Color.White);
     mBotones.ForEach((Button b) => { b.Render(elapsedTime, drawer); });
 }
예제 #10
0
        void Initialize()
        {
            Tabs = new Dictionary<string, GUIComponent>();
            Icons = TextureManager.GetTexture(ContentPaths.GUI.icons);
            TabButtons = new List<Button>();
            GUI = new DwarfGUI(Game, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input)
            {
                DebugDraw = false
            };
            IsInitialized = true;
            Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
            MainWindow = new GUIComponent(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };
            Layout = new GridLayout(GUI, MainWindow, 11, 4);
            Layout.UpdateSizes();

            Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow));
            Layout.SetComponentPosition(back, 0, 10, 1, 1);
            back.OnClicked += back_OnClicked;

            Panel tabPanel = new Panel(GUI, Layout);
            Layout.SetComponentPosition(tabPanel, 0, 0, 4, 1);

            GridLayout tabLayout = new GridLayout(GUI, tabPanel, 1, 10)
            {
                EdgePadding = 10
            };

               CreateTabButton(tabLayout, "Employees", "Hire and fire dwarves", 5, 0);
            EmployeeDisplay employeeDisplay = new EmployeeDisplay(GUI, Layout, PlayState.Master.Faction)
            {
                IsVisible = false
            };
            Tabs["Employees"] = employeeDisplay;

               CreateTabButton(tabLayout, "Assets", "Buy/Sell goods", 3, 1);
               GoodsPanel assetsPanel = new GoodsPanel(GUI, Layout, PlayState.Master.Faction)
               {
               IsVisible = false
               };
               Tabs["Assets"] = assetsPanel;

               CreateTabButton(tabLayout, "Capital", "Financial report", 2, 1);
               CapitalPanel capitalPanel = new CapitalPanel(GUI, Layout, PlayState.Master.Faction)
               {
               IsVisible = false
               };
               Tabs["Capital"] = capitalPanel;

              ButtonClicked(TabButtons[0]);
        }
예제 #11
0
 public abstract void Render(float elapsedTime, Drawer2D drawer);
예제 #12
0
        public override void OnEnter()
        {
            if (!MaintainState)
            {
                DefaultFont = Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default);
                GUI = new DwarfGUI(Game, DefaultFont,
                    Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default),
                    Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input);
                IsInitialized = true;
                Logo = TextureManager.GetTexture(ContentPaths.Logos.gamelogo);

                ListSelect = new ListSelector(GUI, GUI.RootComponent)
                {
                    Label = "- Main Menu -",
                    LocalBounds =
                        new Rectangle(Game.GraphicsDevice.Viewport.Width/2 - 100, Game.GraphicsDevice.Viewport.Height/2,
                            150, 150)
                };
                DefaultItems();

                ListSelect.OnItemClicked += ItemClicked;
                Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
                Input = new InputManager();
            }

            base.OnEnter();
        }
        public void Init(string MediaDir, Drawer2D drawer2D)
        {
            this.drawer2D = drawer2D;

            CustomSprite contadorTiempo = new CustomSprite();

            contadorTiempo.Bitmap = new CustomBitmap(MediaDir + "\\Textures\\ContadorTiempo.png", D3DDevice.Instance.Device);
            relojBG = new HUDSprite(HUD.AnclajeHorizontal.CENTER, HUD.AnclajeVertical.TOP, new TGCVector2(0.0f, 0.0f), new TGCVector2(1.0f, 1.0f), drawer2D, contadorTiempo);
            relojBG.Init();

            CustomSprite medidorTurbo = new CustomSprite();

            medidorTurbo.Bitmap = new CustomBitmap(MediaDir + "\\Textures\\MedidorTurbo.png", D3DDevice.Instance.Device);
            turboHUD            = new HUDSprite(HUD.AnclajeHorizontal.RIGHT, HUD.AnclajeVertical.BOTTOM, new TGCVector2(.05f, .05f), new TGCVector2(1, 1), drawer2D, medidorTurbo);
            turboHUD.Init();

            CustomSprite medidorTurboDos = new CustomSprite();

            medidorTurboDos.Bitmap = new CustomBitmap(MediaDir + "\\Textures\\MedidorTurbo.png", D3DDevice.Instance.Device);
            turboDosHUD            = new HUDSprite(HUD.AnclajeHorizontal.LEFT, HUD.AnclajeVertical.BOTTOM, new TGCVector2(.05f, .05f), new TGCVector2(1, 1), drawer2D, medidorTurboDos);
            turboDosHUD.Init();

            CustomSprite equipoAzulSprite = new CustomSprite();

            equipoAzulSprite.Bitmap = new CustomBitmap(MediaDir + "\\Textures\\EquipoAzul.png", D3DDevice.Instance.Device);
            equipoAzulHUD           = new HUDSprite(HUD.AnclajeHorizontal.LEFT, HUD.AnclajeVertical.TOP, new TGCVector2(0.40f, 0.015f), new TGCVector2(1.0f, 1.5f), drawer2D, equipoAzulSprite);
            equipoAzulHUD.Init();

            CustomSprite equipoRojoSprite = new CustomSprite();

            equipoRojoSprite.Bitmap = new CustomBitmap(MediaDir + "\\Textures\\EquipoRojo.png", D3DDevice.Instance.Device);
            equipoRojoHUD           = new HUDSprite(HUD.AnclajeHorizontal.RIGHT, HUD.AnclajeVertical.TOP, new TGCVector2(0.40f, 0.015f), new TGCVector2(1.0f, 1.5f), drawer2D, equipoRojoSprite);
            equipoRojoHUD.Init();

            TgcText2D textoTurbo = new TgcText2D();

            textoTurbo.Align = TgcText2D.TextAlign.CENTER;
            textoTurbo.Size  = new Size((int)(250 * medidorTurbo.Scaling.X), 50);
            textoTurbo.Color = Color.White;
            textoTurbo.changeFont(new Font("TimesNewRoman", 50, FontStyle.Bold));
            textoTurboHud = new HUDTexto(HUD.AnclajeHorizontal.RIGHT, HUD.AnclajeVertical.BOTTOM, new TGCVector2(.05f, 170f / 1080), drawer2D, textoTurbo);
            textoTurboHud.Init();

            TgcText2D textoTurboDos = new TgcText2D();

            textoTurboDos.Align = TgcText2D.TextAlign.CENTER;
            textoTurboDos.Size  = new Size((int)(250 * medidorTurboDos.Scaling.X), 50);
            textoTurboDos.Color = Color.White;
            textoTurboDos.changeFont(new Font("TimesNewRoman", 50, FontStyle.Bold));
            textoTurboDosHud = new HUDTexto(HUD.AnclajeHorizontal.LEFT, HUD.AnclajeVertical.BOTTOM, new TGCVector2(.05f, 170f / 1080), drawer2D, textoTurboDos);
            textoTurboDosHud.Init();

            TgcText2D textoGolAzul = new TgcText2D();

            textoGolAzul.Align = TgcText2D.TextAlign.CENTER;
            TGCVector2 equipoAzulSize = equipoAzulHUD.Size;

            textoGolAzul.Size  = new Size((int)equipoAzulSize.X, (int)equipoAzulSize.Y);
            textoGolAzul.Color = Color.Black;
            textoGolAzul.changeFont(new Font("TimesNewRoman", 30, FontStyle.Bold));
            textoGolAzulHud = new HUDTexto(HUD.AnclajeHorizontal.LEFT, HUD.AnclajeVertical.TOP, new TGCVector2(0.40f, 0.025f), drawer2D, textoGolAzul);
            textoGolAzulHud.Init();

            TgcText2D textoGolRojo = new TgcText2D();

            textoGolRojo.Align = TgcText2D.TextAlign.CENTER;
            TGCVector2 equipoRojoSize = equipoAzulHUD.Size;

            textoGolRojo.Size  = new Size((int)equipoRojoSize.X, (int)equipoRojoSize.Y);
            textoGolRojo.Color = Color.Black;
            textoGolRojo.changeFont(new Font("TimesNewRoman", 30, FontStyle.Bold));
            textoGolRojoHud = new HUDTexto(HUD.AnclajeHorizontal.RIGHT, HUD.AnclajeVertical.TOP, new TGCVector2(0.40f, 0.025f), drawer2D, textoGolRojo);
            textoGolRojoHud.Init();

            TgcText2D textoConTiempo = new TgcText2D();

            textoConTiempo.Align = TgcText2D.TextAlign.CENTER;
            TGCVector2 relojBGSize = relojBG.Size;

            textoConTiempo.Size  = new Size((int)relojBGSize.X, (int)relojBGSize.Y);
            textoConTiempo.Color = Color.Black;
            textoConTiempo.changeFont(new Font("TimesNewRoman", 20, FontStyle.Bold));
            textoRelojHud = new HUDTexto(HUD.AnclajeHorizontal.CENTER, HUD.AnclajeVertical.TOP, new TGCVector2(0, 0.045f), drawer2D, textoConTiempo);
            textoRelojHud.Init();
        }
 public void Render(float elapsedTime, Drawer2D drawer)
 {
     botonesOpciones.ForEach(boton => boton.Render(elapsedTime, drawer));
 }
예제 #15
0
        /// <summary>
        /// Método que se llama una sola vez,  al principio cuando se ejecuta el ejemplo.
        /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, modifiers, uservars, etc.
        /// Borrar todo lo que no haga falta
        /// </summary>
        public override void Init()
        {
            //Musica
            //GuiController.Instance.Modifiers.addBoolean("Musica", "Música", true);

            //BoundingBox
            //GuiController.Instance.Modifiers.addBoolean("BoundingBox", "BoundingBox", false);

            //Inteligencia Artificial
            //GuiController.Instance.Modifiers.addBoolean("IA", "IA", true);

            //Un boton para reiniciar las posiciones
            //GuiController.Instance.Modifiers.addButton("ReiniciarPosiciones", "Reiniciar Posiciones", new EventHandler(this.ReiniciarPosiciones_Click));

            //Luz
            //GuiController.Instance.Modifiers.addFloat("lightIntensity", 0, 100, 50);
            //GuiController.Instance.Modifiers.addFloat("lightAttenuation", 0.1f, 2, 0.20f);

            //Empiezo con un tema Random :)
            int numbreTrack = new Random().Next(Settings.Default.music.Count);
            //GuiController.Instance.Mp3Player.FileName = pathRecursos + Settings.Default.music[numbreTrack];

            //TODO Arreglar para despues :)
            Dictionary<string, TgcStaticSound> sonidos = new Dictionary<string, TgcStaticSound>();
            TgcStaticSound sonido = new TgcStaticSound();
            sonido.loadSound(MediaDir + "Audio\\pelota-tiro.wav", DirectSound.DsDevice);
            sonidos.Add("pelota-tiro", sonido);

            //Configurar camara en Tercer Persona
            camaraInterna = new TgcThirdPersonCamera();
            Camara = camaraInterna;

            this.pantallaActual = 0;

            //Creo el menu
            this.menu = new MenuInicial(MediaDir, camaraInterna, this);

            //Creo la configuracion del partido
            this.configuracionPartido = new ConfiguracionPartido(MediaDir, D3DDevice.Instance.Width, camaraInterna, this);

            //Creo el partido
            this.partido = PartidoFactory.Instance.CrearPartido(MediaDir, Input, sonidos, camaraInterna);

            drawer2D = new Drawer2D();

            //Mapa
            this.mapa = new CustomSprite();
            this.mapa.Bitmap = new CustomBitmap(MediaDir + "Texturas\\mapa.png", D3DDevice.Instance.Device);
            //this.mapa.Scaling = new Vector2(0.75f, 0.75f);
            Size textureSize = this.mapa.Bitmap.Size;
            this.mapa.Position = new Vector2((D3DDevice.Instance.Width - textureSize.Width) / 2, (D3DDevice.Instance.Height - textureSize.Height));

            this.puntoAzul = new CustomSprite();
            this.puntoAzul.Bitmap = new CustomBitmap(MediaDir + "Texturas\\radarAzul.png", D3DDevice.Instance.Device);
            this.puntoAzul.Scaling = new Vector2(0.03f, 0.03f);

            this.puntoNaranja = new CustomSprite();
            this.puntoNaranja.Bitmap = new CustomBitmap(MediaDir + "Texturas\\radarNaranja.png", D3DDevice.Instance.Device);
            this.puntoNaranja.Scaling = new Vector2(0.03f, 0.03f);

            //Color de fondo (BackgroundColor)
            D3DDevice.Instance.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);

            //FIX que nos mando Mariano para poder bajar el Alpha en el PixelShader
            D3DDevice.Instance.Device.RenderState.ReferenceAlpha = 10;
        }
예제 #16
0
 public override void RenderSprites(Drawer2D drawer)
 {
     drawer.DrawSprite(slotBackground);
     drawer.DrawSprite(productSlot);
     drawer.DrawSprite(productSprite);
 }
예제 #17
0
        public MenuInicial(GameModel gameModel)
        {
            this.gameModel = gameModel;
            drawer2D       = new Drawer2D();

            //Leo las dimensiones de la ventana
            var  screenHeight = D3DDevice.Instance.Device.Viewport.Height;
            var  screenWidth  = D3DDevice.Instance.Device.Viewport.Width;
            Size maxSize      = new Size(1920, 1017);

            var imgDir = Game.Default.MediaDirectory + Game.Default.ImagesDirectory;

            // Cargo la imagen de fondo
            background        = new CustomSprite();
            background.Bitmap = new CustomBitmap(imgDir + "start-screen.png", D3DDevice.Instance.Device);
            // La ubico ocupando toda la pantalla
            var scalingFactorX = (float)screenWidth / (float)background.Bitmap.Width;
            var scalingFactorY = (float)screenHeight / (float)background.Bitmap.Height;

            background.Scaling = new TGCVector2(scalingFactorX, scalingFactorY);

            //Cargo el mensaje de start
            start        = new CustomSprite();
            start.Bitmap = new CustomBitmap(imgDir + "press-start.png", D3DDevice.Instance.Device);
            //La ubico en la pantalla
            start.Scaling  = new TGCVector2(start.Scaling.X * 0.55f * (screenWidth / (float)maxSize.Width), start.Scaling.Y * 0.55f * (screenHeight / (float)maxSize.Height));
            start.Position = new TGCVector2(screenWidth * 0.159f, screenHeight * 0.61f);

            //Cargo el menu

            var menuFont = UtilMethods.createFont("Twisted Stallions", (int)(75 * (screenHeight / (float)maxSize.Height)));

            //Play
            play = new TgcText2D
            {
                Text     = "Play",
                Color    = Color.Silver,
                Position = new Point(-(int)(screenWidth * 0.194f), (int)(screenHeight * 0.52f))
            };
            play.changeFont(menuFont);
            //Controls
            controls = new TgcText2D
            {
                Text     = "Controls",
                Color    = Color.Silver,
                Position = new Point(-(int)(screenWidth * 0.194f), (int)(screenHeight * 0.52f) + (int)(0.147f * screenHeight))
            };
            controls.changeFont(menuFont);
            //Exit
            exit = new TgcText2D
            {
                Text     = "Exit",
                Color    = Color.Silver,
                Position = new Point(-(int)(screenWidth * 0.194f), (int)(screenHeight * 0.52f) + (int)(0.147f * 2 * screenHeight))
            };
            exit.changeFont(menuFont);

            this.gameModel.Camara = new TgcThirdPersonCamera();

            var sm = gameModel.SoundManager;

            sm.LoadMp3(mainMenuSong);
            if (sm.Mp3Player.getStatus() != TgcMp3Player.States.Playing)
            {
                sm.Mp3Player.play(true);
            }
        }
예제 #18
0
        public override void OnEnter()
        {
            DefaultFont = Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default);
            GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input);
            IsInitialized = true;
            Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
            MainWindow = new Panel(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };
            Layout = new GridLayout(GUI, MainWindow, 10, 6);

            Label label = new Label(GUI, Layout, "Options", GUI.TitleFont);
            Layout.SetComponentPosition(label, 0, 0, 1, 1);

            TabSelector = new TabSelector(GUI, Layout, 6);
            Layout.SetComponentPosition(TabSelector, 0, 1, 6, 8);

            TabSelector.Tab graphicsTab = TabSelector.AddTab("Graphics");

            GroupBox graphicsBox = new GroupBox(GUI, graphicsTab, "Graphics")
            {
                WidthSizeMode = GUIComponent.SizeMode.Fit,
                HeightSizeMode = GUIComponent.SizeMode.Fit
            };

            Categories["Graphics"] = graphicsBox;
            CurrentBox = graphicsBox;

            GridLayout graphicsLayout = new GridLayout(GUI, graphicsBox, 6, 5);

            Label resolutionLabel = new Label(GUI, graphicsLayout, "Resolution", GUI.DefaultFont)
            {
                Alignment = Drawer2D.Alignment.Right
            };

            ComboBox resolutionBox = new ComboBox(GUI, graphicsLayout)
            {
                ToolTip = "Sets the size of the screen.\nSmaller for higher framerates."
            };

            foreach(DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
            {
                if(mode.Format != SurfaceFormat.Color)
                {
                    continue;
                }

                if (mode.Width <= 640) continue;

                string s = mode.Width + " x " + mode.Height;
                DisplayModes[s] = mode;
                if(mode.Width == GameSettings.Default.ResolutionX && mode.Height == GameSettings.Default.ResolutionY)
                {
                    resolutionBox.AddValue(s);
                    resolutionBox.CurrentValue = s;
                }
                else
                {
                    resolutionBox.AddValue(s);
                }
            }

            graphicsLayout.SetComponentPosition(resolutionLabel, 0, 0, 1, 1);
            graphicsLayout.SetComponentPosition(resolutionBox, 1, 0, 1, 1);

            resolutionBox.OnSelectionModified += resolutionBox_OnSelectionModified;

            Checkbox fullscreenCheck = new Checkbox(GUI, graphicsLayout, "Fullscreen", GUI.DefaultFont, GameSettings.Default.Fullscreen)
            {
                ToolTip = "If this is checked, the game takes up the whole screen."
            };

            graphicsLayout.SetComponentPosition(fullscreenCheck, 0, 1, 1, 1);

            fullscreenCheck.OnCheckModified += fullscreenCheck_OnClicked;

            Label drawDistance = new Label(GUI, graphicsLayout, "Draw Distance", GUI.DefaultFont);
            Slider chunkDrawSlider = new Slider(GUI, graphicsLayout, "", GameSettings.Default.ChunkDrawDistance, 1, 1000, Slider.SliderMode.Integer)
            {
                ToolTip = "Maximum distance at which terrain will be drawn\nSmaller for faster."
            };

            graphicsLayout.SetComponentPosition(drawDistance, 0, 2, 1, 1);
            graphicsLayout.SetComponentPosition(chunkDrawSlider, 1, 2, 1, 1);
            chunkDrawSlider.OnValueModified += ChunkDrawSlider_OnValueModified;

            Label cullDistance = new Label(GUI, graphicsLayout, "Cull Distance", GUI.DefaultFont);
            Slider cullSlider = new Slider(GUI, graphicsLayout, "", GameSettings.Default.VertexCullDistance, 0.1f, 1000, Slider.SliderMode.Integer)
            {
                ToolTip = "Maximum distance at which anything will be drawn\n Smaller for faster."
            };

            cullSlider.OnValueModified += CullSlider_OnValueModified;

            graphicsLayout.SetComponentPosition(cullDistance, 0, 3, 1, 1);
            graphicsLayout.SetComponentPosition(cullSlider, 1, 3, 1, 1);

            Label generateDistance = new Label(GUI, graphicsLayout, "Generate Distance", GUI.DefaultFont);
            Slider generateSlider = new Slider(GUI, graphicsLayout, "", GameSettings.Default.ChunkGenerateDistance, 1, 1000, Slider.SliderMode.Integer)
            {
                ToolTip = "Maximum distance at which terrain will be generated."
            };

            generateSlider.OnValueModified += GenerateSlider_OnValueModified;

            graphicsLayout.SetComponentPosition(generateDistance, 0, 4, 1, 1);
            graphicsLayout.SetComponentPosition(generateSlider, 1, 4, 1, 1);

            Checkbox glowBox = new Checkbox(GUI, graphicsLayout, "Enable Glow", GUI.DefaultFont, GameSettings.Default.EnableGlow)
            {
                ToolTip = "When checked, there will be a fullscreen glow effect."
            };

            graphicsLayout.SetComponentPosition(glowBox, 1, 1, 1, 1);
            glowBox.OnCheckModified += glowBox_OnCheckModified;

            Label aaLabel = new Label(GUI, graphicsLayout, "Antialiasing", GUI.DefaultFont)
            {
                Alignment = Drawer2D.Alignment.Right
            };

            ComboBox aaBox = new ComboBox(GUI, graphicsLayout)
            {
                ToolTip = "Determines how much antialiasing (smoothing) there is.\nHigher means more smooth, but is slower."
            };
            aaBox.AddValue("None");
            aaBox.AddValue("FXAA");
            aaBox.AddValue("2x MSAA");
            aaBox.AddValue("4x MSAA");
            aaBox.AddValue("16x MSAA");

            foreach(string s in AAModes.Keys.Where(s => AAModes[s] == GameSettings.Default.AntiAliasing))
            {
                aaBox.CurrentValue = s;
            }

            aaBox.OnSelectionModified += AABox_OnSelectionModified;

            graphicsLayout.SetComponentPosition(aaLabel, 2, 0, 1, 1);
            graphicsLayout.SetComponentPosition(aaBox, 3, 0, 1, 1);

            Checkbox reflectTerrainBox = new Checkbox(GUI, graphicsLayout, "Reflect Chunks", GUI.DefaultFont, GameSettings.Default.DrawChunksReflected)
            {
                ToolTip = "When checked, water will reflect terrain."
            };
            reflectTerrainBox.OnCheckModified += reflectTerrainBox_OnCheckModified;
            graphicsLayout.SetComponentPosition(reflectTerrainBox, 2, 1, 1, 1);

            Checkbox refractTerrainBox = new Checkbox(GUI, graphicsLayout, "Refract Chunks", GUI.DefaultFont, GameSettings.Default.DrawChunksRefracted)
            {
                ToolTip = "When checked, water will refract terrain."
            };
            refractTerrainBox.OnCheckModified += refractTerrainBox_OnCheckModified;
            graphicsLayout.SetComponentPosition(refractTerrainBox, 2, 2, 1, 1);

            Checkbox reflectEntities = new Checkbox(GUI, graphicsLayout, "Reflect Entities", GUI.DefaultFont, GameSettings.Default.DrawEntityReflected)
            {
                ToolTip = "When checked, water will reflect trees, dwarves, etc."
            };
            reflectEntities.OnCheckModified += reflectEntities_OnCheckModified;
            graphicsLayout.SetComponentPosition(reflectEntities, 3, 1, 1, 1);

            Checkbox refractEntities = new Checkbox(GUI, graphicsLayout, "Refract Entities", GUI.DefaultFont, GameSettings.Default.DrawEntityReflected)
            {
                ToolTip = "When checked, water will reflect trees, dwarves, etc."
            };
            refractEntities.OnCheckModified += refractEntities_OnCheckModified;
            graphicsLayout.SetComponentPosition(refractEntities, 3, 2, 1, 1);

            Checkbox sunlight = new Checkbox(GUI, graphicsLayout, "Sunlight", GUI.DefaultFont, GameSettings.Default.CalculateSunlight)
            {
                ToolTip = "When checked, terrain will be lit/shadowed by the sun."
            };
            sunlight.OnCheckModified += sunlight_OnCheckModified;
            graphicsLayout.SetComponentPosition(sunlight, 2, 3, 1, 1);

            Checkbox ao = new Checkbox(GUI, graphicsLayout, "Ambient Occlusion", GUI.DefaultFont, GameSettings.Default.AmbientOcclusion)
            {
                ToolTip = "When checked, terrain will smooth shading effects."
            };
            ao.OnCheckModified += AO_OnCheckModified;
            graphicsLayout.SetComponentPosition(ao, 3, 3, 1, 1);

            Checkbox ramps = new Checkbox(GUI, graphicsLayout, "Ramps", GUI.DefaultFont, GameSettings.Default.CalculateRamps)
            {
                ToolTip = "When checked, some terrain will have smooth ramps."
            };

            ramps.OnCheckModified += ramps_OnCheckModified;
            graphicsLayout.SetComponentPosition(ramps, 2, 4, 1, 1);

            Checkbox cursorLight = new Checkbox(GUI, graphicsLayout, "Cursor Light", GUI.DefaultFont, GameSettings.Default.CursorLightEnabled)
            {
                ToolTip = "When checked, a light will follow the player cursor."
            };

            cursorLight.OnCheckModified += cursorLight_OnCheckModified;
            graphicsLayout.SetComponentPosition(cursorLight, 2, 5, 1, 1);

            Checkbox entityLight = new Checkbox(GUI, graphicsLayout, "Entity Lighting", GUI.DefaultFont, GameSettings.Default.EntityLighting)
            {
                ToolTip = "When checked, dwarves, objects, etc. will be lit\nby the sun, lamps, etc."
            };

            entityLight.OnCheckModified += entityLight_OnCheckModified;
            graphicsLayout.SetComponentPosition(entityLight, 3, 4, 1, 1);

            Checkbox selfIllum = new Checkbox(GUI, graphicsLayout, "Ore Glow", GUI.DefaultFont, GameSettings.Default.SelfIlluminationEnabled)
            {
                ToolTip = "When checked, some terrain elements will glow."
            };

            selfIllum.OnCheckModified += selfIllum_OnCheckModified;
            graphicsLayout.SetComponentPosition(selfIllum, 3, 5, 1, 1);

            Checkbox particlePhysics = new Checkbox(GUI, graphicsLayout, "Particle Body", GUI.DefaultFont, GameSettings.Default.ParticlePhysics)
            {
                ToolTip = "When checked, some particles will bounce off terrain."
            };

            particlePhysics.OnCheckModified += particlePhysics_OnCheckModified;
            graphicsLayout.SetComponentPosition(particlePhysics, 0, 5, 1, 1);

            TabSelector.Tab graphics2Tab = TabSelector.AddTab("Graphics II");
            GroupBox graphicsBox2 = new GroupBox(GUI, graphics2Tab, "Graphics II")
            {
                HeightSizeMode = GUIComponent.SizeMode.Fit,
                WidthSizeMode = GUIComponent.SizeMode.Fit
            };
            Categories["Graphics II"] = graphicsBox2;
            GridLayout graphicsLayout2 = new GridLayout(GUI, graphicsBox2, 6, 5);

            Checkbox moteBox = new Checkbox(GUI, graphicsLayout2, "Generate Motes", GUI.DefaultFont, GameSettings.Default.GrassMotes)
            {
                ToolTip = "When checked, trees, grass, etc. will be visible."
            };

            moteBox.OnCheckModified += MoteBox_OnCheckModified;
            graphicsLayout2.SetComponentPosition(moteBox, 1, 2, 1, 1);

            Label numMotes = new Label(GUI, graphicsLayout2, "Num Motes", GUI.DefaultFont);
            Slider motesSlider = new Slider(GUI, graphicsLayout2, "", (int) (GameSettings.Default.NumMotes * 100), 0, 1000, Slider.SliderMode.Integer)
            {
                ToolTip = "Determines the maximum amount of trees/grass that will be visible."
            };

            graphicsLayout2.SetComponentPosition(numMotes, 0, 1, 1, 1);
            graphicsLayout2.SetComponentPosition(motesSlider, 1, 1, 1, 1);
            motesSlider.OnValueModified += MotesSlider_OnValueModified;
            TabSelector.Tab gameplayTab = TabSelector.AddTab("Gameplay");
            GroupBox gameplayBox = new GroupBox(GUI, gameplayTab, "Gameplay")
            {
                WidthSizeMode = GUIComponent.SizeMode.Fit,
                HeightSizeMode = GUIComponent.SizeMode.Fit
            };
            Categories["Gameplay"] = gameplayBox;

            GridLayout gameplayLayout = new GridLayout(GUI, gameplayBox, 6, 5);

            Label moveSpeedLabel = new Label(GUI, gameplayLayout, "Camera Move Speed", GUI.DefaultFont);
            Slider moveSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.CameraScrollSpeed, 0.0f, 20.0f, Slider.SliderMode.Float)
            {
                ToolTip = "Determines how fast the camera will move when keys are pressed."
            };

            gameplayLayout.SetComponentPosition(moveSpeedLabel, 0, 0, 1, 1);
            gameplayLayout.SetComponentPosition(moveSlider, 1, 0, 1, 1);
            moveSlider.OnValueModified += MoveSlider_OnValueModified;

            Label zoomSpeedLabel = new Label(GUI, gameplayLayout, "Zoom Speed", GUI.DefaultFont);
            Slider zoomSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.CameraZoomSpeed, 0.0f, 2.0f, Slider.SliderMode.Float)
            {
                ToolTip = "Determines how fast the camera will go\nup and down with the scroll wheel."
            };

            gameplayLayout.SetComponentPosition(zoomSpeedLabel, 0, 1, 1, 1);
            gameplayLayout.SetComponentPosition(zoomSlider, 1, 1, 1, 1);
            zoomSlider.OnValueModified += ZoomSlider_OnValueModified;

            Checkbox invertZoomBox = new Checkbox(GUI, gameplayLayout, "Invert Zoom", GUI.DefaultFont, GameSettings.Default.InvertZoom)
            {
                ToolTip = "When checked, the scroll wheel is reversed\nfor zooming."
            };

            gameplayLayout.SetComponentPosition(invertZoomBox, 2, 1, 1, 1);
            invertZoomBox.OnCheckModified += InvertZoomBox_OnCheckModified;

            Checkbox edgeScrollBox = new Checkbox(GUI, gameplayLayout, "Edge Scrolling", GUI.DefaultFont, GameSettings.Default.EnableEdgeScroll)
            {
                ToolTip = "When checked, the camera will scroll\nwhen the cursor is at the edge of the screen."
            };

            gameplayLayout.SetComponentPosition(edgeScrollBox, 0, 2, 1, 1);
            edgeScrollBox.OnCheckModified += EdgeScrollBox_OnCheckModified;

            Checkbox introBox = new Checkbox(GUI, gameplayLayout, "Play Intro", GUI.DefaultFont, GameSettings.Default.DisplayIntro)
            {
                ToolTip = "When checked, the intro will be played when the game starts"
            };

            gameplayLayout.SetComponentPosition(introBox, 1, 2, 1, 1);
            introBox.OnCheckModified += IntroBox_OnCheckModified;

            Checkbox fogOfWarBox = new Checkbox(GUI, gameplayLayout, "Fog of War", GUI.DefaultFont, GameSettings.Default.FogofWar)
            {
                ToolTip = "When checked, unexplored blocks will be blacked out"
            };

            gameplayLayout.SetComponentPosition(fogOfWarBox, 2, 2, 1, 1);

            fogOfWarBox.OnCheckModified += fogOfWarBox_OnCheckModified;

            /*
            Label chunkWidthLabel = new Label(GUI, gameplayLayout, "Chunk Width", GUI.DefaultFont);
            Slider chunkWidthSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.ChunkWidth, 4, 256, Slider.SliderMode.Integer)
            {
                ToolTip = "Determines the number of blocks in a chunk of terrain."
            };

            gameplayLayout.SetComponentPosition(chunkWidthLabel, 0, 3, 1, 1);
            gameplayLayout.SetComponentPosition(chunkWidthSlider, 1, 3, 1, 1);
            chunkWidthSlider.OnValueModified += ChunkWidthSlider_OnValueModified;

            Label chunkHeightLabel = new Label(GUI, gameplayLayout, "Chunk Height", GUI.DefaultFont);
            Slider chunkHeightSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.ChunkHeight, 4, 256, Slider.SliderMode.Integer)
            {
                ToolTip = "Determines the maximum depth,\nin blocks, of a chunk of terrain."
            };

            gameplayLayout.SetComponentPosition(chunkHeightLabel, 2, 3, 1, 1);
            gameplayLayout.SetComponentPosition(chunkHeightSlider, 3, 3, 1, 1);

            chunkHeightSlider.OnValueModified += ChunkHeightSlider_OnValueModified;

            Label worldWidthLabel = new Label(GUI, gameplayLayout, "World Width", GUI.DefaultFont);
            Slider worldWidthSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldWidth, 4, 2048, Slider.SliderMode.Integer)
            {
                ToolTip = "Determines the size of the overworld."
            };

            gameplayLayout.SetComponentPosition(worldWidthLabel, 0, 4, 1, 1);
            gameplayLayout.SetComponentPosition(worldWidthSlider, 1, 4, 1, 1);
            worldWidthSlider.OnValueModified += WorldWidthSlider_OnValueModified;

            Label worldHeightLabel = new Label(GUI, gameplayLayout, "World Height", GUI.DefaultFont);
            Slider worldHeightSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldHeight, 4, 2048, Slider.SliderMode.Integer)
            {
                ToolTip = "Determines the size of the overworld."
            };

            gameplayLayout.SetComponentPosition(worldHeightLabel, 2, 4, 1, 1);
            gameplayLayout.SetComponentPosition(worldHeightSlider, 3, 4, 1, 1);
            worldHeightSlider.OnValueModified += WorldHeightSlider_OnValueModified;

            Label worldScaleLabel = new Label(GUI, gameplayLayout, "World Scale", GUI.DefaultFont);
            Slider worldScaleSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldScale, 2, 128, Slider.SliderMode.Integer)
            {
                ToolTip = "Determines the number of voxel\nper pixel of the overworld"
            };

            gameplayLayout.SetComponentPosition(worldScaleLabel, 0, 5, 1, 1);
            gameplayLayout.SetComponentPosition(worldScaleSlider, 1, 5, 1, 1);
            worldScaleSlider.OnValueModified += WorldScaleSlider_OnValueModified;
            */

            TabSelector.Tab audioTab = TabSelector.AddTab("Audio");

            GroupBox audioBox = new GroupBox(GUI, audioTab, "Audio")
            {
              WidthSizeMode = GUIComponent.SizeMode.Fit,
              HeightSizeMode = GUIComponent.SizeMode.Fit
            };
            Categories["Audio"] = audioBox;

            GridLayout audioLayout = new GridLayout(GUI, audioBox, 6, 5);

            Label masterLabel = new Label(GUI, audioLayout, "Master Volume", GUI.DefaultFont);
            Slider masterSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.MasterVolume, 0.0f, 1.0f, Slider.SliderMode.Float);
            audioLayout.SetComponentPosition(masterLabel, 0, 0, 1, 1);
            audioLayout.SetComponentPosition(masterSlider, 1, 0, 1, 1);
            masterSlider.OnValueModified += MasterSlider_OnValueModified;

            Label sfxLabel = new Label(GUI, audioLayout, "SFX Volume", GUI.DefaultFont);
            Slider sfxSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.SoundEffectVolume, 0.0f, 1.0f, Slider.SliderMode.Float);
            audioLayout.SetComponentPosition(sfxLabel, 0, 1, 1, 1);
            audioLayout.SetComponentPosition(sfxSlider, 1, 1, 1, 1);
            sfxSlider.OnValueModified += SFXSlider_OnValueModified;

            Label musicLabel = new Label(GUI, audioLayout, "Music Volume", GUI.DefaultFont);
            Slider musicSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.MusicVolume, 0.0f, 1.0f, Slider.SliderMode.Float);
            audioLayout.SetComponentPosition(musicLabel, 0, 2, 1, 1);
            audioLayout.SetComponentPosition(musicSlider, 1, 2, 1, 1);
            musicSlider.OnValueModified += MusicSlider_OnValueModified;

            TabSelector.Tab keysTab = TabSelector.AddTab("Keys");
            GroupBox keysBox = new GroupBox(GUI, keysTab, "Keys")
            {
                WidthSizeMode = GUIComponent.SizeMode.Fit,
                HeightSizeMode = GUIComponent.SizeMode.Fit
            };
            Categories["Keys"] = keysBox;

            KeyEditor keyeditor = new KeyEditor(GUI, keysBox, new KeyManager(), 8, 4);
            GridLayout keyLayout = new GridLayout(GUI, keysBox, 1, 1);
            keyLayout.SetComponentPosition(keyeditor, 0, 0, 1, 1);
            keyLayout.UpdateSizes();
            keyeditor.UpdateLayout();

            /*
            GroupBox customBox = new GroupBox(GUI, Layout, "Customization")
            {
                IsVisible = false
            };
            Categories["Customization"] = customBox;
            TabSelector.AddItem("Customization");

            GridLayout customBoxLayout = new GridLayout(GUI, customBox, 6, 5);

            List<string> assets = TextureManager.DefaultContent.Keys.ToList();

            AssetManager assetManager = new AssetManager(GUI, customBoxLayout, assets);
            customBoxLayout.SetComponentPosition(assetManager, 0, 0, 5, 6);
            */

            Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check));
            Layout.SetComponentPosition(apply, 5, 9, 1, 1);
            apply.OnClicked += apply_OnClicked;

            Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow));
            Layout.SetComponentPosition(back, 4, 9, 1, 1);
            back.OnClicked += back_OnClicked;

            Layout.UpdateSizes();
            TabSelector.UpdateSize();
            TabSelector.SetTab("Graphics");
            base.OnEnter();
        }
예제 #19
0
 public HUD(AnclajeHorizontal anclajeHorizontal, AnclajeVertical anclajeVertical, TGCVector2 desplazamiento, TGCVector2 escala, Drawer2D drawer2D)
 {
     this.anclajeHorizontal = anclajeHorizontal;
     this.anclajeVertical   = anclajeVertical;
     this.desplazamiento    = desplazamiento;
     this.escala            = escala;
     this.drawer2D          = drawer2D;
     scalingFactor          = (float)D3DDevice.Instance.Width / 1920;
 }
예제 #20
0
        public void DrawPreview()
        {
            if (PreviewRenderTarget == null)
            {
                return;
            }
            if (Generator.CurrentState != WorldGenerator.GenerationState.Finished)
            {
                return;
            }

            Root.DrawQuad(PreviewPanel.Rect, PreviewRenderTarget);

            GetSpawnRectangleInScreenSpace(SpawnRectanglePoints);

            try
            {
                DwarfGame.SafeSpriteBatchBegin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Drawer2D.PointMagLinearMin,
                                               null, null, null, Matrix.Identity);
                Drawer2D.DrawPolygon(DwarfGame.SpriteBatch, Color.Yellow, 1, SpawnRectanglePoints);
                //Drawer2D.DrawStrokedText(DwarfGame.SpriteBatch, "Spawn", DefaultFont, new Vector2(a.X - 5, a.Y - 20),
                //    Color.White, Color.Black);
            }
            finally
            {
                DwarfGame.SpriteBatch.End();
            }


            var font = Root.GetTileSheet("font10");
            var icon = Root.GetTileSheet("map-icons");
            var bkg  = Root.GetTileSheet("basic");
            var rect = PreviewPanel.GetDrawableInterior();

            foreach (var tree in Trees)
            {
                var treeLocation = WorldToScreen(new Vector2(tree.X, tree.Y));
                if (treeLocation.Z > 0.9999f)
                {
                    continue;
                }
                float     scale      = GetIconScale(new Point(tree.X, tree.Y));
                Rectangle nameBounds = new Rectangle(0, 0, (int)(16 * scale), (int)(16 * scale));
                nameBounds.X = (int)treeLocation.X - (nameBounds.Width / 2);
                nameBounds.Y = (int)treeLocation.Y - (nameBounds.Height / 2);
                if (!rect.Contains(nameBounds))
                {
                    continue;
                }
                var mesh = Gui.Mesh.FittedSprite(new Rectangle(nameBounds.Center.X - (int)(8 * scale),
                                                               nameBounds.Center.Y - (int)(8 * scale), (int)(16 * scale), (int)(16 * scale)),
                                                 icon, tree.Z);
                Root.DrawMesh(mesh, Root.RenderData.Texture);
            }

            foreach (var civ in Generator.NativeCivilizations)
            {
                var civLocation = WorldToScreen(new Vector2(civ.Center.X, civ.Center.Y));
                if (civLocation.Z > 0.9999f)
                {
                    continue;
                }
                Rectangle nameBounds;
                var       mesh = Gui.Mesh.CreateStringMesh(civ.Name, font, Vector2.One, out nameBounds);
                nameBounds.X = (int)civLocation.X - (nameBounds.Width / 2);
                nameBounds.Y = (int)civLocation.Y - (nameBounds.Height / 2);
                nameBounds   = MathFunctions.SnapRect(nameBounds, rect);
                mesh.Translate(nameBounds.X, nameBounds.Y);
                if (!rect.Contains(nameBounds))
                {
                    continue;
                }
                if (PreviewSelector.SelectedItem == "Factions") // Draw dots for capitals.
                {
                    var bkgmesh = Gui.Mesh.FittedSprite(nameBounds, bkg, 0)
                                  .Colorize(new Vector4(0.0f, 0.0f, 0.0f, 0.7f));

                    Root.DrawMesh(bkgmesh, Root.RenderData.Texture);
                    Root.DrawMesh(mesh, Root.RenderData.Texture);
                }
                float scale    = GetIconScale(civ.Center);
                var   iconRect = new Rectangle((int)(nameBounds.Center.X - 8 * scale),
                                               (int)(nameBounds.Center.Y + 8 * scale), (int)(16 * scale), (int)(16 * scale));
                if (!rect.Contains(iconRect))
                {
                    continue;
                }
                var iconMesh = Gui.Mesh.FittedSprite(iconRect,
                                                     icon, civ.Race.Icon);
                Root.DrawMesh(iconMesh, Root.RenderData.Texture);
            }

            Rectangle spawnWorld  = Generator.GetSpawnRectangle();
            Vector2   newSpawn    = new Vector2(spawnWorld.Center.X, spawnWorld.Center.Y);
            Vector2   spawnCenter = newSpawn * 0.1f + lastSpawnWorld * 0.9f;
            Vector3   newCenter   = WorldToScreen(newSpawn);
            Vector3   worldCenter = WorldToScreen(spawnCenter);

            if (worldCenter.Z < 0.9999f)
            {
                float     scale       = GetIconScale(new Point((int)spawnCenter.X, (int)spawnCenter.Y));
                Rectangle balloon     = new Rectangle((int)(worldCenter.X - 8 * scale), (int)(worldCenter.Y + 5 * System.Math.Sin(DwarfTime.LastTime.TotalRealTime.TotalSeconds * 2.0f)) - (int)(8 * scale), (int)(16 * scale), (int)(16 * scale));
                var       balloonMesh = Gui.Mesh.FittedSprite(MathFunctions.SnapRect(balloon, PreviewPanel.Rect), icon, 2);
                Root.DrawMesh(balloonMesh, Root.RenderData.Texture);

                Rectangle nameBounds;
                var       mesh = Gui.Mesh.CreateStringMesh("Colony Location", font, Vector2.One, out nameBounds);
                nameBounds.X = (int)newCenter.X - (nameBounds.Width / 2);
                nameBounds.Y = (int)newCenter.Y - (nameBounds.Height / 2) + 16;
                nameBounds   = MathFunctions.SnapRect(nameBounds, PreviewPanel.Rect);
                mesh.Translate(nameBounds.X, nameBounds.Y);
                var bkgmesh = Gui.Mesh.FittedSprite(nameBounds, bkg, 0).Colorize(new Vector4(0.0f, 0.0f, 0.0f, 0.7f));

                Root.DrawMesh(bkgmesh, Root.RenderData.Texture);
                Root.DrawMesh(mesh, Root.RenderData.Texture);
            }

            lastSpawnWorld = spawnCenter;

            if (KeyMesh != null)
            {
                Root.DrawMesh(KeyMesh, Root.RenderData.Texture);
            }
        }
예제 #21
0
        public override void OnEnter()
        {
            PlayState.WorldWidth  = Settings.Width;
            PlayState.WorldHeight = Settings.Height;
            PlayState.SeaLevel    = Settings.SeaLevel;
            PlayState.Random      = new ThreadSafeRandom(Seed);
            PlayState.WorldSize   = new Point3(8, 1, 8);

            Overworld.Volcanoes = new List <Vector2>();

            DefaultFont        = Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default);
            GUI                = new DwarfGUI(Game, DefaultFont, Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Small), Input);
            IsInitialized      = true;
            Drawer             = new Drawer2D(Game.Content, Game.GraphicsDevice);
            GenerationComplete = false;
            MainWindow         = new Panel(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };

            GridLayout layout = new GridLayout(GUI, MainWindow, 7, 4)
            {
                LocalBounds = new Rectangle(0, 0, MainWindow.LocalBounds.Width, MainWindow.LocalBounds.Height)
            };

            Button startButton = new Button(GUI, layout, "Start!", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check))
            {
                ToolTip = "Start the game with the currently generated world."
            };

            layout.SetComponentPosition(startButton, 2, 6, 1, 1);
            startButton.OnClicked += StartButtonOnClick;

            Button saveButton = new Button(GUI, layout, "Save", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Save))
            {
                ToolTip = "Save the generated world to a file."
            };

            layout.SetComponentPosition(saveButton, 1, 6, 1, 1);
            saveButton.OnClicked += saveButton_OnClicked;

            Button exitButton = new Button(GUI, layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow))
            {
                ToolTip = "Back to the main menu."
            };

            layout.SetComponentPosition(exitButton, 0, 6, 1, 1);

            exitButton.OnClicked += ExitButtonOnClick;


            MapPanel = new ImagePanel(GUI, layout, worldMap)
            {
                ToolTip = "Map of the world.\nClick to select a location to embark."
            };

            GridLayout mapLayout = new GridLayout(GUI, MapPanel, 4, 5);

            ColorKeys = new ColorKey(GUI, mapLayout)
            {
                ColorEntries = Overworld.HeightColors
            };

            mapLayout.SetComponentPosition(ColorKeys, 3, 0, 1, 1);

            CloseupPanel = new ImagePanel(GUI, mapLayout, new ImageFrame(worldMap, new Rectangle(0, 0, 128, 128)))
            {
                KeepAspectRatio = true,
                ToolTip         = "Closeup of the colony location"
            };

            mapLayout.SetComponentPosition(CloseupPanel, 3, 2, 2, 2);

            layout.SetComponentPosition(MapPanel, 0, 0, 3, 5);

            if (worldMap != null)
            {
                MapPanel.Image = new ImageFrame(worldMap);
            }


            MapPanel.OnClicked += OnMapClick;

            layout.UpdateSizes();

            GroupBox mapProperties = new GroupBox(GUI, layout, "Map Controls");

            GridLayout mapPropertiesLayout = new GridLayout(GUI, mapProperties, 7, 2)
            {
                LocalBounds = new Rectangle(mapProperties.LocalBounds.X, mapProperties.LocalBounds.Y + 32, mapProperties.LocalBounds.Width, mapProperties.LocalBounds.Height)
            };

            ComboBox worldSizeBox = new ComboBox(GUI, mapPropertiesLayout)
            {
                ToolTip = "Size of the colony spawn area."
            };


            worldSizeBox.AddValue("Tiny Colony");
            worldSizeBox.AddValue("Small Colony");
            worldSizeBox.AddValue("Medium Colony");
            worldSizeBox.AddValue("Large Colony");
            worldSizeBox.AddValue("Huge Colony");
            worldSizeBox.CurrentIndex = 1;

            worldSizeBox.OnSelectionModified += worldSizeBox_OnSelectionModified;
            mapPropertiesLayout.SetComponentPosition(worldSizeBox, 0, 0, 2, 1);

            ViewSelectionBox = new ComboBox(GUI, mapPropertiesLayout)
            {
                ToolTip = "Display type for the map."
            };

            ViewSelectionBox.AddValue("Height");
            ViewSelectionBox.AddValue("Factions");
            ViewSelectionBox.AddValue("Biomes");
            ViewSelectionBox.AddValue("Temp.");
            ViewSelectionBox.AddValue("Rain");
            ViewSelectionBox.AddValue("Erosion");
            ViewSelectionBox.AddValue("Faults");
            ViewSelectionBox.CurrentIndex = 0;

            mapPropertiesLayout.SetComponentPosition(ViewSelectionBox, 1, 1, 1, 1);

            Label selectLabel = new Label(GUI, mapPropertiesLayout, "Display", GUI.DefaultFont);

            mapPropertiesLayout.SetComponentPosition(selectLabel, 0, 1, 1, 1);
            selectLabel.Alignment = Drawer2D.Alignment.Right;

            layout.SetComponentPosition(mapProperties, 3, 0, 1, 6);

            Progress = new ProgressBar(GUI, layout, 0.0f);
            layout.SetComponentPosition(Progress, 0, 5, 3, 1);


            ViewSelectionBox.OnSelectionModified += DisplayModeModified;
            base.OnEnter();
        }
예제 #22
0
        public override void OnEnter()
        {
            PlayState.WorldWidth = Settings.Width;
            PlayState.WorldHeight = Settings.Height;
            PlayState.SeaLevel = Settings.SeaLevel;
            PlayState.Random = new ThreadSafeRandom(Seed);
            PlayState.WorldSize = new Point3(8, 1, 8);

            Overworld.Volcanoes = new List<Vector2>();

            DefaultFont = Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default);
            GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input);
            IsInitialized = true;
            Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
            GenerationComplete = false;
            MainWindow = new Panel(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };

            GridLayout layout = new GridLayout(GUI, MainWindow, 7, 4)
            {
                LocalBounds = new Rectangle(0, 0, MainWindow.LocalBounds.Width, MainWindow.LocalBounds.Height)
            };

            Button startButton = new Button(GUI, layout, "Start!", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check))
            {
                ToolTip = "Start the game with the currently generated world."
            };

            layout.SetComponentPosition(startButton, 2, 6, 1, 1);
            startButton.OnClicked += StartButtonOnClick;

            Button saveButton = new Button(GUI, layout, "Save", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Save))
            {
                ToolTip = "Save the generated world to a file."
            };
            layout.SetComponentPosition(saveButton, 1, 6, 1, 1);
            saveButton.OnClicked += saveButton_OnClicked;

            Button exitButton = new Button(GUI, layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow))
            {
                ToolTip = "Back to the main menu."
            };
            layout.SetComponentPosition(exitButton, 0, 6, 1, 1);

            exitButton.OnClicked += ExitButtonOnClick;

            MapPanel = new ImagePanel(GUI, layout, worldMap)
            {
                ToolTip = "Map of the world.\nClick to select a location to embark."
            };

            GridLayout mapLayout = new GridLayout(GUI, MapPanel, 4, 5);

            ColorKeys = new ColorKey(GUI, mapLayout)
            {
                ColorEntries = Overworld.HeightColors
            };

            mapLayout.SetComponentPosition(ColorKeys, 3, 0, 1, 1);

            CloseupPanel = new ImagePanel(GUI, mapLayout, new ImageFrame(worldMap, new Rectangle(0, 0, 128, 128)))
            {
                KeepAspectRatio = true,
                ToolTip = "Closeup of the colony location"
            };

            mapLayout.SetComponentPosition(CloseupPanel, 3, 2, 2, 2);

            layout.SetComponentPosition(MapPanel, 0, 0, 3, 5);

            if(worldMap != null)
            {
                MapPanel.Image = new ImageFrame(worldMap);
            }

            MapPanel.OnClicked += OnMapClick;

            layout.UpdateSizes();

            GroupBox mapProperties = new GroupBox(GUI, layout, "Map Controls");

            GridLayout mapPropertiesLayout = new GridLayout(GUI, mapProperties, 7, 2)
            {
                LocalBounds = new Rectangle(mapProperties.LocalBounds.X, mapProperties.LocalBounds.Y + 32, mapProperties.LocalBounds.Width, mapProperties.LocalBounds.Height)
            };

            ComboBox worldSizeBox = new ComboBox(GUI, mapPropertiesLayout)
            {
                ToolTip = "Size of the colony spawn area."
            };

            worldSizeBox.AddValue("Tiny Colony");
            worldSizeBox.AddValue("Small Colony");
            worldSizeBox.AddValue("Medium Colony");
            worldSizeBox.AddValue("Large Colony");
            worldSizeBox.AddValue("Huge Colony");
            worldSizeBox.CurrentIndex = 1;

            worldSizeBox.OnSelectionModified += worldSizeBox_OnSelectionModified;
            mapPropertiesLayout.SetComponentPosition(worldSizeBox, 0, 0, 2, 1);

            ViewSelectionBox = new ComboBox(GUI, mapPropertiesLayout)
            {
                ToolTip = "Display type for the map."
            };

            ViewSelectionBox.AddValue("Height");
            ViewSelectionBox.AddValue("Factions");
            ViewSelectionBox.AddValue("Biomes");
            ViewSelectionBox.AddValue("Temp.");
            ViewSelectionBox.AddValue("Rain");
            ViewSelectionBox.AddValue("Erosion");
            ViewSelectionBox.AddValue("Faults");
            ViewSelectionBox.CurrentIndex = 0;

            mapPropertiesLayout.SetComponentPosition(ViewSelectionBox, 1, 1, 1, 1);

            Label selectLabel = new Label(GUI, mapPropertiesLayout, "Display", GUI.DefaultFont);
            mapPropertiesLayout.SetComponentPosition(selectLabel, 0, 1, 1, 1);
            selectLabel.Alignment = Drawer2D.Alignment.Right;

            layout.SetComponentPosition(mapProperties, 3, 0, 1, 6);

            Progress = new ProgressBar(GUI, layout, 0.0f);
            layout.SetComponentPosition(Progress, 0, 5, 3, 1);

            ViewSelectionBox.OnSelectionModified += DisplayModeModified;
            base.OnEnter();
        }
예제 #23
0
 public override void Render(float ElapsedTime, Drawer2D drawer)
 {
     drawer.DrawSprite(sprite);
 }
예제 #24
0
        void Initialize()
        {
            GUI = new DwarfGUI(Game, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input)
            {
                DebugDraw = false
            };
            IsInitialized = true;
            Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
            MainWindow = new Panel(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };
            Layout = new GridLayout(GUI, MainWindow, 11, 4);
            Label title = new Label(GUI, Layout, "You Lose!", GUI.TitleFont);
            Layout.SetComponentPosition(title, 0, 0, 4, 4);

            Label text = new Label(GUI, Layout,
                "The heady days of exploration for " + PlayState.Master.Faction.Economy.Company.Name +
                " are no more.\n Our stock is through the floor. Our investors have all jumped ship! \n We are going to have to sell the company. If only we had shipped more goods...",
                GUI.DefaultFont)
            {
                WordWrap = true
            };

            Layout.SetComponentPosition(text, 0, 4, 4, 4);

            Button okButton = new Button(GUI, Layout, "OK", GUI.DefaultFont, Button.ButtonMode.PushButton, null);
            okButton.OnClicked += okButton_OnClicked;
            Layout.SetComponentPosition(okButton, 2, 10, 2, 1);
            Layout.UpdateSizes();
        }
예제 #25
0
파일: GUITest.cs 프로젝트: scorvi/dwarfcorp
        public override void OnEnter()
        {
            DefaultFont = Game.Content.Load<SpriteFont>("Default");
            GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>("Title"), Game.Content.Load<SpriteFont>("Small"), Input);
            IsInitialized = true;
            Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
            MainWindow = new Panel(GUI, GUI.RootComponent);
            MainWindow.LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2);
            Layout = new GridLayout(GUI, MainWindow, 10, 4);
            Label label = new Label(GUI, Layout, "GUI Elements", GUI.TitleFont);
            Layout.SetComponentPosition(label, 0, 0, 1, 1);

            Checkbox check = new Checkbox(GUI, Layout, "Check 1", GUI.DefaultFont, true);
            Layout.SetComponentPosition(check, 0, 1, 1, 1);

            Checkbox check2 = new Checkbox(GUI, Layout, "Check 2", GUI.DefaultFont, true);
            Layout.SetComponentPosition(check2, 0, 2, 1, 1);

            Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.PushButton, null);
            Layout.SetComponentPosition(apply, 2, 9, 1, 1);

            Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.PushButton, null);
            Layout.SetComponentPosition(back, 3, 9, 1, 1);

            Label sliderLabel = new Label(GUI, Layout, "Slider", GUI.DefaultFont);
            Layout.SetComponentPosition(sliderLabel, 0, 3, 1, 1);
            sliderLabel.Alignment = Drawer2D.Alignment.Right;

            Slider slider = new Slider(GUI, Layout, "Slider", 0, -1000, 1000, Slider.SliderMode.Integer);
            Layout.SetComponentPosition(slider, 1, 3, 1, 1);

            Label comboLabel = new Label(GUI, Layout, "Combobox", GUI.DefaultFont);
            comboLabel.Alignment = Drawer2D.Alignment.Right;

            Layout.SetComponentPosition(comboLabel, 0, 4, 1, 1);

            ComboBox combo = new ComboBox(GUI, Layout);
            combo.AddValue("Foo");
            combo.AddValue("Bar");
            combo.AddValue("Baz");
            combo.AddValue("Quz");
            combo.CurrentValue = "Foo";
            Layout.SetComponentPosition(combo, 1, 4, 1, 1);

            back.OnClicked += back_OnClicked;

            GroupBox groupBox = new GroupBox(GUI, Layout, "");
            Layout.SetComponentPosition(groupBox, 2, 1, 2, 6);
            Layout.UpdateSizes();

            /*
            Texture2D Image = Game.Content.Load<Texture2D>("pine");
            string[] tags = {""};
            DraggableItem image = new DraggableItem(GUI, groupBox,new GItem("Item", new ImageFrame(Image, Image.Bounds), 0, 1, 1, tags));
            image.LocalBounds = new Rectangle(50, 50, Image.Width, Image.Height);

            Label imageLabel = new Label(GUI, image, "Image Panel", GUI.DefaultFont);
            imageLabel.LocalBounds = new Rectangle(0, 0, Image.Width, Image.Height);
            imageLabel.Alignment = Drawer2D.Alignment.Top | Drawer2D.Alignment.Left;
            */

            GridLayout groupLayout = new GridLayout(GUI, groupBox, 1, 2);

            DragManager dragManager = new DragManager();

            DragGrid dragGrid = new DragGrid(GUI, groupLayout, dragManager, 32, 32);
            DragGrid dragGrid2 = new DragGrid(GUI, groupLayout, dragManager, 32, 32);

            groupLayout.SetComponentPosition(dragGrid, 0, 0, 1, 1);
            groupLayout.SetComponentPosition(dragGrid2, 1, 0, 1, 1);
            Layout.UpdateSizes();
            groupLayout.UpdateSizes();
            dragGrid.SetupLayout();
            dragGrid2.SetupLayout();

            foreach(Resource r in ResourceLibrary.Resources.Values)
            {
                if(r.ResourceName != "Container")
                {
                    GItem gitem = new GItem(r.ResourceName, r.Image, 0, 32, 2, 1);
                    gitem.CurrentAmount = 2;
                    dragGrid.AddItem(gitem);
                }
            }

            ProgressBar progress = new ProgressBar(GUI, Layout, 0.7f);
            Label progressLabel = new Label(GUI, Layout, "Progress Bar", GUI.DefaultFont);
            progressLabel.Alignment = Drawer2D.Alignment.Right;

            Layout.SetComponentPosition(progressLabel, 0, 5, 1, 1);
            Layout.SetComponentPosition(progress, 1, 5, 1, 1);

            LineEdit line = new LineEdit(GUI, Layout, "");
            Label lineLabel = new Label(GUI, Layout, "Line Edit", GUI.DefaultFont);
            lineLabel.Alignment = Drawer2D.Alignment.Right;

            Layout.SetComponentPosition(lineLabel, 0, 6, 1, 1);
            Layout.SetComponentPosition(line, 1, 6, 1, 1);

            base.OnEnter();
        }