4 ms·
> So far tried fbdev (but doesn't work well with X), now playing with XCB. Another idea would be to use SDL which essentially provides functionality to make wi
by zetalemur 7y ago
> So far tried fbdev (but doesn't work well with X), now playing with XCB.
Another idea would be to use SDL which essentially provides functionality to make windows, draw pixels and handle input/output. If you do not want to use any library at all and do not mind low "resolution", you could use your terminal as window and regard characters as pixels. Sure, there is the curses library to abstract away different terminals, but if you do not care about platform independence you can just directly write escape sequences to the terminal.
- tomxor 7y agoI was indeed trying to avoid the big libraries, since this is just for personal use I don't care about cross platform which allows me to escape these potentially - I may well end up back at the SDL + OpenGL level later when features or performance are a concern. My current goal is to find a balance of least dependencies and least boilerplate to draw a pixel buffer so i can play with C, nothing more. Once I can do that without lots of fluf then i may be attracted to more advanced or complex methods later on when performance is desirable. I have done some visual things with the console and printf alone in the past which gave me a taste of C, but now I want some real pixels :)
- mntmoss 7y agoYou may want to try raylib. It's written by a teacher who uses it in the classroom and geared for this kind of "let me code games in C but with only one dependency" goal. It does more than you need but that's a common theme of useful libraries.
- tomxor 7y agoThanks, that sounds about right, i'll take a look.
- jfkebwjsbx 7y agoThen you should be using X11 directly!
- tomxor 7y agoMy goal is to attain a balance of least dependencies and boilerplate. From what I've read so far it seems that implementing xclient protocols directly would require considerably more boilerplate than using XCB, (and my understanding is that XCB is just that: a generic xclient implementation and nothing more). Please do elaborate if I'm wrong though! I would be delighted if it's possible to implement a simple subset minimally purely for displaying a pixel buffer without XCB?
- CmdrKrool 7y agoI'm not necessarily recommending you go this route in general, but this is a fantastically actionable article for going deep on various Linux graphics APIs including X11 right on the socket: http://betteros.org/tut/graphics1.php http://betteros.org/tut/graphics1.php
- tomxor 7y agoYes, I really like this article, I used it to get going with fbdev before I moved on to XCB, but only skimmed the remainder since it was avoiding libraries completely it was getting a little verbose (although on second thought DRM doesn't look too bad, and also I missed libdrm should probably see how much that can do). Just realized now revisiting this that the author also showed how to directly implement xclient! the example is rather large confirming my suspicions RE parent comments.
- jfkebwjsbx 7y agoI meant using Xlib, the client library for X11, which is going to always be available if you are using X! You can of course implement the library parts yourself, but that is more boilerplate.
- tomxor 7y agoXCB is actually lower level than xlib, in that sense it is more directly using X11 because unlike xlib it only really implements the client protocol and wraps it up into an interface. I was however planning on trying out Xlib anyway on my path of exploration from simplest/lowest level to complex/higher level libraries: fbdev, DRM < DirectFB, libdrm < XCB < Xlib < SDL et al.
- kovac 7y agoHave you tried A allegro5? Any take on which is better? I've tried both, but I'm too much of a newbie to have a reasonable opinion. Thinking of getting back on to one of the two.