public CapsuleObject(float Length, float Radius, Vector3 Position, Vector3 Rotation, GameScreen Parent) : base(Parent) { InitializeBody(); SetupSkin(Length, Radius); this.Position = Position; this.EulerRotation = Rotation; }
// 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; }
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); }
public PhysicsObject(GameScreen Parent) : base(Parent) { }
public GaussianBlur(int Width, int Height, GameScreen Parent) : base(Engine.Content.Load<Effect>("Content/GaussianBlur"), Width, Height, Parent) { Setup(Width, Height); }
public MenuItem(SpriteFont font, string text, GameScreen parent) : base(parent) { Setup(font, text, new Rectangle(0, 0, 10, 10)); }
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); }
public PhysicsActor(Model Model, PhysicsObject PhysicsObject, GameScreen Parent) : base(Model, PhysicsObject.Position, Parent) { this.PhysicsObject = PhysicsObject; }
public PlaneObject(GameScreen Parent) : base(Parent) { Setup(); }
public Actor(Model Model, Vector3 Position, GameScreen Parent) : base(Parent) { Setup(Model, Position); }
public PostProcessor(Effect Effect, int Width, int Height, GameScreen Parent) : base(Parent) { Setup(Effect, Width, Height); }
// Overloaded constructor allows us to specify the parent public Component(GameScreen Parent) { InitializeComponent(Parent); }
public Terrain2(Texture2D HeightMap, GameScreen Parent) : base(Parent) { Setup(HeightMap); }
public SphereObject(float Radius, Vector3 Position, Vector3 Rotation, GameScreen Parent) : base(Parent) { SetupSkin(Radius, Position, Rotation); }
public FPSCamera(PhysicsObject Object, GameScreen Parent) : base(Parent) { PhysicsObject = Object; }
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)); }
public CrossHair(GameScreen parent) : base(parent) { Setup(); }
public Terrain(Texture2D HeightMap, Texture2D Texture, GameScreen Parent) : base(Parent) { Setup(HeightMap, Texture); }
// 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); }
public MenuItem(SpriteFont font, string text, Rectangle rect, GameScreen parent) : base(parent) { Setup(font, text, rect); }
public SpriteTest(Texture2D tex, GameScreen parent) : base(parent) { LoadSpriteFromTexture(tex); }