Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.NoTitle);
            this.Window.AddFlags(WindowManagerFlags.Fullscreen);

            InputMethodManager input = (InputMethodManager)GetSystemService(Activity.InputMethodService);

            AndroidContext context = new AndroidContext(this, input, Resources.DisplayMetrics.WidthPixels, Resources.DisplayMetrics.HeightPixels);

            IGameAPI gameAPI = new AndroidGameAPI();

            Game game = new Game(context, gameAPI);

            game.Start();

            SetContentView(context);
        }
Exemplo n.º 2
0
        public static void Main()
        {
            Document.AddEventListener(EventType.TouchMove, (e) => {
                e.PreventDefault();
            });

            CanvasElement canvas = Document.GetElementById<CanvasElement>("canvas");
            canvas.Width = Document.DocumentElement.ClientWidth;
            canvas.Height = Document.DocumentElement.ClientHeight;
            InputElement input = Document.GetElementById<InputElement>("input");

            IContext context = new CanvasContext(canvas, input);

            IGameAPI gameAPI = new JQueryGameAPI();

            Game game = new Game(context, gameAPI);

            game.Start();
        }
Exemplo n.º 3
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);
//			textBatch = new TextBatch (GraphicsDevice);
			font = Content.Load<SpriteFont>("Arial");

			context = new DesktopContext(graphics, spriteBatch, font, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height);
			this.Window.ClientSizeChanged += (sender, e) => {
				context.ContentView.Width = context.Width = Window.ClientBounds.Width;
				context.ContentView.Height = context.Height = Window.ClientBounds.Height;

			};


			Stream stream;
			stream = new StreamReader (Path.GetFullPath (@"../../../ThreeOneSevenBee.Frontend.Website/img/star.png")).BaseStream;
			context.imageCache.Add("star.png", Texture2D.FromStream (GraphicsDevice, stream));
			stream = new StreamReader (Path.GetFullPath (@"../../../ThreeOneSevenBee.Frontend.Website/img/master_of_algebrabadge.png")).BaseStream;
			context.imageCache.Add("master_of_algebrabadge.png", Texture2D.FromStream (GraphicsDevice, stream));
			stream = new StreamReader (Path.GetFullPath (@"../../../ThreeOneSevenBee.Frontend.Website/img/potens_badge.png")).BaseStream;
			context.imageCache.Add("potens_badge.png", Texture2D.FromStream (GraphicsDevice, stream));
			stream = new StreamReader (Path.GetFullPath (@"../../../ThreeOneSevenBee.Frontend.Website/img/brøkbadge.png")).BaseStream;
			context.imageCache.Add("brøkbadge.png", Texture2D.FromStream (GraphicsDevice, stream));
			stream = new StreamReader (Path.GetFullPath (@"../../../ThreeOneSevenBee.Frontend.Website/img/restart.png")).BaseStream;
			context.imageCache.Add("restart.png", Texture2D.FromStream (GraphicsDevice, stream));
			stream = new StreamReader (Path.GetFullPath (@"../../../ThreeOneSevenBee.Frontend.Website/img/star_activated.png")).BaseStream;
			context.imageCache.Add("star_activated.png", Texture2D.FromStream (GraphicsDevice, stream));
			stream = new StreamReader (Path.GetFullPath (@"../../../ThreeOneSevenBee.Frontend.Website/img/parenthesis_badge.png")).BaseStream;
			context.imageCache.Add("parenthesis_badge.png", Texture2D.FromStream (GraphicsDevice, stream));
			stream = new StreamReader (Path.GetFullPath (@"../../../ThreeOneSevenBee.Frontend.Website/img/tutorial_badge.png")).BaseStream;
			context.imageCache.Add("tutorial_badge.png", Texture2D.FromStream (GraphicsDevice, stream));

			TOSBGame.IGameAPI gameAPI = new DesktopGameAPI();

			TOSBGame.Game game = new TOSBGame.Game (context, gameAPI);
			game.Start ();
			mouseDevice = new MouseDevice (GraphicsDevice);
			mouseDevice.ButtonReleased += (button, state) => {
				if (button == MouseButtons.Left)
					context.ContentView.Click (state.X, state.Y, context);
			};
		}