Esempio n. 1
0
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ngui    = Gui as NeoforceGui;
            manager = ngui.Manager;

            Window window = new Window(manager);

            window.Init();
            window.Text   = "Options";
            window.Width  = 480;
            window.Height = 200;
            window.Center();
            window.Visible = true;

            Button button = new Button(manager);

            button.Init();
            button.Text   = "OK";
            button.Width  = 72;
            button.Height = 24;
            button.Left   = (window.ClientWidth / 2) - (button.Width / 2);
            button.Top    = window.ClientHeight - button.Height - 8;
            button.Anchor = Anchors.Bottom;
            button.Parent = window;
            button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click);

            manager.Add(window);
        }
Esempio n. 2
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                SimpleModel           simpleModel = new SimpleModel(factory, "Model//cenario");
                TriangleMeshObject    tmesh       = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                ForwardXNABasicShader shader      = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
                ForwardMaterial       fmaterial   = new ForwardMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                this.World.AddObject(obj);
            }

            NeoforceGui guiManager = this.Gui as NeoforceGui;

            System.Diagnostics.Debug.Assert(guiManager != null);

            // Create and setup Window control.
            Window window = new Window(guiManager.Manager);

            window.Init();
            window.Text   = "Getting Started";
            window.Width  = 480;
            window.Height = 200;
            window.Center();
            window.Visible = true;

            // Create Button control and set the previous window as its parent.
            Button button = new Button(guiManager.Manager);

            button.Init();
            button.Text   = "OK";
            button.Width  = 72;
            button.Height = 24;
            button.Left   = (window.ClientWidth / 2) - (button.Width / 2);
            button.Top    = window.ClientHeight - button.Height - 8;
            button.Anchor = Anchors.Bottom;
            button.Parent = window;
            button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click);

            // Add the window control to the manager processing queue.
            guiManager.Manager.Add(window);

            this.World.CameraManager.AddCamera(new CameraFirstPerson(false, GraphicInfo));

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube");

            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
        private void ConfigMenu()
        {
            NeoforceGui guiManager = this.Gui as NeoforceGui;

            System.Diagnostics.Debug.Assert(guiManager != null);

            // Create and setup Window control.
            Window window = new Window(guiManager.Manager);

            window.Init();
            window.Text   = "PloobsEngine Config";
            window.Width  = 350;
            window.Height = 300;
            window.Center();
            window.Visible = true;


            Label lab1 = new Label(guiManager.Manager);

            lab1.Text   = "Resolução";
            lab1.Top    = 20;
            lab1.Left   = 20;
            lab1.Parent = window;

            List <string> colors = new List <string>();

            foreach (var item in GraphicInfo.GraphicsAdapter.SupportedDisplayModes)
            {
                if (item.Format == Microsoft.Xna.Framework.Graphics.SurfaceFormat.Color)
                {
                    colors.Add(item.Width + "x" + item.Height);
                }
            }

            lb1 = new ComboBox(guiManager.Manager);
            lb1.Init();
            lb1.Parent    = window;
            lb1.Left      = lab1.Left;
            lb1.Top       = lab1.Top + lab1.Height;
            lb1.Width     = 200;
            lb1.ItemIndex = 0;
            lb1.Height    = 20;


            lb1.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(lb1_ItemIndexChanged);
            lb1.Anchor            = Anchors.Left | Anchors.Top | Anchors.Right;
            lb1.Items.AddRange(colors);

            lb1.Text           = "800x600";
            lb1.SelectionStart = 0;



            // Create Button control and set the previous window as its parent.
            Button button = new Button(guiManager.Manager);

            button.Init();
            button.Text   = "Apply";
            button.Width  = button.Text.Length * 10;
            button.Height = 24;
            button.Left   = (window.ClientWidth / 2) - (button.Width / 2);
            button.Top    = window.ClientHeight - button.Height - 8;
            button.Anchor = Anchors.Bottom;
            button.Parent = window;
            button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click);


            CheckBox ck1 = new CheckBox(guiManager.Manager);

            ck1.Text    = "FullScreen";
            ck1.Checked = false;
            ck1.Click  += new TomShane.Neoforce.Controls.EventHandler(ck1_Click);
            ck1.Top     = lb1.Top + lb1.Height + 10;
            ck1.Parent  = window;
            ck1.Left    = lb1.Left;
            ck1.Width   = ck1.Text.Length * 10;


            CheckBox ms1 = new CheckBox(guiManager.Manager);

            ms1.Text    = "MultiSampling";
            ms1.Checked = false;
            ms1.Top     = ck1.Top + ck1.Height + 10;
            ms1.Parent  = window;
            ms1.Click  += new TomShane.Neoforce.Controls.EventHandler(ms1_Click);
            ms1.Left    = lb1.Left;
            ms1.Width   = ms1.Text.Length * 10;

            CheckBox vsy = new CheckBox(guiManager.Manager);

            vsy.Text    = "Vertical Sincronization";
            vsy.Checked = false;
            vsy.Top     = ms1.Top + ms1.Height + 10;
            vsy.Parent  = window;
            vsy.Click  += new TomShane.Neoforce.Controls.EventHandler(vsy_Click);
            vsy.Left    = lb1.Left;
            vsy.Width   = vsy.Text.Length * 10;

            CheckBox mip = new CheckBox(guiManager.Manager);

            mip.Text    = "Use MipMap";
            mip.Checked = false;
            mip.Top     = vsy.Top + vsy.Height + 10;
            mip.Parent  = window;
            mip.Click  += new TomShane.Neoforce.Controls.EventHandler(mip_Click);
            mip.Left    = lb1.Left;
            mip.Width   = mip.Text.Length * 10;

            CheckBox ans = new CheckBox(guiManager.Manager);

            ans.Text    = "Use Anisotropic Filtering";
            ans.Checked = false;
            ans.Top     = mip.Top + mip.Height + 10;
            ans.Parent  = window;
            ans.Click  += new TomShane.Neoforce.Controls.EventHandler(ans_Click);
            ans.Left    = lb1.Left;
            ans.Width   = ans.Text.Length * 10;


            // Add the window control to the manager processing queue.
            guiManager.Manager.Add(window);
        }
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            tile = factory.GetTexture2D("Textures/tile");

            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///border
            border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red));

            ///from texture
            {
                Texture2D tex              = factory.GetTexture2D("Textures//goo");
                IModelo2D model            = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject          fs  = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(200, 0);
                this.World.AddObject(o);
            }

            ///from texture, scale usage sample
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                tex = factory.GetScaledTexture(tex, new Vector2(2));
                IModelo2D model            = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject          fs  = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved);
                this.World.AddObject(o);
            }

            ///rectangle
            Vertices verts = PolygonTools.CreateRectangle(50, 50);
            {
                IModelo2D model            = new SpriteFarseer(factory, verts, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject          fs  = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(-200, 0);
                this.World.AddObject(o);
            }

            ///circle
            CircleShape circle = new CircleShape(50, 1);

            {
                IModelo2D model            = new SpriteFarseer(factory, circle, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject          fs  = new FarseerObject(fworld, model);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(200, -100);
                this.World.AddObject(o);
            }

            ///animated sprite
            {
                Texture2D      tex = factory.GetTexture2D("Textures//DudeSheet");
                SpriteAnimated sa  = new SpriteAnimated(tex, 8, 2);
                sa.AddAnimation("ANIM1", 1, 8, 0);
                sa.AddAnimation("ANIM2", 2, 4, MathHelper.PiOver2);

                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                Texture2D     frame        = factory.GetTexturePart(tex, sa.GetFrameRectangle("ANIM1", 0));
                FarseerObject fs           = new FarseerObject(fworld, frame);

                //GhostObject fs = new GhostObject(Vector2.Zero);
                sheet = new I2DObject(fs, mat, sa);
                sheet.PhysicObject.Position = new Vector2(500, 0);
                this.World.AddObject(sheet);
            }

            {
                PointLight2D l = new PointLight2D(new Vector2(-GraphicInfo.BackBufferWidth / 4, -GraphicInfo.BackBufferWidth / 4), Color.Red, 1);
                this.World.AddLight(l);
            }

            {
                SpotLight2D l = new SpotLight2D(new Vector2(+GraphicInfo.BackBufferWidth / 4, -GraphicInfo.BackBufferWidth / 4), Color.Blue, new Vector2(0, 1), MathHelper.ToRadians(45));
                this.World.AddLight(l);
            }

            {
                SimpleConcreteKeyboardInputPlayable sc = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space);
                sc.KeyStateChange += new KeyStateChange(sc_KeyStateChange);
                this.BindInput(sc);
            }

            ///camera
            this.World.Camera2D = new Camera2D(GraphicInfo);

            DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null));

            this.World.ParticleManager.AddAndInitializeParticleSystem(ps);

            ///add a post effect =P
            //this.RenderTechnic.AddPostEffect(new WigglePostEffect());

            ///updateable
            JointUpdateable ju = new JointUpdateable(this, fworld, this.World.Camera2D);

            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                NeoforceGui guiManager = this.Gui as NeoforceGui;
                System.Diagnostics.Debug.Assert(guiManager != null);

                // Create and setup Window control.
                Window window = new Window(guiManager.Manager);
                window.Init();
                window.Text   = "Getting Started";
                window.Width  = 480;
                window.Height = 200;
                window.Center();
                window.Visible = true;

                // Create Button control and set the previous window as its parent.
                Button button = new Button(guiManager.Manager);
                button.Init();
                button.Text   = "OK";
                button.Width  = 72;
                button.Height = 24;
                button.Left   = (window.ClientWidth / 2) - (button.Width / 2);
                button.Top    = window.ClientHeight - button.Height - 8;
                button.Anchor = Anchors.Bottom;
                button.Parent = window;

                // Add the window control to the manager processing queue.
                guiManager.Manager.Add(window);
            }
        }
