mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-17 16:38:14 +03:00
Starting wrapping SDL_mixer.
This commit is contained in:
parent
6a91fc5328
commit
e2aa4792a4
19
core/SDL_mixer.carp
Normal file
19
core/SDL_mixer.carp
Normal 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
12
examples/sounds.carp
Normal 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)))
|
Loading…
Reference in New Issue
Block a user