//Point last = new Point(); private void DrawForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Space) { UpdateTimer.Start(); DrawTimer.Start(); lasttime = DateTime.Now; } if (e.KeyCode == Keys.C) { UpdateTimer.Stop(); DrawTimer.Stop(); } if (e.KeyCode == Keys.D) { //camera.View = camera.View * Matrix4.Translate(0f, coeff, 0f); rocket.Move(new Vector3(rocket.Position.X + 10 * coeff, rocket.Position.Y, rocket.Position.Z)); } if (e.KeyCode == Keys.A) { rocket.Move(new Vector3(rocket.Position.X - 10 * coeff, rocket.Position.Y, rocket.Position.Z)); //camera.View = camera.View * Matrix4.Translate(0f, -coeff, 0f); } if (e.KeyCode == Keys.W) { rocket.Move(new Vector3(rocket.Position.X, rocket.Position.Y - 10 * coeff, rocket.Position.Z)); //camera.View = camera.View * Matrix4.Translate(0f, 0f, coeff); } if (e.KeyCode == Keys.S) { rocket.Move(new Vector3(rocket.Position.X, rocket.Position.Y + 10 * coeff, rocket.Position.Z)); //camera.View = camera.View * Matrix4.Translate(0f, 0f, -coeff); } }
// Выбор материала для рисования карты #region private void buttonGrass_Click(object sender, EventArgs e) { nowMaterial = new Grass(); drawMap = true; DrawTimer.Enabled = true; DrawTimer.Start(); }
private void RandomBTN_Click(object sender, EventArgs e) { if (gameModeClassic == true) { CGame.Clear(); Invalidate(); DrawTimer.Stop(); PlayBTN.Text = "Play"; generation = 0; GenerationLB.Text = "Generation: " + generation; CGame.Random(); } if (gameModeNewRules == true) { NRGame.Clear(); Invalidate(); DrawTimer.Stop(); PlayBTN.Text = "Play"; generation = 0; GenerationLB.Text = "Generation: " + generation; NRGame.Random(); } }
private void GliderBTN_Click(object sender, EventArgs e) { if (gameModeClassic == true) { CGame.Clear(); Invalidate(); DrawTimer.Stop(); PlayBTN.Text = "Play"; generation = 0; GenerationLB.Text = "Generation: " + generation; CGame.setCellAlive(1, 2); CGame.setCellAlive(2, 3); CGame.setCellAlive(3, 1); CGame.setCellAlive(3, 2); CGame.setCellAlive(3, 3); } if (gameModeNewRules == true) { NRGame.Clear(); Invalidate(); DrawTimer.Stop(); PlayBTN.Text = "Play"; generation = 0; GenerationLB.Text = "Generation: " + generation; NRGame.setCellAlive(1, 2); NRGame.setCellAlive(2, 3); NRGame.setCellAlive(3, 1); NRGame.setCellAlive(3, 2); NRGame.setCellAlive(3, 3); } }
/// <summary> /// /// </summary> public LayoutForm(XmlNode node) { InitializeComponent(); SelectionBox = new SelectionTool(); CheckerBoard = new Texture2D(ResourceManager.GetInternalResource("ArcEngine.Resources.checkerboard.png")); // CurrentLayout = new Layout(); CurrentLayout.Load(node); GuiPropertyBox.SelectedObject = CurrentLayout; //TabText = CurrentLayout.Name; // Gather all elements RebuildElementsBox(); // DrawTimer.Start(); }
private void Form1_KeyUp(object sender, KeyEventArgs e) {//при нажатии на пробел запускаем игру и придаем игроку ускорение в верх if (e.KeyCode == Keys.Space) { if (isGlowingOn) { pen.Width = 10; } DrawTimer.Start(); playerVelocity -= 20; DrawTimer.Start(); PlayerTimer.Start(); TubesTimer.Start(); } else if (e.KeyCode == Keys.Escape) { TubesTimer.Enabled = !TubesTimer.Enabled; PlayerTimer.Enabled = !DrawTimer.Enabled; DrawTimer.Enabled = !DrawTimer.Enabled; TubesTimer.Stop(); DrawTimer.Enabled = !DrawTimer.Enabled; button5.Visible = true; button5.Enabled = true; } else if (e.KeyCode == Keys.L) { DrawTimer.Stop(); new LiderboardForm2(score).Show(); } }
/// <summary> /// Draw Timer tick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DrawTimer_Tick(object sender, EventArgs e) { // If not floating panel and the panel is active and AutoRefresh is OK if (this.DockAreas != DockAreas.Float && DockPanel.ActiveDocument == this) { int elapsed = Environment.TickCount - Time; Time = Environment.TickCount; // Stop the drawtimer DrawTimer.Stop(); //Animation.Update(TimeSpan.FromMilliseconds(elapsed)); Animation.Update(new GameTime(TimeSpan.Zero, TimeSpan.Zero, TimeSpan.Zero, TimeSpan.FromMilliseconds(elapsed))); GlFramesControl.Invalidate(); GlTilesControl.Invalidate(); GlPreviewControl.Invalidate(); // Restart the draw timer DrawTimer.Start(); } }
private void Form1_KeyUp(object sender, KeyEventArgs e) { // При нажатии на пробел запускаем игру и // придаем игроку ускорение вверх if (e.KeyCode == Keys.Space) { pen.Width = 10; playerVelocity -= 20; DrawTimer.Start(); TubeTimer.Start(); PlayerTimer.Start(); } else if (e.KeyCode == Keys.Escape) { DrawTimer.Enabled = !DrawTimer.Enabled; PlayerTimer.Enabled = !DrawTimer.Enabled; TubeTimer.Enabled = !DrawTimer.Enabled; button1.Visible = !true; button1.Enabled = !true; button2.Visible = !true; button2.Enabled = !true; button3.Visible = !true; button3.Enabled = !true; button4.Visible = !true; button4.Enabled = !true; } else if (e.KeyCode == Keys.L) { DrawTimer.Stop(); new LeaderBoardForm(score).Show(); } }
/// <summary> /// Form closing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DungeonForm_FormClosed(object sender, FormClosedEventArgs e) { DrawTimer.Stop(); if (Dungeon != null) { Dungeon.Dispose(); } Dungeon = null; if (SpriteBatch != null) { SpriteBatch.Dispose(); } SpriteBatch = null; if (Icons != null) { Icons.Dispose(); } Icons = null; if (CheckerBoard != null) { CheckerBoard.Dispose(); } CheckerBoard = null; }
private void NodeForm_FormClosed(object sender, FormClosedEventArgs e) { DrawTimer.Stop(); if (exampleBitmap != null) { exampleBitmap.Dispose(); } }
public window() { InitializeComponent(); DrawTimer.Start(); DrawGrid(); ChangesMade = false; }
/// <summary> /// Draw timer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DrawTimer_Tick(object sender, EventArgs e) { DrawTimer.Stop(); GlControl_Paint(null, null); DrawTimer.Start(); }
private void ClearScreen_Click(object sender, EventArgs e) { ListOfInstances.Clear(); CurrentState.DrawTime = 0; DrawTimer.Stop(); DrawTimeLabel.Text = "Draw Time: 0 s"; CurrentState.IsMoveShape = false; CurrentState.IsFill = false; }
private void BackBtn_Click(object sender, EventArgs e) { DrawTimer.Stop(); CityList.Items.Clear(); VisitedCityList.Items.Clear(); visiting.Clear(); visitcompleted.Clear(); DrawPathBorder.Visible = false; AddCityPanel.Visible = true; }
private void LionHeartBTN_Click(object sender, EventArgs e) { if (gameModeClassic == true) { CGame.Clear(); Invalidate(); DrawTimer.Stop(); PlayBTN.Text = "Play"; generation = 0; GenerationLB.Text = "Generation: " + generation; //code to preset the specified cells to alive so the user doesnt need to enter them manually CGame.setCellAlive(21, 23); CGame.setCellAlive(21, 24); CGame.setCellAlive(21, 26); CGame.setCellAlive(21, 27); CGame.setCellAlive(22, 22); CGame.setCellAlive(22, 25); CGame.setCellAlive(22, 28); CGame.setCellAlive(23, 22); CGame.setCellAlive(23, 28); CGame.setCellAlive(24, 22); CGame.setCellAlive(24, 28); CGame.setCellAlive(25, 23); CGame.setCellAlive(25, 27); CGame.setCellAlive(26, 24); CGame.setCellAlive(26, 26); CGame.setCellAlive(27, 25); } if (gameModeNewRules == true) { NRGame.Clear(); Invalidate(); DrawTimer.Stop(); PlayBTN.Text = "Play"; generation = 0; GenerationLB.Text = "Generation: " + generation; //code to preset the specified cells to alive so the user doesnt need to enter them manually NRGame.setCellAlive(21, 23); NRGame.setCellAlive(21, 24); NRGame.setCellAlive(21, 26); NRGame.setCellAlive(21, 27); NRGame.setCellAlive(22, 22); NRGame.setCellAlive(22, 25); NRGame.setCellAlive(22, 28); NRGame.setCellAlive(23, 22); NRGame.setCellAlive(23, 28); NRGame.setCellAlive(24, 22); NRGame.setCellAlive(24, 28); NRGame.setCellAlive(25, 23); NRGame.setCellAlive(25, 27); NRGame.setCellAlive(26, 24); NRGame.setCellAlive(26, 26); NRGame.setCellAlive(27, 25); } }
public void CreateZoomLens(Point FixationPoint) { Size zoomSize = new Size(this.Size.Width / 2, this.Size.Height / 2); this.Show();//make lens visible offScreenGraphics.DrawImage(zoomedScreenshot, 0, 0, zoomedScreenshot.Width, zoomedScreenshot.Height); this.TopMost = true; Console.WriteLine("ZoomLens.Bounds.X = " + this.Bounds.X); Console.WriteLine("ZoomLens.Bounds.Y = " + this.Bounds.Y); DrawTimer.Start(); Application.DoEvents(); }
public void ResetZoomLens() { // Stop timer, and hide drawing form and zoom form DrawTimer.Stop(); drawingForm.ClearForm(); drawingForm.Refresh(); drawingForm.Close(); drawingForm = new DrawingForm(); Hide(); Location = new Point(-200, -200); }
//*/ public MainForm() { InitializeComponent(); LangLoad(); LangApply(); ResourceLoad(); DataLoad(); Text = ProductName + " " + ProductVersion; mainToolStripMenuItem.Text = ProductName; versionToolStripMenuItem.Text = "Version: " + ProductVersion; Game_Reset(); DrawTimer.Start(); }
public MainForm() { InitializeComponent(); mainConnector = new FormConnector(this); M_Form = this; this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); Game game = Game.Instance; game.adjustGameFormSize(this); DrawTimer.Start(); }
/// <summary> /// Draw timer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DrawTimer_Tick(object sender, EventArgs e) { DrawTimer.Stop(); GlControl_Paint(null, null); if (GlPreviewControl.Created) { GlPreviewControl_Paint(null, null); } DrawTimer.Start(); }
private void button1_Click(object sender, EventArgs e) { DrawTimer.Start(); PlayerTimer.Start(); TubeTimer.Start(); button1.Visible = false; button1.Enabled = false; button2.Visible = false; button2.Enabled = false; button3.Visible = false; button3.Enabled = false; button4.Visible = false; button4.Enabled = false; }
private void PlayBTN_Click(object sender, EventArgs e) { if (DrawTimer.Enabled) { DrawTimer.Stop(); PlayBTN.Text = "Play"; } else { DrawTimer.Interval = 500; DrawTimer.Start(); PlayBTN.Text = "Pause"; } }
private void UpdateTimer_Tick(object sender, EventArgs e) { camera.View = rocket.Translation; rocket.Move(new Vector3(rocket.Position.X, rocket.Position.Y, rocket.Position.Z + coeff)); //camera.View = camera.View * Matrix4.Scale(1 + coeff, 1 + coeff, 1 + coeff); hit = target.CheckHit(rocket); if (hit) { MessageBox.Show("Попал!"); UpdateTimer.Stop(); DrawTimer.Stop(); } Invalidate(); }
//When an algorithm is finished this timer is started private void DrawTimer_Tick(object sender, EventArgs e) { if (_remainder != null && _remainder.Any()) { PaintNodes(_remainder, Color.LightSkyBlue); return; } if (_path.Any()) { PaintNodes(_path, Color.CornflowerBlue); return; } //When the stack returns null and the stack is empty the timer stops DrawTimer.Stop(); }
/// <summary> /// On form loading /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DungeonForm_Load(object sender, EventArgs e) { glControl.MakeCurrent(); Display.Init(); SpriteBatch = new SpriteBatch(); // Preload background texture resource CheckerBoard = new Texture2D(ResourceManager.GetInternalResource("ArcEngine.Resources.checkerboard.png")); CheckerBoard.HorizontalWrap = TextureWrapFilter.Repeat; CheckerBoard.VerticalWrap = TextureWrapFilter.Repeat; // Preload texture resources Icons = new TileSet(); Icons.Texture = new Texture2D(ResourceManager.GetInternalResource("DungeonEye.Forms.data.editor.png")); int id = 0; for (int y = 0; y < Icons.Texture.Size.Height - 50; y += 25) { for (int x = 0; x < Icons.Texture.Size.Width; x += 25) { Tile tile = Icons.AddTile(id++); tile.Rectangle = new Rectangle(x, y, 25, 25); } } Icons.AddTile(100).Rectangle = new Rectangle(0, 245, 6, 11); // alcoves Icons.AddTile(101).Rectangle = new Rectangle(6, 248, 11, 6); // alcoves Icons.AddTile(102).Rectangle = new Rectangle(17, 243, 10, 13); // wall switch Icons.AddTile(103).Rectangle = new Rectangle(27, 246, 13, 10); // wall switch RebuildMazeList(); if (Dungeon.StartLocation != null && !string.IsNullOrEmpty(Dungeon.StartLocation.Maze) && MazeListBox.Items.Contains(Dungeon.StartLocation.Maze)) { MazeListBox.SelectedItem = Dungeon.StartLocation.Maze; } else if (MazeListBox.Items.Count > 0) { MazeListBox.SelectedIndex = 0; } DrawTimer.Start(); }
private void Form1_Load(object sender, EventArgs e) { Image busstop = Properties.Resources.p_BusStop /*@"p_BusStop.png"*/; Image passenger = Properties.Resources.p_Passenger /*(@"p_Passenger.png")*/; Image bus = Properties.Resources.p_Bus /*(@"p_Bus.png")*/; town = new Town(Width, Height); draw = new DrawField(town); town.BusStops = new List <BusStop>(); town.BusStops.Add(new BusStop(busstop.Width, busstop.Height, Width, Height)); town.BusStops.Add(new BusStop(Width - busstop.Width * 2 - busstop.Width / 2, busstop.Height, Width, Height)); town.BusStops.Add(new BusStop(Width / 2 - busstop.Width + busstop.Width / 3, Height - busstop.Height - 50 - busstop.Height / 2, Width, Height)); town.RandomBusesAndPassengers(); draw = new DrawField(town, busstop, bus, passenger); DrawTimer.Start(); ChangeTimer.Start(); }
private void DrawTimer_Tick(object sender, EventArgs e) { g.DrawLine(pen, Convert.ToInt64(citypositions[visitcompleted[counter]].x * MapImage.Width), Convert.ToInt64(citypositions[visitcompleted[counter]].y * MapImage.Height), Convert.ToInt64(citypositions[visitcompleted[counter + 1]].x * MapImage.Width), Convert.ToInt64(citypositions[visitcompleted[counter + 1]].y * MapImage.Height)); counter++; VisitedCityList.SelectedIndex = counter + 1; if (CityList.Items.Contains(cityname[visitcompleted[counter]])) { g.DrawString(cityname[visitcompleted[counter]], new Font("Arial", 12, FontStyle.Bold), new SolidBrush(drawcolor), new Point(Convert.ToInt32(citypositions[visitcompleted[counter]].x * MapImage.Width), Convert.ToInt32(citypositions[visitcompleted[counter]].y * MapImage.Height - 20))); g.DrawRectangle(pen, Convert.ToInt32(citypositions[visitcompleted[counter]].x * MapImage.Width) - 3, Convert.ToInt32(citypositions[visitcompleted[counter]].y * MapImage.Height) - 3, 6, 6); drawcolor = Color.FromArgb(255, rastgele.Next(0, 255), rastgele.Next(0, 255), rastgele.Next(0, 255)); pen.Color = drawcolor; } if (counter == visitcompleted.Count - 1) { DrawTimer.Stop(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DecorationForm_Load(object sender, System.EventArgs e) { OpenGLBox.MakeCurrent(); Display.ViewPort = new Rectangle(Point.Empty, OpenGLBox.Size); Display.RenderState.ClearColor = Color.Black; Display.RenderState.Blending = true; Display.BlendingFunction(BlendingFactorSource.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); Batch = new SpriteBatch(); // Collect all Tileset definition List <string> list = ResourceManager.GetAssets <TileSet>(); BackgroundTileSetBox.Items.AddRange(list.ToArray()); // Background tileset if (list.Contains(DecorationSet.BackgroundTileset)) { BackgroundTileSetBox.SelectedItem = DecorationSet.BackgroundTileset; } else if (BackgroundTileSetBox.Items.Count > 0) { ChangeBackgroundTileSet((string)BackgroundTileSetBox.Items[0]); BackgroundTileSetBox.SelectedIndex = 0; } // Decoration TileSet list = ResourceManager.GetAssets <TileSet>(); TilesetBox.Items.AddRange(list.ToArray()); if (list.Contains(DecorationSet.TileSetName)) { TilesetBox.SelectedItem = DecorationSet.TileSetName; } //list = ResourceManager.GetAssets<TileSet>(); ItemTileSetBox.Items.AddRange(list.ToArray()); OpenGLBox.MouseWheel += new MouseEventHandler(OpenGLBox_MouseWheel); DrawTimer.Start(); }
/// <summary> /// Time to paint my dear ! /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RenderControl_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { RenderControl.MakeCurrent(); // Stop the draw timer DrawTimer.Stop(); // Clear the background Display.ClearBuffers(); Batch.Begin(); // Background texture // Background texture Rectangle dst = new Rectangle(Point.Empty, RenderControl.Size); Batch.Draw(CheckerBoard, dst, dst, Color.White); // Draw the layout CurrentLayout.Draw(Batch); // Draw the selection box SelectionBox.Draw(Batch); // If no action and mouse over an element, draw its bounding box if (SelectionBox.MouseTool == MouseTools.NoTool) { Control elem = FindElementAt(RenderControl.PointToClient(System.Windows.Forms.Control.MousePosition)); if (elem != null) { //Display.DrawRectangle(elem.Rectangle, Color.White); } } Batch.End(); RenderControl.SwapBuffers(); // Start the draw timer DrawTimer.Start(); }
private void MainForm_Load(object sender, EventArgs e) { Image busstop = Properties.Resources.p_Conveer; /*@"p_BusStop.png"*/; Image passenger = Properties.Resources.p_Mechanic /*(@"p_Passenger.png")*/; Image bus = Properties.Resources.p_Pogruz /*(@"p_Bus.png")*/; Image revolt = Properties.Resources.mark; town = new Town(Width, Height); draw = new DrawField(town); town.BusStops = new List <Conveer>(); town.BusStops.Add(new Conveer(busstop.Width, busstop.Height, Width, Height)); town.BusStops.Add(new Conveer(Width - busstop.Width * 2 - busstop.Width / 2, busstop.Height, Width, Height)); town.BusStops.Add(new Conveer(busstop.Width, Height - busstop.Height - 50 - busstop.Height / 2, Width, Height)); town.BusStops.Add(new Conveer(Width - busstop.Width * 2 - busstop.Width / 2, Height - busstop.Height - 50 - busstop.Height / 2, Width, Height)); town.RandomBusesAndPassengers(); draw = new DrawField(town, busstop, bus, passenger, revolt); DrawTimer.Start(); ChangeTimer.Start(); }