public Form1() { gm = Graphics.FromImage(mp); bs = TileFactory.fancy(); bd = TileFactory.CreateBoard(22, bs); corners = PaintBoard.Tilate(bd, 700, 600, tileTilt.vertical); squareSize = PaintBoard.TileSize(bd, 700, 600, tileTilt.vertical); gm.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; gm.FillRectangle(bush, 0, 0, 700, 600); InitializeComponent(); bearImg = Image.FromFile(@"..\..\..\bear.bmp", false); }
void renderman() { int x, y, wx, wy; Stopwatch tim = new Stopwatch(); Rectangle rekt; tim.Start(); foreach (var thing in corners) { ((SolidBrush)bush).Color = PaintBoard.colorFromTemp(thing.Item1.Temp); x = thing.Item2; y = thing.Item3; wx = squareSize.Item1; wy = squareSize.Item2; rekt = new Rectangle(x, y, 2 * wx, 2 * wy); gm.FillRectangle(bush, rekt); switch (thing.Item1.State) { case TileType.invalid: break; case TileType.empty: break; case TileType.fire: break; case TileType.ice1: break; case TileType.ice2: break; case TileType.ice3: break; case TileType.maxice: break; default: break; } } pictureBox1.Image = mp; tim.Stop(); label1.Text = label1.Text + "\n" + tim.ElapsedMilliseconds.ToString(); }
public GameRunning() { paintBoard = new PaintBoard("short-n-sweet.txt"); player = new Player(); player.SetPosition(0.45f, 0.6f); player.SetExtent(0.1f, 0.1f); playerList.Add(player); backGroundImage = new Entity( new StationaryShape(new Vec2F(0.0f, 0.0f), new Vec2F(1.0f, 1.0f)), new Image(Path.Combine("Assets", "Images", "SpaceBackground.png")) ); explosionStrides = ImageStride.CreateStrides(8, Path.Combine("Assets", "Images", "Explosion.png")); explosion = new AnimationContainer(8); }
//click paintBoard private void paintBoard_OnClickGrid(object sender, PaintBoard.PaintBoard.ClickEventArgs e) { int x = e.Col; int y = e.Row; Grid currentGrid = level.GetGrid(y, x); if (currentGrid == null) { currentGrid = new Grid(y, x); level.grids.Add(currentGrid); } if (deleteClick) { level.DeleteGrid(y, x); } else { currentGrid.GridState = type; level.SetGrid(y, x, currentGrid); } //Console.WriteLine(currentGrid.GridState); }