Skip to content

Commit

Permalink
#69 2D and 3D coordinates consistency: cursor position, scroll offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
borodust committed Jan 31, 2017
1 parent bd0f3b1 commit 257faed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ Experimental **bod**acious **g**ame **e**ngine written in **C**ommon **L**isp.
(ql:quickload '(:bodge-blobs :cl-bodge))
```

### Upstream sources
### Manually

Required foreign libraries:

| Library | Version | Dependent system
|---------|:-------:|-------------------------
| `libffi` | 3.0 | `cl-bodge/host`
| `glfw3` | 3.1 | `cl-bodge/host`
| `OpenAL` | 1.1 | `cl-bodge/audio`
| `ODE` | 0.14 | `cl-bodge/physics`
| `libsndfile` | 1.0 | `cl-bodge/resources`
| `OpenGL` | 4.1 | `cl-bodge/graphics`
| `libepoxy` | ?.? | `bodge-nanovg`
| `NanoVG` | ?.? | `bodge-nanovg`
| `Nuklear` | 1.20 | `bodge-nuklear`
| Library | Version | Dependent system
|--------------|:-------:|-------------------------
| `libffi` | 3.0 | `cl-bodge/host`
| `glfw3` | 3.1 | `cl-bodge/host`
| `OpenAL` | 1.1 | `cl-bodge/audio`
| `ODE` | 0.14 | `cl-bodge/physics`
| `libsndfile` | 1.0 | `cl-bodge/resources`
| `OpenGL` | 4.1 | `cl-bodge/graphics`
| `libepoxy` | ?.? | `bodge-nanovg`
| `NanoVG` | ?.? | `bodge-nanovg`
| `Nuklear` | 1.20 | `bodge-nuklear`


You need few CL dependencies installed manually:
Expand Down
12 changes: 7 additions & 5 deletions host/system.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@


(glfw:def-cursor-pos-callback on-cursor-movement (window x y)
(declare (ignore window))
(post (make-cursor-event x y)
(event-system-of *system*)))
(let ((height (second (glfw:get-window-size window))))
(post (make-cursor-event x (- height y))
(event-system-of *system*))))


(glfw:def-scroll-callback on-scroll (window x y)
(declare (ignore window))
(post (make-scroll-event x y)
(post (make-scroll-event x (- y))
(event-system-of *system*)))


Expand Down Expand Up @@ -158,7 +158,9 @@


(define-system-function cursor-position host-system ()
(glfw:get-cursor-position (window-of *system*)))
(let ((height (second (viewport-size))))
(destructuring-bind (x y) (glfw:get-cursor-position (window-of *system*))
(list x (- height y)))))


(define-system-function mouse-button-state host-system (button)
Expand Down
5 changes: 3 additions & 2 deletions poiu/poiu.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@


(defun register-cursor-position (x y)
(%nk:input-motion *handle* (floor x) (floor y)))
(%nk:input-motion *handle* (floor x) (floor (- (height-of *context*) y))))


(defun register-character-input (character)
Expand Down Expand Up @@ -149,4 +149,5 @@
(:middle %nk:+button-middle+)
(:right %nk:+button-right+)))
(nk-state (button-state->nk state)))
(%nk:input-button *handle* nk-button (floor x) (floor y) nk-state)))
(%nk:input-button *handle* nk-button
(floor x) (floor (- (height-of *context*) y)) nk-state)))

0 comments on commit 257faed

Please sign in to comment.