Esempio n. 5
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            SimpleModel          simpleModel = new SimpleModel(factory, "Model//cenario");
            TriangleMeshObject   tmesh       = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
            DeferredNormalShader shader      = new DeferredNormalShader();
            DeferredMaterial     fmaterial   = new DeferredMaterial(shader);
            IObject obj = new IObject(fmaterial, simpleModel, tmesh);

            this.World.AddObject(obj);

            NeoforceGui guiManager = this.Gui as NeoforceGui;

            System.Diagnostics.Debug.Assert(guiManager != null);

            // Create and setup Window control.
            Window window = new Window(guiManager.Manager);

            window.Init();
            window.Text   = "Getting Started";
            window.Width  = 480;
            window.Height = 200;
            window.Center();
            window.Visible = true;

            // Create Button control and set the previous window as its parent.
            Button button = new Button(guiManager.Manager);

            button.Init();
            button.Text   = "OK";
            button.Width  = 72;
            button.Height = 24;
            button.Left   = (window.ClientWidth / 2) - (button.Width / 2);
            button.Top    = window.ClientHeight - button.Height - 8;
            button.Anchor = Anchors.Bottom;
            button.Parent = window;
            button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click);

            // Add the window control to the manager processing queue.
            guiManager.Manager.Add(window);



            #region NormalLight
            DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White);
            DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White);
            DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White);
            DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White);
            DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White);
            float li = 0.5f;
            ld1.LightIntensity = li;
            ld2.LightIntensity = li;
            ld3.LightIntensity = li;
            ld4.LightIntensity = li;
            ld5.LightIntensity = li;
            this.World.AddLight(ld1);
            this.World.AddLight(ld2);
            this.World.AddLight(ld3);
            this.World.AddLight(ld4);
            this.World.AddLight(ld5);
            #endregion

            this.World.CameraManager.AddCamera(new CameraFirstPerson(false, GraphicInfo));

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//cubemap");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                ///Create the xml file model extractor
                ///Loads a XML file that was export by our 3DS MAX plugin
                ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
                this.AttachCleanUpAble(ext);
                ///Extract all the XML info (Model,Cameras, ...)
                ModelLoaderData data = ext.Load(factory, GraphicInfo, "ilha");
                ///Create the WOrld Loader
                ///Convert the ModelLoaderData in World Entities
                WorldLoader wl = new WorldLoader(); ///all default
                wl.LoadWorld(factory, GraphicInfo, World, data);
            }

            NeoforceGui guiManager = this.Gui as NeoforceGui;

            System.Diagnostics.Debug.Assert(guiManager != null);

            // Create and setup Window control.
            Window window = new Window(guiManager.Manager);

            window.Init();
            window.Text   = "Getting Started";
            window.Width  = 480;
            window.Height = 200;
            window.Center();
            window.Visible = true;

            // Create Button control and set the previous window as its parent.
            Button button = new Button(guiManager.Manager);

            button.Init();
            button.Text   = "OK";
            button.Width  = 72;
            button.Height = 24;
            button.Left   = (window.ClientWidth / 2) - (button.Width / 2);
            button.Top    = window.ClientHeight - button.Height - 8;
            button.Anchor = Anchors.Bottom;
            button.Parent = window;
            button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click);

            // Add the window control to the manager processing queue.
            guiManager.Manager.Add(window);



            #region NormalLight
            DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White);
            DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White);
            DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White);
            DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White);
            DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White);
            float li = 0.5f;
            ld1.LightIntensity = li;
            ld2.LightIntensity = li;
            ld3.LightIntensity = li;
            ld4.LightIntensity = li;
            ld5.LightIntensity = li;
            this.World.AddLight(ld1);
            this.World.AddLight(ld2);
            this.World.AddLight(ld3);
            this.World.AddLight(ld4);
            this.World.AddLight(ld5);
            #endregion

            this.World.CameraManager.AddCamera(new CameraFirstPerson(false, GraphicInfo));

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }