mirror of
https://github.com/Ryujinx/SDL2-CS.git
synced 2025-07-25 18:19:40 +00:00
Compare commits
685 commits
Author | SHA1 | Date | |
---|---|---|---|
|
d50837c46b | ||
|
caa502a393 | ||
|
71ec99d676 | ||
|
7389c35176 | ||
|
14e19b5164 | ||
|
038059ecc9 | ||
|
b42777f4d3 | ||
|
82c0c38477 | ||
|
c66a752bf5 | ||
|
2402c1a0db | ||
|
275e67ad11 | ||
|
70a111cbb6 | ||
|
8f286bb048 | ||
|
e96d39d94b | ||
|
a389f319ce | ||
|
ce6acac60e | ||
|
3547f466d7 | ||
|
4251b252ed | ||
|
7f231ea460 | ||
|
802dd6f15a | ||
|
68ab08e264 | ||
|
df777874bc | ||
|
232018f03e | ||
|
95f9c5c73a | ||
|
077f5e5171 | ||
|
6fa4edcdc4 | ||
|
aa545e727a | ||
|
f4681ebf95 | ||
|
161373c455 | ||
|
4e470dba41 | ||
|
9af6bb8fe8 | ||
|
172acaa08d | ||
|
7ca43ee88c | ||
|
497d929939 | ||
|
54cb2e08c7 | ||
|
ce3bfab43c | ||
|
6bd29ff214 | ||
|
b6e8330d71 | ||
|
b4c039993e | ||
|
832a10c772 | ||
|
740c7a8f87 | ||
|
4d2270aa86 | ||
|
d046b2f2c1 | ||
|
d0361d0e73 | ||
|
5dc54d80a0 | ||
|
2428ad15be | ||
|
45535693a6 | ||
|
bccb6a3136 | ||
|
fc8ed7005b | ||
|
2ec5b46232 | ||
|
eb9f81ac25 | ||
|
2b1c66c7eb | ||
|
16ec96817c | ||
|
9b92aed4b4 | ||
|
a730d16076 | ||
|
f0bef1b9c3 | ||
|
556cd552dd | ||
|
d2e0088381 | ||
|
aa80fe5791 | ||
|
4969c7f3fe | ||
|
658f11e526 | ||
|
ecbe28799d | ||
|
da916a88d5 | ||
|
09f36bcf76 | ||
|
07df446ec8 | ||
|
3d22cd7cb9 | ||
|
00c73365df | ||
|
a30ddefbaf | ||
|
32913b2335 | ||
|
903eebdec4 | ||
|
2519332ce6 | ||
|
e07402105e | ||
|
98a238fe07 | ||
|
f6cf0b57d1 | ||
|
7e10ed6133 | ||
|
3ec97c0015 | ||
|
d00aabdc2f | ||
|
429dca2440 | ||
|
0b373076f6 | ||
|
0f4a522842 | ||
|
b11bffacf6 | ||
|
fdae20ed32 | ||
|
9dd06c9aa7 | ||
|
3de7aae105 | ||
|
aa6c6691d1 | ||
|
356c96c4b4 | ||
|
d5c82b3874 | ||
|
0fc27053cd | ||
|
7b7046588d | ||
|
30125e4c6d | ||
|
38d4e62170 | ||
|
ff81aa5bbf | ||
|
d256ffdeea | ||
|
5547e37319 | ||
|
838530d427 | ||
|
ad5cacb46e | ||
|
a0aab9f1c7 | ||
|
4071670de8 | ||
|
fb9bc3460a | ||
|
741b0ed124 | ||
|
658b2d0dda | ||
|
b0dff7be83 | ||
|
b2530ebcfe | ||
|
cfaabd8550 | ||
|
b10629a93b | ||
|
66fafb3d76 | ||
|
bd3a9589c8 | ||
|
c525718620 | ||
|
68b683d275 | ||
|
686c286baa | ||
|
63bf18bb0a | ||
|
b3f4650a53 | ||
|
345238b69a | ||
|
b408ea8ed5 | ||
|
685f7ae03a | ||
|
a0a77142af | ||
|
bd78b7596e | ||
|
dcfa9193db | ||
|
ff8df8363a | ||
|
f1157c7b62 | ||
|
819ca80e95 | ||
|
a2a122d8cf | ||
|
f4c321267e | ||
|
017f034e30 | ||
|
f3af14599f | ||
|
978e54378a | ||
|
0f36127209 | ||
|
e0cd3e38b1 | ||
|
78ec07396f | ||
|
4da4dc03d4 | ||
|
56be43cd7b | ||
|
fd5e568e35 | ||
|
1f6614f127 | ||
|
46d736ff5a | ||
|
b45fdd562a | ||
|
9110635e65 | ||
|
fca9b7bf84 | ||
|
b721400a5a | ||
|
7af8222ce3 | ||
|
aacbe5085a | ||
|
61272d3cbc | ||
|
2070a7f25c | ||
|
39e7892cba | ||
|
ff158cffd3 | ||
|
0b5cb56c74 | ||
|
a2a5bb01c1 | ||
|
562fc2fcfe | ||
|
9f7112dab7 | ||
|
95c34e8606 | ||
|
74b903b48f | ||
|
79efec7b3a | ||
|
d6ddadcd3f | ||
|
5b8f857b62 | ||
|
619b60041d | ||
|
1c79fa9d6b | ||
|
1815852dcc | ||
|
4eaea60401 | ||
|
46f2eabdc7 | ||
|
f06b293caa | ||
|
c7e834b048 | ||
|
fdbdfbc6b4 | ||
|
2e544995ce | ||
|
7c09b28d8a | ||
|
c33223356b | ||
|
f0df2348d3 | ||
|
36ca8b2802 | ||
|
34338dfab2 | ||
|
d1e53cea05 | ||
|
1821b2bb17 | ||
|
b7fd7d726c | ||
|
19aa8b1798 | ||
|
f32e4b5478 | ||
|
366aa00589 | ||
|
ae180cfc1f | ||
|
187f94d325 | ||
|
81c382eab4 | ||
|
11d2922072 | ||
|
702b7c877a | ||
|
735989b51e | ||
|
8cefdf4486 | ||
|
b35aaa494e | ||
|
83205d8921 | ||
|
12137a127b | ||
|
f62950eae7 | ||
|
0a8a135a34 | ||
|
298a725adb | ||
|
9a9d4fbfb9 | ||
|
f84a835639 | ||
|
52f2a61602 | ||
|
3b42c239f0 | ||
|
a0a6f8f64d | ||
|
d4c8b25a79 | ||
|
31db8dd836 | ||
|
0e75d73195 | ||
|
8f179f0549 | ||
|
ff380bf048 | ||
|
48224c9bd6 | ||
|
d4bc1065c0 | ||
|
c168f4271a | ||
|
0c6e7ac1a2 | ||
|
054e86eabe | ||
|
6dd9f14040 | ||
|
9a854009f0 | ||
|
80841ecef0 | ||
|
4e9088b49d | ||
|
db935863bb | ||
|
ec5e8d8357 | ||
|
5df88baf4b | ||
|
9ad2ef91d4 | ||
|
46d450901c | ||
|
a903801fcb | ||
|
79c04ec4e4 | ||
|
365ac7343c | ||
|
589530739f | ||
|
3dd6caee61 | ||
|
7b9cc0930c | ||
|
9e75a76b27 | ||
|
1ccc304a3b | ||
|
41f1a7b98c | ||
|
7411451ccd | ||
|
6cbf30b667 | ||
|
13efd80035 | ||
|
661432e075 | ||
|
07bf0132e2 | ||
|
1740846bfb | ||
|
c7b2eed527 | ||
|
1f5701255d | ||
|
47d127ff42 | ||
|
57efe7508d | ||
|
180c6624da | ||
|
616ec3e4af | ||
|
d122cdc0cc | ||
|
7fef4e4bcf | ||
|
54fea85d7f | ||
|
7e253ea7fd | ||
|
1b8cb2a3ef | ||
|
be91db5b85 | ||
|
e063120875 | ||
|
a5dd0e3002 | ||
|
55c8fc9736 | ||
|
1d947d73ad | ||
|
c51685eab3 | ||
|
6ce8eaf83a | ||
|
904eed3cb0 | ||
|
931d5fc06e | ||
|
8ac357412e | ||
|
e7e6bdefb0 | ||
|
36ceacad9b | ||
|
c1556e8f95 | ||
|
52db66311c | ||
|
606c573d3e | ||
|
c94f27fa40 | ||
|
09716fcbc2 | ||
|
7a875af110 | ||
|
253d6b4da9 | ||
|
88abfa1730 | ||
|
4c2bf2ab88 | ||
|
82aef37aca | ||
|
52e4a98e0a | ||
|
7a7197c277 | ||
|
ef5dc11cd3 | ||
|
e368843d7a | ||
|
74a1fff30b | ||
|
bcec137696 | ||
|
33e12f2306 | ||
|
3fcefdd96d | ||
|
104a0e76cc | ||
|
d5e1e56983 | ||
|
184bcfd476 | ||
|
ae543f186c | ||
|
1f2d1af595 | ||
|
ec825444fb | ||
|
d786027acc | ||
|
7e899b49c0 | ||
|
2c82d193b9 | ||
|
300874e40a | ||
|
4b751678a2 | ||
|
d0d4705c55 | ||
|
d9511db82c | ||
|
16fdc264b6 | ||
|
1415d15998 | ||
|
cd42526f1c | ||
|
251ec9ae31 | ||
|
b188a3b90c | ||
|
9cb3215569 | ||
|
a535172268 | ||
|
afaa34f0f3 | ||
|
b2ed029f11 | ||
|
8c25be5b12 | ||
|
42709cf78f | ||
|
00c94a24eb | ||
|
e316ae5cfd | ||
|
a234470e39 | ||
|
abd696f7c0 | ||
|
8b76a259af | ||
|
0ea9805e1d | ||
|
dc716ca7c5 | ||
|
db92e59f27 | ||
|
fadd0135c3 | ||
|
e8bf894c31 | ||
|
94f6c5e79a | ||
|
b97b3cd339 | ||
|
460f879545 | ||
|
5944136044 | ||
|
c54101eaf5 | ||
|
b40112a74b | ||
|
722f71f3a5 | ||
|
2ee992ef3b | ||
|
4785fd817f | ||
|
a04537c994 | ||
|
8462f99195 | ||
|
7b7585b045 | ||
|
65b8105f09 | ||
|
83717c51ef | ||
|
b8b194a7ec | ||
|
c9b096c847 | ||
|
4c196724b0 | ||
|
ecc9a9a154 | ||
|
d5484a2fec | ||
|
9be777f917 | ||
|
c0281870b1 | ||
|
a858e3061d | ||
|
8110b3c582 | ||
|
89753c4684 | ||
|
36eccd760b | ||
|
0c4c44634f | ||
|
b904c1164d | ||
|
8825ccdf59 | ||
|
4ca474a69b | ||
|
8807bcc1b2 | ||
|
503baa3663 | ||
|
408fadcded | ||
|
8a2eb9bfa0 | ||
|
e05d0ef426 | ||
|
53596261ca | ||
|
e230266ff3 | ||
|
1b81e33fee | ||
|
947e2503da | ||
|
b6fdbf043e | ||
|
c37b077242 | ||
|
9bf64d5cd1 | ||
|
3216da88bf | ||
|
7bc858acd8 | ||
|
cc7d210bf4 | ||
|
3442d7e8b4 | ||
|
a043e0bb33 | ||
|
186a34554d | ||
|
67dc4d0842 | ||
|
d00bb32648 | ||
|
18cbf1485e | ||
|
742ad3c971 | ||
|
82e95483bd | ||
|
800ae50c84 | ||
|
e2fb4179bd | ||
|
eb4e0cbe50 | ||
|
dc028d0497 | ||
|
32330ebdbd | ||
|
53026deb22 | ||
|
2b8d237fd4 | ||
|
f636c6175d | ||
|
22301b61f4 | ||
|
21ec9cecad | ||
|
1e01bc8eeb | ||
|
332667f37b | ||
|
4eab64f274 | ||
|
51e0a82a3c | ||
|
c5911dcc22 | ||
|
5ace052807 | ||
|
5b7f489e98 | ||
|
ef21e36cea | ||
|
600dfe2de5 | ||
|
0dfc1a8cbb | ||
|
0287457930 | ||
|
4c3602ce14 | ||
|
98e58cb814 | ||
|
1a11a38891 | ||
|
eedabe04d2 | ||
|
c219f70e0d | ||
|
5acf9e579e | ||
|
243fe0b884 | ||
|
9289a3fd82 | ||
|
5966578e82 | ||
|
e95ef4e98a | ||
|
b253a810e0 | ||
|
f4d713f651 | ||
|
a31694d145 | ||
|
3e7eaf9d5b | ||
|
c782115e7f | ||
|
040d39b4a5 | ||
|
4d11cf48a9 | ||
|
0c9a67cd45 | ||
|
6dba3318fa | ||
|
12c4d809ef | ||
|
155c51adb8 | ||
|
0addb31520 | ||
|
32c23f3e35 | ||
|
0729f73aa1 | ||
|
67a6fb4532 | ||
|
ad755967f3 | ||
|
19be86c467 | ||
|
2994716b99 | ||
|
ef9c50923a | ||
|
849d398070 | ||
|
0f73183733 | ||
|
8d0760016b | ||
|
11064cc128 | ||
|
e7d628f539 | ||
|
6cb034a649 | ||
|
6a28ae8594 | ||
|
8aa635b27f | ||
|
c6524e2eb4 | ||
|
1a3556441e | ||
|
1f35c7f2fd | ||
|
dc9d98a075 | ||
|
99a3123c42 | ||
|
0b6091c655 | ||
|
3185ae7eba | ||
|
1c0c33ff5b | ||
|
eeadbf0709 | ||
|
59b5620bd5 | ||
|
7aaf5e6203 | ||
|
499ad108b9 | ||
|
80a13ba107 | ||
|
d0d0ae0071 | ||
|
386ebcfcc9 | ||
|
c787ad8f8d | ||
|
f4c767259f | ||
|
162bbe0ba4 | ||
|
d5b0e14cf5 | ||
|
cd4064203f | ||
|
859737b1e1 | ||
|
65d719a058 | ||
|
0cd8f85918 | ||
|
b5a66888f5 | ||
|
3819b959b6 | ||
|
93acf5457b | ||
|
48621907a2 | ||
|
292c0084a1 | ||
|
9743aaef11 | ||
|
3672e94be5 | ||
|
0560581774 | ||
|
f5e19f2114 | ||
|
48e13433b3 | ||
|
dd6f7face8 | ||
|
f26b55e8be | ||
|
a16e9951f7 | ||
|
8e0cec49a0 | ||
|
03f0431995 | ||
|
99846d578c | ||
|
8e75771fca | ||
|
0f768e1c18 | ||
|
bd3b64fe32 | ||
|
9549b1c920 | ||
|
821c6aaf49 | ||
|
c764309ae5 | ||
|
5ec50891a3 | ||
|
77cffe2f92 | ||
|
ed4838b75d | ||
|
64e2a93d55 | ||
|
396299307f | ||
|
41a2c5b93d | ||
|
63aeac09ca | ||
|
14ef9e4643 | ||
|
d9bfc8b16a | ||
|
2c3515f458 | ||
|
795db4433d | ||
|
5785d3d464 | ||
|
11adade8c2 | ||
|
912569d705 | ||
|
689dcf5342 | ||
|
f7dbc10af5 | ||
|
cf7a5fa2a1 | ||
|
0da7c81d81 | ||
|
b9939c43e3 | ||
|
776b77c27f | ||
|
9cdd0079b4 | ||
|
dc98059905 | ||
|
498a565eda | ||
|
705681d982 | ||
|
d03071653d | ||
|
4ec65bc5a0 | ||
|
8a51516de0 | ||
|
a230993c4c | ||
|
6f158b9f79 | ||
|
cceef27e50 | ||
|
9b6f16a238 | ||
|
8cf81bc2e6 | ||
|
e3e22902e7 | ||
|
c6fa4d1457 | ||
|
d77d831acb | ||
|
23e25a3b2d | ||
|
1efc47ee26 | ||
|
a44c92397d | ||
|
5d5f4154bb | ||
|
1c03cdfb2c | ||
|
c2d58d61d5 | ||
|
0532deb9a6 | ||
|
c41fcf5b19 | ||
|
2e9752838d | ||
|
7f3d91e2e5 | ||
|
dbffbe778b | ||
|
83012b9866 | ||
|
62a28724f2 | ||
|
f29dbb7e4d | ||
|
ec8bd4ab09 | ||
|
2748a2f4e2 | ||
|
6ca6862d7e | ||
|
07d4d8a494 | ||
|
a273ea9a18 | ||
|
7a248e2678 | ||
|
784cda961f | ||
|
9c475e36fa | ||
|
818a5cb6e0 | ||
|
0834d434ec | ||
|
1313fc8b66 | ||
|
19b00a2345 | ||
|
99f2688d2b | ||
|
847df8350b | ||
|
7386579667 | ||
|
471b3f9658 | ||
|
9a1f823bca | ||
|
e395a5114d | ||
|
818830fc3a | ||
|
df0b8c03d6 | ||
|
92f293416d | ||
|
babac2a7f0 | ||
|
34d66997f0 | ||
|
f284899867 | ||
|
650fa8e44a | ||
|
1b0674efbe | ||
|
419a25e86d | ||
|
ed817aad60 | ||
|
3a4bc35646 | ||
|
d26d719d76 | ||
|
b8baa22a1b | ||
|
a6665a6c08 | ||
|
eaa4f366d0 | ||
|
fbe2627fd4 | ||
|
ed8c91d2f3 | ||
|
7a39b5d49c | ||
|
db291e6464 | ||
|
37058ed972 | ||
|
07853258b4 | ||
|
1c6261532c | ||
|
48bae22f0e | ||
|
eb23cc18a7 | ||
|
3ea9ae0ede | ||
|
55c7c04b0b | ||
|
1a8273cdc2 | ||
|
a7fe72d17a | ||
|
b4ccfe1c96 | ||
|
4ad42a1e9d | ||
|
7d3217b375 | ||
|
e8731efadb | ||
|
713e25ab96 | ||
|
67f4c81bb3 | ||
|
6899e6cdb0 | ||
|
f495b5318c | ||
|
43a1905edf | ||
|
af13848840 | ||
|
21ab9a5d69 | ||
|
1055efcc34 | ||
|
404c4d583d | ||
|
82cd690656 | ||
|
f7ba9ab3b7 | ||
|
a7b2d3de69 | ||
|
6d0456c99e | ||
|
2e719b0650 | ||
|
60454e8878 | ||
|
a74f245fe6 | ||
|
8846dbcaa4 | ||
|
7dd378d866 | ||
|
cbf996466d | ||
|
6bf1984db9 | ||
|
0fb37403cd | ||
|
4a37ca4387 | ||
|
078ef09a09 | ||
|
63c194dd81 | ||
|
193b1db8cb | ||
|
5caa264f85 | ||
|
062241ca82 | ||
|
f3ae14eb98 | ||
|
70af91f844 | ||
|
ff2d14d00b | ||
|
191ce0ad89 | ||
|
b5762af567 | ||
|
5b575f02a0 | ||
|
3ce41e80ac | ||
|
ac4ac4d299 | ||
|
1ffb95fa74 | ||
|
4b61ff485a | ||
|
acd92371fc | ||
|
d1e5b4d1a0 | ||
|
f154bab1d8 | ||
|
1d1eebb5cc | ||
|
cfec5bc59f | ||
|
85dd4bbb6d | ||
|
8facd9f0b0 | ||
|
861f5b3df6 | ||
|
29372e5fa4 | ||
|
475b9b6787 | ||
|
15aa82b2df | ||
|
1459270321 | ||
|
e7f9b53796 | ||
|
390a6c2cb3 | ||
|
afdfc7e627 | ||
|
58a8d318ac | ||
|
95f0f58b84 | ||
|
3f2eeba67f | ||
|
49f4419656 | ||
|
552a8b5ead | ||
|
68b9cdcea9 | ||
|
080f4e6e2b | ||
|
0b7cd87083 | ||
|
28ad7c171c | ||
|
657c78f956 | ||
|
72735d2b8d | ||
|
29c51a3f9b | ||
|
c4bcd17f60 | ||
|
41885b1e80 | ||
|
dbe1891988 | ||
|
5b2d1c3aea | ||
|
9b86627382 | ||
|
eaf552bad0 | ||
|
ad6e7a7fa8 | ||
|
796e0b9e54 | ||
|
10e0d51f85 | ||
|
72dd621577 | ||
|
52931f5c4e | ||
|
2d5f572ccf | ||
|
482319f9b0 | ||
|
a9f3447df3 | ||
|
65d95597bb | ||
|
82aae4d722 | ||
|
70c4d742c8 | ||
|
5dd0738ebd | ||
|
c751ad0a03 | ||
|
fe8cf68230 | ||
|
7a4820d660 | ||
|
941209348a | ||
|
51e907c959 | ||
|
423ace8dd8 | ||
|
92397d8a98 | ||
|
964f553e25 | ||
|
b877b08553 | ||
|
284c1cde76 | ||
|
f42d304eff | ||
|
19d4602321 | ||
|
00f353693e | ||
|
4868a53683 | ||
|
1c6c04f2e2 | ||
|
1741030481 | ||
|
cbbc74bc76 | ||
|
c84875d275 | ||
|
2c3a759c6b | ||
|
0d5195c00c | ||
|
9f0949be21 | ||
|
2658498408 | ||
|
8876cc0117 | ||
|
1b692d307d | ||
|
6ccf4ca414 | ||
|
ce89a55acf | ||
|
0023c59bd3 | ||
|
7c1bfdbaeb | ||
|
4c9d372611 | ||
|
647e1b5efd | ||
|
4f02e3d005 | ||
|
a69308c8d6 | ||
|
d49903dd9e | ||
|
f154fc784b | ||
|
5440f8ad22 | ||
|
2a2bdc2884 | ||
|
ffab51b4a0 | ||
|
015be72dad | ||
|
9ab9d57b23 | ||
|
fdbf76f308 | ||
|
50f06c87fb | ||
|
61300054cc | ||
|
90c8e858f7 | ||
|
b1fd6e4caf | ||
|
a571614c3b | ||
|
7ba9db97ea | ||
|
3eb90d9c52 | ||
|
f6eff6c217 | ||
|
21cb7cb7b7 |
9
.github/dependabot.yml
vendored
Normal file
9
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
version: 2
|
||||
updates:
|
||||
- directory: /
|
||||
package-ecosystem: github-actions
|
||||
reviewers:
|
||||
- marysaka
|
||||
- TSRBerry
|
||||
schedule:
|
||||
interval: daily
|
92
.github/workflows/build.yml
vendored
Normal file
92
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
name: build-native
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
rev:
|
||||
description: 'Ryujinx/SDL commit to build (this has to be a full commit sha, otherwise it will not work)'
|
||||
required: true
|
||||
# schedule:
|
||||
# - cron: '0 0 * * *'
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.platform.name }}
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: win-x64, os: windows-latest, arch: x64 }
|
||||
# - { name: win-x86, os: windows-latest, arch: Win32 }
|
||||
- { name: win-arm64, os: windows-latest, arch: ARM64 }
|
||||
- { name: linux-x64, os: ubuntu-20.04, arch: amd64 }
|
||||
# - { name: linux-x86, os: ubuntu-20.04, arch: i386 }
|
||||
- { name: linux-arm64, os: ubuntu-20.04, arch: arm64 }
|
||||
- { name: osx-x64, os: macos-latest, arch: x86_64 }
|
||||
- { name: osx-arm64, os: macos-latest, arch: arm64 }
|
||||
steps:
|
||||
- name: Setup qemu static
|
||||
uses: docker/setup-qemu-action@v3
|
||||
if: runner.os == 'Linux'
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: Ryujinx/SDL
|
||||
ref: ${{ github.event.inputs.rev }}
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'SDL2-CS'
|
||||
- name: Build and prepare release
|
||||
run: SDL2-CS/ci/run.sh $PWD $PWD/SDL2-CS/native/${{ matrix.platform.name }} ${{ matrix.platform.arch }}
|
||||
shell: bash
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.platform.name }}-binaries
|
||||
path: install_output
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
commit-message: Update ${{ matrix.platform.name }} SDL binaries
|
||||
title: Update ${{ matrix.platform.name }} SDL binaries
|
||||
body: This PR has been auto-generated to update the ${{ matrix.platform.name }} SDL binaries.
|
||||
branch: update-${{ matrix.platform.name }}-binaries
|
||||
path: 'SDL2-CS'
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
||||
|
||||
build-ios:
|
||||
name: ios
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: Ryujinx/SDL
|
||||
ref: ${{ github.event.inputs.rev }}
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'SDL2-CS'
|
||||
- name: Build (iOS)
|
||||
run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -scheme xcFramework-iOS -configuration Release
|
||||
- name: Prepare release directory (iOS)
|
||||
run: mkdir -p SDL2-CS/native/ios
|
||||
- name: Prepare release (iOS)
|
||||
run: |
|
||||
mkdir -p SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework;
|
||||
mkdir -p SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/Info.plist;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64/SDL2.framework/SDL2 SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/SDL2;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64/SDL2.framework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/Info.plist;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/SDL2 SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/SDL2;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/Info.plist;
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
commit-message: Update iOS SDL binaries
|
||||
title: Update iOS SDL binaries
|
||||
body: This PR has been auto-genereated to update the iOS SDL binaries
|
||||
branch: update-ios-binaries
|
||||
path: 'SDL2-CS'
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
34
.github/workflows/ci.yml
vendored
Normal file
34
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs: {}
|
||||
#push:
|
||||
# branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 7.0.x
|
||||
- uses: nuget/setup-nuget@v1
|
||||
with:
|
||||
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
|
||||
nuget-version: '6.x'
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal
|
||||
- name: Pack & Publish
|
||||
run: |
|
||||
dotnet pack --version-suffix "build${{ github.run_number }}" -c Release .\SDL2-CS.csproj -o .
|
||||
$file_to_publish = Get-ChildItem -Path $dir -Filter *.nupkg | Select -First 1
|
||||
echo $file_to_publish
|
||||
nuget push $file_to_publish -Source https://api.nuget.org/v3/index.json
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
bin/
|
||||
obj/
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*.suo
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013 Ethan Lee.
|
||||
* Copyright (c) 2013-2021 Ethan Lee.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
|
|
17
README
17
README
|
@ -14,17 +14,16 @@ http://wiki.libsdl.org/moin.fcg/FrontPage
|
|||
|
||||
About the C# Wrapper
|
||||
--------------------
|
||||
The C# wrapper was written to be used for MonoGame's desktop platforms. However,
|
||||
this is written in a way that can be used for any general C# application.
|
||||
The C# wrapper was written to be used for FNA's platform support. However, this
|
||||
is written in a way that can be used for any general C# application.
|
||||
|
||||
The wrapper provides bindings for the following libraries:
|
||||
- SDL2
|
||||
- SDL2_gfx
|
||||
- SDL2_image
|
||||
- SDL2_mixer
|
||||
- SDL2_ttf
|
||||
|
||||
We are in the process of adding bindings for OpenGL and OpenAL, via OpenTK.
|
||||
|
||||
Note that SDL2# will not provide every single SDL2 function. This is due to
|
||||
limitations in the C# language that would cause major conflicts with the native
|
||||
SDL2 library and its extensions.
|
||||
|
@ -35,8 +34,10 @@ be exactly as they are done in the C library, with little-to-no concern for
|
|||
names will indicate which library file the function/type/value exists in, and
|
||||
everything else will be as close to the C version as technically possible.
|
||||
|
||||
Roadmap
|
||||
-------
|
||||
To see the current roadmap for SDL2#, visit the GitHub issues page:
|
||||
About the Visual Studio Debugger
|
||||
--------------------------------
|
||||
When running C# applications under the Visual Studio debugger, native code that
|
||||
names threads with the 0x406D1388 exception will silently exit. To prevent this
|
||||
exception from being thrown by SDL, add this line before your SDL_Init call:
|
||||
|
||||
https://github.com/flibitijibibo/SDL2-CS/issues
|
||||
SDL.SDL_SetHint(SDL.SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, "1");
|
||||
|
|
59
SDL2#.csproj
59
SDL2#.csproj
|
@ -1,59 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{85480198-8711-4355-830E-72FD794AD3F6}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>SDL2</RootNamespace>
|
||||
<AssemblyName>SDL2#</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<additionalargs>/unsafe</additionalargs>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<additionalargs>/unsafe</additionalargs>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Compile Include="src\SDL2.cs" />
|
||||
<Compile Include="src\SDL2_image.cs" />
|
||||
<Compile Include="src\SDL2_mixer.cs" />
|
||||
<Compile Include="src\SDL2_ttf.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SDL2#.dll.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="src\" />
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<StandardHeader Text="" IncludeInNewFiles="False" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<dllmap dll="SDL2.dll" os="windows" target="SDL2.dll"/>
|
||||
<dllmap dll="SDL2.dll" os="osx" target="libSDL2-2.0.0.dylib"/>
|
||||
<dllmap dll="SDL2.dll" os="linux" target="libSDL2-2.0.so.0"/>
|
||||
|
||||
<dllmap dll="SDL2_image.dll" os="windows" target="SDL2_image.dll"/>
|
||||
<dllmap dll="SDL2_image.dll" os="osx" target="libSDL2_image-2.0.0.dylib"/>
|
||||
<dllmap dll="SDL2_image.dll" os="linux" target="libSDL2_image-2.0.so.0"/>
|
||||
|
||||
<dllmap dll="SDL2_mixer.dll" os="windows" target="SDL2_mixer.dll"/>
|
||||
<dllmap dll="SDL2_mixer.dll" os="osx" target="libSDL2_mixer-2.0.0.dylib"/>
|
||||
<dllmap dll="SDL2_mixer.dll" os="linux" target="libSDL2_mixer-2.0.so.0"/>
|
||||
|
||||
<dllmap dll="SDL2_ttf.dll" os="windows" target="SDL2_ttf.dll"/>
|
||||
<dllmap dll="SDL2_ttf.dll" os="osx" target="libSDL2_ttf-2.0.0.dylib"/>
|
||||
<dllmap dll="SDL2_ttf.dll" os="linux" target="libSDL2_ttf-2.0.so.0"/>
|
||||
</configuration>
|
20
SDL2#.sln
20
SDL2#.sln
|
@ -1,20 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL2#", "SDL2#.csproj", "{85480198-8711-4355-830E-72FD794AD3F6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Debug|x86.Build.0 = Debug|x86
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Release|x86.ActiveCfg = Release|x86
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = SDL2#.csproj
|
||||
EndGlobalSection
|
||||
EndGlobal
|
62
SDL2-CS.csproj
Normal file
62
SDL2-CS.csproj
Normal file
|
@ -0,0 +1,62 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyTitle>SDL2#</AssemblyTitle>
|
||||
<AssemblyName>SDL2-CS</AssemblyName>
|
||||
<Description>libSDL2 bindings for C#</Description>
|
||||
<RootNamespace>SDL2</RootNamespace>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<VersionPrefix>2.30.0</VersionPrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="NuGet">
|
||||
<Authors>marysaka & ppy Pty Ltd & flibitijibibo</Authors>
|
||||
<Title>SDL2#</Title>
|
||||
<PackageId>Ryujinx.SDL2-CS</PackageId>
|
||||
<PackageProjectUrl>https://github.com/Ryujinx/SDL2-CS</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/Ryujinx/SDL2-CS</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\win-x64\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/win-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\win-arm64\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/win-arm64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\osx-x64\libSDL2.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/osx-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\osx-arm64\libSDL2.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/osx-arm64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\linux-x64\libSDL2.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/linux-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\linux-arm64\libSDL2.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/linux-arm64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\ios\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/ios/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="app.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
32
SDL2-CS.sln
Normal file
32
SDL2-CS.sln
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL2-CS", "SDL2-CS.csproj", "{85480198-8711-4355-830E-72FD794AD3F6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Debug|x64.Build.0 = Debug|x64
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Debug|x86.Build.0 = Debug|x86
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Release|x64.ActiveCfg = Release|x64
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Release|x64.Build.0 = Release|x64
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Release|x86.ActiveCfg = Release|x86
|
||||
{85480198-8711-4355-830E-72FD794AD3F6}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = SDL2-CS.csproj
|
||||
EndGlobalSection
|
||||
EndGlobal
|
6
app.config
Normal file
6
app.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<dllmap dll="SDL2" os="windows" target="SDL2.dll"/>
|
||||
<dllmap dll="SDL2" os="osx" target="libSDL2.dylib"/>
|
||||
<dllmap dll="SDL2" os="linux" target="libSDL2-2.0.so.0"/>
|
||||
</configuration>
|
8
appveyor.yml
Normal file
8
appveyor.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
image: Visual Studio 2022
|
||||
build_script:
|
||||
- cmd: dotnet restore
|
||||
- cmd: dotnet pack SDL2-CS.csproj -c:Release --include-symbols /p:Version=%APPVEYOR_BUILD_VERSION%
|
||||
test: off
|
||||
version: 1.0.{build}-alpha
|
||||
artifacts:
|
||||
- path: 'bin\Release\*.nupkg'
|
109
ci/compile.sh
Executable file
109
ci/compile.sh
Executable file
|
@ -0,0 +1,109 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -le 1 ]; then
|
||||
echo "usage: <sdl_dir> <output_path> [build_arch]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
uname_system="$(uname -s)"
|
||||
|
||||
case "${uname_system}" in
|
||||
Linux*) system_name=linux;;
|
||||
Darwin*) system_name=macos;;
|
||||
CYGWIN*) system_name=win;;
|
||||
MINGW*) system_name=win;;
|
||||
*) system_name="Unknown OS: ${uname_system}"
|
||||
esac
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
sdl_dir=$1
|
||||
output_path=$2
|
||||
build_arch=$3
|
||||
|
||||
mkdir -p $output_path
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
if [ $system_name == "linux" ]; then
|
||||
build_arch=$(dpkg --print-architecture)
|
||||
else
|
||||
echo "ERROR - build_arch parameter needed on macOS and Windows"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v sudo &> /dev/null
|
||||
then
|
||||
SUDO=sudo
|
||||
fi
|
||||
|
||||
if [[ $system_name == "linux" ]]; then
|
||||
if [[ $build_arch == "i386" ]]; then
|
||||
sudo dpkg --add-architecture i386
|
||||
|
||||
export CFLAGS=-m32
|
||||
export CXXFLAGS=-m32
|
||||
fi
|
||||
|
||||
$SUDO apt-get update -y
|
||||
$SUDO apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
wayland-scanner++ \
|
||||
wayland-protocols \
|
||||
pkg-config:$build_arch \
|
||||
libasound2-dev:$build_arch \
|
||||
libdbus-1-dev:$build_arch \
|
||||
libegl1-mesa-dev:$build_arch \
|
||||
libgl1-mesa-dev:$build_arch \
|
||||
libgles2-mesa-dev:$build_arch \
|
||||
libglu1-mesa-dev:$build_arch \
|
||||
libibus-1.0-dev:$build_arch \
|
||||
libpulse-dev:$build_arch \
|
||||
libsdl2-2.0-0:$build_arch \
|
||||
libsndio-dev:$build_arch \
|
||||
libudev-dev:$build_arch \
|
||||
libwayland-dev:$build_arch \
|
||||
libx11-dev:$build_arch \
|
||||
libxcursor-dev:$build_arch \
|
||||
libxext-dev:$build_arch \
|
||||
libxi-dev:$build_arch \
|
||||
libxinerama-dev:$build_arch \
|
||||
libxkbcommon-dev:$build_arch \
|
||||
libxrandr-dev:$build_arch \
|
||||
libxss-dev:$build_arch \
|
||||
libxt-dev:$build_arch \
|
||||
libxv-dev:$build_arch \
|
||||
libxxf86vm-dev:$build_arch \
|
||||
libdrm-dev:$build_arch \
|
||||
libgbm-dev:$build_arch \
|
||||
libpulse-dev:$build_arch \
|
||||
libhidapi-dev:$build_arch \
|
||||
libwayland-client++0:$build_arch \
|
||||
libwayland-cursor++0:$build_arch
|
||||
|
||||
extra_cmake_flags="-GNinja"
|
||||
elif [[ $system_name == "macos" ]]; then
|
||||
extra_cmake_flags="-DCMAKE_OSX_ARCHITECTURES=\"$build_arch\" -DCMAKE_OSX_DEPLOYMENT_TARGET=\"11.0\""
|
||||
elif [[ $system_name == "win" ]]; then
|
||||
extra_cmake_flags="-A $build_arch"
|
||||
fi
|
||||
|
||||
pushd $sdl_dir
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON $extra_cmake_flags
|
||||
cmake --build build/ --config Release
|
||||
$SUDO cmake --install build/ --prefix install_output --config Release
|
||||
|
||||
mkdir -p $output_path
|
||||
|
||||
if [[ $system_name == "linux" ]]; then
|
||||
cp install_output/lib/libSDL2-2.0.so.0 $output_path/libSDL2.so
|
||||
elif [[ $system_name == "macos" ]]; then
|
||||
cp install_output/lib/libSDL2-2.0.dylib $output_path/libSDL2.dylib
|
||||
elif [[ $system_name == "win" ]]; then
|
||||
cp install_output/bin/SDL2.dll $output_path/SDL2.dll
|
||||
fi
|
||||
popd
|
41
ci/run.sh
Executable file
41
ci/run.sh
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -le 2 ]; then
|
||||
echo "usage: <sdl_dir> <output_path> <build_arch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
uname_system="$(uname -s)"
|
||||
|
||||
case "${uname_system}" in
|
||||
Linux*) system_name=linux;;
|
||||
Darwin*) system_name=macos;;
|
||||
CYGWIN*) system_name=win;;
|
||||
MINGW*) system_name=win;;
|
||||
*) system_name="Unknown OS: ${uname_system}"
|
||||
esac
|
||||
|
||||
sdl_dir=$1
|
||||
output_path=$2
|
||||
build_arch=$3
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
mkdir -p $output_path
|
||||
|
||||
if [ $system_name == "linux" ] && [ $build_arch == "arm64" ]; then
|
||||
if command -v podman &> /dev/null; then
|
||||
DOCKER=podman
|
||||
elif command -v docker &> /dev/null; then
|
||||
DOCKER=docker
|
||||
else
|
||||
echo "ERROR - Missing docker/podman env, cannot crossbuild"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$DOCKER run --rm -v $SCRIPT_DIR:/scripts -v $output_path:/output -v $sdl_dir:/source -t arm64v8/ubuntu:focal bash /scripts/compile.sh /source /output $build_arch
|
||||
else
|
||||
$SCRIPT_DIR/compile.sh "$sdl_dir" "$output_path" "$build_arch"
|
||||
fi
|
19
linux-build/Dockerfile.amd64
Normal file
19
linux-build/Dockerfile.amd64
Normal file
|
@ -0,0 +1,19 @@
|
|||
FROM debian:jessie
|
||||
|
||||
# We build on Jessie, but libwayland-dev and wayland-protocols are only in
|
||||
# Stretch and later.
|
||||
COPY stretch-package-pins /etc/apt/preferences.d/stretch
|
||||
|
||||
# Packages are from https://hg.libsdl.org/SDL/file/default/docs/README-linux.md
|
||||
RUN echo deb http://deb.debian.org/debian/ stretch main > /etc/apt/sources.list.d/stretch.list && \
|
||||
echo deb http://security.debian.org/debian-security stretch/updates main >> /etc/apt/sources.list.d/stretch.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y build-essential mercurial make cmake autoconf automake \
|
||||
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
|
||||
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
|
||||
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
|
||||
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
|
||||
fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \
|
||||
libxkbcommon-dev wayland-protocols
|
||||
|
||||
ENTRYPOINT ["/entry"]
|
19
linux-build/Dockerfile.i386
Normal file
19
linux-build/Dockerfile.i386
Normal file
|
@ -0,0 +1,19 @@
|
|||
FROM i386/debian:jessie
|
||||
|
||||
# We build on Jessie, but libwayland-dev and wayland-protocols are only in
|
||||
# Stretch and later.
|
||||
COPY stretch-package-pins /etc/apt/preferences.d/stretch
|
||||
|
||||
# Packages are from https://hg.libsdl.org/SDL/file/default/docs/README-linux.md
|
||||
RUN echo deb http://deb.debian.org/debian/ stretch main > /etc/apt/sources.list.d/stretch.list && \
|
||||
echo deb http://security.debian.org/debian-security stretch/updates main >> /etc/apt/sources.list.d/stretch.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y build-essential mercurial make cmake autoconf automake \
|
||||
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
|
||||
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
|
||||
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
|
||||
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
|
||||
fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \
|
||||
libxkbcommon-dev wayland-protocols
|
||||
|
||||
ENTRYPOINT ["/entry"]
|
11
linux-build/compile
Executable file
11
linux-build/compile
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euf -o pipefail
|
||||
|
||||
cd /src
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
../configure --prefix=/io
|
||||
make -j$(nproc)
|
||||
make install
|
27
linux-build/stretch-package-pins
Normal file
27
linux-build/stretch-package-pins
Normal file
|
@ -0,0 +1,27 @@
|
|||
Package: *
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 50
|
||||
|
||||
Package: libwayland-dev
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: libwayland-bin
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: libwayland-client0
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: libwayland-cursor0
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: libwayland-server0
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: wayland-protocols
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
40
native/ios/SDL2.xcframework/Info.plist
Normal file
40
native/ios/SDL2.xcframework/Info.plist
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AvailableLibraries</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>SDL2.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>SDL2.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/Info.plist
Normal file
BIN
native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/Info.plist
Normal file
Binary file not shown.
BIN
native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/SDL2
Executable file
BIN
native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/SDL2
Executable file
Binary file not shown.
Binary file not shown.
BIN
native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/SDL2
Executable file
BIN
native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/SDL2
Executable file
Binary file not shown.
BIN
native/linux-arm64/libSDL2.so
Normal file
BIN
native/linux-arm64/libSDL2.so
Normal file
Binary file not shown.
BIN
native/linux-x64/libSDL2.so
Executable file
BIN
native/linux-x64/libSDL2.so
Executable file
Binary file not shown.
BIN
native/linux-x86/libSDL2.so
Executable file
BIN
native/linux-x86/libSDL2.so
Executable file
Binary file not shown.
BIN
native/osx-arm64/libSDL2.dylib
Executable file
BIN
native/osx-arm64/libSDL2.dylib
Executable file
Binary file not shown.
BIN
native/osx-x64/libSDL2.dylib
Executable file
BIN
native/osx-x64/libSDL2.dylib
Executable file
Binary file not shown.
BIN
native/win-arm64/SDL2.dll
Normal file
BIN
native/win-arm64/SDL2.dll
Normal file
Binary file not shown.
BIN
native/win-x64/SDL2.dll
Executable file
BIN
native/win-x64/SDL2.dll
Executable file
Binary file not shown.
BIN
native/win-x86/SDL2.dll
Executable file
BIN
native/win-x86/SDL2.dll
Executable file
Binary file not shown.
7188
src/SDL2.cs
7188
src/SDL2.cs
File diff suppressed because it is too large
Load diff
390
src/SDL2_gfx.cs
Normal file
390
src/SDL2_gfx.cs
Normal file
|
@ -0,0 +1,390 @@
|
|||
#region License
|
||||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013-2021 Ethan Lee.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Ethan "flibitijibibo" Lee <flibitijibibo@flibitijibibo.com>
|
||||
*
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
namespace SDL2
|
||||
{
|
||||
public static class SDL_gfx
|
||||
{
|
||||
#region SDL2# Variables
|
||||
|
||||
/* Used by DllImport to load the native library. */
|
||||
private const string nativeLibName = "SDL2_gfx";
|
||||
|
||||
#endregion
|
||||
|
||||
public const double M_PI = 3.1415926535897932384626433832795;
|
||||
|
||||
#region SDL2_gfxPrimitives.h
|
||||
|
||||
public const uint SDL2_GFXPRIMITIVES_MAJOR = 1;
|
||||
public const uint SDL2_GFXPRIMITIVES_MINOR = 0;
|
||||
public const uint SDL2_GFXPRIMITIVES_MICRO = 1;
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int pixelColor(IntPtr renderer, short x, short y, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int pixelRGBA(IntPtr renderer, short x, short y, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int hlineColor(IntPtr renderer, short x1, short x2, short y, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int hlineRGBA(IntPtr renderer, short x1, short x2, short y, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int vlineColor(IntPtr renderer, short x, short y1, short y2, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int vlineRGBA(IntPtr renderer, short x, short y1, short y2, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int rectangleColor(IntPtr renderer, short x1, short y1, short x2, short y2, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int rectangleRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int roundedRectangleColor(IntPtr renderer, short x1, short y1, short x2, short y2, short rad, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int roundedRectangleRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, short rad, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int boxColor(IntPtr renderer, short x1, short y1, short x2, short y2, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int boxRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int roundedBoxColor(IntPtr renderer, short x1, short y1, short x2, short y2, short rad, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int roundedBoxRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, short rad, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int lineColor(IntPtr renderer, short x1, short y1, short x2, short y2, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int lineRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aalineColor(IntPtr renderer, short x1, short y1, short x2, short y2, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aalineRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int thickLineColor(IntPtr renderer, short x1, short y1, short x2, short y2, byte width, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int thickLineRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, byte width, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int circleColor(IntPtr renderer, short x, short y, short rad, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int circleRGBA(IntPtr renderer, short x, short y, short rad, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int arcColor(IntPtr renderer, short x, short y, short rad, short start, short end, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int arcRGBA(IntPtr renderer, short x, short y, short rad, short start, short end, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aacircleColor(IntPtr renderer, short x, short y, short rad, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aacircleRGBA(IntPtr renderer, short x, short y, short rad, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledCircleColor(IntPtr renderer, short x, short y, short rad, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledCircleRGBA(IntPtr renderer, short x, short y, short rad, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int ellipseColor(IntPtr renderer, short x, short y, short rx, short ry, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int ellipseRGBA(IntPtr renderer, short x, short y, short rx, short ry, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aaellipseColor(IntPtr renderer, short x, short y, short rx, short ry, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aaellipseRGBA(IntPtr renderer, short x, short y, short rx, short ry, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledEllipseColor(IntPtr renderer, short x, short y, short rx, short ry, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledEllipseRGBA(IntPtr renderer, short x, short y, short rx, short ry, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int pieColor(IntPtr renderer, short x, short y, short rad, short start, short end, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int pieRGBA(IntPtr renderer, short x, short y, short rad, short start, short end, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledPieColor(IntPtr renderer, short x, short y, short rad, short start, short end, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledPieRGBA(IntPtr renderer, short x, short y, short rad, short start, short end, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int trigonColor(IntPtr renderer, short x1, short y1, short x2, short y2, short x3, short y3, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int trigonRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, short x3, short y3, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aatrigonColor(IntPtr renderer, short x1, short y1, short x2, short y2, short x3, short y3, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aatrigonRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, short x3, short y3, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledTrigonColor(IntPtr renderer, short x1, short y1, short x2, short y2, short x3, short y3, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledTrigonRGBA(IntPtr renderer, short x1, short y1, short x2, short y2, short x3, short y3, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int polygonColor(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int polygonRGBA(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aapolygonColor(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int aapolygonRGBA(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledPolygonColor(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int filledPolygonRGBA(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int texturedPolygon(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, IntPtr texture, int texture_dx, int texture_dy);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int bezierColor(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, int s, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int bezierRGBA(IntPtr renderer, [In] short[] vx, [In] short[] vy, int n, int s, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void gfxPrimitivesSetFont([In] byte[] fontdata, uint cw, uint ch);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void gfxPrimitivesSetFontRotation(uint rotation);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int characterColor(IntPtr renderer, short x, short y, char c, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int characterRGBA(IntPtr renderer, short x, short y, char c, byte r, byte g, byte b, byte a);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int stringColor(IntPtr renderer, short x, short y, string s, uint color);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int stringRGBA(IntPtr renderer, short x, short y, string s, byte r, byte g, byte b, byte a);
|
||||
|
||||
#endregion
|
||||
|
||||
#region SDL2_rotozoom.h
|
||||
|
||||
public const int SMOOTHING_OFF = 0;
|
||||
public const int SMOOTHING_ON = 1;
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr rotozoomSurface(IntPtr src, double angle, double zoom, int smooth);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr rotozoomSurfaceXY(IntPtr src, double angle, double zoomx, double zoomy, int smooth);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rotozoomSurfaceSize(int width, int height, double angle, double zoom, out int dstwidth, out int dstheight);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rotozoomSurfaceSizeXY(int width, int height, double angle, double zoomx, double zoomy, out int dstwidth, out int dstheight);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr zoomSurface(IntPtr src, double zoomx, double zoomy, int smooth);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, out int dstwidth, out int dstheight);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr shrinkSurface(IntPtr src, int factorx, int factory);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr rotateSurface90Degrees(IntPtr src, int numClockwiseTurns);
|
||||
|
||||
#endregion
|
||||
|
||||
#region SDL2_framerate.h
|
||||
|
||||
public const int FPS_UPPER_LIMIT = 200;
|
||||
public const int FPS_LOWER_LIMIT = 1;
|
||||
public const int FPS_DEFAULT = 30;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct FPSmanager
|
||||
{
|
||||
public uint framecount;
|
||||
public float rateticks;
|
||||
public uint baseticks;
|
||||
public uint lastticks;
|
||||
public uint rate;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void SDL_initFramerate(ref FPSmanager manager);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_setFramerate(ref FPSmanager manager, uint rate);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_getFramerate(ref FPSmanager manager);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_getFramecount(ref FPSmanager manager);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern uint SDL_framerateDelay(ref FPSmanager manager);
|
||||
|
||||
#endregion
|
||||
|
||||
#region SDL2_imageFilter.h
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterMMXdetect();
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void SDL_imageFilterMMXoff();
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void SDL_imageFilterMMXon();
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterAdd([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterMean([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterSub([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterAbsDiff([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterMult([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterMultNor([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterMultDivby2([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterMultDivby4([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterBitAnd([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterBitOr([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterDiv([In] byte[] src1, [In] byte[] src2, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterBitNegation([In] byte[] src1, [Out] byte[] dest, uint length);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterAddByte([In] byte[] src1, [Out] byte[] dest, uint length, byte c);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterAddUint([In] byte[] src1, [Out] byte[] dest, uint length, uint c);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterAddByteToHalf([In] byte[] src1, [Out] byte[] dest, uint length, byte c);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterSubByte([In] byte[] src1, [Out] byte[] dest, uint length, byte c);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterSubUint([In] byte[] src1, [Out] byte[] dest, uint length, uint c);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterShiftRight([In] byte[] src1, [Out] byte[] dest, uint length, byte n);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterShiftRightUint([In] byte[] src1, [Out] byte[] dest, uint length, byte n);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterMultByByte([In] byte[] src1, [Out] byte[] dest, uint length, byte c);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterShiftRightAndMultByByte([In] byte[] src1, [Out] byte[] dest, uint length, byte n, byte c);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterShiftLeftByte([In] byte[] src1, [Out] byte[] dest, uint length, byte n);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterShiftLeftUint([In] byte[] src1, [Out] byte[] dest, uint length, byte n);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterShiftLeft([In] byte[] src1, [Out] byte[] dest, uint length, byte n);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterBinarizeUsingThreshold([In] byte[] src1, [Out] byte[] dest, uint length, byte t);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterClipToRange([In] byte[] src1, [Out] byte[] dest, uint length, byte tmin, byte tmax);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_imageFilterNormalizeLinear([In] byte[] src1, [Out] byte[] dest, uint length, int cmin, int cmax, int nmin, int nmax);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region License
|
||||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013 Ethan Lee.
|
||||
* Copyright (c) 2013-2021 Ethan Lee.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
|
@ -36,14 +36,22 @@ namespace SDL2
|
|||
public static class SDL_image
|
||||
{
|
||||
#region SDL2# Variables
|
||||
|
||||
|
||||
/* Used by DllImport to load the native library. */
|
||||
private const string nativeLibName = "SDL2_image.dll";
|
||||
|
||||
private const string nativeLibName = "SDL2_image";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region SDL_image.h
|
||||
|
||||
|
||||
/* Similar to the headers, this is the version we're expecting to be
|
||||
* running with. You will likely want to check this somewhere in your
|
||||
* program!
|
||||
*/
|
||||
public const int SDL_IMAGE_MAJOR_VERSION = 2;
|
||||
public const int SDL_IMAGE_MINOR_VERSION = 0;
|
||||
public const int SDL_IMAGE_PATCHLEVEL = 6;
|
||||
|
||||
[Flags]
|
||||
public enum IMG_InitFlags
|
||||
{
|
||||
|
@ -52,48 +60,258 @@ namespace SDL2
|
|||
IMG_INIT_TIF = 0x00000004,
|
||||
IMG_INIT_WEBP = 0x00000008
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_LinkedVersion")]
|
||||
private static extern IntPtr INTERNAL_IMG_LinkedVersion();
|
||||
public static SDL.SDL_version IMG_LinkedVersion()
|
||||
|
||||
public static void SDL_IMAGE_VERSION(out SDL.SDL_version X)
|
||||
{
|
||||
X.major = SDL_IMAGE_MAJOR_VERSION;
|
||||
X.minor = SDL_IMAGE_MINOR_VERSION;
|
||||
X.patch = SDL_IMAGE_PATCHLEVEL;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_Linked_Version", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_IMG_Linked_Version();
|
||||
public static SDL.SDL_version IMG_Linked_Version()
|
||||
{
|
||||
SDL.SDL_version result;
|
||||
IntPtr result_ptr = INTERNAL_IMG_LinkedVersion();
|
||||
IntPtr result_ptr = INTERNAL_IMG_Linked_Version();
|
||||
result = (SDL.SDL_version) Marshal.PtrToStructure(
|
||||
result_ptr,
|
||||
result.GetType()
|
||||
typeof(SDL.SDL_version)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int IMG_Init(IMG_InitFlags flags);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void IMG_Quit();
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr IMG_Load(
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string file
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_Load", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_IMG_Load(
|
||||
byte* file
|
||||
);
|
||||
|
||||
public static unsafe IntPtr IMG_Load(string file)
|
||||
{
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
IntPtr handle = INTERNAL_IMG_Load(
|
||||
utf8File
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* src refers to an SDL_RWops*, IntPtr to an SDL_Surface* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_Load_RW(
|
||||
IntPtr src,
|
||||
int freesrc
|
||||
);
|
||||
|
||||
/* src refers to an SDL_RWops*, IntPtr to an SDL_Surface* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_LoadTyped_RW", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_IMG_LoadTyped_RW(
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
byte* type
|
||||
);
|
||||
public static unsafe IntPtr IMG_LoadTyped_RW(
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
string type
|
||||
) {
|
||||
int utf8TypeBufSize = SDL.Utf8Size(type);
|
||||
byte* utf8Type = stackalloc byte[utf8TypeBufSize];
|
||||
return INTERNAL_IMG_LoadTyped_RW(
|
||||
src,
|
||||
freesrc,
|
||||
SDL.Utf8Encode(type, utf8Type, utf8TypeBufSize)
|
||||
);
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr IMG_LoadTexture(
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_LoadTexture", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_IMG_LoadTexture(
|
||||
IntPtr renderer,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
byte* file
|
||||
);
|
||||
public static unsafe IntPtr IMG_LoadTexture(
|
||||
IntPtr renderer,
|
||||
string file
|
||||
) {
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
IntPtr handle = INTERNAL_IMG_LoadTexture(
|
||||
renderer,
|
||||
utf8File
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* renderer refers to an SDL_Renderer*.
|
||||
* src refers to an SDL_RWops*.
|
||||
* IntPtr to an SDL_Texture*.
|
||||
*/
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadTexture_RW(
|
||||
IntPtr renderer,
|
||||
IntPtr src,
|
||||
int freesrc
|
||||
);
|
||||
|
||||
/* renderer refers to an SDL_Renderer*.
|
||||
* src refers to an SDL_RWops*.
|
||||
* IntPtr to an SDL_Texture*.
|
||||
*/
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_LoadTextureTyped_RW", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_IMG_LoadTextureTyped_RW(
|
||||
IntPtr renderer,
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
byte* type
|
||||
);
|
||||
public static unsafe IntPtr IMG_LoadTextureTyped_RW(
|
||||
IntPtr renderer,
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
string type
|
||||
) {
|
||||
byte* utf8Type = SDL.Utf8EncodeHeap(type);
|
||||
IntPtr handle = INTERNAL_IMG_LoadTextureTyped_RW(
|
||||
renderer,
|
||||
src,
|
||||
freesrc,
|
||||
utf8Type
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Type);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_ReadXPMFromArray(
|
||||
[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)]
|
||||
string[] xpm
|
||||
);
|
||||
|
||||
/* surface refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_SavePNG", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe int INTERNAL_IMG_SavePNG(
|
||||
IntPtr surface,
|
||||
byte* file
|
||||
);
|
||||
public static unsafe int IMG_SavePNG(IntPtr surface, string file)
|
||||
{
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
int result = INTERNAL_IMG_SavePNG(
|
||||
surface,
|
||||
utf8File
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* surface refers to an SDL_Surface*, dst to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int IMG_SavePNG_RW(
|
||||
IntPtr surface,
|
||||
IntPtr dst,
|
||||
int freedst
|
||||
);
|
||||
|
||||
/* surface refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_SaveJPG", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe int INTERNAL_IMG_SaveJPG(
|
||||
IntPtr surface,
|
||||
byte* file,
|
||||
int quality
|
||||
);
|
||||
public static unsafe int IMG_SaveJPG(IntPtr surface, string file, int quality)
|
||||
{
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
int result = INTERNAL_IMG_SaveJPG(
|
||||
surface,
|
||||
utf8File,
|
||||
quality
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* surface refers to an SDL_Surface*, dst to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int IMG_SaveJPG_RW(
|
||||
IntPtr surface,
|
||||
IntPtr dst,
|
||||
int freedst,
|
||||
int quality
|
||||
);
|
||||
|
||||
public static string IMG_GetError()
|
||||
{
|
||||
return SDL.SDL_GetError();
|
||||
}
|
||||
|
||||
public static void IMG_SetError(string fmtAndArglist)
|
||||
{
|
||||
SDL.SDL_SetError(fmtAndArglist);
|
||||
}
|
||||
|
||||
#region Animated Image Support
|
||||
|
||||
/* This region is only available in 2.0.6 or higher. */
|
||||
|
||||
public struct IMG_Animation
|
||||
{
|
||||
public int w;
|
||||
public int h;
|
||||
public IntPtr frames; /* SDL_Surface** */
|
||||
public IntPtr delays; /* int* */
|
||||
}
|
||||
|
||||
/* IntPtr refers to an IMG_Animation* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadAnimation(
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string file
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int IMG_InvertAlpha(int on);
|
||||
|
||||
/* IntPtr refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr IMG_ReadXPMFromArray(ref char[] xpm);
|
||||
|
||||
|
||||
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadAnimation_RW(
|
||||
IntPtr src,
|
||||
int freesrc
|
||||
);
|
||||
|
||||
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadAnimationTyped_RW(
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string type
|
||||
);
|
||||
|
||||
/* anim refers to an IMG_Animation* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void IMG_FreeAnimation(IntPtr anim);
|
||||
|
||||
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadGIFAnimation_RW(IntPtr src);
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region License
|
||||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013 Ethan Lee.
|
||||
* Copyright (c) 2013-2021 Ethan Lee.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
|
@ -36,43 +36,60 @@ namespace SDL2
|
|||
public static class SDL_mixer
|
||||
{
|
||||
#region SDL2# Variables
|
||||
|
||||
|
||||
/* Used by DllImport to load the native library. */
|
||||
private const string nativeLibName = "SDL2_mixer.dll";
|
||||
|
||||
private const string nativeLibName = "SDL2_mixer";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region SDL_mixer.h
|
||||
|
||||
|
||||
/* Similar to the headers, this is the version we're expecting to be
|
||||
* running with. You will likely want to check this somewhere in your
|
||||
* program!
|
||||
*/
|
||||
public const int SDL_MIXER_MAJOR_VERSION = 2;
|
||||
public const int SDL_MIXER_MINOR_VERSION = 0;
|
||||
public const int SDL_MIXER_PATCHLEVEL = 5;
|
||||
|
||||
/* In C, you can redefine this value before including SDL_mixer.h.
|
||||
* We're not going to allow this in SDL2#, since the value of this
|
||||
* variable is persistent and not dependent on preprocessor ordering.
|
||||
*/
|
||||
public const int MIX_CHANNELS = 8;
|
||||
|
||||
public static readonly int MIX_DEFAULT_FREQUENCY = 22050;
|
||||
|
||||
public static readonly int MIX_DEFAULT_FREQUENCY = 44100;
|
||||
public static readonly ushort MIX_DEFAULT_FORMAT =
|
||||
BitConverter.IsLittleEndian ? SDL.AUDIO_S16LSB : SDL.AUDIO_S16MSB;
|
||||
public static readonly int MIX_DEFAULT_CHANNELS = 2;
|
||||
public static readonly byte MIX_MAX_VOLUME = 128;
|
||||
|
||||
|
||||
[Flags]
|
||||
public enum MIX_InitFlags
|
||||
{
|
||||
MIX_INIT_FLAC = 0x00000001,
|
||||
MIX_INIT_MOD = 0x00000002,
|
||||
MIX_INIT_MP3 = 0x00000004,
|
||||
MIX_INIT_OGG = 0x00000008,
|
||||
MIX_INIT_FLUIDSYNTH = 0x00000010,
|
||||
MIX_INIT_MP3 = 0x00000008,
|
||||
MIX_INIT_OGG = 0x00000010,
|
||||
MIX_INIT_MID = 0x00000020,
|
||||
MIX_INIT_OPUS = 0x00000040
|
||||
}
|
||||
|
||||
|
||||
public struct MIX_Chunk
|
||||
{
|
||||
public int allocated;
|
||||
public IntPtr abuf; /* Uint8* */
|
||||
public uint alen;
|
||||
public byte volume;
|
||||
}
|
||||
|
||||
public enum Mix_Fading
|
||||
{
|
||||
MIX_NO_FADING,
|
||||
MIX_FADING_OUT,
|
||||
MIX_FADING_IN
|
||||
}
|
||||
|
||||
|
||||
public enum Mix_MusicType
|
||||
{
|
||||
MUS_NONE,
|
||||
|
@ -82,48 +99,53 @@ namespace SDL2
|
|||
MUS_MID,
|
||||
MUS_OGG,
|
||||
MUS_MP3,
|
||||
MUS_MP3_MAD,
|
||||
MUS_MP3_MAD_UNUSED,
|
||||
MUS_FLAC,
|
||||
MUS_MODPLUG
|
||||
MUS_MODPLUG_UNUSED,
|
||||
MUS_OPUS
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Mix_Chunk
|
||||
{
|
||||
public int allocated;
|
||||
public IntPtr abuf; // Uint8*
|
||||
public uint alen;
|
||||
public byte volume;
|
||||
}
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void MixFuncDelegate(
|
||||
IntPtr udata, // void*
|
||||
IntPtr stream, // Uint8*
|
||||
int len
|
||||
);
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void Mix_EffectFunc_t(
|
||||
int chan,
|
||||
IntPtr stream, // void*
|
||||
int len,
|
||||
IntPtr udata // void*
|
||||
);
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void Mix_EffectDone_t(
|
||||
int chan,
|
||||
IntPtr udata // void*
|
||||
);
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void MusicFinishedDelegate();
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void ChannelFinishedDelegate(int channel);
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate int SoundFontDelegate(
|
||||
IntPtr a, // const char*
|
||||
IntPtr b // void*
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "MIX_Linked_Version")]
|
||||
|
||||
public static void SDL_MIXER_VERSION(out SDL.SDL_version X)
|
||||
{
|
||||
X.major = SDL_MIXER_MAJOR_VERSION;
|
||||
X.minor = SDL_MIXER_MINOR_VERSION;
|
||||
X.patch = SDL_MIXER_PATCHLEVEL;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "MIX_Linked_Version", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_MIX_Linked_Version();
|
||||
public static SDL.SDL_version MIX_Linked_Version()
|
||||
{
|
||||
|
@ -131,185 +153,261 @@ namespace SDL2
|
|||
IntPtr result_ptr = INTERNAL_MIX_Linked_Version();
|
||||
result = (SDL.SDL_version) Marshal.PtrToStructure(
|
||||
result_ptr,
|
||||
result.GetType()
|
||||
typeof(SDL.SDL_version)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_Init(MIX_InitFlags flags);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_Quit();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_OpenAudio(
|
||||
int frequency,
|
||||
ushort format,
|
||||
int channels,
|
||||
int chunksize
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_AllocateChannels(int numchans);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_QuerySpec(
|
||||
ref int frequency,
|
||||
ref ushort format,
|
||||
ref int channels
|
||||
out int frequency,
|
||||
out ushort format,
|
||||
out int channels
|
||||
);
|
||||
|
||||
/* These are for Mix_LoadWAV, which is a macro in the C header.
|
||||
* THIS IS AN RWops FUNCTION!
|
||||
*/
|
||||
/* IntPtr refers to a Mix_Chunk* */
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_LoadWAV_RW")]
|
||||
private static extern IntPtr INTERNAL_Mix_LoadWAV_RW(
|
||||
|
||||
/* src refers to an SDL_RWops*, IntPtr to a Mix_Chunk* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr Mix_LoadWAV_RW(
|
||||
IntPtr src,
|
||||
int freesrc
|
||||
);
|
||||
|
||||
/* IntPtr refers to a Mix_Chunk* */
|
||||
/* This is an RWops macro in the C header. */
|
||||
public static IntPtr Mix_LoadWAV(string file)
|
||||
{
|
||||
IntPtr rwops = SDL.INTERNAL_SDL_RWFromFile(file, "rb");
|
||||
return INTERNAL_Mix_LoadWAV_RW(rwops, 1);
|
||||
IntPtr rwops = SDL.SDL_RWFromFile(file, "rb");
|
||||
return Mix_LoadWAV_RW(rwops, 1);
|
||||
}
|
||||
|
||||
|
||||
/* IntPtr refers to a Mix_Music* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr Mix_LoadMUS(
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string file
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_LoadMUS", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_Mix_LoadMUS(
|
||||
byte* file
|
||||
);
|
||||
|
||||
public static unsafe IntPtr Mix_LoadMUS(string file)
|
||||
{
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
IntPtr handle = INTERNAL_Mix_LoadMUS(
|
||||
utf8File
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* IntPtr refers to a Mix_Chunk* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr Mix_QuickLoad_WAV(byte[] mem);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr Mix_QuickLoad_WAV(
|
||||
[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1)]
|
||||
byte[] mem
|
||||
);
|
||||
|
||||
/* IntPtr refers to a Mix_Chunk* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Mix_Chunk Mix_QuickLoad_RAW(byte[] mem, uint len);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr Mix_QuickLoad_RAW(
|
||||
[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)]
|
||||
byte[] mem,
|
||||
uint len
|
||||
);
|
||||
|
||||
/* chunk refers to a Mix_Chunk* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_FreeChunk(IntPtr chunk);
|
||||
|
||||
|
||||
/* music refers to a Mix_Music* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_FreeMusic(IntPtr music);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GetNumChunkDecoders();
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetChunkDecoder")]
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetChunkDecoder", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_Mix_GetChunkDecoder(int index);
|
||||
public static string Mix_GetChunkDecoder(int index)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetChunkDecoder(index)
|
||||
);
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GetNumMusicDecoders();
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicDecoder")]
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicDecoder", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_Mix_GetMusicDecoder(int index);
|
||||
public static string Mix_GetMusicDecoder(int index)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetMusicDecoder(index)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* music refers to a Mix_Music* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Mix_MusicType Mix_GetMusicType(IntPtr music);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicTitle", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr INTERNAL_Mix_GetMusicTitle(IntPtr music);
|
||||
public static string Mix_GetMusicTitle(IntPtr music)
|
||||
{
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetMusicTitle(music)
|
||||
);
|
||||
}
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicTitleTag", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr INTERNAL_Mix_GetMusicTitleTag(IntPtr music);
|
||||
public static string Mix_GetMusicTitleTag(IntPtr music)
|
||||
{
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetMusicTitleTag(music)
|
||||
);
|
||||
}
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicArtistTag", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr INTERNAL_Mix_GetMusicArtistTag(IntPtr music);
|
||||
public static string Mix_GetMusicArtistTag(IntPtr music)
|
||||
{
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetMusicArtistTag(music)
|
||||
);
|
||||
}
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicAlbumTag", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr INTERNAL_Mix_GetMusicAlbumTag(IntPtr music);
|
||||
public static string Mix_GetMusicAlbumTag(IntPtr music)
|
||||
{
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetMusicAlbumTag(music)
|
||||
);
|
||||
}
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicCopyrightTag", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr INTERNAL_Mix_GetMusicCopyrightTag(IntPtr music);
|
||||
public static string Mix_GetMusicCopyrightTag(IntPtr music)
|
||||
{
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetMusicCopyrightTag(music)
|
||||
);
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_SetPostMix(
|
||||
MixFuncDelegate mix_func,
|
||||
IntPtr arg // void*
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_HookMusic(
|
||||
MixFuncDelegate mix_func,
|
||||
IntPtr arg // void*
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_HookMusicFinished(
|
||||
MusicFinishedDelegate music_finished
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to a void* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr Mix_GetMusicHookData();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_ChannelFinished(
|
||||
ChannelFinishedDelegate channel_finished
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_RegisterEffect(
|
||||
int chan,
|
||||
Mix_EffectFunc_t f,
|
||||
Mix_EffectDone_t d,
|
||||
IntPtr arg // void*
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_UnregisterEffect(
|
||||
int channel,
|
||||
Mix_EffectFunc_t f
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_UnregisterAllEffects(int channel);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_SetPanning(
|
||||
int channel,
|
||||
byte left,
|
||||
byte right
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_SetPosition(
|
||||
int channel,
|
||||
short angle,
|
||||
byte distance
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_SetDistance(int channel, byte distance);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_SetReverseStereo(int channel, int flip);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_ReserveChannels(int num);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GroupChannel(int which, int tag);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GroupChannels(int from, int to, int tag);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GroupAvailable(int tag);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GroupCount(int tag);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GroupOldest(int tag);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GroupNewer(int tag);
|
||||
|
||||
|
||||
/* chunk refers to a Mix_Chunk* */
|
||||
public static int Mix_PlayChannel(
|
||||
int channel,
|
||||
|
@ -318,37 +416,37 @@ namespace SDL2
|
|||
) {
|
||||
return Mix_PlayChannelTimed(channel, chunk, loops, -1);
|
||||
}
|
||||
|
||||
|
||||
/* chunk refers to a Mix_Chunk* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_PlayChannelTimed(
|
||||
int channel,
|
||||
IntPtr chunk,
|
||||
int loops,
|
||||
int ticks
|
||||
);
|
||||
|
||||
|
||||
/* music refers to a Mix_Music* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_PlayMusic(IntPtr music, int loops);
|
||||
|
||||
|
||||
/* music refers to a Mix_Music* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_FadeInMusic(
|
||||
IntPtr music,
|
||||
int loops,
|
||||
int ms
|
||||
);
|
||||
|
||||
|
||||
/* music refers to a Mix_Music* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_FadeInMusicPos(
|
||||
IntPtr music,
|
||||
int loops,
|
||||
int ms,
|
||||
double position
|
||||
);
|
||||
|
||||
|
||||
/* chunk refers to a Mix_Chunk* */
|
||||
public static int Mix_FadeInChannel(
|
||||
int channel,
|
||||
|
@ -358,9 +456,9 @@ namespace SDL2
|
|||
) {
|
||||
return Mix_FadeInChannelTimed(channel, chunk, loops, ms, -1);
|
||||
}
|
||||
|
||||
|
||||
/* chunk refers to a Mix_Chunk* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_FadeInChannelTimed(
|
||||
int channel,
|
||||
IntPtr chunk,
|
||||
|
@ -368,115 +466,201 @@ namespace SDL2
|
|||
int ms,
|
||||
int ticks
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_Volume(int channel, int volume);
|
||||
|
||||
|
||||
/* chunk refers to a Mix_Chunk* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_VolumeChunk(
|
||||
IntPtr chunk,
|
||||
int volume
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_VolumeMusic(int volume);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GetVolumeMusicStream(IntPtr music);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_HaltChannel(int channel);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_HaltGroup(int tag);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_HaltMusic();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_ExpireChannel(int channel, int ticks);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_FadeOutChannel(int which, int ms);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_FadeOutGroup(int tag, int ms);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_FadeOutMusic(int ms);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Mix_Fading Mix_FadingMusic();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Mix_Fading Mix_FadingChannel(int which);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_Pause(int channel);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_Resume(int channel);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_Paused(int channel);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_PauseMusic();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_ResumeMusic();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_RewindMusic();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_PausedMusic();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_SetMusicPosition(double position);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern double Mix_GetMusicPosition(IntPtr music);
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern double Mix_MusicDuration(IntPtr music);
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern double Mix_GetMusicLoopStartTime(IntPtr music);
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern double Mix_GetMusicLoopEndTime(IntPtr music);
|
||||
|
||||
/* music refers to a Mix_Music*
|
||||
* Only available in 2.0.5 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern double Mix_GetMusicLoopLengthTime(IntPtr music);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_Playing(int channel);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_PlayingMusic();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int Mix_SetMusicCMD(
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string command
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_SetMusicCMD", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe int INTERNAL_Mix_SetMusicCMD(
|
||||
byte* command
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static unsafe int Mix_SetMusicCMD(string command)
|
||||
{
|
||||
byte* utf8Cmd = SDL.Utf8EncodeHeap(command);
|
||||
int result = INTERNAL_Mix_SetMusicCMD(
|
||||
utf8Cmd
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Cmd);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_SetSynchroValue(int value);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_GetSynchroValue();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int Mix_SetSoundFonts(
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string paths
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_SetSoundFonts", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe int INTERNAL_Mix_SetSoundFonts(
|
||||
byte* paths
|
||||
);
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetSoundFonts")]
|
||||
public static unsafe int Mix_SetSoundFonts(string paths)
|
||||
{
|
||||
byte* utf8Paths = SDL.Utf8EncodeHeap(paths);
|
||||
int result = INTERNAL_Mix_SetSoundFonts(
|
||||
utf8Paths
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Paths);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetSoundFonts", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_Mix_GetSoundFonts();
|
||||
public static string Mix_GetSoundFonts()
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(INTERNAL_Mix_GetSoundFonts());
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetSoundFonts()
|
||||
);
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_EachSoundFont(
|
||||
SoundFontDelegate function,
|
||||
IntPtr data // void*
|
||||
);
|
||||
|
||||
|
||||
/* Only available in 2.0.5 or later. */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Mix_SetTimidityCfg(
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string path
|
||||
);
|
||||
|
||||
/* Only available in 2.0.5 or later. */
|
||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetTimidityCfg", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr INTERNAL_Mix_GetTimidityCfg();
|
||||
public static string Mix_GetTimidityCfg()
|
||||
{
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_Mix_GetTimidityCfg()
|
||||
);
|
||||
}
|
||||
|
||||
/* IntPtr refers to a Mix_Chunk* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr Mix_GetChunk(int channel);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Mix_CloseAudio();
|
||||
|
||||
public static string Mix_GetError()
|
||||
{
|
||||
return SDL.SDL_GetError();
|
||||
}
|
||||
|
||||
public static void Mix_SetError(string fmtAndArglist)
|
||||
{
|
||||
SDL.SDL_SetError(fmtAndArglist);
|
||||
}
|
||||
|
||||
public static void Mix_ClearError()
|
||||
{
|
||||
SDL.SDL_ClearError();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
694
src/SDL2_ttf.cs
694
src/SDL2_ttf.cs
|
@ -1,7 +1,7 @@
|
|||
#region License
|
||||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013 Ethan Lee.
|
||||
* Copyright (c) 2013-2021 Ethan Lee.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
|
@ -36,29 +36,45 @@ namespace SDL2
|
|||
public static class SDL_ttf
|
||||
{
|
||||
#region SDL2# Variables
|
||||
|
||||
|
||||
/* Used by DllImport to load the native library. */
|
||||
private const string nativeLibName = "SDL2_ttf.dll";
|
||||
|
||||
private const string nativeLibName = "SDL2_ttf";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region SDL_ttf.h
|
||||
|
||||
|
||||
/* Similar to the headers, this is the version we're expecting to be
|
||||
* running with. You will likely want to check this somewhere in your
|
||||
* program!
|
||||
*/
|
||||
public const int SDL_TTF_MAJOR_VERSION = 2;
|
||||
public const int SDL_TTF_MINOR_VERSION = 0;
|
||||
public const int SDL_TTF_PATCHLEVEL = 16;
|
||||
|
||||
public const int UNICODE_BOM_NATIVE = 0xFEFF;
|
||||
public const int UNICODE_BOM_SWAPPED = 0xFFFE;
|
||||
|
||||
|
||||
public const int TTF_STYLE_NORMAL = 0x00;
|
||||
public const int TTF_STYLE_BOLD = 0x01;
|
||||
public const int TTF_STYLE_ITALIC = 0x02;
|
||||
public const int TTF_STYLE_UNDERLINE = 0x04;
|
||||
public const int TTF_STYLE_STRIKETHROUGH = 0x08;
|
||||
|
||||
public const int TTF_HINTING_NORMAL = 0;
|
||||
public const int TTF_HINTING_LIGHT = 1;
|
||||
public const int TTF_HINTING_MONO = 2;
|
||||
public const int TTF_HINTING_NONE = 3;
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_LinkedVersion")]
|
||||
|
||||
public const int TTF_HINTING_NORMAL = 0;
|
||||
public const int TTF_HINTING_LIGHT = 1;
|
||||
public const int TTF_HINTING_MONO = 2;
|
||||
public const int TTF_HINTING_NONE = 3;
|
||||
public const int TTF_HINTING_LIGHT_SUBPIXEL = 4; /* >= 2.0.16 */
|
||||
|
||||
public static void SDL_TTF_VERSION(out SDL.SDL_version X)
|
||||
{
|
||||
X.major = SDL_TTF_MAJOR_VERSION;
|
||||
X.minor = SDL_TTF_MINOR_VERSION;
|
||||
X.patch = SDL_TTF_PATCHLEVEL;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_LinkedVersion", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_TTF_LinkedVersion();
|
||||
public static SDL.SDL_version TTF_LinkedVersion()
|
||||
{
|
||||
|
@ -66,312 +82,688 @@ namespace SDL2
|
|||
IntPtr result_ptr = INTERNAL_TTF_LinkedVersion();
|
||||
result = (SDL.SDL_version) Marshal.PtrToStructure(
|
||||
result_ptr,
|
||||
result.GetType()
|
||||
typeof(SDL.SDL_version)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TTF_ByteSwappedUNICODE(int swapped);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_Init();
|
||||
|
||||
|
||||
/* IntPtr refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr TTF_OpenFont(
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string file,
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_OpenFont", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_TTF_OpenFont(
|
||||
byte* file,
|
||||
int ptsize
|
||||
);
|
||||
|
||||
public static unsafe IntPtr TTF_OpenFont(string file, int ptsize)
|
||||
{
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
IntPtr handle = INTERNAL_TTF_OpenFont(
|
||||
utf8File,
|
||||
ptsize
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_OpenFontRW(
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
int ptsize
|
||||
);
|
||||
|
||||
/* IntPtr refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr TTF_OpenFontIndex(
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string file,
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_OpenFontIndex", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_TTF_OpenFontIndex(
|
||||
byte* file,
|
||||
int ptsize,
|
||||
long index
|
||||
);
|
||||
|
||||
public static unsafe IntPtr TTF_OpenFontIndex(
|
||||
string file,
|
||||
int ptsize,
|
||||
long index
|
||||
) {
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
IntPtr handle = INTERNAL_TTF_OpenFontIndex(
|
||||
utf8File,
|
||||
ptsize,
|
||||
index
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_OpenFontIndexRW(
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
int ptsize,
|
||||
long index
|
||||
);
|
||||
|
||||
/* font refers to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_SetFontSize(
|
||||
IntPtr font,
|
||||
int ptsize
|
||||
);
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GetFontStyle(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TTF_SetFontStyle(IntPtr font, int style);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GetFontOutline(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TTF_SetFontOutline(IntPtr font, int outline);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GetFontHinting(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TTF_SetFontHinting(IntPtr font, int hinting);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_FontHeight(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_FontAscent(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_FontDescent(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_FontLineSkip(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GetFontKerning(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TTF_SetFontKerning(IntPtr font, int allowed);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font*.
|
||||
* IntPtr is actually a C long! This ignores Win64!
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_FontFaces(IntPtr font);
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern long TTF_FontFaces(IntPtr font);
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_FontFaceIsFixedWidth(IntPtr font);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_FontFaceFamilyName")]
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_FontFaceFamilyName", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_TTF_FontFaceFamilyName(
|
||||
IntPtr font
|
||||
);
|
||||
public static string TTF_FontFaceFamily(IntPtr font)
|
||||
public static string TTF_FontFaceFamilyName(IntPtr font)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_TTF_FontFaceFamilyName(font)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_FontFaceStyleName")]
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_FontFaceStyleName", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_TTF_FontFaceStyleName(
|
||||
IntPtr font
|
||||
);
|
||||
public static string TTF_FontFaceStyleName(IntPtr font)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(
|
||||
return SDL.UTF8_ToManaged(
|
||||
INTERNAL_TTF_FontFaceStyleName(font)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GlyphIsProvided(IntPtr font, ushort ch);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GlyphIsProvided32(IntPtr font, uint ch);
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GlyphMetrics(
|
||||
IntPtr font,
|
||||
ushort ch,
|
||||
ref int minx,
|
||||
ref int maxx,
|
||||
ref int miny,
|
||||
ref int maxy,
|
||||
ref int advance
|
||||
out int minx,
|
||||
out int maxx,
|
||||
out int miny,
|
||||
out int maxy,
|
||||
out int advance
|
||||
);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GlyphMetrics32(
|
||||
IntPtr font,
|
||||
uint ch,
|
||||
out int minx,
|
||||
out int maxx,
|
||||
out int miny,
|
||||
out int maxy,
|
||||
out int advance
|
||||
);
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_SizeText(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
ref int w,
|
||||
ref int h
|
||||
out int w,
|
||||
out int h
|
||||
);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int TTF_SizeUTF8(
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_SizeUTF8", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern unsafe int INTERNAL_TTF_SizeUTF8(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
ref int w,
|
||||
ref int h
|
||||
byte* text,
|
||||
out int w,
|
||||
out int h
|
||||
);
|
||||
|
||||
public static unsafe int TTF_SizeUTF8(
|
||||
IntPtr font,
|
||||
string text,
|
||||
out int w,
|
||||
out int h
|
||||
) {
|
||||
byte* utf8Text = SDL.Utf8EncodeHeap(text);
|
||||
int result = INTERNAL_TTF_SizeUTF8(
|
||||
font,
|
||||
utf8Text,
|
||||
out w,
|
||||
out h
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_SizeUNICODE(
|
||||
IntPtr font,
|
||||
ushort[] text,
|
||||
ref int w,
|
||||
ref int h
|
||||
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
||||
string text,
|
||||
out int w,
|
||||
out int h
|
||||
);
|
||||
|
||||
|
||||
/* font refers to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_MeasureText(
|
||||
IntPtr font,
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
int measure_width,
|
||||
out int extent,
|
||||
out int count
|
||||
);
|
||||
|
||||
/* font refers to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_MeasureUTF8", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern unsafe int INTERNAL_TTF_MeasureUTF8(
|
||||
IntPtr font,
|
||||
byte* text,
|
||||
int measure_width,
|
||||
out int extent,
|
||||
out int count
|
||||
);
|
||||
public static unsafe int TTF_MeasureUTF8(
|
||||
IntPtr font,
|
||||
string text,
|
||||
int measure_width,
|
||||
out int extent,
|
||||
out int count
|
||||
) {
|
||||
byte* utf8Text = SDL.Utf8EncodeHeap(text);
|
||||
int result = INTERNAL_TTF_MeasureUTF8(
|
||||
font,
|
||||
utf8Text,
|
||||
measure_width,
|
||||
out extent,
|
||||
out count
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* font refers to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_MeasureUNICODE(
|
||||
IntPtr font,
|
||||
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
||||
string text,
|
||||
int measure_width,
|
||||
out int extent,
|
||||
out int count
|
||||
);
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderText_Solid(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr TTF_RenderUTF8_Solid(
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Solid", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Solid(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
byte* text,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
public static unsafe IntPtr TTF_RenderUTF8_Solid(
|
||||
IntPtr font,
|
||||
string text,
|
||||
SDL.SDL_Color fg
|
||||
) {
|
||||
byte* utf8Text = SDL.Utf8EncodeHeap(text);
|
||||
IntPtr result = INTERNAL_TTF_RenderUTF8_Solid(
|
||||
font,
|
||||
utf8Text,
|
||||
fg
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderUNICODE_Solid(
|
||||
IntPtr font,
|
||||
ushort[] text,
|
||||
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderText_Solid_Wrapped(
|
||||
IntPtr font,
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
uint wrapLength
|
||||
);
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Solid_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Solid_Wrapped(
|
||||
IntPtr font,
|
||||
byte* text,
|
||||
SDL.SDL_Color fg,
|
||||
uint wrapLength
|
||||
);
|
||||
public static unsafe IntPtr TTF_RenderUTF8_Solid_Wrapped(
|
||||
IntPtr font,
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
uint wrapLength
|
||||
) {
|
||||
byte* utf8Text = SDL.Utf8EncodeHeap(text);
|
||||
IntPtr result = INTERNAL_TTF_RenderUTF8_Solid_Wrapped(
|
||||
font,
|
||||
utf8Text,
|
||||
fg,
|
||||
wrapLength
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderUNICODE_Solid_Wrapped(
|
||||
IntPtr font,
|
||||
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
uint wrapLength
|
||||
);
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderGlyph_Solid(
|
||||
IntPtr font,
|
||||
ushort ch,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderGlyph32_Solid(
|
||||
IntPtr font,
|
||||
uint ch,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderText_Shaded(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr TTF_RenderUTF8_Shaded(
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Shaded", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Shaded(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
byte* text,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg
|
||||
);
|
||||
|
||||
public static unsafe IntPtr TTF_RenderUTF8_Shaded(
|
||||
IntPtr font,
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg
|
||||
) {
|
||||
byte* utf8Text = SDL.Utf8EncodeHeap(text);
|
||||
IntPtr result = INTERNAL_TTF_RenderUTF8_Shaded(
|
||||
font,
|
||||
utf8Text,
|
||||
fg,
|
||||
bg
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderUNICODE_Shaded(
|
||||
IntPtr font,
|
||||
ushort[] text,
|
||||
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderText_Shaded_Wrapped(
|
||||
IntPtr font,
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg,
|
||||
uint wrapLength
|
||||
);
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Shaded_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(
|
||||
IntPtr font,
|
||||
byte* text,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg,
|
||||
uint wrapLength
|
||||
);
|
||||
public static unsafe IntPtr TTF_RenderUTF8_Shaded_Wrapped(
|
||||
IntPtr font,
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg,
|
||||
uint wrapLength
|
||||
) {
|
||||
byte* utf8Text = SDL.Utf8EncodeHeap(text);
|
||||
IntPtr result = INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(
|
||||
font,
|
||||
utf8Text,
|
||||
fg,
|
||||
bg,
|
||||
wrapLength
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderUNICODE_Shaded_Wrapped(
|
||||
IntPtr font,
|
||||
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg,
|
||||
uint wrapLength
|
||||
);
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderGlyph_Shaded(
|
||||
IntPtr font,
|
||||
ushort ch,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderGlyph32_Shaded(
|
||||
IntPtr font,
|
||||
uint ch,
|
||||
SDL.SDL_Color fg,
|
||||
SDL.SDL_Color bg
|
||||
);
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderText_Blended(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr TTF_RenderUTF8_Blended(
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Blended", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Blended(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
byte* text,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
public static unsafe IntPtr TTF_RenderUTF8_Blended(
|
||||
IntPtr font,
|
||||
string text,
|
||||
SDL.SDL_Color fg
|
||||
) {
|
||||
byte* utf8Text = SDL.Utf8EncodeHeap(text);
|
||||
IntPtr result = INTERNAL_TTF_RenderUTF8_Blended(
|
||||
font,
|
||||
utf8Text,
|
||||
fg
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderUNICODE_Blended(
|
||||
IntPtr font,
|
||||
ushort[] text,
|
||||
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderText_Blended_Wrapped(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
uint wrapped
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern IntPtr TTF_RenderUTF8_Blended_Wrapped(
|
||||
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Blended_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Blended_Wrapped(
|
||||
IntPtr font,
|
||||
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
byte* text,
|
||||
SDL.SDL_Color fg,
|
||||
uint wrapped
|
||||
);
|
||||
|
||||
public static unsafe IntPtr TTF_RenderUTF8_Blended_Wrapped(
|
||||
IntPtr font,
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
uint wrapped
|
||||
) {
|
||||
byte* utf8Text = SDL.Utf8EncodeHeap(text);
|
||||
IntPtr result = INTERNAL_TTF_RenderUTF8_Blended_Wrapped(
|
||||
font,
|
||||
utf8Text,
|
||||
fg,
|
||||
wrapped
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderUNICODE_Blended_Wrapped(
|
||||
IntPtr font,
|
||||
ushort[] text,
|
||||
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
||||
string text,
|
||||
SDL.SDL_Color fg,
|
||||
uint wrapped
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderGlyph_Blended(
|
||||
IntPtr font,
|
||||
ushort ch,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
|
||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr TTF_RenderGlyph32_Blended(
|
||||
IntPtr font,
|
||||
uint ch,
|
||||
SDL.SDL_Color fg
|
||||
);
|
||||
|
||||
/* Only available in 2.0.16 or higher. */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_SetDirection(int direction);
|
||||
|
||||
/* Only available in 2.0.16 or higher. */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_SetScript(int script);
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TTF_CloseFont(IntPtr font);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TTF_Quit();
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_WasInit();
|
||||
|
||||
|
||||
/* font refers to a TTF_Font* */
|
||||
[DllImport(nativeLibName)]
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int SDL_GetFontKerningSize(
|
||||
IntPtr font,
|
||||
int prev_index,
|
||||
int index
|
||||
);
|
||||
|
||||
/* font refers to a TTF_Font*
|
||||
* Only available in 2.0.15 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GetFontKerningSizeGlyphs(
|
||||
IntPtr font,
|
||||
ushort previous_ch,
|
||||
ushort ch
|
||||
);
|
||||
|
||||
/* font refers to a TTF_Font*
|
||||
* Only available in 2.0.16 or higher.
|
||||
*/
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TTF_GetFontKerningSizeGlyphs32(
|
||||
IntPtr font,
|
||||
ushort previous_ch,
|
||||
ushort ch
|
||||
);
|
||||
|
||||
public static string TTF_GetError()
|
||||
{
|
||||
return SDL.SDL_GetError();
|
||||
}
|
||||
|
||||
public static void TTF_SetError(string fmtAndArglist)
|
||||
{
|
||||
SDL.SDL_SetError(fmtAndArglist);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue