aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 35e931a9dd40ad6151e1618e90f045f67035aad9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
ESDL2
=====

SDL2 Erlang NIF.

Status
------

Week-end project. Work in progress.

The following limitations apply:

 *  Erlang 17.0+ is required
 *  SDL 2.0.3+ is required
 *  No support for UTF-8 strings, only Latin-1

The following ideas need to be investigated:

 *  We may benefit from the reference receive optimization when doing calls
 *  We may want a way to pipeline draw operations
 *  Using HiPE mutable bytearrays for "void* pixels" types

The following tasks remain to be done:

* http://hg.libsdl.org/SDL/file/default/include/SDL_hints.h
  * We need to implement everything.

* http://hg.libsdl.org/SDL/file/default/include/SDL_error.h
  * Anything that can produce errors will have an automatic call to SDL_GetError.
  * I am not sure we need any direct access to those functions.

* http://hg.libsdl.org/SDL/file/default/include/SDL_log.h
  * We already have logging in Erlang. Not sure we need this.

* http://hg.libsdl.org/SDL/file/default/include/SDL_assert.h
  * I am not sure we need this, and we can't use the assert macro directly anyway.

* http://hg.libsdl.org/SDL/file/default/include/SDL_version.h
  * It might be useful to provide access to some of the macros as functions.
  * The SDL_GetRevisionNumber function needs to be implemented.
  * It might be interesting to use the macros to conditionally implement some features,
    this way we could be compatible with all versions >= 2.0.0.

* http://hg.libsdl.org/SDL/file/default/include/SDL_video.h
  * The SDL_DisplayMode structure and related functions need to be implemented:
    * SDL_GetNumDisplayModes()
    * SDL_GetDisplayMode()
    * SDL_GetDesktopDisplayMode()
    * SDL_GetCurrentDisplayMode()
    * SDL_GetClosestDisplayMode()
    * SDL_SetWindowDisplayMode()
    * SDL_GetWindowDisplayMode()
  * Most other display functions are also not implemented:
    * SDL_GetNumVideoDisplays()
	* SDL_GetDisplayName()
	* SDL_GetDisplayBounds()
	* SDL_GetDisplayDPI()
  * Some window functions need to be implemented:
    * SDL_CreateWindowFrom()
	* SDL_GetWindowData()
	* SDL_SetWindowData()
    * SDL_GetWindowPixelFormat()
	* SDL_GetWindowFromID()
	* SDL_GetWindowSurface()
	* SDL_UpdateWindowSurface()
	* SDL_UpdateWindowSurfaceRects()
	* SDL_GetGrabbedWindow()
	* SDL_SetWindowGammaRamp()
	* SDL_GetWindowGammaRamp()
	* SDL_SetWindowModalFor()
	* SDL_SetWindowInputFocus()
	* SDL_SetWindowOpacity()
	* SDL_GetWindowOpacity()
	* SDL_SetWindowResizable()
  * There is an SDL_WINDOW_MOUSE_CAPTURE window flag we need to implement.
  * There are two window pos flags, related to multi monitors, that we don't support:
    * SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)
	* SDL_WINDOWPOS_CENTERED_DISPLAY(X)
  * We do not support OpenGL at all yet:
    * SDL_GLContext
	* SDL_GLattr
	* SDL_GLprofile
	* SDL_GLcontextFlag
	* SDL_GLcontextReleaseFlag
	* SDL_GL_LoadLibrary()
	* SDL_GL_GetProcAddress()
	* SDL_GL_UnloadLibrary()
	* SDL_GL_ExtensionSupported()
	* SDL_GL_ResetAttributes()
	* SDL_GL_SetAttribute()
	* SDL_GL_GetAttribute()
	* SDL_GL_MakeCurrent()
	* SDL_GL_GetCurrentWindow()
	* SDL_GL_GetCurrentContext()
	* SDL_GL_GetDrawableSize()
	* SDL_GL_SetSwapInterval()
	* SDL_GL_GetSwapInterval()
  * We do not support any of the video driver related functions:
    * SDL_GetNumVideoDrivers()
	* SDL_GetVideoDriver()
	* SDL_VideoInit()
	* SDL_VideoQuit()
	* SDL_GetCurrentVideoDriver()
  * Flags and functions relating to SDL_HitTest are not implemented:
    * SDL_HitTestResult
	* SDL_HitTest() callback
	* SDL_SetWindowHitTest()
  * Screensaver related functions are not implemented:
    * SDL_IsScreenSaverEnabled()
	* SDL_EnableScreenSaver()
	* SDL_DisableScreenSaver()

