frusdl 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +51 -0
- data/lib/frusdl.rb +145 -0
- data/lib/frusdl/low.rb +30 -0
- data/lib/frusdl/low/gfx.rb +95 -0
- data/lib/frusdl/low/img.rb +10 -0
- data/lib/frusdl/low/mix.rb +138 -0
- data/lib/frusdl/low/sdl.rb +881 -0
- data/lib/frusdl/low/sge.rb +100 -0
- data/lib/frusdl/low/ttf.rb +95 -0
- data/lib/frusdl/sdl.rb +425 -0
- data/lib/frusdl/sdl/pixelformat.rb +78 -0
- data/lib/frusdl/sdl/screen.rb +199 -0
- data/lib/frusdl/sdl/surface.rb +0 -0
- data/lib/frusdl/sdl/videoinfo.rb +23 -0
- data/lib/frusdl/wrap.rb +49 -0
- metadata +79 -0
data/README
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
###########################################
|
2
|
+
# FRUSDL - Ffi RUby SDL bindings - README #
|
3
|
+
###########################################
|
4
|
+
|
5
|
+
|
6
|
+
What is it?
|
7
|
+
===========
|
8
|
+
Wafer-thin bindings to SDL, SDL_image, SDL_ttf, SDL_mixer, SDL_gfx, and
|
9
|
+
SGE for MRI, Jruby, Rubinius, ... using FFI. You will be able to easily port
|
10
|
+
your Ruby/SDL games to JRuby.
|
11
|
+
|
12
|
+
For now, only a few high-level, Ruby/SDL compatible objects are available.
|
13
|
+
But the low level wrappers should work fine for experimenting, or even to program a
|
14
|
+
quick demo game.
|
15
|
+
|
16
|
+
Goal
|
17
|
+
=====
|
18
|
+
|
19
|
+
Source code compatibility with Ruby/SDL 2.0.1 or higher, but with lower level
|
20
|
+
functions available. All help for towards this goal is welcome.
|
21
|
+
|
22
|
+
Version
|
23
|
+
=======
|
24
|
+
|
25
|
+
0.0.1
|
26
|
+
|
27
|
+
Requirements
|
28
|
+
============
|
29
|
+
* Ruby: MRI 1.9.1 or higher, JRuby 1.1.6 or higher. Rubinius currently untested.
|
30
|
+
* FFI: Version 0.2.0 or higher or MRI.
|
31
|
+
* The shared libraries for SDL 1.2.x, SDL_image, SDL_ttf, SDL_mixer, SDL_gfx
|
32
|
+
or SGE should be installed properly on your system.
|
33
|
+
|
34
|
+
Documentation
|
35
|
+
=============
|
36
|
+
|
37
|
+
None yet. Check out the documentation of SDL itself, since the
|
38
|
+
low level interface to sdl in Frusdl::Low should be mostly compatible with
|
39
|
+
the C way of doing things, if you include Frusdl::Low. Alternatively,
|
40
|
+
use the source, Ruke. ^_^
|
41
|
+
|
42
|
+
License
|
43
|
+
=======
|
44
|
+
|
45
|
+
ZLIB license. Please note that SDL has a LGPL license. However, FRUSDL
|
46
|
+
uses dynamic linking, so , I think it should be fine.
|
47
|
+
|
48
|
+
Contact
|
49
|
+
=======
|
50
|
+
|
51
|
+
beoran AT rubyforge POINT org
|
data/lib/frusdl.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
#
|
2
|
+
# Frusdl : Wafer-thin bindings to SDL, SDL_image, SDL_ttf, SDL_mixer, SDL_gfx,
|
3
|
+
# and SGE for MRI, Jruby, Rubinius, ... using FFI
|
4
|
+
#
|
5
|
+
# Goal: source code compatibility with Ruby/SDL 2.0.1,
|
6
|
+
# but with lower level functions available.
|
7
|
+
#
|
8
|
+
# Version: 0.0.1
|
9
|
+
#
|
10
|
+
# Requirements:
|
11
|
+
# * Ruby ( MRI or JRUBY 1.1.6 or higher)
|
12
|
+
# * FFI ( version 0.2.0 or higher or MRI)
|
13
|
+
# * The shared libraries for SDL 1.2.x, SDL_image, SDL_ttf, SDL_mixer, SDL_gfx
|
14
|
+
# or SGE should be installed properly on your system.
|
15
|
+
#
|
16
|
+
# Licence: ZLIB license.
|
17
|
+
#
|
18
|
+
# Frusdl
|
19
|
+
#
|
20
|
+
# Copyright (c) 2008, Bjorn De Meyer
|
21
|
+
#
|
22
|
+
# This software is provided 'as-is', without any express or implied
|
23
|
+
# warranty. In no event will the authors be held liable for any damages
|
24
|
+
# arising from the use of this software.
|
25
|
+
#
|
26
|
+
# Permission is granted to anyone to use this software for any purpose,
|
27
|
+
# including commercial applications, and to alter it and redistribute it
|
28
|
+
# freely, subject to the following restrictions:
|
29
|
+
# 1. The origin of this software must not be misrepresented; you must not
|
30
|
+
# claim that you wrote the original software. If you use this software
|
31
|
+
# in a product, an acknowledgment in the product documentation would be
|
32
|
+
# appreciated but is not required.
|
33
|
+
#
|
34
|
+
# 2. Altered source versions must be plainly marked as such, and must not be
|
35
|
+
# misrepresented as being the original software.
|
36
|
+
#
|
37
|
+
# 3. This notice may not be removed or altered from any source
|
38
|
+
# distribution.
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
begin
|
43
|
+
require 'rubygems'
|
44
|
+
rescue
|
45
|
+
# try to load Rubygems, but don't care if it fails.
|
46
|
+
end
|
47
|
+
|
48
|
+
require 'ffi'
|
49
|
+
# We need FFI
|
50
|
+
|
51
|
+
|
52
|
+
module Frusdl
|
53
|
+
# Low level FFI functions and structures
|
54
|
+
autoload :Low , 'frusdl/low'
|
55
|
+
# Meta programming helper that makes writing wrappers easier.
|
56
|
+
autoload :Wrap , 'frusdl/wrap'
|
57
|
+
# High level SDL wrapper, compatible with Ruby/SDL, unimplemented for now.
|
58
|
+
autoload :SDL , 'frusdl/sdl'
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
# Source code compatibility with Ruby/SDL
|
63
|
+
unless defined? SDL
|
64
|
+
# SDL = Frusdl
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
if $0 == __FILE__
|
73
|
+
|
74
|
+
def peek_at_proc
|
75
|
+
puts `ps u -p #{Process.pid}`
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
include Frusdl::Low
|
81
|
+
|
82
|
+
puts SDL.SDL_getenv('HOME')
|
83
|
+
|
84
|
+
|
85
|
+
fontname = '/usr/share/fonts/liberation/LiberationSerif-Regular.ttf'
|
86
|
+
Frusdl::SDL.init(Frusdl::SDL::INIT_EVERYTHING)
|
87
|
+
p Frusdl::SDL::Screen.driver_name
|
88
|
+
p Frusdl::SDL::Screen.list_modes(nil, SDL::SDL_FULLSCREEN)
|
89
|
+
info = Frusdl::SDL::Screen.info
|
90
|
+
p info.video_mem
|
91
|
+
p info.current_w
|
92
|
+
p info.current_h
|
93
|
+
p info.pixel_format.alpha
|
94
|
+
# at_exit { SDL.SDL_Quit() }
|
95
|
+
TTF.TTF_Init()
|
96
|
+
at_exit { TTF.TTF_Quit() }
|
97
|
+
fontp = TTF.TTF_OpenFont(fontname, 20)
|
98
|
+
screen2 = Frusdl::SDL::Screen.open(640, 480, 32, SDL::SDL_HWSURFACE | SDL::SDL_DOUBLEBUF )
|
99
|
+
p screen2.w
|
100
|
+
p screen2.h
|
101
|
+
screenp = screen2.pointer
|
102
|
+
# screenp = SDL.SDL_SetVideoMode(640, 480, 32, SDL::SDL_HWSURFACE | SDL::SDL_DOUBLEBUF )
|
103
|
+
# surf = SDL.SDL_CreateRGBSurface(0, 32, 32, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000)
|
104
|
+
|
105
|
+
njoy = SDL.SDL_NumJoysticks()
|
106
|
+
puts "You have a joystick: " if njoy == 1
|
107
|
+
puts "You have #{njoy} joysticks: " if njoy > 1
|
108
|
+
puts "No joysticks found!" if njoy < 1
|
109
|
+
for i in (0...njoy) do
|
110
|
+
puts SDL.SDL_JoystickName(i)
|
111
|
+
end
|
112
|
+
|
113
|
+
peek_at_proc
|
114
|
+
|
115
|
+
screen = SDL::SDL_Surface.new(screenp)
|
116
|
+
rect = SDL::SDL_Rect.new
|
117
|
+
screen_format = SDL::SDL_PixelFormat.new(screen[:format])
|
118
|
+
white = SDL::SDL_MapRGB(screen_format, 255,255,255)
|
119
|
+
blue = SDL::SDL_MapRGB(screen_format, 0, 0, 128)
|
120
|
+
p screen_format[:bitsperpixel]
|
121
|
+
rect[:w] = 640
|
122
|
+
rect[:h] = 20
|
123
|
+
mesg = "SDL and Ruby are sitting on a tree... K I S S I N G!"
|
124
|
+
textp = TTF.TTF_RenderUTF8_Blended(fontp, mesg, white)
|
125
|
+
event = SDL::SDL_Event.new
|
126
|
+
|
127
|
+
loop do
|
128
|
+
polled = SDL.SDL_PollEvent(event.pointer)
|
129
|
+
if polled > 0
|
130
|
+
break if event[:type] == SDL::SDL_QUIT
|
131
|
+
end
|
132
|
+
SDL.SDL_FillRect(screen.pointer, rect.pointer, blue)
|
133
|
+
# SGE.sge_FilledEllipse(screenp, 300, 100, 10, 20, blue)
|
134
|
+
SDL.SDL_UpperBlit(textp, nil, screen, rect)
|
135
|
+
screen2.flip
|
136
|
+
# And flip the screen
|
137
|
+
end
|
138
|
+
|
139
|
+
SDL.SDL_FreeSurface(textp)
|
140
|
+
# Free the rendered text surface.
|
141
|
+
GC.start # force collection
|
142
|
+
puts "End"
|
143
|
+
peek_at_proc
|
144
|
+
end
|
145
|
+
|
data/lib/frusdl/low.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (c) 2008, Bjorn De Meyer
|
2
|
+
#
|
3
|
+
# This software is provided 'as-is', without any express or implied
|
4
|
+
# warranty. In no event will the authors be held liable for any damages
|
5
|
+
# arising from the use of this software.
|
6
|
+
#
|
7
|
+
# Permission is granted to anyone to use this software for any purpose,
|
8
|
+
# including commercial applications, and to alter it and redistribute it
|
9
|
+
# freely, subject to the following restrictions:
|
10
|
+
# 1. The origin of this software must not be misrepresented; you must not
|
11
|
+
# claim that you wrote the original software. If you use this software
|
12
|
+
# in a product, an acknowledgment in the product documentation would be
|
13
|
+
# appreciated but is not required.
|
14
|
+
#
|
15
|
+
# 2. Altered source versions must be plainly marked as such, and must not be
|
16
|
+
# misrepresented as being the original software.
|
17
|
+
#
|
18
|
+
# 3. This notice may not be removed or altered from any source
|
19
|
+
# distribution.
|
20
|
+
|
21
|
+
module Frusdl
|
22
|
+
module Low
|
23
|
+
autoload :IMG, 'frusdl/low/img'
|
24
|
+
autoload :GFX, 'frusdl/low/gfx'
|
25
|
+
autoload :MIX, 'frusdl/low/mix'
|
26
|
+
autoload :SDL, 'frusdl/low/sdl'
|
27
|
+
autoload :SGE, 'frusdl/low/sge'
|
28
|
+
autoload :TTF, 'frusdl/low/ttf'
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Copyright (c) 2008, Bjorn De Meyer
|
2
|
+
#
|
3
|
+
# This software is provided 'as-is', without any express or implied
|
4
|
+
# warranty. In no event will the authors be held liable for any damages
|
5
|
+
# arising from the use of this software.
|
6
|
+
#
|
7
|
+
# Permission is granted to anyone to use this software for any purpose,
|
8
|
+
# including commercial applications, and to alter it and redistribute it
|
9
|
+
# freely, subject to the following restrictions:
|
10
|
+
# 1. The origin of this software must not be misrepresented; you must not
|
11
|
+
# claim that you wrote the original software. If you use this software
|
12
|
+
# in a product, an acknowledgment in the product documentation would be
|
13
|
+
# appreciated but is not required.
|
14
|
+
#
|
15
|
+
# 2. Altered source versions must be plainly marked as such, and must not be
|
16
|
+
# misrepresented as being the original software.
|
17
|
+
#
|
18
|
+
# 3. This notice may not be removed or altered from any source
|
19
|
+
# distribution.
|
20
|
+
|
21
|
+
module Frusdl
|
22
|
+
module Low
|
23
|
+
# Alternative graphics primitives library
|
24
|
+
module GFX
|
25
|
+
extend FFI::Library
|
26
|
+
ffi_lib('SDL_gfx')
|
27
|
+
|
28
|
+
attach_function :pixelColor , [:pointer, :short, :short, :ulong], :int
|
29
|
+
attach_function :pixelRGBA , [:pointer, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
30
|
+
attach_function :hlineColor , [:pointer, :short, :short, :short, :ulong], :int
|
31
|
+
attach_function :hlineRGBA , [:pointer, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
32
|
+
attach_function :vlineColor , [:pointer, :short, :short, :short, :ulong], :int
|
33
|
+
attach_function :vlineRGBA , [:pointer, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
34
|
+
attach_function :rectangleColor, [:pointer, :short, :short, :short, :short, :ulong], :int
|
35
|
+
attach_function :rectangleRGBA , [:pointer, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
36
|
+
attach_function :boxColor , [:pointer, :short, :short, :short, :short, :ulong], :int
|
37
|
+
attach_function :boxRGBA , [:pointer, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
38
|
+
attach_function :lineColor , [:pointer, :short, :short, :short, :short, :ulong], :int
|
39
|
+
attach_function :lineRGBA , [:pointer, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
40
|
+
attach_function :aalineColor , [:pointer, :short, :short, :short, :short, :ulong], :int
|
41
|
+
attach_function :aalineRGBA , [:pointer, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
42
|
+
attach_function :circleColor , [:pointer, :short, :short, :short, :ulong], :int
|
43
|
+
attach_function :circleRGBA , [:pointer, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
44
|
+
attach_function :aacircleColor, [:pointer, :short, :short, :short, :ulong], :int
|
45
|
+
attach_function :aacircleRGBA , [:pointer, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
46
|
+
attach_function :filledCircleColor, [:pointer, :short, :short, :short, :ulong], :int
|
47
|
+
attach_function :filledCircleRGBA , [:pointer, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
48
|
+
attach_function :ellipseColor , [:pointer, :short, :short, :short, :short, :ulong], :int
|
49
|
+
attach_function :ellipseRGBA , [:pointer, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
50
|
+
attach_function :aaellipseColor , [:pointer, :short, :short, :short, :short, :ulong], :int
|
51
|
+
attach_function :aaellipseRGBA , [:pointer, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
52
|
+
|
53
|
+
attach_function :pieColor , [:pointer, :short, :short, :short, :short, :short, :ulong], :int
|
54
|
+
attach_function :pieRGBA , [:pointer, :short, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
55
|
+
attach_function :filledPieColor, [:pointer, :short, :short, :short, :short, :short, :ulong], :int
|
56
|
+
attach_function :filledPieRGBA , [:pointer, :short, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
57
|
+
attach_function :trigonColor , [:pointer, :short, :short, :short, :short, :short, :short, :ulong], :int
|
58
|
+
attach_function :trigonRGBA , [:pointer, :short, :short, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
59
|
+
attach_function :aatrigonColor , [:pointer, :short, :short, :short, :short, :short, :short, :ulong], :int
|
60
|
+
attach_function :aatrigonRGBA , [:pointer, :short, :short, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
61
|
+
attach_function :filledTrigonColor, [:pointer, :short, :short, :short, :short, :short, :short, :ulong], :int
|
62
|
+
attach_function :filledTrigonRGBA , [:pointer, :short, :short, :short, :short, :short, :short, :uchar, :uchar, :uchar, :uchar], :int
|
63
|
+
attach_function :polygonColor, [:pointer, :pointer, :pointer, :int, :ulong], :int
|
64
|
+
attach_function :polygonRGBA , [:pointer, :pointer, :pointer, :int, :uchar, :uchar, :uchar, :uchar], :int
|
65
|
+
attach_function :aapolygonColor, [:pointer, :pointer, :pointer, :int, :ulong], :int
|
66
|
+
attach_function :aapolygonRGBA , [:pointer, :pointer, :pointer, :int, :uchar, :uchar, :uchar, :uchar], :int
|
67
|
+
attach_function :filledPolygonColor, [:pointer, :pointer, :pointer, :int, :ulong], :int
|
68
|
+
attach_function :filledPolygonRGBA , [:pointer, :pointer, :pointer, :int, :uchar, :uchar, :uchar, :uchar], :int
|
69
|
+
attach_function :texturedPolygon, [:pointer, :pointer, :pointer, :int, :pointer, :int, :int], :int
|
70
|
+
attach_function :bezierColor, [:pointer, :pointer, :pointer, :int, :int, :ulong], :int
|
71
|
+
attach_function :bezierRGBA , [:pointer, :pointer, :pointer, :int, :int, :uchar, :uchar, :uchar, :uchar], :int
|
72
|
+
|
73
|
+
SMOOTHING_OFF = 0
|
74
|
+
SMOOTHING_ON = 1
|
75
|
+
|
76
|
+
# Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
|
77
|
+
attach_function :rotozoomSurface , [:pointer, :double, :double, :int], :pointer
|
78
|
+
attach_function :rotozoomSurfaceXY, [:pointer, :double, :double, :double, :int], :pointer
|
79
|
+
# Returns the size of the target surface for a rotozoomSurface() call
|
80
|
+
attach_function :rotozoomSurfaceSize, [:int, :int, :double, :double, :pointer, :pointer], :void
|
81
|
+
attach_function :rotozoomSurfaceSizeXY, [:int, :int, :double, :double, :double, :pointer, :pointer], :void
|
82
|
+
# Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
|
83
|
+
attach_function :zoomSurface, [:pointer, :double, :double, :int], :pointer
|
84
|
+
# Returns the size of the target surface for a zoomSurface() call
|
85
|
+
attach_function :zoomSurfaceSize, [:int, :int, :double, :double, :pointer, :pointer], :void
|
86
|
+
# Shrinks a 32bit or 8bit 'src' surface to a newly created 'dst' surface.
|
87
|
+
attach_function :shrinkSurface, [:pointer, :int, :int], :pointer
|
88
|
+
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# Copyright (c) 2008, Bjorn De Meyer
|
2
|
+
#
|
3
|
+
# This software is provided 'as-is', without any express or implied
|
4
|
+
# warranty. In no event will the authors be held liable for any damages
|
5
|
+
# arising from the use of this software.
|
6
|
+
#
|
7
|
+
# Permission is granted to anyone to use this software for any purpose,
|
8
|
+
# including commercial applications, and to alter it and redistribute it
|
9
|
+
# freely, subject to the following restrictions:
|
10
|
+
# 1. The origin of this software must not be misrepresented; you must not
|
11
|
+
# claim that you wrote the original software. If you use this software
|
12
|
+
# in a product, an acknowledgment in the product documentation would be
|
13
|
+
# appreciated but is not required.
|
14
|
+
#
|
15
|
+
# 2. Altered source versions must be plainly marked as such, and must not be
|
16
|
+
# misrepresented as being the original software.
|
17
|
+
#
|
18
|
+
# 3. This notice may not be removed or altered from any source
|
19
|
+
# distribution.
|
20
|
+
|
21
|
+
module Frusdl
|
22
|
+
module Low
|
23
|
+
module MIX
|
24
|
+
extend FFI::Library
|
25
|
+
ffi_lib('SDL_mixer')
|
26
|
+
class Mix_Chunk < FFI::Struct
|
27
|
+
layout :allocated => :int,
|
28
|
+
:abuf => :pointer,
|
29
|
+
:alen => :ulong,
|
30
|
+
:volume => :uchar
|
31
|
+
end
|
32
|
+
|
33
|
+
MIX_NO_FADING = 0
|
34
|
+
MIX_FADING_OUT = 1
|
35
|
+
MIX_FADING_IN = 2
|
36
|
+
|
37
|
+
MUS_NONE = 0
|
38
|
+
MUS_CMD = 1
|
39
|
+
MUS_WAV = 2
|
40
|
+
MUS_MOD = 3
|
41
|
+
MUS_MID = 4
|
42
|
+
MUS_OGG = 5
|
43
|
+
MUS_MP3 = 6
|
44
|
+
|
45
|
+
class Mix_Music < FFI::Struct
|
46
|
+
layout :fake => :pointer
|
47
|
+
end
|
48
|
+
|
49
|
+
attach_function :Mix_OpenAudio, [:int, :ushort, :int, :int], :int
|
50
|
+
attach_function :Mix_AllocateChannels, [:int], :int
|
51
|
+
attach_function :Mix_QuerySpec, [:pointer, :pointer, :pointer], :int
|
52
|
+
# Load a wave file or a music (.mod .s3m .it .xm) file
|
53
|
+
attach_function :Mix_LoadWAV_RW, [:pointer, :int], :pointer
|
54
|
+
def self.Mix_LoadWAV(filename)
|
55
|
+
Mix_LoadWAV_RW(SDL_RWFromFile(filename, "rb"), 1)
|
56
|
+
end
|
57
|
+
|
58
|
+
attach_function :Mix_LoadMUS, [:string], :pointer
|
59
|
+
attach_function :Mix_LoadMUS_RW, [:pointer], :pointer
|
60
|
+
# Free an audio chunk previously loaded
|
61
|
+
attach_function :Mix_FreeChunk, [:pointer], :void
|
62
|
+
attach_function :Mix_FreeMusic, [:pointer], :void
|
63
|
+
attach_function :Mix_GetMusicType, [:pointer], :int
|
64
|
+
# skipped Mix_SetPostMix
|
65
|
+
# skipped extern Mix_HookMusic
|
66
|
+
# skiped Mix_HookMusicFinished
|
67
|
+
# skipped Mix_GetMusicHookData(void);
|
68
|
+
# skipped Mix_ChannelFinished
|
69
|
+
MIX_CHANNEL_POST = -2
|
70
|
+
# skipped Mix_RegisterEffect
|
71
|
+
# skipped Mix_UnregisterEffect
|
72
|
+
# skipped Mix_UnregisterAllEffects
|
73
|
+
# define MIX_EFFECTSMAXSPEED "MIX_EFFECTSMAXSPEED"
|
74
|
+
attach_function :Mix_SetPanning, [:int, :uchar, :uchar], :int
|
75
|
+
attach_function :Mix_SetPosition, [:int, :short, :uchar], :int
|
76
|
+
attach_function :Mix_SetDistance, [:int, :uchar], :int
|
77
|
+
attach_function :Mix_SetReverseStereo, [:int, :int], :int
|
78
|
+
attach_function :Mix_ReserveChannels, [:int], :int
|
79
|
+
attach_function :Mix_GroupChannel , [:int, :int], :int
|
80
|
+
attach_function :Mix_GroupChannels , [:int, :int, :int], :int
|
81
|
+
attach_function :Mix_GroupAvailable, [:int], :int
|
82
|
+
attach_function :Mix_GroupCount , [:int], :int
|
83
|
+
attach_function :Mix_GroupOldest , [:int], :int
|
84
|
+
attach_function :Mix_GroupNewer , [:int], :int
|
85
|
+
|
86
|
+
def self.Mix_PlayChannel(channel,chunk,loops)
|
87
|
+
Mix_PlayChannelTimed(channel,chunk,loops,-1)
|
88
|
+
end
|
89
|
+
|
90
|
+
attach_function :Mix_PlayChannelTimed , [:int, :pointer, :int, :int], :int
|
91
|
+
attach_function :Mix_PlayMusic , [:pointer, :int], :int
|
92
|
+
# Fade in music or a channel over "ms" milliseconds
|
93
|
+
attach_function :Mix_FadeInMusic , [:pointer, :int, :int], :int
|
94
|
+
attach_function :Mix_FadeInMusicPos , [:pointer, :int, :int, :double] , :int
|
95
|
+
attach_function :Mix_FadeInChannelTimed , [:int, :pointer, :int, :int, :int], :int
|
96
|
+
|
97
|
+
def self.Mix_FadeInChannel(channel, chunk, loops, ms)
|
98
|
+
Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1)
|
99
|
+
end
|
100
|
+
# Set volume
|
101
|
+
attach_function :Mix_Volume , [:int , :int], :int
|
102
|
+
attach_function :Mix_VolumeChunk , [:pointer, :int , :int], :int
|
103
|
+
attach_function :Mix_VolumeMusic , [:int], :int
|
104
|
+
# Halt playing of a particular channel
|
105
|
+
attach_function :Mix_HaltChannel , [:int], :int
|
106
|
+
attach_function :Mix_HaltGroup , [:int], :int
|
107
|
+
attach_function :Mix_HaltMusic , [], :int
|
108
|
+
# Change the expiration delay for a particular channel.
|
109
|
+
attach_function :Mix_ExpireChannel , [:int, :int], :int
|
110
|
+
# Halt a channel, fading it out progressively till it's silent
|
111
|
+
attach_function :Mix_FadeOutChannel , [:int, :int], :int
|
112
|
+
attach_function :Mix_FadeOutGroup , [:int, :int], :int
|
113
|
+
attach_function :Mix_FadeOutMusic , [:int], :int
|
114
|
+
# Query the fading status of a channel
|
115
|
+
attach_function :Mix_FadingMusic , [] , :int
|
116
|
+
attach_function :Mix_FadingChannel , [:int], :int
|
117
|
+
# Pause/Resume a particular channel or music.
|
118
|
+
attach_function :Mix_Pause , [:int], :void
|
119
|
+
attach_function :Mix_Resume , [:int], :void
|
120
|
+
attach_function :Mix_Paused , [:int], :void
|
121
|
+
attach_function :Mix_PauseMusic , [], :void
|
122
|
+
attach_function :Mix_ResumeMusic , [], :void
|
123
|
+
attach_function :Mix_RewindMusic , [], :void
|
124
|
+
attach_function :Mix_PausedMusic , [], :int
|
125
|
+
attach_function :Mix_SetMusicPosition , [:double], :int
|
126
|
+
# Check the status of a specific channel.
|
127
|
+
attach_function :Mix_Playing , [:int], :int
|
128
|
+
attach_function :Mix_PlayingMusic , [], :int
|
129
|
+
# Stop music and set external music playback command
|
130
|
+
attach_function :Mix_SetMusicCMD , [:string], :int
|
131
|
+
# Skipping MIKMOD synchro values.
|
132
|
+
# Get the Mix_Chunk currently associated with a mixer channel
|
133
|
+
attach_function :Mix_GetChunk , [:int], :pointer
|
134
|
+
# Close the mixer, halting all playing audio
|
135
|
+
attach_function :Mix_CloseAudio , [:void], :void
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|