예제 #1
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Engine engine = new Engine();
     Application.Run(new TForm(engine));
 }
예제 #2
0
 public Figure(ColorType color, int blocksize, Engine e)
 {
     this.color = color;
     this.blocksize = blocksize;
     this.engine = e;
     this.maxX = engine.getMaxX();
     this.maxY = engine.getMaxY();
     this.terminate = false;
     x1 = 0;
     x2 = 0;
     y1 = 0;
     y2 = 0;
 }
예제 #3
0
        public TForm(Engine engine)
        {
            InitializeComponent();
            this.engine = engine;

            this.SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint | System.Windows.Forms.ControlStyles.UserPaint | System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer, true);
            bmp = new Bitmap(250, 800);
            g = Graphics.FromImage(bmp);
            this.graphicsObj = g;
            Pen myPen = new Pen(System.Drawing.Color.Red, 5);
            graphicsObj.DrawLine(myPen, 0, 600, 200, 600);
            graphicsObj.DrawLine(myPen, 0, 80, 200, 80);
            engine.setGraphics(g2);
            graphicsObj.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
        }
예제 #4
0
 public Square(ColorType color, int blocksize, Engine e)
     : base(color, blocksize, e)
 {
     int x1 = 4*e.getBS();
     int y1=2*e.getBS();
     int x2 = x1+e.getBS()*2;
     int y2 = 0;
     int bs = e.getBS();
     this.colframe = new ColFrame(x1 - bs, y1 + bs, x2 + bs, y2 + bs);
     Block b1 = new Block(x1, y1, x1 + bs, y1 - bs,color);
     Block b2 = new Block(x1 + bs, y1, x2, y1 - bs, color);
     Block b3 = new Block(x1, y1 - bs, x1 + bs, y2, color);
     Block b4 = new Block(x2 - bs, y2 + bs, x2, y2, color);
     this.blocks = new Block[4];
     blocks[0] = b1;
     blocks[1] = b2;
     blocks[2] = b3;
     blocks[3] = b4;
 }
예제 #5
0
파일: L.cs 프로젝트: marce155/Tetris-Csharp
 public L(ColorType color, int blocksize, Engine e)
     : base(color, blocksize, e)
 {
     int x1 = 4*e.getBS();
     int y1=2*e.getBS();
     int x2 = x1+e.getBS()*5;
     int y2 = e.getBS();
     int bs = e.getBS();
     this.colframe = new ColFrame(x1 - bs, y1 + bs, x1 + 2*bs, y1 - 2*bs);
     b1 = new Block(x1, y1, x1 + bs, y1 - bs,color);
     b2 = new Block(x1, y1-bs, x1+bs, y1 - 2*bs, color);
     b3 = new Block(x1, y1+bs, x1, y1, color);
     b4 = new Block(x1+bs, y1+bs, x1+2*bs, y1, color);
     this.blocks = new Block[4];
     blocks[0] = b1;
     blocks[1] = b2;
     blocks[2] = b3;
     blocks[3] = b4;
     this.rotpos = 0;
 }