Closed bigos closed 1 year ago
Could you please clarify what you mean by "complex UI"? In fact, if you want to create a new widget in GTK, it is also done by using Cairo for drawing. However, currently, subclassing a GObject class in Lisp is not supported at present.
What if I want to create my own widgets and widget system to depend on Gtk as little as possible?
Here, you have the example of a simple tic-tac-toe game. But if I want to go further, creating more complex games, diagram programs, or specialist editors, the UI will become complex. My approach explores the ability to test the UI model without the use of Gtk. So, in the end, I can run a function that does the same as the callback for Cairo canvas drawing, but instead of drawing to a widget, it draws to a PNG file. That gives me the ability to visually verify that the code did what I want. I can have a series of snapshots and way to compare to previous runs without constantly creating screen grabs.
On Wed, 27 Sept 2023 at 07:11, bohonghuang @.***> wrote:
Could you please clarify what you mean by "complex UI"? In fact, if you want to create a new widget in GTK, it is also done by using Cairo for drawing. However, currently, subclassing a GObject class in Lisp is not supported at present.
— Reply to this email directly, view it on GitHub https://github.com/bohonghuang/cl-gtk4/issues/31#issuecomment-1736763081, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC72MQT556LVEVEJT6RE5DX4O7RPANCNFSM6AAAAAA5IL62XU . You are receiving this because you authored the thread.Message ID: @.***>
If you want to create complex applications like games, Cairo may not be the best choice, and an immediate UI based on OpenGL might better suit your needs. In OpenGL, you have the ability to draw any control you want and handle complex mouse or keyboard interactions on your own.
GTK supports creating an OpenGL context, and you can also use a lighter-weight library like GLFW. Common Lisp has mature bindings for these libraries as well.
Yes, but following discussions here:https://github.com/kaveh808/kons-9/discussions, I can see other issues. I was wondering how far I can go with Cairo before I need to switch to GLFW. And how can I test the underlying model without using Gtk.
Maybe that is a speculation outside the scope of your project.
Please feel free to close the issue.
Maybe that is a speculation outside the scope of your project.
Yes, but at the same time, I'm glad to see your attempts in this regard.
https://github.com/bigos/Pyrulis/blob/7086cd1a1cf455b2cf876e88ab7c511b50280232/Lisp/cl-gtk4-tictactoe.lisp#L1211
https://github.com/bigos/Pyrulis/blob/7086cd1a1cf455b2cf876e88ab7c511b50280232/Lisp/cl-gtk4-tictactoe.lisp#L326
What do you think about the idea of developing complex UI in separation from Gtk?