예제 #1
0
        // My alternative to LoadContent; makes progress bars easier
        protected override ContentManager Load()
        {
            ContentManager c = new ContentManager();

            c.AddTask(new LoadTask("effects", delegate()
            {
                _effectBlackout  = Content.Load <Effect>("fx/effect_blackout");
                _effectGreyscale = Content.Load <Effect>("fx/effect_greyscale");
                _effectGreyscale.Parameters["lightness"].SetValue(0f);
            }));

            c.AddTask(new LoadTask("physics", delegate()
            {
                TouchPanel.EnabledGestures = GestureType.Tap | GestureType.FreeDrag | GestureType.DragComplete;
                ConvertUnits.SetDisplayUnitToSimUnitRatio(10f);

                _world = new World(new Vector2(0, 9.98f));

                _hand        = new Hand(_world, Content, new Vector2(0, 26));
                _baseballBat = new BaseballBat(_world, Content, new Vector2(0, -24));

                Camera = new View.Camera(this, new Vector2(0, 0), 1f);
            }));

            return(c);
        }
예제 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="spriteBatch">SpriteBatch instance</param>
 /// <param name="player">Player object</param>
 /// <param name="inputHandler">InputHandler instance</param>
 /// <param name="camera">Camera instance</param>
 public WorldMap(SpriteBatch spriteBatch, Model.Player player, InputHandler inputHandler, Camera camera)
 {
     this._player       = player;
     this._spriteBatch  = spriteBatch;
     this._inputHandler = inputHandler;
     this._camera       = camera;
 }
예제 #3
0
 public BurstSystem(View.Camera camera, Vector2 position, float radius, Texture2D texture)
 {
     this.camera = camera;
     this.position = position;
     this.radius = radius;
     this.texture = texture;
 }
예제 #4
0
        public Vector2 TestLogicalToVisualCoordinates(float scale, bool rotated)
        {
            View.Camera camera = new View.Camera();
            Vector2 logicalCoordinates;
            Vector2 visualCoordinates;
            int x, y;

            while (true)
            {
                Console.Clear();
                Console.Write("X: ");

                x = Convert.ToInt32(Console.ReadLine());

                Console.Write("Y: ");
                y = Convert.ToInt32(Console.ReadLine());

                Console.Clear();

                logicalCoordinates.X = x;
                logicalCoordinates.Y = y;

                Console.WriteLine("Logiskt position ({0}, {1})", x, y);
                Console.Write("Visuell position ");

                visualCoordinates = camera.LogicalToVisualCoordinates(logicalCoordinates, scale, rotated);

                Console.WriteLine("({0}, {1})", visualCoordinates.X, visualCoordinates.Y);

                Console.ReadLine();
            }
        }
예제 #5
0
 public SplashSystem(View.Camera camera, Vector2 position, Texture2D dropTexture, Texture2D rainbowTexture)
 {
     this.camera = camera;
     this.position = position;
     this.dropTexture = dropTexture;
     this.rainbowTexture = rainbowTexture;
 }
예제 #6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch (GraphicsDevice);

            //TODO: use this.Content to load your game content here
            this.camera = new View.Camera (GraphicsDevice);
            this.view = new View.ExplosionView (Content, GraphicsDevice, this.camera);
        }
예제 #7
0
        public BallView(ContentManager content, Model.BallSimulation ballSimulation, View.Camera camera)
        {
            this.ballTexture = content.Load<Texture2D> ("Texture/bubble.png");
            this.rainbowTexture = content.Load<Texture2D> ("Texture/rainbow.png");
            this.burstSpriteSheet = content.Load<Texture2D> ("Texture/burst.png");
            this.bubblePop = content.Load<SoundEffect>("Sound/bubblepop.wav");

            this.ballSimulation = ballSimulation;
            this.camera = camera;
        }
 public GameController(View.View a_view, View.Camera a_camera, View.Menu a_menu, GraphicsDeviceManager a_manager, ContentManager a_contentManager)
 {
     m_enemyBolt = new Model.EnemyBolt();
     m_view = a_view;
     m_menu = a_menu;
     m_camera = a_camera;
     m_manager = a_manager;
     m_model = new Model.Model(m_player, m_statehandler, m_levels, m_enemy, m_enemyBolt);
     //    m_sound = new Model.SoundManager(a_contentManager);
     m_save = new Model.Save(m_player, m_statehandler, m_levels, m_model);
 }
