X11 C & C++ Tutorial - Window, Input, Drawing

preview_player
Показать описание
This Month's Charity
St Jude Children's Research Hospital

Like, comment, and subscribe! 👍

Music

#x11 #libx11 #programming
Рекомендации по теме
Комментарии
Автор

Loved your video, it shows the basics and was very helpful. There is not a lot of content about the Xlib, bravo!

yohanntumpling
Автор

Nice. I would like to add a couple of comments here. This is supposed to work with plain C. Yet there are few additions that needs to be made.
1. There are function name collisions with the names imported from unistd, which gets included with Xos. You'll only see that if you compile with 'gcc' instead of 'g++'. One possible solution: add prefix 'm_' to functions 'init', 'draw' and 'close'.
2. I don't think it is a good idea to call 'exit' in a function that is not 'main'. Solution: remove 'exit' call and put a 'break' in the body of 'if' after the 'close'.

Bonus. You can include <stdbool.h> and use `true` in the while loop. As for the '(char *)0' it would be better to put NULL there or nullptr in case of C++.

linuxgaminginfullhdfps
Автор

4:50 explained ->
each int, r, g, b are made up of 8 bits
the long is the length of all integer bits added together with every 8 bits representing an r, then a b, then a g

the way an int stores numbers is by having each bit be worth double the value of the next -> 128 64 32 16 8 4 2 1)
if the bit is a 1, that number represented is part of the total (00001101 -> 13)

if two integers are added if they share a bit, the bit shared is turned off and the bit before that one is turned on + ->
the values of each integer plainly added together would mix, confusing the system and giving a weird value (00100101 + 00001011 -> 00110000)

To shift a bit or set of bits either direction we use >> or << depending on which way we want them shifted (00010100 >> 2 ->
Because each value is worth 8 bits and they're all in the same 24 bit space, we can easily move the ints into non-overlapping space
b(01010001) + (g(11000100) << 8) + (r(01110010) >> 16) -> (011100101100010001010001) -> ((r -> 01110010) (g -> 11000100) (b -> 01010001))

Now the rgb values don't overlap, are all represented, and are all stored in a single variable for ease of transportation.

lazerpie
Автор

Hey! Hope you guys enjoyed today's video. As always the code is in the description. If you have any questions let me know. This month's charity is St Jude Children's Hospital. Link in the desc. as well. Have a great one!

jarreed
Автор

please use whitespace, the text all bunched up is unreadable

v_ferrari
Автор

Xlib is native to Linux can't use to develop apps in Windows .

ramsharma-onhf
Автор

The heading is misleading instead of X11 C++ Tutorial it should read "X11 C -Tutorial" cause X11 does NOT have a C++ class structure. As C++ more errors proved and tight nested class structure,

imrank
Автор

Hi, is it possible to only show one or two window borders like you would with CSS? For example I would like a window with only the bottom border. Thank you.

OzGlove
Автор

anyone here using linux on bare metal, and just cant work with win32 gdi?

css
Автор

you're impressive.
but my g++ compiler find libX11 with -lX11, without libX11

leon