* http://hg.libsdl.org/SDL/file/default/include/SDL_render.h
  * The SDL_RendererInfo structure and related functions are not implemented:
    * SDL_GetRenderDriverInfo()
	* SDL_GetRendererInfo()
  * The SDL_TextureAccess enum is not implemented.
  * The SDL_TextureModulate enum is not implemented.
  * A number of other functions are not implemented:
    * SDL_CreateSoftwareRenderer()
	* SDL_GetRenderer()
	* SDL_CreateTexture()
	* SDL_QueryTexture()
	* SDL_UpdateTexture()
	* SDL_UpdateYUVTexture()
	* SDL_LockTexture()
	* SDL_UnlockTexture()
	* SDL_SetRenderTarget()
	* SDL_GetRenderTarget()
	* SDL_RenderIsClipEnabled()
	* SDL_RenderReadPixels()
	* SDL_RenderSetIntegerScale()
  * We do not support OpenGL at all yet:
    * SDL_GL_BindTexture()
	* SDL_GL_UnbindTexture()

* http://hg.libsdl.org/SDL/file/default/include/SDL_pixels.h
  * We need to implement everything.

* http://hg.libsdl.org/SDL/file/default/include/SDL_rect.h
  * We need to implement everything, though we already have points and rects as maps elsewhere.

* http://hg.libsdl.org/SDL/file/default/include/SDL_surface.h
  * We need to implement everything except SDL_FreeSurface().

* http://hg.libsdl.org/SDL/file/default/include/SDL_syswm.h
  * We need to implement everything.

* http://hg.libsdl.org/SDL/file/default/include/SDL_events.h
  * The following event types need to be implemented:
    * SDL_APP_TERMINATING (iOS and Android)
	* SDL_APP_LOWMEMORY (iOS and Android)
	* SDL_APP_WILLENTERBACKGROUND (iOS and Android)
	* SDL_APP_DIDENTERBACKGROUND (iOS and Android)
	* SDL_APP_WILLENTERFOREGROUND (iOS and Android)
	* SDL_APP_DIDENTERFOREGROUND (iOS and Android)
	* SDL_SYSWMEVENT (SDL_SysWMEvent, SDL_SysWMmsg)
	* SDL_TEXTEDITING (SDL_TEXTEDITINGEVENT_TEXT_SIZE, SDL_TextEditingEvent)
	* SDL_TEXTINPUT (SDL_TEXTINPUTEVENT_TEXT_SIZE, SDL_TextInputEvent)
	* SDL_JOYAXISMOTION (SDL_JoyAxisEvent)
	* SDL_JOYBALLMOTION (SDL_JoyBallEvent)
	* SDL_JOYHATMOTION (SDL_JoyHatEvent)
	* SDL_JOYBUTTONDOWN (SDL_JoyButtonEvent)
	* SDL_JOYBUTTONUP (SDL_JoyButtonEvent)
	* SDL_JOYDEVICEADDED (SDL_JoyDeviceEvent)
	* SDL_JOYDEVICEREMOVED (SDL_JoyDeviceEvent)
	* SDL_CONTROLLERAXISMOTION (SDL_ControllerAxisEvent)
	* SDL_CONTROLLERBUTTONDOWN (SDL_ControllerButtonEvent)
	* SDL_CONTROLLERBUTTONUP (SDL_ControllerButtonEvent)
	* SDL_CONTROLLERDEVICEADDED (SDL_ControllerDeviceEvent)
	* SDL_CONTROLLERDEVICEREMOVED (SDL_ControllerDeviceEvent)
	* SDL_CONTROLLERDEVICEREMAPPED (SDL_ControllerDeviceEvent)
	* SDL_FINGERDOWN (SDL_TouchFingerEvent)
	* SDL_FINGERUP (SDL_TouchFingerEvent)
	* SDL_FINGERMOTION (SDL_TouchFingerEvent)
	* SDL_DOLLARGESTURE (SDL_DollarGestureEvent)
	* SDL_DOLLARRECORD (SDL_DollarGestureEvent)
	* SDL_MULTIGESTURE (SDL_MultiGestureEvent)
	* SDL_CLIPBOARDUPDATE
	* SDL_DROPFILE (SDL_DropEvent)
	* SDL_AUDIODEVICEADDED (SDL_AudioDeviceEvent)
	* SDL_AUDIODEVICEREMOVED (SDL_AudioDeviceEvent)
	* SDL_RENDER_TARGETS_RESET
	* SDL_RENDER_DEVICE_RESET
	* SDL_WINDOWEVENT_HIT_TEST
	* SDL_WINDOWEVENT_TAKE_FOCUS
	* SDL_KEYMAPCHANGED
	* User defined events, from SDL_USEREVENT to SDL_LASTEVENT (SDL_UserEvent)
  * We currently do not handle the SDL_MouseMotionEvent.state value
  * We currently do not handle the SDL_MouseWheelEvent.direction value (SDL >= 2.0.4, unreleased yet)
  * We need to implement the following functions:
    * SDL_PumpEvents()
	* SDL_PeepEvents()
	* SDL_HasEvent()
	* SDL_HasEvents()
	* SDL_FlushEvent()
	* SDL_FlushEvents()
	* SDL_WaitEvent()
	* SDL_WaitEventTimeout()
	* SDL_PushEvent()
	* SDL_SetEventFilter()
	* SDL_GetEventFilter()
	* SDL_AddEventWatch()
	* SDL_DelEventWatch()
	* SDL_FilterEvents()
	* SDL_EventState()
	* SDL_RegisterEvents()

