Use new entity API
This commit is contained in:
parent
7ce11ace97
commit
43edd539f4
1 changed files with 11 additions and 10 deletions
|
|
@ -21,18 +21,18 @@
|
||||||
|
|
||||||
(defun setup-input ()
|
(defun setup-input ()
|
||||||
(global-set-key :escape #'quit)
|
(global-set-key :escape #'quit)
|
||||||
(global-set-key (:e :continuous) (lambda () (move (get-first-component (main-camera (world)) :graph-node) :dz -0.1)))
|
(global-set-key (:e :continuous) (lambda () (move (component (main-camera) 'scene-object-component) :dz -0.1)))
|
||||||
(global-set-key (:j :continuous) (lambda () (move (get-first-component (main-camera (world)) :graph-node) :dz 0.1)))
|
(global-set-key (:j :continuous) (lambda () (move (component (main-camera) 'scene-object-component) :dz 0.1)))
|
||||||
(global-set-key (:q :continuous) (lambda () (move (get-first-component (main-camera (world)) :graph-node) :dx -0.1)))
|
(global-set-key (:q :continuous) (lambda () (move (component (main-camera) 'scene-object-component) :dx -0.1)))
|
||||||
(global-set-key (:k :continuous) (lambda () (move (get-first-component (main-camera (world)) :graph-node) :dx 0.1)))
|
(global-set-key (:k :continuous) (lambda () (move (component (main-camera) 'scene-object-component) :dx 0.1)))
|
||||||
(global-set-key (:o :continuous) (lambda () (rotate (get-first-component (main-camera (world)) :graph-node) :dz -2)))
|
(global-set-key (:o :continuous) (lambda () (rotate (component (main-camera) 'scene-object-component) :dz -2)))
|
||||||
(global-set-key (:u :continuous) (lambda () (rotate (get-first-component (main-camera (world)) :graph-node) :dz 2)))
|
(global-set-key (:u :continuous) (lambda () (rotate (component (main-camera) 'scene-object-component) :dz 2)))
|
||||||
(let (freelook-mode)
|
(let (freelook-mode)
|
||||||
(flet ((set-freelook (enable)
|
(flet ((set-freelook (enable)
|
||||||
(setf freelook-mode enable))
|
(setf freelook-mode enable))
|
||||||
(freelook-move (dx dy)
|
(freelook-move (dx dy)
|
||||||
(when freelook-mode
|
(when freelook-mode
|
||||||
(rotate (get-first-component (main-camera (world)) :graph-node) :dx dx :dy dy))))
|
(rotate (component (main-camera) 'scene-object-component) :dx dx :dy dy))))
|
||||||
(global-set-key 3 #'set-freelook t)
|
(global-set-key 3 #'set-freelook t)
|
||||||
(global-set-key (3 :release) #'set-freelook nil)
|
(global-set-key (3 :release) #'set-freelook nil)
|
||||||
(global-set-motion #'freelook-move :dx :dy))))
|
(global-set-motion #'freelook-move :dx :dy))))
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
(defun initialize (&optional argv)
|
(defun initialize (&optional argv)
|
||||||
(declare (ignore argv))
|
(declare (ignore argv))
|
||||||
(setup-input)
|
(setup-input)
|
||||||
(create-world))
|
(create-world "World"))
|
||||||
|
|
||||||
(defun finalize ())
|
(defun finalize ())
|
||||||
|
|
||||||
|
|
@ -48,7 +48,8 @@
|
||||||
(declare (ignore delta-time))
|
(declare (ignore delta-time))
|
||||||
(unless (null (world))
|
(unless (null (world))
|
||||||
(locking-scene
|
(locking-scene
|
||||||
(when (main-camera (world))
|
(with-components (camera-component scene-object-component) (main-camera)
|
||||||
(update-view (get-first-component (main-camera (world)) :camera))))))
|
(with-slots (position direction) scene-object-component
|
||||||
|
(update-view camera-component position direction))))))
|
||||||
|
|
||||||
(defmodule stoe-game :game)
|
(defmodule stoe-game :game)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue