Esempio n. 1
0
 public Camera(int width, int height, World world)
     : base(width, height)
 {
     this.width = width;
     this.height = height;
     //zoom sets diagonal as well
     zoom = 1f;
     this.world = world;
 }
Esempio n. 2
0
        public MapPreviewer(World world, Land land, Vector2 size)
            : base(world)
        {
            Texture2D textureBase = land.getMinimap(new Point((int)size.X,(int)size.Y));

            AssetTexture text = new AssetTexture(textureBase, "minimapTexture");

            minimap = new DrawableTexture(text, this);
            minimap.size = size;
        }
Esempio n. 3
0
 /// <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);
 }
Esempio n. 4
0
 /// <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);
 }
Esempio n. 5
0
 public LandActiveBox(Land land, World world, Point size)
     : base(world, new Camera(size.X - 10, size.Y - 10, land))
 {
     border = new DrawableTexture("whiteSquare", this);
     border.size.X = size.X;
     border.size.Y = size.Y;
     border.filter = Color.Black;
     border.layer = 0.501f;
     texture.layer = 0.5f;
 }
Esempio n. 6
0
        public LandLoadPreviewer(World world, Land loadingLand)
            : base(world)
        {
            this.loadingLand = loadingLand;

            AssetSpriteFont font = AssetManager.CreateAssetSpriteFont("landLoaderFont", "defaultFont");
            statusText = new DrawableText(font, this, "", Color.White);

            statusBar = new DrawableTexture("whiteSquare", this);
            statusBar.size = new Vector2(20f, 10f);
            statusBar.position = new Vector2(0f, 30f);
        }
Esempio n. 7
0
        /// <summary>
        /// Animate position, rotation and size. (GameObject must implement Resizable)
        /// </summary>
        /// <param name="world"></param>
        /// <param name="targetObject"></param>
        /// <param name="originalPosition"></param>
        /// <param name="destinationPosition"></param>
        /// <param name="originalRotation"></param>
        /// <param name="destinationRotation"></param>
        /// <param name="originalSize"></param>
        /// <param name="destinationSize"></param>
        /// <param name="duration"></param>
        /// <param name="interpolationType"></param>
        /// <param name="start"></param>
        public LoopingAnimation(
            World world, 
            GameObject targetObject, 
            Vector2 originalPosition, 
            Vector2 destinationPosition,
            float originalRotation,
            float destinationRotation,
            Vector2 originalSize,
            Vector2 destinationSize,
            float loopTime, 
            InterpolationType 
            interpolationType, 
            bool start,
            float initialPhase
            )
            : base(world)
        {
            target = targetObject;

            if (!(target is Resizable))
                throw new Exception("Attempt at resizing a unresizable object. (Implement Resizable interface)");

            started = start;
            running = start;
            ended = false;

            this.looptime = loopTime;
            this.initialPhase = initialPhase;

            interpolPosition = true;
            interpolRotation = true;
            interpolSize = true;

            this.interpolationType = interpolationType;

            this.originalPosition = originalPosition;
            this.destinationPosition = destinationPosition;
            this.originalRotation = originalRotation;
            this.destinationRotation = destinationRotation;
            this.originalSize = originalSize;
            this.destinationSize = destinationSize;
        }
Esempio n. 8
0
        public GameManager(World UIWorld, Game game)
            : base(UIWorld)
        {
            this.game = game;

            // Create managers
            menuManager = new MenuManager(this);
            landManager = new LandManager(this);
            fightManager = new FightManager(this);
            gameState = gameManagerState.inMenu;

            //Create player
            Dictionary<ActionKeyType, Keys> keyMapping = new Dictionary<ActionKeyType,Keys>();
            keyMapping.Add(ActionKeyType.Up, Keys.W);
            keyMapping.Add(ActionKeyType.Down, Keys.S);
            keyMapping.Add(ActionKeyType.Right, Keys.D);
            keyMapping.Add(ActionKeyType.Left, Keys.A);
            keyMapping.Add(ActionKeyType.Space, Keys.Space);
            player1 = new LocalPlayer(keyMapping);
            PlayerManager.addPlayer(player1, "player1");

            //UserInterfaceManager.createNewUserInterfaceArea(new Vector2(Graphics.resolution.X - 200, Graphics.resolution.Y), new Vector2((Graphics.resolution.X/2f - 200f)/2f, 0), "activebox");
            UserInterfaceManager.createNewUserInterfaceArea(new Rectangle(200, 0, Graphics.resolution.X - 200, Graphics.resolution.Y), "activebox");
        }
Esempio n. 9
0
 public StripDummy(World world, AssetTextureStrip textureStrip)
     : base(world)
 {
     this.texture = new DrawableTextureStrip(textureStrip, this);
 }
Esempio n. 10
0
 public StripDummy(World world, String textureStrip)
     : base(world)
 {
     this.texture = new DrawableTextureStrip(AssetManager.getAssetTextureStrip(textureStrip), this);
 }
Esempio n. 11
0
 public Dummy(World world, AssetTexture texture)
     : base(world)
 {
     this.texture = new DrawableTexture(texture, this);
 }
Esempio n. 12
0
 public GameObject(World world)
 {
     this.world = world;
     world.AddObject(this);
 }
Esempio n. 13
0
        /// <summary>
        /// Animate position.
        /// </summary>
        /// <param name="world"></param>
        /// <param name="targetObject"></param>
        /// <param name="originalPosition"></param>
        /// <param name="destinationPosition"></param>
        /// <param name="duration"></param>
        /// <param name="interpolationType"></param>
        /// <param name="start"></param>
        public Animation(
            World world,
            GameObject targetObject,
            Vector2 originalPosition,
            Vector2 destinationPosition,
            float duration,
            InterpolationType
            interpolationType,
            bool start
            )
            : base(world)
        {
            target = targetObject;

            started = start;
            running = start;
            ended = false;

            lifetime = duration;

            interpolPosition = true;
            interpolRotation = false;
            interpolSize = false;

            this.originalPosition = originalPosition;
            this.destinationPosition = destinationPosition;
        }
Esempio n. 14
0
        /// <summary>
        /// Animate to destination rotation, position and size.
        /// </summary>
        /// <param name="world"></param>
        /// <param name="targetObject"></param>
        /// <param name="destinationPosition"></param>
        /// <param name="destinationRotation"></param>
        /// <param name="destinationSize"></param>
        /// <param name="duration"></param>
        /// <param name="interpolationType"></param>
        /// <param name="start"></param>
        public Animation(
            World world,
            GameObject targetObject,
            Vector2 destinationPosition,
            float destinationRotation,
            Vector2 destinationSize,
            float duration,
            InterpolationType
            interpolationType,
            bool start
            )
            : base(world)
        {
            target = targetObject;

            if (!(target is Resizable))
                throw new Exception("Attempt at resizing a unresizable object. (Implement Resizable interface)");

            started = start;
            running = start;
            ended = false;

            lifetime = duration;

            interpolPosition = true;
            interpolRotation = true;
            interpolSize = true;

            this.originalPosition = target.position;
            this.destinationPosition = destinationPosition;
            this.originalRotation = target.rotation;
            this.destinationRotation = destinationRotation;
            this.originalSize = ((Resizable)target).getSize();
            this.destinationSize = destinationSize;
        }
Esempio n. 15
0
        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;
        }