Dekita

Untitled

May 16th, 2013
156
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. # http://dekitarpg.wordpress.com/
  3. #===============================================================================
  4. #
  5. # Easily change the default FPS (frames per second) for your game, also allows
  6. # a slow key && a fast key, press to speed up the FPS (only for $TEST / $BTEST).
  7. # Requires $D13x Core to use Fast / Slow key functions.
  8. #
  9. #===============================================================================
  10. module FPS_Set
  11. #===============================================================================
  12. Use = true # Make false to disable snippet
  13. Fps = {
  14. :default => 60, # Default FPS (Vx Ace Default is 60)
  15. :slow => [:LSHIFT, 30], # Slow FPS => [ :key , fps ]
  16. :fast => [:L_CTRL, 120], # Fast FPS => [ :key , fps ]
  17. } # << Keep
  18. end
  19. #===============================================================================
  20. module Graphics
  21. #===============================================================================
  22. if FPS_Set::Use
  23. #---------------------------------------------------------------------------
  24. # Alias List
  25. #---------------------------------------------------------------------------
  26. class << self
  27. alias :update_fps :update
  28. end
  29. #---------------------------------------------------------------------------
  30. # Update
  31. #---------------------------------------------------------------------------
  32. def self.update
  33. update_fps
  34. update_de_fps
  35. end
  36. #---------------------------------------------------------------------------
  37. # Update FPS
  38. #---------------------------------------------------------------------------
  39. def self.update_de_fps
  40. if ($TEST || $BTEST) && $D13x[:CORE]
  41. if Keys.press?(Keys::Key[FPS_Set::Fps[:slow][0]])
  42. return unless self.frame_rate != FPS_Set::Fps[:slow][1]
  43. return self.frame_rate = FPS_Set::Fps[:slow][1]
  44. end
  45. if Keys.press?(Keys::Key[FPS_Set::Fps[:fast][0]])
  46. return unless self.frame_rate != FPS_Set::Fps[:fast][1]
  47. return self.frame_rate = FPS_Set::Fps[:fast][1]
  48. end
  49. end
  50. return unless self.frame_rate != FPS_Set::Fps[:default]
  51. return self.frame_rate = FPS_Set::Fps[:default]
  52. end
  53. end # << if FPS::Use
  54. end # << module Graphics
  55. #===============================================================================
  56. # http://dekitarpg.wordpress.com/
  57. #===============================================================================
RAW Paste Data