# mnit specific method to draw a sprite
# app is used to optain the assets and the display
# Each sprite should implements this method
- fun draw_on_display(app: ShootApp) do end
+ fun draw_on_display(app: App) do end
# Helper function to draw an image centered on the current sprite position
- fun draw_image(app: ShootApp, img: Image)
+ fun draw_image(app: App, img: Image)
do
app.display.blit_centered(img, (self.x.to_f/app.scale).to_i, (self.y.to_f/app.scale).to_i)
end
# Helper function to draw an image translated and rotated on the current sprite position
- fun draw_rotated_image(app: ShootApp, img: Image, dx, dy: Int, angle: Float)
+ fun draw_rotated_image(app: App, img: Image, dx, dy: Int, angle: Float)
do
app.display.blit_rotated(img, self.x.to_f/app.scale, self.y.to_f/app.scale, angle)
end
end
redef class Scene
- fun draw_on_display(app: ShootApp) do end
- fun input(app: ShootApp, input_event: InputEvent): Bool do return false
+ fun draw_on_display(app: App) do end
+ fun input(app: App, input_event: InputEvent): Bool do return false
end
redef class PlayScene
###
-class ShootApp
- super App
+redef class App
super View
var debug: Bool = false
end
end
- init do super
-
var scene: ShotScene
var img_hitbox: Image
scale = (800.0 * 600.0 / display.width.to_f / display.height.to_f).sqrt * 100.0
+ debug = args.length > 0 and args.first == "--debug"
+
# TODO load assets here
# ex: img = load_image( "img.png" )
# to get file located at assets/img.png before deployement
return
end
-var app = new ShootApp
-app.debug = args.length > 0 and args.first == "--debug"
+app.setup
app.run