Include raw data in C# source code

549 Views Asked by At

I have an array that contains a default texture for a sprite like this:

uint[] bitmap = new uint[] {
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
    ...
};

Texture2D texture = new Texture2D(
    GameHost.GraphicsDevice,
    (int) Math.Sqrt(bitmap.Length),
    (int) Math.Sqrt(bitmap.Length),
    false, SurfaceFormat.Color);

    texture.SetData<uint>(bitmap, 0, bitmap.Length);

Is there a way to include an external text file that contains the bitmap data? Or, as an alternative, I should add a resource... But how could I embed such a resource in my XNA DLL for WindowsPhone?

0

There are 0 best solutions below