Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Performance
#1
Quick question.

I understand the purpose of the "fwait" command and it use to control the "speed" (for want of a better word) of the program. What I would like to know is... is there a way for N7 to display the current FPS? For example: If I wanted to check the performance impact by moving more and more sprites on the screen... Or even like an FPS counter when running stress tests... that kind of thing...  I hope that I am making sense... Just curious...

J
Logic is the beginning of wisdom.
Reply
#2
(Today, 02:29 AM)johnno56 Wrote: Quick question.

I understand the purpose of the "fwait" command and it use to control the "speed" (for want of a better word) of the program. What I would like to know is... is there a way for N7 to display the current FPS? For example: If I wanted to check the performance impact by moving more and more sprites on the screen... Or even like an FPS counter when running stress tests... that kind of thing...  I hope that I am making sense... Just curious...

J

Perhaps like this one .....

Code:
set window "FPS Checker",400,300

set redraw off

' Variables to calculate FPS
time_start = time()
frame_count = 0
fps = 0
fw = 60

'Main Loop
while not keydown(KEY_ESCAPE,true)
    ' Clear screen
    set color 32,32,32
    cls

    ' Frame counting
    frame_count = frame_count +1
    time_now = time()

    ' Calculate FPS every second
    if time_now - time_start >= 1 then
        fps = (frame_count) / (time_now - time_start)
        time_start = time_now
        frame_count = 0
    endif

    ' Display FPS
    set caret width()/2, height()/2
    set color 255,255,255
    center "Current FPS: " + fps

    ' Update screen
    redraw
   
    if keydown(KEY_UP,true) then fw = fw + 10
    if keydown(KEY_DOWN,true) then fw = fw - 10
   
    fwait fw

wend
Reply
#3
Excellent! Thank you!
Logic is the beginning of wisdom.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)