Skip to content

Commit 73bc56b

Browse files
committed
all: support SDL2 v2.0.18
1 parent e35e34d commit 73bc56b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2718
-130
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
timeout-minutes: 30
1515
env:
1616
VFLAGS: -cc tcc -no-retry-compilation
17-
SDL2_VERSION: 2.0.16
17+
SDL2_VERSION: 2.0.18
1818
steps:
1919
- name: Install dependencies
2020
run: |
@@ -86,7 +86,7 @@ jobs:
8686
timeout-minutes: 30
8787
env:
8888
VFLAGS: -cc gcc -no-retry-compilation
89-
SDL2_VERSION: 2.0.16
89+
SDL2_VERSION: 2.0.18
9090
steps:
9191
- name: Checkout V
9292
uses: actions/checkout@v2

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Currently available APIs:
2323
- gesture (SDL_gesture.h)
2424
- haptic (SDL_haptic.h)
2525
- hints (SDL_hints.h)
26+
- hidapi (SDL_hidapi.h)
2627
- joystick (SDL_joystick.h)
2728
- keyboard (SDL_keyboard.h)
2829
- keycode (SDL_keycode.h)
@@ -111,7 +112,7 @@ This will create a directory called "thirdparty" which will be used to download
111112
To successfully run a provided example or your own projects, the sdl dlls must be copied to the main application directory.
112113
e.g..
113114
```
114-
copy thirdparty\SDL2-2.0.16\lib\x64\SDL2.dll examples\basic_window\
115+
copy thirdparty\SDL2-2.0.18\lib\x64\SDL2.dll examples\basic_window\
115116
cd ..
116117
v run sdl\examples\basic_window\main.v
117118
```

atomic.c.v

+27-2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ fn C.SDL_AtomicTryLock(lock_ &C.SDL_SpinLock) bool
6868
//
6969
// returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
7070
//
71+
// NOTE This function is available since SDL 2.0.0.
72+
//
7173
// See also: SDL_AtomicLock
7274
// See also: SDL_AtomicUnlock
7375
pub fn atomic_try_lock(lock_ &SpinLock) bool {
@@ -83,6 +85,8 @@ fn C.SDL_AtomicLock(lock_ &C.SDL_SpinLock)
8385
//
8486
// `lock_` a pointer to a lock variable
8587
//
88+
// NOTE This function is available since SDL 2.0.0.
89+
//
8690
// See also: SDL_AtomicTryLock
8791
// See also: SDL_AtomicUnlock
8892
pub fn atomic_lock(lock_ &SpinLock) {
@@ -125,6 +129,8 @@ pub fn atomic_unlock(lock_ &SpinLock) {
125129
//
126130
// For more information on these semantics, take a look at the blog post:
127131
// http://preshing.com/20120913/acquire-and-release-semantics
132+
//
133+
// NOTE This function is available since SDL 2.0.6.
128134
fn C.SDL_MemoryBarrierReleaseFunction()
129135
pub fn memory_barrier_release_function() {
130136
C.SDL_MemoryBarrierReleaseFunction()
@@ -177,6 +183,8 @@ fn C.SDL_AtomicSet(a &C.SDL_atomic_t, v int) int
177183
// `v` the desired value
178184
// returns the previous value of the atomic variable.
179185
//
186+
// NOTE This function is available since SDL 2.0.2.
187+
//
180188
// See also: SDL_AtomicGet
181189
pub fn atomic_set(a &AtomicT, v int) int {
182190
return unsafe { C.SDL_AtomicSet(&C.SDL_atomic_t(a), v) }
@@ -192,6 +200,8 @@ fn C.SDL_AtomicGet(a &C.SDL_atomic_t) int
192200
// `a` a pointer to an SDL_atomic_t variable
193201
// returns the current value of an atomic variable.
194202
//
203+
// NOTE This function is available since SDL 2.0.2.
204+
//
195205
// See also: SDL_AtomicSet
196206
pub fn atomic_get(a &AtomicT) int {
197207
return unsafe { C.SDL_AtomicGet(&C.SDL_atomic_t(a)) }
@@ -210,6 +220,8 @@ fn C.SDL_AtomicAdd(a &C.SDL_atomic_t, v int) int
210220
// `v` the desired value to add
211221
// returns The previous value of the atomic variable.
212222
//
223+
// NOTE This function is available since SDL 2.0.2.
224+
//
213225
// See also: SDL_AtomicDecRef
214226
// See also: SDL_AtomicIncRef
215227
pub fn atomic_add(a &AtomicT, v int) int {
@@ -260,7 +272,7 @@ pub fn atomic_cas_ptr(a voidptr, oldval voidptr, newval voidptr) bool {
260272

261273
fn C.SDL_AtomicSetPtr(a voidptr, v voidptr) voidptr
262274

263-
// atomic_set_ptr set a pointer to a value atomically.
275+
// atomic_set_ptr sets a pointer to a value atomically.
264276
//
265277
// NOTE If you don't know what this function is for, you shouldn't use
266278
// it!
@@ -269,6 +281,8 @@ fn C.SDL_AtomicSetPtr(a voidptr, v voidptr) voidptr
269281
// `v` the desired pointer value
270282
// returns the previous value of the pointer.
271283
//
284+
// NOTE This function is available since SDL 2.0.2.
285+
//
272286
// See also: SDL_AtomicCASPtr
273287
// See also: SDL_AtomicGetPtr
274288
//
@@ -279,7 +293,18 @@ pub fn atomic_set_ptr(a voidptr, v voidptr) voidptr {
279293

280294
fn C.SDL_AtomicGetPtr(a voidptr) voidptr
281295

282-
// atomic_get_ptr gets the value of a pointer atomically.
296+
// atomic_get_ptr gets a pointer to a value atomically.
297+
//
298+
// NOTE If you don't know what this function is for, you shouldn't use
299+
// it!
300+
//
301+
// `a` a pointer to a pointer
302+
// returns the current value of a pointer.
303+
//
304+
// NOTE This function is available since SDL 2.0.2.
305+
//
306+
// See also: SDL_AtomicCASPtr
307+
// See also: SDL_AtomicSetPtr
283308
//
284309
// `a`'s C type is `void **a`
285310
pub fn atomic_get_ptr(a voidptr) voidptr {

0 commit comments

Comments
 (0)