Skip to content

smysloff/xlib-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XLib - First Steps

Code examples for simple applications using Xlib to work with windows on Unix-like operating systems with X Window System.

Translations

Description

X Window System is a client-server system for managing the display of windows for raster displays, widely used in Unix-like operating systems. X provides the basis for a graphical environment (GUI), handling the drawing and movement of windows on the screen, as well as interaction with the mouse and keyboard.

X11 is the name of the current version of the X Window System protocol.

Xlib (X Window System library) is a library that is part of the X Window System and implements X11. It provides access to low-level graphics system functions, allowing applications to work directly with window display and screen graphics content.

Code Examples

Here are some examples of how to use the Xlib library. These examples gradually reveal the basic concepts of working with a graphics server and solve typical tasks of building a graphical application.

All examples can be compiled with one command: make.

Each example can be compiled and run separately. The examples and how to run them are described in detail below.

  • Simple Window

make simple_window

Minimalistic example showing how to connect to the graphics server and open a window using the XCreateSimpleWindow() function.

  • Event Handling

make event_handling

Minimalistic example showing how to handle simple events. In this case, the window is closed when the Escape key is pressed.

  • Create Window

make create_window

Simple example demonstrating creating a window using the XCreateWindow() function, setting the window title, drawing a square in it, and handling window closing in the window manager.

  • Font Drawing

make font_drawing

Simple example demonstrating basic work with fonts.

  • Draw Rect

make draw_rect

Example in which a rotating rectangle is drawn in a window, which rotation can be controlled using the keys A, D, Left Arrow, Right Arrow, Space.

  • Dodger Game

make dodger_game

Simple game where you have to dodge hordes of bloodthirsty squares. Control is done using arrow keys or WASD.

Useful links

License

GNU GPL-3.0

About

Xlib basic code examples

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published