示例#1
0
 public MiniMap(Sea sea)
 {
     mapPaper = DiverGame.DefaultContent.Load<Texture2D>("mappaper");
     mapTiles = new SpriteGrid("maptiles", 4, 5);
     rooms = new int[sea.Width, sea.Height];
     ClearDiscoveries();
 }
示例#2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            graphics = new Graphics(GraphicsDevice);
            renderTarget = new RenderTarget2D(GraphicsDevice, 512, 512, 0, SurfaceFormat.Color, MultiSampleType.None, 1);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            White = new Texture2D(GraphicsDevice, 4, 4, 1, TextureUsage.Tiled, SurfaceFormat.Color);
            White.SetData(new uint[] { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
                                       0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
                                       0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
                                       0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff });

            font = Content.Load<SpriteFont>("Font");

            guiManager.Top = new Container();
            guiManager.Top.Size = new Point(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            guiManager.Top.Font = font;

            BorderBox areaDefault = new BorderBox(White, true, Color.Gray, Color.Black, 2);
            BorderBox areaPressed = new BorderBox(White, true, Color.Black, Color.White, 2);
            BorderBox areaHover = new BorderBox(White, true, Color.LightGray, Color.Black, 2);

            Button b = new Button("Click me!", areaDefault, areaPressed, areaHover);
            b.X = 10;
            b.Y = 10;
            guiManager.Top.Add(b);
            b.AutoResize();

            audioClip = new AudioClip(Content.RootDirectory + "/" + "clip.wav");

            b.Clicked += new Button.ClickedHandler(PlaySound);

            waterEffect = DefaultContent.Load<Effect>("water");

            sea = new Sea("sea", 2, 2, 1, 0);

            // TODO: use this.Content to load your game content

            Console.WriteLine(GraphicsDevice.GraphicsDeviceCapabilities.MaxPixelShaderProfile);
        }