Starting wrapping SDL_mixer.

This commit is contained in:
Erik Svedäng 2018-03-23 09:55:32 +01:00
parent 6a91fc5328
commit e2aa4792a4
2 changed files with 31 additions and 0 deletions

19
core/SDL_mixer.carp Normal file
View File

@ -0,0 +1,19 @@
(system-include "SDL2/SDL_mixer.h")
(add-lib "-lSDL2_mixer")
(Project.config "cflag" "-Wno-incompatible-pointer-types-discards-qualifiers")
(register-type Mix_Chunk)
(register-type Mix_Music)
(defmodule Mixer
(register default-format
Int
"MIX_DEFAULT_FORMAT")
;; freq format channels chunksize
(register open-audio
(Fn [Int Int Int Int] ())
"Mix_OpenAudio")
)

12
examples/sounds.carp Normal file
View File

@ -0,0 +1,12 @@
(load "SDL.carp")
(load "SDL_mixer.carp")
(defn draw [app rend state]
(SDL.bg rend &(SDL.rgb 255 0 0)))
(defn main []
(let [app (SDLApp.create "Sound Effects with SDL_mixer" 400 300)
rend @(SDLApp.renderer &app)]
(do
(SDLApp.run-with-callbacks &app SDLApp.default-event-handler id draw 0)
0)))