ruby2d 0.9.4 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/SDL2/SDL.h +4 -1
  3. data/assets/include/SDL2/SDL_assert.h +3 -1
  4. data/assets/include/SDL2/SDL_atomic.h +1 -1
  5. data/assets/include/SDL2/SDL_audio.h +1 -1
  6. data/assets/include/SDL2/SDL_bits.h +1 -1
  7. data/assets/include/SDL2/SDL_blendmode.h +4 -1
  8. data/assets/include/SDL2/SDL_clipboard.h +1 -1
  9. data/assets/include/SDL2/SDL_config.h +1 -1
  10. data/assets/include/SDL2/SDL_config_android.h +7 -3
  11. data/assets/include/SDL2/SDL_config_iphoneos.h +16 -10
  12. data/assets/include/SDL2/SDL_config_macosx.h +40 -14
  13. data/assets/include/SDL2/SDL_config_minimal.h +1 -1
  14. data/assets/include/SDL2/SDL_config_os2.h +26 -8
  15. data/assets/include/SDL2/SDL_config_pandora.h +4 -2
  16. data/assets/include/SDL2/SDL_config_psp.h +2 -1
  17. data/assets/include/SDL2/SDL_config_windows.h +40 -9
  18. data/assets/include/SDL2/SDL_config_winrt.h +5 -2
  19. data/assets/include/SDL2/SDL_config_wiz.h +5 -2
  20. data/assets/include/SDL2/SDL_copying.h +1 -1
  21. data/assets/include/SDL2/SDL_cpuinfo.h +32 -3
  22. data/assets/include/SDL2/SDL_egl.h +4 -1
  23. data/assets/include/SDL2/SDL_endian.h +6 -3
  24. data/assets/include/SDL2/SDL_error.h +38 -2
  25. data/assets/include/SDL2/SDL_events.h +64 -28
  26. data/assets/include/SDL2/SDL_filesystem.h +1 -1
  27. data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
  28. data/assets/include/SDL2/SDL_gesture.h +1 -1
  29. data/assets/include/SDL2/SDL_haptic.h +10 -1
  30. data/assets/include/SDL2/SDL_hints.h +316 -4
  31. data/assets/include/SDL2/SDL_joystick.h +115 -24
  32. data/assets/include/SDL2/SDL_keyboard.h +1 -1
  33. data/assets/include/SDL2/SDL_keycode.h +11 -9
  34. data/assets/include/SDL2/SDL_loadso.h +1 -1
  35. data/assets/include/SDL2/SDL_locale.h +101 -0
  36. data/assets/include/SDL2/SDL_log.h +3 -3
  37. data/assets/include/SDL2/SDL_main.h +1 -1
  38. data/assets/include/SDL2/SDL_messagebox.h +6 -4
  39. data/assets/include/SDL2/SDL_metal.h +117 -0
  40. data/assets/include/SDL2/SDL_misc.h +75 -0
  41. data/assets/include/SDL2/SDL_mouse.h +1 -1
  42. data/assets/include/SDL2/SDL_mutex.h +1 -1
  43. data/assets/include/SDL2/SDL_name.h +1 -1
  44. data/assets/include/SDL2/SDL_opengl.h +1 -1
  45. data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
  46. data/assets/include/SDL2/SDL_opengles.h +1 -1
  47. data/assets/include/SDL2/SDL_opengles2.h +1 -1
  48. data/assets/include/SDL2/SDL_pixels.h +25 -16
  49. data/assets/include/SDL2/SDL_platform.h +1 -1
  50. data/assets/include/SDL2/SDL_power.h +1 -1
  51. data/assets/include/SDL2/SDL_quit.h +1 -1
  52. data/assets/include/SDL2/SDL_rect.h +1 -1
  53. data/assets/include/SDL2/SDL_render.h +63 -3
  54. data/assets/include/SDL2/SDL_revision.h +2 -2
  55. data/assets/include/SDL2/SDL_rwops.h +2 -10
  56. data/assets/include/SDL2/SDL_scancode.h +1 -1
  57. data/assets/include/SDL2/SDL_sensor.h +25 -9
  58. data/assets/include/SDL2/SDL_shape.h +1 -1
  59. data/assets/include/SDL2/SDL_stdinc.h +44 -4
  60. data/assets/include/SDL2/SDL_surface.h +11 -2
  61. data/assets/include/SDL2/SDL_system.h +50 -4
  62. data/assets/include/SDL2/SDL_syswm.h +29 -2
  63. data/assets/include/SDL2/SDL_test.h +1 -1
  64. data/assets/include/SDL2/SDL_test_assert.h +1 -1
  65. data/assets/include/SDL2/SDL_test_common.h +14 -1
  66. data/assets/include/SDL2/SDL_test_compare.h +1 -1
  67. data/assets/include/SDL2/SDL_test_crc32.h +1 -1
  68. data/assets/include/SDL2/SDL_test_font.h +1 -1
  69. data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
  70. data/assets/include/SDL2/SDL_test_harness.h +1 -1
  71. data/assets/include/SDL2/SDL_test_images.h +1 -1
  72. data/assets/include/SDL2/SDL_test_log.h +1 -1
  73. data/assets/include/SDL2/SDL_test_md5.h +1 -1
  74. data/assets/include/SDL2/SDL_test_memory.h +1 -1
  75. data/assets/include/SDL2/SDL_test_random.h +1 -1
  76. data/assets/include/SDL2/SDL_thread.h +34 -11
  77. data/assets/include/SDL2/SDL_timer.h +1 -1
  78. data/assets/include/SDL2/SDL_touch.h +1 -1
  79. data/assets/include/SDL2/SDL_types.h +1 -1
  80. data/assets/include/SDL2/SDL_version.h +2 -2
  81. data/assets/include/SDL2/SDL_video.h +11 -5
  82. data/assets/include/SDL2/SDL_vulkan.h +6 -8
  83. data/assets/include/SDL2/begin_code.h +5 -9
  84. data/assets/include/SDL2/close_code.h +1 -1
  85. data/assets/macos/lib/libFLAC.a +0 -0
  86. data/assets/macos/lib/libSDL2.a +0 -0
  87. data/assets/macos/lib/libSDL2_image.a +0 -0
  88. data/assets/macos/lib/libSDL2_mixer.a +0 -0
  89. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  90. data/assets/macos/lib/libfreetype.a +0 -0
  91. data/assets/macos/lib/libjpeg.a +0 -0
  92. data/assets/macos/lib/libmodplug.a +0 -0
  93. data/assets/macos/lib/libmpg123.a +0 -0
  94. data/assets/macos/lib/libogg.a +0 -0
  95. data/assets/macos/lib/libpng16.a +0 -0
  96. data/assets/macos/lib/libtiff.a +0 -0
  97. data/assets/macos/lib/libvorbis.a +0 -0
  98. data/assets/macos/lib/libvorbisfile.a +0 -0
  99. data/assets/macos/lib/libwebp.a +0 -0
  100. data/assets/mingw/bin/SDL2.dll +0 -0
  101. data/assets/mingw/lib/libSDL2.a +0 -0
  102. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  103. data/assets/mingw/lib/libSDL2_test.a +0 -0
  104. data/assets/mingw/lib/libSDL2main.a +0 -0
  105. data/bin/ruby2d +1 -0
  106. data/{assets/linux/simple2d/src/simple2d.c → ext/ruby2d/common.c} +32 -32
  107. data/{assets/linux/simple2d/src → ext/ruby2d}/controllers.c +17 -17
  108. data/ext/ruby2d/extconf.rb +37 -59
  109. data/ext/ruby2d/font.c +35 -0
  110. data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +66 -98
  111. data/ext/ruby2d/gl2.c +86 -0
  112. data/{assets/linux/simple2d/src → ext/ruby2d}/gl3.c +69 -112
  113. data/{assets/linux/simple2d/src → ext/ruby2d}/gles.c +22 -81
  114. data/ext/ruby2d/image.c +58 -0
  115. data/{assets/linux/simple2d/src → ext/ruby2d}/input.c +8 -8
  116. data/{assets/linux/simple2d/src → ext/ruby2d}/music.c +30 -17
  117. data/ext/ruby2d/ruby2d.c +449 -439
  118. data/ext/ruby2d/ruby2d.h +652 -0
  119. data/{assets/linux/simple2d/src → ext/ruby2d}/shapes.c +18 -18
  120. data/{assets/linux/simple2d/src → ext/ruby2d}/sound.c +39 -14
  121. data/ext/ruby2d/text.c +22 -0
  122. data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +63 -63
  123. data/lib/ruby2d/circle.rb +21 -3
  124. data/lib/ruby2d/cli/build.rb +4 -7
  125. data/lib/ruby2d/dsl.rb +16 -9
  126. data/lib/ruby2d/entity.rb +17 -0
  127. data/lib/ruby2d/font.rb +23 -3
  128. data/lib/ruby2d/image.rb +35 -7
  129. data/lib/ruby2d/line.rb +23 -1
  130. data/lib/ruby2d/music.rb +5 -0
  131. data/lib/ruby2d/pixel.rb +17 -0
  132. data/lib/ruby2d/quad.rb +21 -1
  133. data/lib/ruby2d/rectangle.rb +12 -3
  134. data/lib/ruby2d/renderable.rb +4 -20
  135. data/lib/ruby2d/sound.rb +30 -0
  136. data/lib/ruby2d/sprite.rb +57 -75
  137. data/lib/ruby2d/square.rb +10 -1
  138. data/lib/ruby2d/text.rb +55 -12
  139. data/lib/ruby2d/texture.rb +28 -0
  140. data/lib/ruby2d/tileset.rb +87 -0
  141. data/lib/ruby2d/triangle.rb +19 -1
  142. data/lib/ruby2d/version.rb +1 -1
  143. data/lib/ruby2d/vertices.rb +84 -0
  144. data/lib/ruby2d/window.rb +259 -22
  145. data/lib/ruby2d.rb +6 -1
  146. metadata +30 -26
  147. data/assets/include/simple2d.h +0 -757
  148. data/assets/linux/simple2d/Makefile +0 -260
  149. data/assets/linux/simple2d/bin/simple2d.sh +0 -1318
  150. data/assets/linux/simple2d/include/simple2d.h +0 -757
  151. data/assets/linux/simple2d/src/gl2.c +0 -146
  152. data/assets/linux/simple2d/src/image.c +0 -138
  153. data/assets/linux/simple2d/src/sprite.c +0 -147
  154. data/assets/linux/simple2d/src/text.c +0 -129
  155. data/assets/macos/lib/libsimple2d.a +0 -0
  156. data/assets/mingw/lib/libsimple2d.a +0 -0
