public void Draw()
        {
            Vector2 guiOffset = new Vector2(700, 128);

            Engine.Instance.SpriteBatch.Draw(BG, Engine.Instance.ScreenArea, Color.White);
            Engine.Instance.SpriteBatch.Draw(GUIBG, guiOffset + new Vector2(-30, -50), Color.White);

            Grid.Instance.Draw();
            ActiveShape.Draw();

            Engine.Instance.SpriteBatch.DrawString(GUIFont, string.Format("Score: {0}", Score), guiOffset + new Vector2(0, 0), Color.White);
            Engine.Instance.SpriteBatch.DrawString(GUIFont, string.Format("Level: {0}", LevelNr), guiOffset + new Vector2(0, 50), Color.White);
            Engine.Instance.SpriteBatch.DrawString(GUIFont, string.Format("Lives: {0}", Lives), guiOffset + new Vector2(0, 75), Color.White);
            Engine.Instance.SpriteBatch.DrawString(GUIFont, "Next Block", guiOffset + new Vector2(0, 100), Color.White);

            NextShape.DrawInGUI(guiOffset + new Vector2(0, 150));

            if (State == eLevelState.CountingDown)
            {
                Engine.Instance.SpriteBatch.DrawString(CountDownFont, (CountDown.TimeLeftSec + 1).ToString(), Grid.Instance.GridArea.CenterVector(), Color.White);
            }
            else if (State == eLevelState.QuitConfirm)
            {
                Engine.Instance.SpriteBatch.Draw(QuitDlgBG, Engine.Instance.ScreenArea.CenterVector() - new Vector2(QuitDlgBG.Width / 2, QuitDlgBG.Height / 2), Color.White);
            }
        }
Exemple #2
0
 public void Draw()
 {
     Console.Clear();
     DrawBorders();
     grid.Draw();
     DisplayData();
     currShape.Draw(grid);
     nextShape.Draw(grid.Left + grid.Columns + 3, grid.Top + grid.Rows / 2 - 2);
 }
Exemple #3
0
        } // end method DrawNextShape

        /// <summary>
        /// This method draws the shape being held on the form.
        /// </summary>
        /// <param name="g">The graphics object to draw onto.</param>
        private void DrawHeldShape(Graphics g)
        {
            Point startPoint = new Point(
                Boundaries.Right + BlocksOver(2), Boundaries.Top + BlocksOver(6));
            string nextShapeString = "Held Shape:";
            Font   nextShapeFont   = new Font("Arial", 12, FontStyle.Bold);

            g.DrawString(nextShapeString, nextShapeFont, Brushes.Black, startPoint);
            startPoint.Y += 20;
            Size      displaySize = new Size(BlocksOver(6), BlocksOver(4));
            Rectangle background  = new Rectangle(startPoint, displaySize);

            g.FillRectangle(Brushes.Black, background);

            if (heldShape != null)
            {
                Point shapeDisplayPoint = GetShapeDisplayPoint(heldShape, background);
                Shape displayShape      = heldShape.CopyShape(shapeDisplayPoint);
                displayShape.Draw(g);
            }
        } // end method DrawHeldShape
Exemple #4
0
        private static void OnRenderFrame()
        {
            Gl.Viewport(0, 0, ConfigurationHandler.WindowWidth, ConfigurationHandler.WindowHeight);
            Gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            Gl.ClearColor(0.53f, 0.8f, 0.98f, 1);

            ShaderProgram.Use();
            ShaderProgram["projection_matrix"].SetValue(Matrix4.CreatePerspectiveFieldOfView(0.45f,
                                                                                             (float)ConfigurationHandler.WindowWidth / ConfigurationHandler.WindowHeight,
                                                                                             0.1f, 1000f));
            ShaderProgram["view_matrix"].SetValue(Matrix4.LookAt(new Vector3(0, 0, 10), Vector3.Zero, Vector3.Up));


            Shape.Draw();
            Grid.Draw();


            Glut.glutSwapBuffers();
            Shape.Dispose();
            Grid.Dispose();
        }