打印本文 打印本文 关闭窗口 关闭窗口
VB.NET实现DirectDraw9 (1) 托管的DDraw
作者:武汉SEO闵涛  文章来源:敏韬网  点击数5101  更新时间:2009/4/23 19:00:43  文章录入:mintao  责任编辑:mintao
p;   Clip.Window = P

        BS = New Surface(fn, desc2, Dev)

        PS = New Surface(desc, Dev)

        PS.Clipper = Clip

        Me.Text = "loaded"

 

    End Sub

 

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

        run = Not run

        If TT Is Nothing Then

            TT = New Threading.Thread(AddressOf main2)

            TT.Start()

        End If

    End Sub

    Sub blt()

 

        If PS Is Nothing Then Exit Sub

        Dim r1 As Rectangle

        Dim r2 As Rectangle

        r2.Height = desc2.Height

        r2.Width = desc2.Width

        r1.Height = P.Size.Height

        r1.X = 0

        r1.Y = 0

        r1.Width = P.Size.Width

        PS.Draw(r1, BS, r2, DrawFlags.Wait)

 

    End Sub

 

    Sub main2()

        Dim tfp As Integer = 0                                      ''''''''''''fps

        Dim mytime As Date = DateTime.Now                           ''''''''''''临时用一下

        While (run = True)                                          ''''''''''''如果游戏没有结束

            blt()                                                   ''''''''''''主要绘制过程

            tfp += 1                                                ''''''''''''fps++

            If tfp = 200 Then                                       ''''''''''''200次的时候计算时间

                tfp = 0

                Dim ts As New TimeSpan

                ts = (DateTime.Now.Subtract(mytime))

                mytime = DateTime.Now

                If ts.TotalSeconds <> 0 Then

                    Dim qiqi As Double = 200 / (ts.TotalSeconds)

                    Me.Text = qiqi.ToString("##.##") + "F c"

                End If

 

            End If

上一页  [1] [2] [3] [4] [5]  下一页

打印本文 打印本文 关闭窗口 关闭窗口