Example #1
0
 public CapsuleObject(float Length, float Radius, Vector3 Position, 
     Vector3 Rotation, GameScreen Parent)
     : base(Parent)
 {
     InitializeBody();
     SetupSkin(Length, Radius);
     this.Position = Position;
     this.EulerRotation = Rotation;
 }
Example #2
0
        // Called by the constructor to initialize the component
        protected virtual void InitializeComponent(GameScreen Parent)
        {
            // Check if engine is initialized before setting up component
            // otherwise the Engine will crash when the component tries
            // to add itself to the list
            if (!Engine.IsInitialized)
            {
                throw new Exception("Engine must be initialized with 'SetupEngine()'"
                    + "before components can be initialized");
            }

            Parent.Components.Add(this);
            Initialized = true;

            count++;
            Name = this.GetType().FullName + count;
        }
Example #3
0
        public void RecieveSerializationData(SerializationData Data)
        {
            // Set the basic Component values
            this.DrawOrder = Data.GetData<int>("Component.DrawOrder");
            this.Visible = Data.GetData<bool>("Component.Visible");
            this.Name = Data.GetData<string>("Component.Name");

            // Get the ServiceData from the data
            ServiceData sd = Data.GetData<ServiceData>("Component.ServiceData");

            // If the conponent was a service
            if (sd.IsService)
            {
                // Get the type back from the serializer
                Type t = Data.GetTypeFromDependency(sd.Type);

                // Add the service to the Engine
                Engine.Services.AddService(t, this);
            }

            // Set the owner GameScreen
            string parent = Data.GetData<string>("Component.ParentScreen");
            this.Parent = Engine.GameScreens[parent];

            // Call the overridable function that allow components to load from data
            LoadFromSerializationData(Data);
        }
Example #4
0
 public PhysicsObject(GameScreen Parent)
     : base(Parent)
 {
 }
Example #5
0
 public GaussianBlur(int Width, int Height, GameScreen Parent)
     : base(Engine.Content.Load<Effect>("Content/GaussianBlur"), Width, Height, Parent)
 {
     Setup(Width, Height);
 }
Example #6
0
 public MenuItem(SpriteFont font, string text, GameScreen parent)
     : base(parent)
 {
     Setup(font, text, new Rectangle(0, 0, 10, 10));
 }
Example #7
0
 public GodCamera(GameScreen Parent)
     : base(Parent)
 {
 }
 public TriangleMeshObject(Vector3 Position, Vector3 Rotation,
     GameScreen Parent)
     : base(Parent)
 {
     Setup(Position, Rotation);
 }
 public HeightMapObject(HeightMapInfo heightMapInfo, Vector2 shift, GameScreen parent)
     : base(parent)
 {
     Setup(heightMapInfo, shift);
 }
Example #10
0
 public PhysicsActor(Model Model, PhysicsObject PhysicsObject, GameScreen Parent)
     : base(Model, PhysicsObject.Position, Parent)
 {
     this.PhysicsObject = PhysicsObject;
 }
Example #11
0
 public PlaneObject(GameScreen Parent)
     : base(Parent)
 {
     Setup();
 }
Example #12
0
 public Actor(Model Model, Vector3 Position, GameScreen Parent)
     : base(Parent)
 {
     Setup(Model, Position);
 }
Example #13
0
 public PostProcessor(Effect Effect, int Width, int Height, GameScreen Parent)
     : base(Parent)
 {
     Setup(Effect, Width, Height);
 }
Example #14
0
 // Overloaded constructor allows us to specify the parent
 public Component(GameScreen Parent)
 {
     InitializeComponent(Parent);
 }
Example #15
0
 public Terrain2(Texture2D HeightMap, GameScreen Parent)
     : base(Parent)
 {
     Setup(HeightMap);
 }
Example #16
0
 public SphereObject(float Radius, Vector3 Position, Vector3 Rotation,
     GameScreen Parent)
     : base(Parent)
 {
     SetupSkin(Radius, Position, Rotation);
 }
Example #17
0
 public FPSCamera(PhysicsObject Object, GameScreen Parent)
     : base(Parent)
 {
     PhysicsObject = Object;
 }
Example #18
0
        private void pause(KeyboardDevice keyboard, MouseDevice mouse)
        {
            paused_mouse_position = mouse.Position;
            GameScreen pause = new GameScreen("Pause");
            mouse.ResetMouseAfterUpdate = false;
            this.IsMouseVisible = true;
            pause.Components.Add(keyboard);
            pause.Components.Add(mouse);
            Engine.blur.Visible = true;
            pause.BlocksUpdate = true;
            //MenuItem paused = new MenuItem(Engine.Content.Load<SpriteFont>("Content/MenuFont"), "Paused", new Rectangle(350,100,100,30), pause);

            MenuItem resume = new MenuItem(Engine.Content.Load<SpriteFont>("Content/MenuFont"), "Resume", new Rectangle(350, 150, 70, 30), pause);
            resume.Subscribe((object o, InputDeviceEventArgs<MouseButtons, MouseState> args) => ResumeHandler(o, args, resume));
            MenuItem exit = new MenuItem(Engine.Content.Load<SpriteFont>("Content/MenuFont"), "Exit", new Rectangle(350, 200, 50, 30), pause);
            exit.Subscribe((object o, InputDeviceEventArgs<MouseButtons, MouseState> args) => Terminate(o, args, exit));
        }
Example #19
0
 public CrossHair(GameScreen parent)
     : base(parent)
 {
     Setup();
 }
Example #20
0
 public Terrain(Texture2D HeightMap, Texture2D Texture, GameScreen Parent)
     : base(Parent)
 {
     Setup(HeightMap, Texture);
 }
Example #21
0
        // Initializes the engine
        public static void SetupEngine(IGraphicsDeviceService GraphicsDeviceService)
        {
            // Setup GraphicsDevice and SpriteBatch
            Engine.GraphicsDevice = GraphicsDeviceService.GraphicsDevice;
            Engine.SpriteBatch = new SpriteBatch(GraphicsDeviceService.GraphicsDevice);

            Engine.Services = new IEServiceContainer();
            Engine.Services.AddService(typeof(IGraphicsDeviceService), GraphicsDeviceService);
            Engine.Content = new IEContentManager(Services);

            // Setup background screen
            BackgroundScreen = new GameScreen("Engine.BackgroundScreen");
            BackgroundScreen.OverrideUpdateBlocked = false;
            BackgroundScreen.OverrideDrawBlocked = true;
            BackgroundScreen.OverrideInputBlocked = false;

            DefaultScreen = BackgroundScreen;

            Engine.IsInitialized = true;
            blur = new GaussianBlur(Engine.GraphicsDevice.Viewport.Width, Engine.GraphicsDevice.Viewport.Height);
        }
Example #22
0
 public MenuItem(SpriteFont font, string text, Rectangle rect, GameScreen parent)
     : base(parent)
 {
     Setup(font, text, rect);
 }
Example #23
0
 public SpriteTest(Texture2D tex, GameScreen parent)
     : base(parent)
 {
     LoadSpriteFromTexture(tex);
 }