/// <summary> /// A constructor which takes the world the ActiveBox will be displayed in plus Camera specifications. /// </summary> /// <param name="activeBoxWorld">The world the ActiveBox will be displayed in.</param> /// <param name="targetWorld">The world the camera displayed will draw.</param> /// <param name="cameraWidth">The width of the backbuffer of the camera.</param> /// <param name="cameraHeight">The heifht of the backbuffer of the camera.</param> public ActiveBox(World activeBoxWorld, World targetWorld, int cameraWidth, int cameraHeight) : base(activeBoxWorld) { currentID++; ID = currentID; reDrawing = true; this.camera = new Camera(cameraWidth, cameraHeight, targetWorld); AssetTexture textureAsset = AssetManager.CreateAssetTexture("ActiveBoxText" + ID, camera.backbuffer); texture = new DrawableTexture(textureAsset, this); }
/// <summary> /// A constructor which takes the world the ActiveBox will be displayed in and the Camera which will be displayed. /// </summary> /// <param name="world">The world the ActiveBox is going to be displayed im.</param> /// <param name="camera">The camera the ActiveBox will display the texture of.</param> public ActiveBox(World world, Camera camera) : base(world) { currentID++; ID = currentID; this.camera = camera; this.reDrawing = true; AssetTexture textureAsset = AssetManager.CreateAssetTexture("ActiveBoxText" + ID, camera.backbuffer); texture = new DrawableTexture(textureAsset , this); }
public override void Update(UpdateState state) { switch (this.state) { case LandManagerState.loading: if (land.isLoaded()) { if (minimapFinishLoadAnimation == null) { minimapLoopAnimation.destroy(); minimapLoopAnimation = null; Vector2 minimapPosition = UserInterfaceManager.getCurrentUpperLeftCorner() + new Vector2(100f, 100f); minimapFinishLoadAnimation = new Animation(world, minimap, minimapPosition, 0f, new Vector2(200f, 200f), 1.2f, Animation.InterpolationType.linear, true); } else if(minimapFinishLoadAnimation.isFinished()) { minimapFinishLoadAnimation.destroy(); minimapFinishLoadAnimation = null; loadPreviewer = null; Rectangle activeBoxArea = gameManager.getActiveBoxArea(); activeBox = new LandActiveBox(land, world, new Point(activeBoxArea.Width, activeBoxArea.Height)); landCamera = activeBox.camera; LandCameraControl control = new LandCameraControl(land, landCamera); HumanPlayer metaHuman = new HumanPlayer(land); LandHumanPlayer human = new LandHumanPlayer(land, metaHuman, gameManager); PlayerManager.getPlayer("player1").addControlable(human); control.setAnchor(human); land.addContentRequirer(human); land.addUpdateNode(human); activeBox.position = UserInterfaceManager.getUserInterfaceArea("activebox").getCenter(); this.state = LandManagerState.inland; } } break; case LandManagerState.inland: land.Update(state); break; } }
public static void Initialize() { baseWorld = new World(); baseCamera = new Camera(Graphics.resolution.X, Graphics.resolution.Y, baseWorld); UpdateManager.addUpdateRegister(new UpdateRegister(baseWorld, "UIBaseWorld")); Graphics.baseCamera = baseCamera; }
public LandCameraControl(Land land, Camera camera) : base(land) { this.camera = camera; }