abstract class
PF::Game
- PF::Game
- Reference
- Object
Defined in:
game.crConstant Summary
-
SHOW_FPS =
true
Constructors
Instance Method Summary
-
#clear(color : PF::Pixel)
Clear the screen to black, or optionally an RGB color
-
#clear(r = 0, g = 0, b = 0)
Clear the screen to black, or optionally an RGB color
- #controllers : Array(PF::Controller(LibSDL::Scancode))
- #controllers=(controllers : Array(PF::Controller(LibSDL::Scancode)))
-
#draw
Called to draw the current frame
- #draw_circle(*args, **options)
- #draw_circle(*args, **options, &)
- #draw_curve(*args, **options)
- #draw_curve(*args, **options, &)
- #draw_line(*args, **options)
- #draw_line(*args, **options, &)
- #draw_point(*args, **options)
- #draw_point(*args, **options, &)
- #draw_rect(*args, **options)
- #draw_rect(*args, **options, &)
- #draw_spline(*args, **options)
- #draw_spline(*args, **options, &)
- #draw_string(*args, **options)
- #draw_string(*args, **options, &)
- #draw_triangle(*args, **options)
- #draw_triangle(*args, **options, &)
-
#elapsed_milliseconds
Get the time (in milliseconds) since the engine started
-
#elapsed_seconds
Get the time (in seconds) since the engine started
- #fill_circle(*args, **options)
- #fill_circle(*args, **options, &)
- #fill_poly(*args, **options)
- #fill_poly(*args, **options, &)
- #fill_rect(*args, **options)
- #fill_rect(*args, **options, &)
- #fill_spline(*args, **options)
- #fill_spline(*args, **options, &)
- #fill_splines(*args, **options)
- #fill_splines(*args, **options, &)
- #fill_triangle(*args, **options)
- #fill_triangle(*args, **options, &)
-
#frame_seconds : Float64
Returns the time taken in seconds since the last frame
-
#height
Returns the height of the window and render area
-
#on_controller_input(dt : Float64)
Called when the controller has input override in your subclass to hook into this behavior
- #on_event(event : Event)
-
#on_exit
This method is called when the game loop has terminated override in your subclass to hook into this behavior
-
#on_mouse_button(event : Event)
Called when the mouse is clicked override in your subclass to hook into this behavior
-
#on_mouse_motion(cursor : PF2d::Vec)
Called when the mouse is moved override in your subclass to hook into this behavior
- #paint_triangle(*args, **options)
- #paint_triangle(*args, **options, &)
-
#plug_in(controller : Controller)
Register a controller to be aware of Events
-
#quit!
Stop the game loop
- #renderer : SDL::Renderer
-
#run!
Start the Game loop
- #running : Bool
- #running=(running : Bool)
- #scale : PF2d::Vec2(Int32)
- #scan_line(*args, **options)
- #scan_line(*args, **options, &)
- #screen : Sprite
- #screen=(screen : Sprite)
- #title : String
- #title=(title : String)
- #total_milliseconds
-
#update(dt : Float64)
Could be called multiple times per frame, used for updating the simulation
- #viewport : PF2d::Vec2(Int32)
- #viewport=(viewport : PF2d::Vec2(Int32))
-
#width
Returns the width of the window and render area
- #window : SDL::Window
Constructor Detail
Instance Method Detail
Clear the screen to black, or optionally an RGB color
Called when the controller has input override in your subclass to hook into this behavior
This method is called when the game loop has terminated override in your subclass to hook into this behavior
Called when the mouse is clicked override in your subclass to hook into this behavior
Called when the mouse is moved override in your subclass to hook into this behavior
Register a controller to be aware of Events
@controller = PF::Controller.new({
PF::Keys::RIGHT => "Move Right",
PF::Keys::LEFT => "Move Left",
})
plug_in @controller
Could be called multiple times per frame, used for updating the simulation