/clops-gui

Primary LanguageCommon Lisp

Clops-Gui

A system that uses cl-gtk4 and allows other apps to use its GUI capabilities for drawing canvas, menu and events. Quite limited subset of Gtk4 capabilities has been implemented, but it may be enough for simple 2D graphics or games.

So far it can only do multiple windows that contain only one widget, that is DrawingArea. The examples folder will contain examples of using the system.

There is a limitation bohonghuang/cl-gtk4#58 of what the underlying library can do, so you may have to implement your own widget system similar to those in Smalltalk systems.

Perhaps it would be possible to have a declarative way to define other widgets than DrawingArea, in similar manner to function menu-bar-menu is used for menu, but that is not my priority.

Usage

(load "~/Programming/Lisp/clops-gui/examples/example.lisp")

Installation

You need SBCL, quicklisp and ultralisp. Please follow the relevant instructions.

also install development libraries

sudo apt install libgtk-4-dev

coding conventions

discussion about prepending functions with % https://www.reddit.com/r/Common_Lisp/comments/jgj9lu/naming_conventions/

And some programmers will name particularly low-level functions with names that start with % or even %%. https://gigamonkeys.com/book/syntax-and-semantics

links

http://www.mohamedelafrit.com/education/ENSEIRB/lisp/standards.pdf

https://ccrma.stanford.edu/CCRMA/Courses/AlgoComp/cm/doc/contrib/lispstyle.html https://lisp-lang.org/style-guide/

https://github.com/bbatsov/emacs-lisp-style-guide

https://www.cliki.net/naming+conventions

https://softwareengineering.stackexchange.com/questions/363084/use-labels-or-nested-flet

linting

not so good, rather disappointing

CL-USER> (ql:quickload :sblint)
CL-USER> (sblint:run-lint-directory "~/Programming/Lisp/clops-gui/")

notes

moving to app

file:~/Programming/Lisp/clops-gui/examples/example.lisp::1

remove gui-box from gui-window

file:src/gui-window.lisp::(defmethod add-child and the method below need to be somehow moved to gui-box

Interesting Gtk doc

Drawing model

https://docs.gtk.org/gtk4/drawing-model.html

event

Some events, like mouse motion are compressed so that only a single mouse motion event per clock cycle

update

running animation

layout

geometry changes, sizes and positions

paint

redrawing what needs redrawing

Great ideas

https://lisp-journey.gitlab.io/resources/

Archy

https://en.wikipedia.org/wiki/Archy_(software)

Archy has been compared as similar to the Emacs text editor, although its design begins from a clean slate.