-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCanvas.cs
46 lines (39 loc) · 1.12 KB
/
Canvas.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace seainvaders
{
class Canvas : Form
{
public Game game;
public Canvas()
{
this.DoubleBuffered = true;
this.Shown += Canvas_Shown; //Shown is the event, Canvas_Shown is the listener
}
private void Canvas_Shown(object sender, EventArgs e) // this is waiting for the window to be shown before creating the game
{
game = new Game(this);
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// Canvas
//
this.ClientSize = new System.Drawing.Size(1000, 1000);
this.Name = "Canvas";
this.Load += new System.EventHandler(this.Canvas_Load);
this.ResumeLayout(false);
}
private void Canvas_Load(object sender, EventArgs e)
{
}
//we need to clear the screen, because we want a different background
~Canvas()
{
game.canvasClosed = true;
}
}
}