示例#1
0
        public void setPixel32(int x, int y, uint color)
        {
            //Hmmmm, hacky much - haha

            if (PixelData.ContainsKey(texture) == false)
            {
                var pixelData = new Color[texture.Width * texture.Height];
                texture.GetData(pixelData);
                PixelData[texture] = pixelData;
            }

            PixelData[texture][(y * texture.Width) + x] = FlashRenderer.UIntToColor(color);
        }
示例#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()
    {
        PresentationParameters pp     = GraphicsDevice.PresentationParameters;
        SurfaceFormat          format = pp.BackBufferFormat;

        SpriteFont           = Content.Load <SpriteFont>("textures/font-sprites");
        _mousepointerTexture = Content.Load <Texture2D>("textures/Mousepointer");

        SpriteBatch        = new SpriteBatch(GraphicsDevice);
        _sceneRenderTarget = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, format, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);

        FlashRenderer.LoadContent(Content, GraphicsDevice);
        FlashRenderer.Register(_sceneRenderTarget);

        Renderer.LoadContent(Content);
        SoundLibrary.LoadContent(Content);
        Level.LoadContent(Content);

        PostProcess.LoadContent();
    }
示例#3
0
    public XnaGame()
    {
        Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

        Instance              = this;
        _graphics             = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";

        IsFixedTimeStep = true;
        IsMouseVisible  = false;

        #if WINDOWS
        _graphics.PreferredBackBufferWidth  = 960;
        _graphics.PreferredBackBufferHeight = 640;

        _mousepointer = true;
        #elif XBOX360
        _graphics.PreferredBackBufferWidth  = 1280;
        _graphics.PreferredBackBufferHeight = 720;

        _mousepointer = true;
        #elif WINDOWS_PHONE
        _graphics.PreferredBackBufferFormat = SurfaceFormat.Color;
        _mousepointer = false;
        #endif

        //Make 30 FPS or put a key limiter on KeyDown!
        TargetElapsedTime = TimeSpan.FromSeconds(1 / 60.0f);

        StorageManager = new StorageManager("EndingXNA");
        StorageManager.ShowStorageGuide();
        StorageManager.StorageDeviceAction += (sender, e) => {
            if (e.DialogAction == DialogAction.Select)
            {
                Game.LoadFromUserStorage(e.StorageContainer);
            }
        };


        FlashRenderer = new FlashRenderer();

        //Post processing effects for bloom, fisheye and scanlines...
        PostProcess = new PostProcess(this, null);
        #if WINDOWS || XBOX360
        PostProcess.AddProcessor(new BloomProcessor(this)
        {
            Active = true, Settings = BloomProcessor.BloomSettings.PresetSettings[7]
        });
        PostProcess.AddProcessor(new BarrelDistortionProcessor(this)
        {
            Active = false
        });
        PostProcess.AddProcessor(new ScanlinesProcessor(this)
        {
            Active = false, ScanlinesValue = 0.25f
        });

        Components.Add(new GamerServicesComponent(this));
        Components.Add(ThreadPoolComponent = new ThreadPoolComponent(this));
        #endif
    }