예제 #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="graphicsDevice">GraphicsDevice instance</param>
 /// <param name="spriteBatch">SpriteBatch instance</param>
 /// <param name="gameModel">GameModel instance</param>
 /// <param name="animationSystem">AnimationSystem instance</param>
 /// <param name="inputHandler">InputHandler instance</param>
 /// <param name="soundHandler">SoundHandler instance</param>
 public GameView(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, Model.GameModel gameModel, View.AnimationSystem animationSystem, View.InputHandler inputHandler, View.SoundHandler soundHandler)
 {
     this._gameModel       = gameModel;
     this._camera          = new Camera(graphicsDevice, gameModel);
     this._spriteBatch     = spriteBatch;
     this._soundHandler    = soundHandler;
     this._inputHandler    = inputHandler;
     this._animationSystem = animationSystem;
     this._conversation    = new Dialog(spriteBatch, _gameModel, _camera, _inputHandler);
     this._UIView          = new UIView(spriteBatch, _camera, _inputHandler, gameModel, _conversation);
     this._unitView        = new UnitView(_gameModel, spriteBatch, _camera, _inputHandler, _animationSystem, _conversation);
 }
예제 #10
0
 public GameView(GraphicsDevice a_graphicsDevice, SpriteBatch a_spriteBatch, Model.GameModel a_gameModel, View.AnimationSystem a_animationSystem, View.InputHandler a_inputHandler, View.SoundHandler a_soundHandler)
 {
     this.m_gameModel       = a_gameModel;
     this.m_camera          = new Camera(a_graphicsDevice, a_gameModel);
     this.m_spriteBatch     = a_spriteBatch;
     this.m_soundHandler    = a_soundHandler;
     this.m_inputHandler    = a_inputHandler;                                                                                        //Hantering av samtliga anv-inputs
     this.m_animationSystem = a_animationSystem;                                                                                     //System för sprite-animationer
     this.m_conversation    = new Conversation(m_spriteBatch, m_gameModel, m_camera, m_inputHandler);                                //Behandlar/ritar dialogtexter
     this.m_UIView          = new UIView(m_spriteBatch, m_camera, m_inputHandler, a_gameModel, m_conversation);                      //Utritning av user-interface
     this.m_unitView        = new UnitView(m_gameModel, m_spriteBatch, m_camera, m_inputHandler, m_animationSystem, m_conversation); //Utritning av samtliga units
 }
        public UIView(SpriteBatch a_spriteBatch, Camera a_camera, InputHandler a_inputHandler, Model.GameModel a_gameModel, Conversation a_conversation)
        {
            this.m_spriteBatch  = a_spriteBatch;
            this.m_keyPositions = new Vector2[7];
            this.m_camera       = a_camera;

            this.m_inputHandler = a_inputHandler;
            this.m_activeSpells = a_gameModel.m_playerSystem.m_spellSystem.ActiveSpells;
            this.m_player       = a_gameModel.m_playerSystem.m_player;
            this.m_questSystem  = a_gameModel.m_questSystem;
            this.m_worldItems   = a_gameModel.m_itemSystem.m_items;
            this.m_currentMap   = a_gameModel.m_level.CurrentMap();

            this.m_rightClickWatch = new Stopwatch();
            this.m_conversation    = a_conversation;
        }
예제 #12
0
        public BoxView(GraphicsDevice device, View.Camera camera)
        {
            this.box = new Model.Box ();
            this.line = new View.LineDrawer (device);
            this.camera = camera;

            /*
            this.box.Top = this.camera.BoxMargin + this.camera.BoxWindowDisplacement.Y;
            this.box.Bottom = this.camera.BoxMargin + this.camera.BoxSize + this.camera.BoxWindowDisplacement.Y;
            this.box.Left = this.camera.BoxMargin + this.camera.BoxWindowDisplacement.X;
            this.box.Right = this.camera.BoxMargin + this.camera.BoxSize + this.camera.BoxWindowDisplacement.X;
            */

            this.box.Top = this.camera.BoxMargin;
            this.box.Bottom = device.Viewport.Height - this.camera.BoxMargin;
            this.box.Left = this.camera.BoxMargin;
            this.box.Right = device.Viewport.Width - this.camera.BoxMargin;
        }
