public SpriteProject() { Colors.Palette = PaletteManager.PaletteFromMachine(MachineType.C64); Colors.Palettes.Add(Colors.Palette); for (int i = 0; i < TotalNumberOfSprites; ++i) { Sprites.Add(new SpriteData(Colors)); PaletteManager.ApplyPalette(Sprites[i].Tile.Image); } }
public GraphicScreenProject() { PaletteManager.ApplyPalette(Image); for (int i = 0; i < 16; ++i) { ColorMapping.Add(i, new List <ColorMappingTarget> { ColorMappingTarget.ANY }); } Colors.Palette = PaletteManager.PaletteFromMachine(MachineType.C64); }
public CharsetProject() { for (int i = 0; i < 256; ++i) { Characters.Add(new CharData()); } Categories.Add("Uncategorized"); for (int i = 0; i < 16 * 16; ++i) { // white spaces PlaygroundChars.Add(0x10000 | 0x20); } Colors.Palette = PaletteManager.PaletteFromMachine(MachineType.C64); }
public bool ReadFromBuffer(GR.Memory.ByteBuffer ProjectFile) { ColorMapping.Clear(); for (int i = 0; i < 16; ++i) { ColorMapping.Add(i, new List <ColorMappingTarget> { ColorMappingTarget.ANY }); } Colors.Palettes.Clear(); GR.IO.MemoryReader memReader = new GR.IO.MemoryReader(ProjectFile); GR.IO.FileChunk chunk = new GR.IO.FileChunk(); while (chunk.ReadFromStream(memReader)) { GR.IO.MemoryReader chunkReader = chunk.MemoryReader(); switch (chunk.Type) { case FileChunkConstants.GRAPHIC_SCREEN_INFO: SelectedCheckType = (CheckType)chunkReader.ReadUInt32(); ScreenOffsetX = chunkReader.ReadInt32(); ScreenOffsetY = chunkReader.ReadInt32(); ScreenWidth = chunkReader.ReadInt32(); ScreenHeight = chunkReader.ReadInt32(); if ((ScreenWidth == 0) || (ScreenHeight == 0)) { ScreenWidth = 320; ScreenHeight = 200; } break; case FileChunkConstants.GRAPHIC_COLOR_MAPPING: { ColorMapping.Clear(); int numEntries = chunkReader.ReadInt32(); for (int i = 0; i < numEntries; ++i) { ColorMapping.Add(i, new List <ColorMappingTarget>()); int numMappings = chunkReader.ReadInt32(); for (int j = 0; j < numMappings; ++j) { ColorMappingTarget mappingTarget = (ColorMappingTarget)chunkReader.ReadUInt8(); ColorMapping[i].Add(mappingTarget); } } } break; case FileChunkConstants.GRAPHIC_DATA: { int width = chunkReader.ReadInt32(); int height = chunkReader.ReadInt32(); GR.Drawing.PixelFormat format = (GR.Drawing.PixelFormat)chunkReader.ReadInt32(); int paletteCount = chunkReader.ReadInt32(); Image.Create(width, height, format); for (int i = 0; i < paletteCount; ++i) { byte r = chunkReader.ReadUInt8(); byte g = chunkReader.ReadUInt8(); byte b = chunkReader.ReadUInt8(); Image.SetPaletteColor(i, r, g, b); } uint dataSize = chunkReader.ReadUInt32(); GR.Memory.ByteBuffer imageData = new GR.Memory.ByteBuffer(); chunkReader.ReadBlock(imageData, dataSize); Image.SetData(imageData); } break; case FileChunkConstants.MULTICOLOR_DATA: MultiColor = (chunkReader.ReadUInt8() == 1); Colors.BackgroundColor = chunkReader.ReadUInt8(); Colors.MultiColor1 = chunkReader.ReadUInt8(); Colors.MultiColor2 = chunkReader.ReadUInt8(); Colors.ActivePalette = chunkReader.ReadInt32(); if ((Colors.MultiColor1 < 0) || (Colors.MultiColor1 >= 16)) { Colors.MultiColor1 = 0; } if ((Colors.MultiColor2 < 0) || (Colors.MultiColor2 >= 16)) { Colors.MultiColor2 = 0; } break; case FileChunkConstants.PALETTE: Colors.Palettes.Add(Palette.Read(chunkReader)); break; } } memReader.Close(); if (Colors.Palettes.Count == 0) { Colors.Palettes.Add(PaletteManager.PaletteFromMachine(MachineType.C64)); } return(true); }