Skip to content

mikkun/gawk-sdl2

Repository files navigation

gawk-sdl2

GitHub top language GitHub release (latest by date) GitHub license

🎮 SDL2 bindings for gawk

Description

gawk-sdl2 provides a shared library extension for gawk to use the SDL2 library.

gawk-sdl2 screenshot

Note

This is an experimental project with a very limited number of available functions. Additionally, due to gawk storing all numbers as double-precision floating point numbers, it may not function properly on 64-bit systems.

Requirements

Installation

Install the Build Dependencies

# Debian-based distributions
sudo apt install build-essential
sudo apt install libsdl2-dev libsdl2-mixer-dev

# Fedora-based distributions
sudo dnf groupinstall "Development Tools" "Development Libraries"
sudo dnf install SDL2-devel SDL2_mixer-devel

# Arch-based distributions
sudo pacman -S base-devel
sudo pacman -S sdl2 sdl2_mixer

Clone the Repository

git clone https://github.com/mikkun/gawk-sdl2.git

Build the Extension

cd gawk-sdl2
make

Run the Example

cd examples
AWKLIBPATH=.. ./pong.awk

Usage

See examples/*.awk for usage.

Implemented Functions

🚧 Functions are being implemented as needed. The functions currently implemented are as follows:

SDL 2.0

  • SDL_BlitSurface
  • SDL_CreateRGBSurface
  • SDL_CreateRenderer
  • SDL_CreateTexture
  • SDL_CreateWindow
  • SDL_Delay
  • SDL_DestroyRenderer
  • SDL_DestroyTexture
  • SDL_DestroyWindow
  • SDL_FillRect
  • SDL_Gawk_CreateEvent
  • SDL_Gawk_CreateRect
  • SDL_Gawk_GetEventType
  • SDL_Gawk_GetKeyboardState
  • SDL_Gawk_PixelFormatToArray
  • SDL_Gawk_SurfaceToArray
  • SDL_Gawk_UpdateRect
  • SDL_GetError
  • SDL_GetTicks
  • SDL_GetWindowPixelFormat
  • SDL_HasIntersection
  • SDL_InitSubSystem
  • SDL_Init
  • SDL_PixelFormatEnumToMasks
  • SDL_PollEvent
  • SDL_QuitSubSystem
  • SDL_Quit
  • SDL_RenderClear
  • SDL_RenderCopy
  • SDL_RenderDrawLine
  • SDL_RenderDrawRect
  • SDL_RenderFillRect
  • SDL_RenderPresent
  • SDL_SetPaletteColors
  • SDL_SetRenderDrawColor
  • SDL_SetWindowTitle
  • SDL_ShowSimpleMessageBox
  • SDL_UpdateTexture
  • SDL_VERSIONNUM

SDL_mixer 2.0

  • Mix_AllocateChannels
  • Mix_CloseAudio
  • Mix_FreeChunk
  • Mix_FreeMusic
  • Mix_Gawk_Linked_Version
  • Mix_Gawk_QuerySpec
  • Mix_GetError
  • Mix_HaltChannel
  • Mix_HaltMusic
  • Mix_LoadMUS
  • Mix_LoadWAV
  • Mix_OpenAudio
  • Mix_PlayChannelTimed
  • Mix_PlayChannel
  • Mix_PlayMusic
  • Mix_PlayingMusic
  • Mix_Playing
  • Mix_SetDistance
  • Mix_SetMusicCMD
  • Mix_SetMusicPosition
  • Mix_SetPanning
  • Mix_SetPosition
  • Mix_SetReverseStereo
  • Mix_VolumeMusic

TODO

  • Implement more functions.

License

GNU General Public License v3.0 or later

Author

KUSANAGI Mitsuhisa

References