@@ -1,260 +0,0 @@
1
- # Makefile for Unix-like systems:
2
- # macOS, Linux, Raspberry Pi, MinGW
3
-
4
- PREFIX?=/usr/local
5
- CFLAGS=-std=c11
6
-
7
- # ARM platforms
8
- ifneq (,$(findstring arm,$(shell uname -m)))
9
- # Raspberry Pi includes
10
- INCLUDES=-I/opt/vc/include/
11
- endif
12
-
13
- # Apple
14
- ifeq ($(shell uname),Darwin)
15
- PLATFORM=apple
16
- XCPRETTY_STATUS=$(shell xcpretty -v &>/dev/null; echo $$?)
17
- ifeq ($(XCPRETTY_STATUS),0)
18
- XCPRETTY=xcpretty
19
- else
20
- XCPRETTY=cat
21
- endif
22
- endif
23
-
24
- # Linux
25
- ifeq ($(shell uname),Linux)
26
- CFLAGS+=-fPIC
27
- endif
28
-
29
- # BSD
30
- ifneq (,$(findstring BSD,$(shell uname)))
31
- CC=cc
32
- INCLUDES=-I/usr/local/include/
33
- CFLAGS+=-fPIC
34
- endif
35
-
36
- # MinGW
37
- ifneq (,$(findstring MINGW,$(shell uname -s)))
38
- PLATFORM=mingw
39
- CC=gcc
40
- INCLUDES=-I/usr/local/include/
41
- endif
42
-
43
- SOURCES=$(notdir $(wildcard src/*.c))
44
- OBJECTS=$(addprefix build/,$(notdir $(SOURCES:.c=.o)))
45
-
46
- VERSION=$(shell bash bin/simple2d.sh -v)
47
-
48
- # Release directories and archive filenames
49
- APPLE_RELEASE=simple2d-apple-$(VERSION)
50
- MINGW_RELEASE=simple2d-windows-mingw-$(VERSION)
51
-
52
- # Helper functions
53
-
54
- define task_msg
55
- @printf "\n\033[1;34m==>\033[39m $(1)\033[0m\n\n"
56
- endef
57
-
58
- define info_msg
59
- @printf "\033[1;36mInfo:\e[39m $(1)\033[0m\n"
60
- endef
61
-
62
- define run_test
63
- $(call task_msg,Running $(1).c)
64
- @cd test/; ./$(1)
65
- endef
66
-
67
- # Targets
68
-
69
- all: prereqs install-deps $(SOURCES)
70
- ar -vq build/libsimple2d.a $(OBJECTS)
71
- cp bin/simple2d.sh build/simple2d
72
- chmod 0777 build/simple2d
73
- rm build/*.o
74
-
75
- prereqs:
76
- $(call task_msg,Building)
77
- mkdir -p build
78
-
79
- install-deps:
80
- ifeq ($(PLATFORM),mingw)
81
- $(call task_msg,Installing dependencies for MinGW)
82
- mkdir -p $(PREFIX)/include/
83
- mkdir -p $(PREFIX)/lib/
84
- mkdir -p $(PREFIX)/bin/
85
- cp -R deps/mingw/include/* $(PREFIX)/include
86
- cp -R deps/mingw/lib/* $(PREFIX)/lib
87
- cp -R deps/mingw/bin/* $(PREFIX)/bin
88
- endif
89
-
90
- $(SOURCES):
91
- $(CC) $(CFLAGS) $(INCLUDES) src/$@ -c -o build/$(basename $@).o
92
-
93
- install:
94
- $(call task_msg,Installing Simple 2D)
95
- mkdir -p $(PREFIX)/include/
96
- mkdir -p $(PREFIX)/lib/
97
- mkdir -p $(PREFIX)/bin/
98
- cp include/simple2d.h $(PREFIX)/include/
99
- cp build/libsimple2d.a $(PREFIX)/lib/
100
- cp build/simple2d $(PREFIX)/bin/
101
-
102
- ifeq ($(PLATFORM),apple)
103
- frameworks: all
104
- $(call task_msg,Building iOS and tvOS frameworks)
105
- xcodebuild -version
106
- ifneq ($(XCPRETTY_STATUS),0)
107
- @echo "xcpretty not found: Run \`gem install xcpretty\` for nicer xcodebuild output.\n"
108
- endif
109
- mkdir -p build
110
- cp -R deps/xcode/Simple2D.xcodeproj build
111
- cd build && \
112
- xcodebuild -sdk iphoneos | $(XCPRETTY) && \
113
- xcodebuild -sdk iphonesimulator | $(XCPRETTY) && \
114
- xcodebuild -sdk appletvos | $(XCPRETTY) && \
115
- xcodebuild -sdk appletvsimulator | $(XCPRETTY)
116
- mkdir -p build/Release-ios-universal
117
- mkdir -p build/Release-tvos-universal
118
- lipo build/Release-iphoneos/libsimple2d.a build/Release-iphonesimulator/libsimple2d.a -create -output build/Release-ios-universal/libsimple2d.a
119
- lipo build/Release-appletvos/libsimple2d.a build/Release-appletvsimulator/libsimple2d.a -create -output build/Release-tvos-universal/libsimple2d.a
120
- mkdir -p build/ios build/tvos
121
- libtool -static build/Release-ios-universal/libsimple2d.a deps/ios/SDL2.framework/SDL2 -o build/ios/Simple2D
122
- libtool -static build/Release-tvos-universal/libsimple2d.a deps/tvos/SDL2.framework/SDL2 -o build/tvos/Simple2D
123
- mkdir -p build/ios/Simple2D.framework/Headers
124
- mkdir -p build/tvos/Simple2D.framework/Headers
125
- cp include/simple2d.h build/ios/Simple2D.framework/Headers
126
- cp include/simple2d.h build/tvos/Simple2D.framework/Headers
127
- cp -R deps/headers/SDL2 build/ios/Simple2D.framework/Headers
128
- cp -R deps/headers/SDL2 build/tvos/Simple2D.framework/Headers
129
- cp deps/xcode/Info.plist build/ios/Simple2D.framework/Info.plist
130
- cp deps/xcode/Info.plist build/tvos/Simple2D.framework/Info.plist
131
- mv build/ios/Simple2D build/ios/Simple2D.framework
132
- mv build/tvos/Simple2D build/tvos/Simple2D.framework
133
- $(call info_msg,iOS framework built at \`build/ios/Simple2D.framework\`)
134
- $(call info_msg,tvOS framework built at \`build/tvos/Simple2D.framework\`)
135
- endif
136
-
137
- ifeq ($(PLATFORM),apple)
138
- install-frameworks: install
139
- ifeq ($(shell test -d build/ios/Simple2D.framework && test -d build/tvos/Simple2D.framework; echo $$?),1)
140
- $(error Frameworks missing. Run `frameworks` target first)
141
- endif
142
- $(call task_msg,Installing iOS and tvOS frameworks)
143
- mkdir -p $(PREFIX)/Frameworks/Simple2D/iOS/
144
- mkdir -p $(PREFIX)/Frameworks/Simple2D/tvOS/
145
- cp -R build/ios/Simple2D.framework $(PREFIX)/Frameworks/Simple2D/iOS/
146
- cp -R build/tvos/Simple2D.framework $(PREFIX)/Frameworks/Simple2D/tvOS/
147
- endif
148
-
149
- ifeq ($(PLATFORM),apple)
150
- release: clean frameworks
151
- $(call task_msg,Building macOS release)
152
- mkdir -p build/$(APPLE_RELEASE)/macOS
153
- cp build/libsimple2d.a build/$(APPLE_RELEASE)/macOS
154
- $(call task_msg,Building iOS and tvOS release)
155
- mkdir -p build/$(APPLE_RELEASE)/iOS
156
- mkdir -p build/$(APPLE_RELEASE)/tvOS
157
- cp -R build/ios/* build/$(APPLE_RELEASE)/iOS/
158
- cp -R build/tvos/* build/$(APPLE_RELEASE)/tvOS/
159
- cd build; zip -rq $(APPLE_RELEASE).zip $(APPLE_RELEASE)
160
- $(call info_msg,Apple release zipped at \`build/$(APPLE_RELEASE).zip\`)
161
- endif
162
-
163
- ifeq ($(PLATFORM),mingw)
164
- release: clean all
165
- mkdir -p build/$(MINGW_RELEASE)/include
166
- mkdir -p build/$(MINGW_RELEASE)/lib
167
- mkdir -p build/$(MINGW_RELEASE)/bin
168
- cp -R deps/mingw/include/* build/$(MINGW_RELEASE)/include
169
- cp -R deps/mingw/lib/* build/$(MINGW_RELEASE)/lib
170
- cp -R deps/mingw/bin/* build/$(MINGW_RELEASE)/bin
171
- cp deps/LICENSES.md build/$(MINGW_RELEASE)
172
- cp include/simple2d.h build/$(MINGW_RELEASE)/include
173
- cp build/libsimple2d.a build/$(MINGW_RELEASE)/lib
174
- cp build/simple2d build/$(MINGW_RELEASE)/bin
175
- cp bin/win-installer-mingw.sh build/$(MINGW_RELEASE)/install.sh
176
- PowerShell -Command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('build/$(MINGW_RELEASE)', 'build/\$(MINGW_RELEASE).zip'); }"
177
- endif
178
-
179
- clean:
180
- $(call task_msg,Cleaning)
181
- rm -rf build/*
182
- ifeq ($(PLATFORM),mingw)
183
- rm -f test/auto.exe
184
- rm -f test/triangle.exe
185
- rm -f test/testcard.exe
186
- rm -f test/audio.exe
187
- rm -f test/controller.exe
188
- else
189
- rm -f test/auto
190
- rm -f test/triangle
191
- rm -f test/testcard
192
- rm -f test/audio
193
- rm -f test/controller
194
- endif
195
-
196
- uninstall:
197
- $(call task_msg,Uninstalling)
198
- rm -f /usr/local/include/simple2d.h
199
- rm -f /usr/local/lib/libsimple2d.a
200
- rm -f /usr/local/bin/simple2d
201
- ifeq ($(PLATFORM),apple)
202
- rm -rf /usr/local/Frameworks/Simple2D
203
- endif
204
-
205
- test:
206
- $(call task_msg,Building tests)
207
- simple2d build test/auto.c
208
- simple2d build test/triangle.c
209
- simple2d build test/testcard.c
210
- simple2d build test/audio.c
211
- simple2d build test/controller.c
212
-
213
- rebuild: uninstall clean all install test
214
-
215
- auto:
216
- $(call run_test,auto)
217
-
218
- triangle:
219
- $(call run_test,triangle)
220
-
221
- testcard:
222
- $(call run_test,testcard)
223
-
224
- audio:
225
- $(call run_test,audio)
226
-
227
- controller:
228
- $(call run_test,controller)
229
-
230
- ifeq ($(PLATFORM),apple)
231
- ios:
232
- ifeq ($(shell test -d /usr/local/Frameworks/Simple2D/iOS/Simple2D.framework; echo $$?),1)
233
- $(error Simple2D.framework missing for iOS. Run `frameworks` and `install-frameworks` targets first)
234
- endif
235
- $(call task_msg,Running iOS test)
236
- mkdir -p build/ios
237
- cp -R deps/xcode/ios/* build/ios
238
- cp test/triangle-ios-tvos.c build/ios/main.c
239
- simple2d build --ios build/ios/MyApp.xcodeproj
240
- simple2d simulator --open "iPhone X"
241
- simple2d simulator --install "build/ios/build/Release-iphonesimulator/MyApp.app"
242
- simple2d simulator --launch "Simple2D.MyApp"
243
- endif
244
-
245
- ifeq ($(PLATFORM),apple)
246
- tvos:
247
- ifeq ($(shell test -d /usr/local/Frameworks/Simple2D/tvOS/Simple2D.framework; echo $$?),1)
248
- $(error Simple2D.framework missing for tvOS. Run `frameworks` and `install-frameworks` targets first)
249
- endif
250
- $(call task_msg,Running tvOS test)
251
- mkdir -p build/tvos
252
- cp -R deps/xcode/tvos/* build/tvos
253
- cp test/triangle-ios-tvos.c build/tvos/main.c
254
- simple2d build --tvos build/tvos/MyApp.xcodeproj
255
- simple2d simulator --open "Apple TV 4K"
256
- simple2d simulator --install "build/tvos/build/Release-appletvsimulator/MyApp.app"
257
- simple2d simulator --launch "Simple2D.MyApp"
258
- endif
259
-
260
- .PHONY: build test