defun-games / claylib

A Common Lisp 2D/3D game toolkit built on top of Raylib 4.5.
zlib License
69 stars 4 forks source link

Problems with example "scroll-panel" #79

Open Filipp-Druan opened 1 year ago

Filipp-Druan commented 1 year ago

I tested a scroll panel (https://github.com/defun-games/claylib/blame/main/examples/gui/scroll-panel.lisp) example, and found one error. The scroll-panel example don't work on SBCL 2.3.5 (Manjaro). Then I call the MAIN function, I had an error: The value of SCROLL is #<CLAYLIB::VECTOR2 :X 99.0 :Y -20.0 :C-PTR #.(SB-SYS:INT-SAP #X7F3774AAF300) :CHILDREN #<HASH-TABLE :TEST EQL :COUNT 0 {1003BC14A3}> >, which is not of type SB-SYS:SYSTEM-AREA-POINTER. I find, what problem in this line: https://github.com/defun-games/claylib/blob/3eb86bc5f6b88570e053e0eefed66384d2c28365/examples/gui/scroll-panel.lisp#L92 (gui-scroll-panel panel-rec "scroll panel" panel-content-rec panel-scroll :rec view)

The PANEL-SCROLL is a VECTOR2, but not SB-SYS:SYSTEM-AREA-POINTER. What I can to do?

P.S. The hash table definition is not beautiful. I suggest using an alist-hash-table.

shelvick commented 1 year ago

Both of the GUI examples need to be rewritten. The scroll panel one in particular never worked right because it was ported from the Raygui version, which didn't include all the necessary update logic (so it also never worked right).

Some changes were made awhile back to make the GUI features more like the rest of Claylib, e.g. with CLOS objects instead of just procedural draw calls. If you want some practice on the GUI side, it should be pretty easy to fix up the portable window example. That said, I'd generally recommend familiarizing yourself with the more basic non-GUI examples first.