-- | Provides SDL utlities for Mischief.
module Mischief.SDL
  ( -- * What is SDL?
    -- $whatis

    -- * Installing SDL
    -- $installing
    SDLPlugin,
    module Mischief.SDL.Events,
    module Mischief.SDL.Window,
  )
where

import Mischief.ECS (Plugin (..), dep)
import Mischief.SDL.Events
import Mischief.SDL.Window

data SDLPlugin

instance Plugin SDLPlugin where
  deps :: [Dependency]
deps = [forall p. Plugin p => Dependency
dep @SDLEventsPlugin, forall p. Plugin p => Dependency
dep @WindowPlugin]

-- $whatis
-- [SDL](https://wiki.libsdl.org) is a C library offering low-level tools for windows, input, rendering, etc.
-- A lot of the official Mischief libraries (such as @mischief-input@ and @mischief-render@) use this library,
-- and therefore require SDL to be installed.

-- $installing
-- The current official version of SDL used is @sdl-3.4.18@. You should
-- find this pre-built for most Operating Systems, and installing it is relatively easy.
--
-- These install instructions are mostly copied from [sdl3-bindgen-sys](https://hackage.haskell.org/package/sdl3-bindgen-sys)'s readme.
--
-- * Debian / Ubuntu
--
-- @
-- apt install libsdl3-dev-3.4.18
-- @
--
-- * MacOS
--
-- @
-- -- uninstall sdl3 if you have it
-- brew tap-new $USER/local
-- brew extract --version=3.4.18 sdl3 $USER/local
-- brew install $USER/local/sdl3@3.4.18
-- @
--
-- * Arch
--
-- @
-- pacman -S sdl3@3.4.18
-- @
--
-- * Fedora
--
-- @
-- dnf install SDL3-devel-3.4.18
-- @
--
-- * Windows
--
-- @
-- pacman -Syyu # repeat/restart terminal if pacman asks you to
-- pacman -S mingw-w64-ucrt-x86_64-sdl3-3.4.18 mingw-w64-ucrt-x86_64-pkgconf
-- @