You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

2 years ago
(in-package :pong.client)
(defparameter *scene* nil)
(defun open-main-menu% ()
(setf *scene* (open-main-menu #'start-1-player-game
#'start-2-players-game
#'create-online-game
#'join-online-game)))
(defun start-1-player-game ()
(setf *scene* (open-game (make-instance 'local-game-1p) #'open-main-menu%)))
(defun start-2-players-game ()
(setf *scene* (open-game (make-instance 'local-game-2p) #'open-main-menu%)))
(defun create-online-game ()
(format t "~%Create online game."))
(defun join-online-game ()
(format t "~%Join online game."))
(defun main ()
(let* ((last-time nil)
(current-time (get-internal-real-time)))
(r:with-window (800 600 "Pariatech's Pong")
(gui:with-gui
(open-main-menu%)
(r:set-config-flags r:+flag-window-resizable+)
(r:set-target-fps 60)
(r:set-exit-key 0)
(loop
until (or (r:window-should-close) (scene-should-close *scene*))
do (setf last-time current-time)
(setf current-time (/ (get-internal-real-time) internal-time-units-per-second))
(let ((timelapse (- current-time last-time)))
(on-update *scene* timelapse))
(r:with-drawing
(r:clear-background r:+gray+)
(on-draw *scene*)
(r:draw-fps 20 20)))))))
(main)