Skip to content

Demos fast blitting of a video buffer to the screen with scaling while respecting aspect-ratio in C99 for both SDL 2 and SDL 1

License

Notifications You must be signed in to change notification settings

hartwork/sdl_video_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build on Linux Enforce clang-format

SDL video demo (for both SDL 2 and SDL 1)

This repository demos fast blitting of a video buffer to the screen with scaling while respecting aspect-ratio in C99.

There are two versions with ~70% identical code, one for old SDL 1.x and one for current SDL 2.x. It has been an explicit goal to allow holding the two versions' code side by side easily, e.g. using Meld, and to be able to compare their performance.

The code is Software Libre licensed under GPL v3 or later.

Here's a quick 256 color recording of what to expect at runtime: Recording of sdl2_video_demo

Requirements

  • SDL 2.x
  • SDL 1.x (or sdl12-compat)
  • sdl-gfx for SDL 1.x (not sdl2-gfx)

e.g.:

# sudo apt install --no-install-recommends --yes -V \
    build-essential \
    libsdl1.2-dev \
    libsdl-gfx1.2-dev \
    libsdl2-dev

Compilation

# make CFLAGS='-O2 -pipe' -j
# ./sdl1_video_demo &
# ./sdl2_video_demo &

Hotkeys

  • f or F11 — toggle fullscreen
  • q or ESC — exit

About

Demos fast blitting of a video buffer to the screen with scaling while respecting aspect-ratio in C99 for both SDL 2 and SDL 1

Topics

Resources

License

Stars

Watchers

Forks