예제 #13
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="spriteBatch">Instance of SpriteBatch</param>
        /// <param name="camera">Instance of Camera</param>
        /// <param name="inputHandler">Instance of InputHandler</param>
        /// <param name="gameModel">Instance of GameModel</param>
        /// <param name="dialog">Instance of Dialog</param>
        public UIView(SpriteBatch spriteBatch, Camera camera, InputHandler inputHandler, Model.GameModel gameModel, Dialog dialog)
        {
            this._spriteBatch     = spriteBatch;
            this._player          = gameModel.PlayerSystem.Player;
            this._worldItems      = gameModel.ItemSystem._items;
            this._currentMap      = gameModel.Level.CurrentMap();
            this._activeSpells    = gameModel.PlayerSystem.SpellSystem.ActiveSpells;
            this._rightClickWatch = new Stopwatch();

            this._dialog       = dialog;
            this._camera       = camera;
            this._inputHandler = inputHandler;
            this._questSystem  = gameModel.QuestSystem;

            this._common    = new UI.Common(_spriteBatch);
            this._avatar    = new UI.Avatar(_spriteBatch, _player);
            this._worldMap  = new UI.WorldMap(_spriteBatch, _player, _inputHandler, _camera);
            this._actionBar = new UI.ActionBar(_spriteBatch, _activeSpells, _player, _questSystem, _camera);
        }
예제 #14
0
 public SmokeSystem(ContentManager content, GraphicsDevice device, View.Camera camera)
 {
     this.particlesmoke = content.Load<Texture2D> ("particlesmoke.tga");
     this.camera = camera;
     this.random = new Random();
 }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch (GraphicsDevice);

            //TODO: use this.Content to load your game content here
            this.camera = new View.Camera (GraphicsDevice);
            this.ballView = new View.BallView (Content, ballSimulation, this.camera);
            this.boxView = new View.BoxView (GraphicsDevice, this.camera);
            this.pointerView = new View.PointerView (Content, this.camera);
        }
예제 #16
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            splashTexture = this.Content.Load<Texture2D>("splash");
            font = Content.Load<SpriteFont>("fontTexture");

            titleMusic = Content.Load<SoundEffect>("titleMusic");
            titleInstance = titleMusic.CreateInstance();
            titleInstance.IsLooped = true;

            doorEffect = Content.Load<SoundEffect>("door");
            doorInstance = doorEffect.CreateInstance();
            doorInstance.Pitch = 1f;
            doorInstance.Volume = .5f;

            dummyTexture = new Texture2D(graphics.GraphicsDevice, 1, 1);
            dummyTexture.SetData(new Color[] { Color.White });

            // New Camera
            camera = new View.Camera(graphics.GraphicsDevice.Viewport);

            //Load MenuGUI for mainMenu
            gui_mainMenu = new MenuGUI(spriteBatch, Content, camera.getScreenWidth() / 5, camera.getScreenHeight() - camera.getScreenHeight() / 4);
            gui_mainMenu.addItem("New Game");
            gui_mainMenu.addItem("Exit");

            //Load menuGUI for pauseMenu
            gui_pauseMenu = new MenuGUI(spriteBatch, Content, camera.getScreenWidth() / 2, camera.getScreenHeight() / 3 + 40);
            gui_pauseMenu.addItem("Continue");
            gui_pauseMenu.addItem("Exit to main Menu");

            //Load menuGUI for gameDoneMenu
            gui_gameDoneMenu = new MenuGUI(spriteBatch, Content, camera.getScreenWidth() / 2, camera.getScreenHeight() / 3 + 40);
            gui_gameDoneMenu.addItem("New Game");
            gui_gameDoneMenu.addItem("Exit to main Menu");
        }
예제 #17
0
 public ExplosionView(GraphicsDevice device, View.Camera camera)
 {
     this.camera = camera;
 }
예제 #18
0
        public SplitterSystem(ContentManager content, GraphicsDevice device)
        {
            spark = content.Load<Texture2D> ("spark.png");

            this.camera = new View.Camera (device);
        }