Author Topic: frame rate/speed  (Read 14336 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: frame rate/speed
« Reply #30 on: September 25, 2010, 02:38:59 pm »
Ah ok, what is it for? Is it the code to slow down the game to a specific framerate when fewer stuff is drawn?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: frame rate/speed
« Reply #31 on: September 25, 2010, 02:45:09 pm »
What it does is perform an action at a certain rate.
Lemme explain it for you :) (Note that it is only an example ;D)
Code: [Select]
.Initialize variables for the program
0->C->X
.Just to make it look nice
ClrHome
.Set up the timer interrupt
fnInt(T,0
.Main program loop
Repeat getKey(0)
.If the counter is zero
!If C
.Display and increment X and put a new line
Disp X+1->X>Dec,i
.Reset the counter to 50 again
50->C
End
.Because Disp is silly
FnOn
End
.Clean up and return
LnReg
Return
.The timer
Lbl T
.Just decrement C
C-1->C
In short, it's an example program that counts up at regular intervals. Note that the only weakness to this method is, if you don't reset the counter when it reaches 0, it will have to count down all the way from 65535 to 0 again. (This normally should not be a problem)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: frame rate/speed
« Reply #32 on: September 25, 2010, 02:50:23 pm »
Ah ok. I assume this is less accurate if many actions are performed at once, though?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: frame rate/speed
« Reply #33 on: September 25, 2010, 02:54:07 pm »
No, it should as accurate as the interrupts are as timers, providing that you don't miss when the timer is 0. ;D
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: frame rate/speed
« Reply #34 on: September 25, 2010, 03:02:13 pm »
Ah ok, I was worried about when you had like 100 sprites to draw and another set of frames you had 1-2 :P
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: frame rate/speed
« Reply #35 on: September 25, 2010, 03:09:10 pm »
Actually, something I missed: if the counter will hit 0 n times per second, then taking over an nth of a second will cause it to skip a cycle. (Very similar to interrupt routines, in fact)
But, again, unless you do a lot of stuff, this shouldn't be a problem :)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.