Ignore:
Timestamp:
2011-06-22 08:56:14 (9 years ago)
Author:
sijoseha
Message:

Whoa. A lot of stuff since last commit.
Implemented ScreenManager? stuff to handle all the screens.
Input is handled also.
Simple tile based map system started up.
Normal menu.
Alotofsmallstuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2011/23/sijoseha/Fera Proelia/Fera Proelia/Fera Proelia/Fera_Proelia.cs

    r2079 r2141  
    1919    { 
    2020        GraphicsDeviceManager graphics; 
    21         SpriteBatch spriteBatch; 
    2221 
    23         private Viewport gameView, hudView; 
    24         Beast beast; 
     22        ScreenManager screenManager; 
    2523 
    2624        public Fera_Proelia() 
    2725        { 
    2826            graphics = new GraphicsDeviceManager(this); 
     27            graphics.IsFullScreen = true; 
    2928            Content.RootDirectory = "Content"; 
    30  
    31             // Frame rate is 30 fps by default for Windows Phone. 
    32             TargetElapsedTime = TimeSpan.FromTicks(333333); 
    33         } 
    34  
    35         /// <summary> 
    36         /// Allows the game to perform any initialization it needs to before starting to run. 
    37         /// This is where it can query for any required services and load any non-graphic 
    38         /// related content.  Calling base.Initialize will enumerate through any components 
    39         /// and initialize them as well. 
    40         /// </summary> 
    41         protected override void Initialize() 
    42         { 
    43             // TODO: Add your initialization logic here 
    44             graphics.IsFullScreen = true; 
    4529            graphics.SupportedOrientations = DisplayOrientation.Portrait; 
    4630            graphics.PreferredBackBufferWidth = 480; 
    4731            graphics.PreferredBackBufferHeight = 800; 
    48             graphics.ApplyChanges(); 
    49             base.Initialize(); 
    50         } 
     32            // Frame rate is 30 fps by default for Windows Phone. 
     33            TargetElapsedTime = TimeSpan.FromTicks(333333); 
    5134 
    52         /// <summary> 
    53         /// LoadContent will be called once per game and is the place to load 
    54         /// all of your content. 
    55         /// </summary> 
    56         protected override void LoadContent() 
    57         { 
    58             // Create a new SpriteBatch, which can be used to draw textures. 
    59             spriteBatch = new SpriteBatch(GraphicsDevice); 
    60              
    61             gameView = new Viewport(new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height - 200)); 
    62             hudView = new Viewport(new Rectangle(0, Window.ClientBounds.Height - 200, Window.ClientBounds.Width, 200)); 
     35            screenManager = new ScreenManager(this); 
     36            Components.Add(screenManager); 
    6337 
    64             beast = new Beast(new Vector2(0, 0), 32, 32); 
    65             beast.Image = Content.Load<Texture2D>("debugImage"); 
    66             // TODO: use this.Content to load your game content here 
    67         } 
    68  
    69         /// <summary> 
    70         /// UnloadContent will be called once per game and is the place to unload 
    71         /// all content. 
    72         /// </summary> 
    73         protected override void UnloadContent() 
    74         { 
    75             // TODO: Unload any non ContentManager content here 
    76         } 
    77  
    78         /// <summary> 
    79         /// Allows the game to run logic such as updating the world, 
    80         /// checking for collisions, gathering input, and playing audio. 
    81         /// </summary> 
    82         /// <param name="gameTime">Provides a snapshot of timing values.</param> 
    83         protected override void Update(GameTime gameTime) 
    84         { 
    85             // Allows the game to exit 
    86             if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) 
    87                 this.Exit(); 
    88  
    89             // TODO: Add your update logic here 
    90  
    91             base.Update(gameTime); 
     38            screenManager.AddScreen(new MainMenuScreen()); 
    9239        } 
    9340 
     
    9946        { 
    10047            GraphicsDevice.Clear(Color.CornflowerBlue); 
    101             GraphicsDevice.Viewport = gameView; 
    102             spriteBatch.Begin(); 
    103             spriteBatch.Draw(beast.Image, beast.Position, Color.White); 
    104             spriteBatch.End(); 
    105             GraphicsDevice.Viewport = hudView; 
    106             spriteBatch.Begin(); 
    107             spriteBatch.Draw(beast.Image, beast.Position, Color.White); 
    108             spriteBatch.Draw(beast.Image, new Vector2(50,100), Color.White); 
    109             spriteBatch.Draw(beast.Image, new Vector2(70, 100), Color.White); 
    110             spriteBatch.End(); 
    11148            // TODO: Add your drawing code here 
    11249 
Note: See TracChangeset for help on using the changeset viewer.