Advertisement
Guest User

Untitled

a guest
May 13th, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Microsoft.Xna.Framework;
  5. using Microsoft.Xna.Framework.Audio;
  6. using Microsoft.Xna.Framework.Content;
  7. using Microsoft.Xna.Framework.GamerServices;
  8. using Microsoft.Xna.Framework.Graphics;
  9. using Microsoft.Xna.Framework.Input;
  10. using Microsoft.Xna.Framework.Media;
  11.  
  12. namespace AwesomiumComponentUsage
  13. {
  14.     /// <summary>
  15.     /// This is the main type for your game
  16.     /// </summary>
  17.     public class Game1 : Microsoft.Xna.Framework.Game
  18.     {
  19.         GraphicsDeviceManager graphics;
  20.         SpriteBatch spriteBatch;
  21.  
  22.         private AwesomiumComponent awesomium;
  23.  
  24.         public Game1()
  25.         {
  26.             graphics = new GraphicsDeviceManager(this);
  27.             Content.RootDirectory = "Content";
  28.         }
  29.  
  30.         /// <summary>
  31.         /// Allows the game to perform any initialization it needs to before starting to run.
  32.         /// This is where it can query for any required services and load any non-graphic
  33.         /// related content.  Calling base.Initialize will enumerate through any components
  34.         /// and initialize them as well.
  35.         /// </summary>
  36.         protected override void Initialize()
  37.         {
  38.             awesomium = new AwesomiumComponent(this, GraphicsDevice.Viewport.Bounds);
  39.             this.Components.Add(awesomium);
  40.             awesomium.WebView.LoadURL("http://jsfiddle.net/jcpmcdonald/T7q4z/111/");
  41.             base.Initialize();
  42.         }
  43.  
  44.         /// <summary>
  45.         /// LoadContent will be called once per game and is the place to load
  46.         /// all of your content.
  47.         /// </summary>
  48.         protected override void LoadContent()
  49.         {
  50.             // Create a new SpriteBatch, which can be used to draw textures.
  51.             spriteBatch = new SpriteBatch(GraphicsDevice);
  52.  
  53.             base.LoadContent();
  54.         }
  55.  
  56.         /// <summary>
  57.         /// UnloadContent will be called once per game and is the place to unload
  58.         /// all content.
  59.         /// </summary>
  60.         protected override void UnloadContent()
  61.         {
  62.             // TODO: Unload any non ContentManager content here
  63.         }
  64.  
  65.         /// <summary>
  66.         /// Allows the game to run logic such as updating the world,
  67.         /// checking for collisions, gathering input, and playing audio.
  68.         /// </summary>
  69.         /// <param name="gameTime">Provides a snapshot of timing values.</param>
  70.         protected override void Update(GameTime gameTime)
  71.         {
  72.             base.Update(gameTime);
  73.         }
  74.  
  75.         /// <summary>
  76.         /// This is called when the game should draw itself.
  77.         /// </summary>
  78.         /// <param name="gameTime">Provides a snapshot of timing values.</param>
  79.         protected override void Draw(GameTime gameTime)
  80.         {
  81.             GraphicsDevice.Clear(Color.CornflowerBlue);
  82.             spriteBatch.Begin();
  83.             if (awesomium.WebViewTexture != null)
  84.             {
  85.                 spriteBatch.Draw(awesomium.WebViewTexture, Vector2.Zero, Color.White);
  86.             }
  87.             spriteBatch.End();
  88.  
  89.             base.Draw(gameTime);
  90.         }
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement