Skip to content

Commit 720241d

Browse files
committed
Port font editor to SDL2
Replace X11 with SDL2 to improve the portability and cross-platform support Migrated window creation from X11's `XCreateWindow` to `SDL_CreateWindow`. Replaced X11 event handling with SDL2’s event loop (`SDL_PollEvent`) to capture input events such as keyboard and mouse interactions. Updated rendering to use `SDL_Renderer` and `SDL_Surface`, replacing X11's rendering functions. * Modified some key event logic: 1. SDLK_ESCAPE: ESC now exits the program. 2. SDL_QUIT: Clicking the "X" on the window exits the program. * Unchanged key event logic: 1. SDLK_q: Switches to the next font. * Features not fully implemented yet: 1. SDLK_s, SDLK_u, SDLK_f, SDLK_d, SDLK_DOWN: Handling logic for stripe drawing operations. 2. SDL_WINDOWEVENT, SDL_MOUSEBUTTONDOWN.
1 parent 9efea6e commit 720241d

File tree

4 files changed

+161
-146
lines changed

4 files changed

+161
-146
lines changed

tools/font-edit/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
TARGET = twin-fedit
22

3-
CFLAGS = $(shell pkg-config --cflags cairo x11) -g -Wall
4-
LIBS = $(shell pkg-config --libs cairo x11)
3+
CFLAGS = $(shell pkg-config --cflags cairo) $(shell sdl2-config --cflags) -g -Wall
4+
LIBS = $(shell pkg-config --libs cairo) $(shell sdl2-config --libs)
55

66
OBJS = \
77
twin-fedit.o \

tools/font-edit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ screens.
55

66
## Build Dependency
77
```shell
8-
sudo apt-get install libx11-dev libcairo2-dev
8+
sudo apt-get install libsdl2-dev libcairo2-dev
99
```
1010

1111
## Usage

0 commit comments

Comments
 (0)