* http://hg.libsdl.org/SDL/file/default/include/SDL_keyboard.h
  * We need to implement the following functions:
  	* SDL_GetKeyboardFocus()
	* SDL_GetKeyboardState()
	* SDL_GetModState()
	* SDL_SetModState()
	* SDL_GetKeyFromScancode()
	* SDL_GetScancodeFromKey()
	* SDL_GetScancodeName()
	* SDL_GetScancodeFromName()
	* SDL_GetKeyName()
	* SDL_GetKeyFromName()
	* SDL_SetTextInputRect()
	* SDL_HasScreenKeyboardSupport()
	* SDL_IsScreenKeyboardShown()

* http://hg.libsdl.org/SDL/file/default/include/SDL_keycode.h
  * We probably should make it easy to identify keycodes and scancodes.

* http://hg.libsdl.org/SDL/file/default/include/SDL_scancode.h
  * We probably should make it easy to identify keycodes and scancodes.

* http://hg.libsdl.org/SDL/file/default/include/SDL_joystick.h
  * We need to implement everything.

* http://hg.libsdl.org/SDL/file/default/include/SDL_gamecontroller.h
  * We need to implement everything.

* http://hg.libsdl.org/SDL/file/default/include/SDL_haptic.h
  * We need to implement everything.

* http://hg.libsdl.org/SDL/file/default/include/SDL_audio.h
  * We need to implement everything.
  * We might want to implement SDL_mixer first.

* http://hg.libsdl.org/SDL/file/default/include/SDL_thread.h
  * We don't really need this for Erlang, do we?

* http://hg.libsdl.org/SDL/file/default/include/SDL_mutex.h
  * We don't really need this for Erlang, do we?

* http://hg.libsdl.org/SDL/file/default/include/SDL_atomic.h
  * We don't really need this for Erlang, do we?

* http://hg.libsdl.org/SDL/file/default/include/SDL_timer.h
  * We need to implement everything.
  * It's not the most useful to have, but doesn't hurt to have it.

* http://hg.libsdl.org/SDL/file/default/include/SDL_rwops.h
  * We need to implement everything.
  * It's currently unclear if and how this should be implemented.

* http://hg.libsdl.org/SDL/file/default/include/SDL_loadso.h
  * We don't really need this for Erlang, do we?

* http://hg.libsdl.org/SDL/file/default/include/SDL_platform.h
  * We need to implement the one function in there. Can always be useful.

* http://hg.libsdl.org/SDL/file/default/include/SDL_cpuinfo.h
  * The function SDL_HasAVX2() needs to be implemented. (SDL >= 2.0.4, unreleased yet)
  * SDL_HasNEON()

* http://hg.libsdl.org/SDL/file/default/include/SDL_endian.h
  * We need to implement everything.
  * It's currently unclear if and how this should be implemented.

* http://hg.libsdl.org/SDL/file/default/include/SDL_bits.h
  * We need to implement everything.
  * It's currently unclear if and how this should be implemented.

* http://hg.libsdl.org/SDL/file/default/include/SDL_system.h
  * We need to implement everything.
  * It's currently unclear if and how this should be implemented.

* http://hg.libsdl.org/SDL/file/default/include/SDL_stdinc.h
  * Nothing except support for SDL_bool was implemented.
  * There might be useful bits and pieces in there, in particular the math or iconv functions.

* SDL_image, SDL_mixer, ... also need to be investigated and implemented.