Example #1
0
        /* Global Variables initialization */
        protected override void Initialize()
        {
            //graphicMode(1440, 900, true);

            _GLOBAL.InputHandler = new InputHandler();
            _GLOBAL.Viewport = _GLOBAL.Graphics.GraphicsDevice.Viewport;
            _GLOBAL.ViewportRect = new Rectangle(_GLOBAL.Viewport.X, _GLOBAL.Viewport.Y, _GLOBAL.Viewport.Width, _GLOBAL.Viewport.Height);
            _GLOBAL.SpriteBatch = new SpriteBatch(GraphicsDevice);
            _GLOBAL.AudioEngine = new AudioEngine(@"Content\audio\audioEngine.xgs");
            _GLOBAL.WaveBank = new WaveBank(_GLOBAL.AudioEngine, @"Content\audio\waveBank.xwb");
            _GLOBAL.SoundBank = new SoundBank(_GLOBAL.AudioEngine, @"Content\audio\soundBank.xsb");

            base.Initialize();
            cursor = new Obj(cursorTexture, 0, 0);

            _GLOBAL.GameStateManager.activate(new Opening());
        }
Example #2
0
 internal bool collision(Obj anotherObj)
 {
     return posRect.Intersects(anotherObj.posRect);
 }
Example #3
0
        private void convertObj(XmlTag element)
        {
            string key = "";
            Texture2D baseObj = null;
            Obj value;

            foreach (KeyValuePair<string, string> attrib in element.Attributes)
            {
                if (attrib.Key == "id")
                    key = attrib.Value;
                else if (attrib.Key == "src")
                    baseObj = (Texture2D)Texture.FromFile(_GLOBAL.Graphics.GraphicsDevice, attrib.Value); // dynamic loading
            }

            value = new Obj(baseObj, 0, 0);
            value.ID = key;
            objs.Add(key, value);
        }
Example #4
0
        private void convertObject(XmlTag element)
        {
            string key = "";
            Texture2D img = null;
            int x, y, width, height;
            x = y = width = height = 0;
            Obj value = null;

            foreach (KeyValuePair<string, string> attrib in element.Attributes)
            {
                if (attrib.Key == "id")
                    key = attrib.Value;
                else if (attrib.Key == "src")
                    img = (Texture2D)Texture.FromFile(_GLOBAL.Graphics.GraphicsDevice, attrib.Value); // dynamic loading
                else if (attrib.Key == "x")
                    x = Int32.Parse(attrib.Value);
                else if (attrib.Key == "y")
                    y = Int32.Parse(attrib.Value);
                else if (attrib.Key == "width")
                    width = (attrib.Value == "default") ? img.Width : Int32.Parse(attrib.Value); // default value
                else if (attrib.Key == "height")
                    height = (attrib.Value == "default") ? img.Height : Int32.Parse(attrib.Value); // default value
            }

            value = new Obj(img, x, y, img.Width, img.Height, width * height / (img.Width * img.Height));

            if (key != "")  // Key is not required for Object. If not specified, use the one generated by the Obj class
                value.ID = key;
            objects.Add(value.ID, value);
        }
Example #5
0
        protected override void Initialize()
        {
            titlePos = new Vector2(_GLOBAL.Viewport.Width - 180, 100);
            activeTitleColor = new Color(0, 0, 0, 200);
            inactiveTitleColor = new Color(0, 0, 0, 100);

            LoadContent();
            arrow = new Obj(arrowTexture, titlePos.X - 70, 100);
        }