public CreationLevel(float panelWidth, float panelHeight, string levelFile, Graphics g) { vars = new CreationGlobalVars(); rand = new Random(); this.g = g; Bitmap lvlImg = ( Bitmap )Bitmap.FromFile(levelFile); cameraWidth = panelWidth; cameraHeight = panelHeight; this.levelWidth = lvlImg.Width * GlobalVars.LEVEL_READER_TILE_WIDTH; this.levelHeight = lvlImg.Height * GlobalVars.LEVEL_READER_TILE_HEIGHT; if (!sysManagerInit) { sysManager = new CreationSystemManager(this); } sysManagerInit = true; LevelImageReader lvlImgReader = new LevelImageReader(this, lvlImg); lvlImgReader.readImage(this); //levelBeginState = new Dictionary<int, Entity>(entities); //Copy the beginning game state prevTicks = DateTime.Now.Ticks; levelFullyLoaded = true; }
public void loadFromPaint(string fileName, Graphics newG) { sysManagerInit = false; this.g = newG; Bitmap lvlImg = ( Bitmap )Bitmap.FromFile(fileName); this.levelWidth = lvlImg.Width * GlobalVars.LEVEL_READER_TILE_WIDTH; this.levelHeight = lvlImg.Height * GlobalVars.LEVEL_READER_TILE_HEIGHT; sysManager = new CreationSystemManager(this); sysManagerInit = true; LevelImageReader lvlImgReader = new LevelImageReader(this, lvlImg); lvlImgReader.readImage(this); }