mdlfps.bas

来自「一款VB编写的时实光线跟踪的实例.需要用VB工具打开.」· BAS 代码 · 共 39 行

BAS
39
字号
Attribute VB_Name = "mdlFPS"
Option Explicit

'//Realtime raytracer
'//Original (c++) version and other nice
'//Raytrace versions (with shadows, cilinders, etc)
'//Can be found at http://www.2tothex.com/
'//VB port by Almar Joling / quadrantwars@quadrantwars.com
'//Websites: http://www.quadrantwars.com (my game)
'//          http://vbfibre.digitalrice.com (Many VB speed tricks with benchmarks)

'//This code is highly optimized. If you manage to gain some more FPS
'//I'm always interested =-)

'//Finished @ 01/03/2002
'//Feel free to post this code anywhere, but please leave the above info
'//and author info intact. Thank you.


Private Declare Function GetTickCount Lib "kernel32" () As Long

Private lngTimer As Long
Private intFPSCounter As Integer
Private intFPS As Integer

Public Function GetFPS() As Long
    '//Count FPS
    If lngTimer + 1000 <= GetTickCount Then
        lngTimer = GetTickCount
        intFPS = intFPSCounter + 1
        intFPSCounter = 0
    Else
        intFPSCounter = intFPSCounter + 1
    End If
    
    '//Return FPS
    GetFPS = intFPS
End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?